Optimal Electoral Strategies for Socialist Parties