def __init__(self, evaluation_object, evaluator=None, name=None, save_log=False): if evaluator is not None: self.evaluator = evaluator else: self._evaluator = None self.evaluation_object = evaluation_object if name is None: try: name = evaluation_object.name + '_optimization' except AttributeError: msg = '__init__() missing 1 required positional argument: \'name\'' raise TypeError(msg) self.name = name if save_log: self.logger = log.get_logger(self.name, log_directory=self.name) else: self.logger = log.get_logger(self.name) self._variables = [] self._objectives = [] self._nonlinear_constraints = [] self._linear_constraints = [] self._linear_equality_constraints = [] self._x0 = None
def __init__(self, stationarity_evaluator=None): self.logger = get_logger('Simulation') if stationarity_evaluator is None: self._stationarity_evaluator = StationarityEvaluator() else: self.stationarity_evaluator = stationarity_evaluator self.evaluate_stationarity = True
def optimize(self, optimization_problem, save_results=False, *args, **kwargs): """ """ if not isinstance(optimization_problem, OptimizationProblem): raise TypeError('Expected OptimizationProblem') if save_results: results_directory = optimization_problem.name self.logger = get_logger(str(self), log_directory=results_directory) log_time('Optimization', self.logger.level)(self.run) log_results('Optimization', self.logger.level)(self.run) log_exceptions('Optimization', self.logger.level)(self.run) results = self.run(optimization_problem, *args, **kwargs) if save_results: results.save(results_directory) return results
def __init__(self): self.logger = get_logger(str(self))
def __init__(self): self.logger = log.get_logger('StationarityEvaluator')