How to use the pypesto.optimize.ScipyOptimizer function in pypesto

To help you get started, we’ve selected a few pypesto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ICB-DCM / pyPESTO / test / test_profile.py View on Github external
def create_optimization_results(objective):
    # create optimizer, pypesto problem and options
    options = {
        'maxiter': 200
    }
    optimizer = optimize.ScipyOptimizer(method='TNC', options=options)

    lb = -2 * np.ones(2)
    ub = 2 * np.ones(2)
    problem = pypesto.Problem(objective, lb, ub)

    optimize_options = optimize.OptimizeOptions(allow_failed_starts=True)

    # run optimization
    result = optimize.minimize(
        problem=problem,
        optimizer=optimizer,
        n_starts=5,
        startpoint_method=pypesto.startpoint.uniform,
        options=optimize_options
    )
github ICB-DCM / pyPESTO / pypesto / petab_import / petab_import.py View on Github external
def create_optimizer(self):
        config = self.config
        if config is not None and 'pypesto' in config:
            if 'optimizer' not in config['pypesto']:
                return None
            optimizers = {'ScipyOptimizer': ScipyOptimizer}
            config_optimizer = config['pypesto']['optimizer']
            if config_optimizer not in optimizers:
                raise ValueError(f"Optimizer must be one of {optimizers}.")
            if config_optimizer == 'ScipyOptimizer':
                kwargs = {}
                if 'method' in config['pypesto']:
                    kwargs['method'] = config['pypesto']['method']
                if 'optimizer_options' in config['pypesto']:
                    kwargs['options'] = config['pypesto']['optimizer_options']
                return ScipyOptimizer(**kwargs)
            # TODO: add Dlib
        return None