def create_arguments_parser(add_help): """Create the parser for the command-line arguments""" # Create the solve model parser which will give us some arguments # controlling the solver (start/stop_time etc) solve_model_parser = solve_model.create_arguments_parser(False) description = "Perform an optimisation for parameter values" parser = argparse.ArgumentParser(add_help=add_help, parents=[solve_model_parser], description=description) # Might want to make the type of this 'FileType('r')' parser.add_argument('filenames', metavar='F', nargs='+', help="The input files: model gold_standard initparams") cost_function_choices = ["x2", "fft", "special", "circad" ] parser.add_argument('--cost-function', action='append', choices=cost_function_choices, help="Set the cost function(s) to be used to evaluate individuals") parser.add_argument('--target-cost', action='store', type=int, default=0, help="Set the target cost to meet, default = 0") parser.add_argument('--generations', action='store', type=int, default=10, help="Set the number of generations to evolve") # There is no default for the population size, this is such that # the algorithms may distinguish between a population size set by # the user and the default. Hence the each algorithm can make its own # mind up about what the default should be, for example in simple it # is equal to the number of parameters. parser.add_argument('--population', action='store', type=int, # no default, None signals default help="Set the population size of each generation") algorithm_choices = ["sa", "simple", "experiment"] parser.add_argument('--algorithm', action='store', choices=algorithm_choices, default="simple", help="Select the genetic algorithm to deploy") parser.add_argument('--results-dir', action='store', help="Select a directory in which to store the results") parser.add_argument('--record-freq', action='store', type=int, # no default, None signals no freq help="Specify how often results should be recorded") return parser
def setUp(self): # Similarly we can't do much about the name 'setUp' # pylint: disable=C0103 self.arg_parser = solve_model.create_arguments_parser(True)