def __init__(self, experiment_dir, candidate_id=None, generation=None,
                    base_name=None, logger=None):
        """
        Constructor.

        :param experiment_dir: the directory where experiment results go
        :param candidate_id: the id of the candidate
        :param generation: the generation number for the candidate
        :param base_name: a full base name to use (minus extension)
        :param logger: The logger to use for messaging
        """

        use_base_name = base_name
        if use_base_name is None:
            use_base_name = self.get_base_name(candidate_id, generation)

        use_dir = experiment_dir
        if generation is not None:
            filer = GenerationFiler(experiment_dir, generation)
            use_dir = filer.get_generation_dir()

        dictionary_converter = CandidateDictionaryConverter(
                                        allow_restore_none=False)
        super(CandidatePersistence, self).__init__(
                            base_name=use_base_name,
                            folder=use_dir,
                            dictionary_converter=dictionary_converter,
                            must_exist=True,
                            logger=logger)
    def __init__(self, experiment_dir, generation, logger=None):
        """
        Constructor.

        :param experiment_dir: the directory where experiment results go
        :param generation: the generation number of the population results
        :param logger: A logger to send messaging to
        """

        filer = GenerationFiler(experiment_dir, generation)
        generation_dir = filer.get_generation_dir()

        super(PopulationResultsPersistence, self).__init__(
                base_name="population_results",
                folder=generation_dir,
                dictionary_converter=PopulationResultsDictionaryConverter(),
                logger=logger)