def __init__(self, **kwargs): # ! # Here all algorithm parameters needed no matter what is problem is passed are defined # problem dependent initialization happens in setup(problem, **kwargs) # ! super().__init__() # prints the compile warning if enabled FunctionLoader.get_instance() # ! # DEFAULT SETTINGS OF ALGORITHM # ! # the termination criterion to be used by the algorithm - might be specific for an algorithm self.termination = kwargs.get("termination") # set the display variable supplied to the algorithm - might be specific for an algorithm self.display = kwargs.get("display") # callback to be executed each generation self.callback = kwargs.get("callback") # ! # Attributes to be set later on for each problem run # ! # the optimization problem as an instance self.problem = None # whether the algorithm should finally return the least infeasible solution if no feasible found self.return_least_infeasible = None # whether the history should be saved or not self.save_history = None # whether the algorithm should print output in this run or not self.verbose = None # the random seed that was used self.seed = None # an algorithm can defined the default termination which can be overwritten self.default_termination = None # whether the algorithm as terminated or not self.has_terminated = None # the pareto-front of the problem - if it exist or passed self.pf = None # the function evaluator object (can be used to inject code) self.evaluator = None # the current number of generation or iteration self.n_gen = None # the history object which contains the list self.history = None # the current solutions stored - here considered as population self.pop = None # a placeholder object for implementation to store solutions in each iteration self.off = None # the optimum found by the algorithm self.opt = None # can be used to store additional data in submodules self.data = {} # if the initialized method has been called before or not self.is_initialized = False # the time when the algorithm has been setup for the first time self.start_time = None
def __init__(self, callback=None, display=None, termination=None, return_least_infeasible=False, **kwargs): # ! # Here all algorithm parameters needed no matter what is problem is passed are defined # problem dependent initialization happens in initialize(problem, **kwargs) # ! super().__init__() # prints the compile warning if enabled FunctionLoader.get_instance() # function used to display attributes # other attributes of the algorithm self.callback = callback self.display = None self.return_least_infeasible = return_least_infeasible # ! # Attributes to be set later on for each problem run # ! # the optimization problem as an instance self.problem = None # the termination criterion of the algorithm self.termination = termination # an algorithm can defined the default termination which can be overwritten self.default_termination = None # the random seed that was used self.seed = None # the pareto-front of the problem - if it exist or passed self.pf = None # the function evaluator object (can be used to inject code) self.evaluator = None # the current number of generation or iteration self.n_gen = None # whether the history should be saved or not self.save_history = None # the history object which contains the list self.history = None # the current solutions stored - here considered as population self.pop = None # the optimum found by the algorithm self.opt = None # whether the algorithm should print output in this run or not self.verbose = None # set the display variable supplied to the algorithm self.display = display # can be used to store additional data in submodules self.data = {}