Implementations

class condor.implementations.simple.ExplicitSystem(model_instance)

Implementation for ExplicitSystem model.

No Options expected.

class condor.implementations.simple.MultiMatchedField(matched_to=None, symmetric=None, **kwargs)

multi-match field, with symmetry checks

flatten()

flatten matches to the on_field, defaults tot he match.

on_field is used to override which field instance’s dataclass gets filled in; this is currently used during TrajectoryAnalysis construction which creates its own copies of the matching fields

element_class

alias of MatchedElement

class condor.implementations.simple.ExternalSolverModel(model_instance)

Implementation for External Solver models.

No Options expected.

condor.implementations.sgm_trajectory.isnan(x)
class condor.implementations.sgm_trajectory.TrajectoryAnalysis(model_instance)

Implementation for TrajectoryAnalysis model.

All Options may be prefixed with state_ or adjoint_ to apply only to the forward or reverse solvers, respectively. Without either prefix, the option will be passed to both solvers. For additional details on the Solver options, see the sweeping_gradient_method solvers.

class Solver(*values)
CVODE = <class 'condor.solvers.sweeping_gradient_method.SolverCVODE'>

currently unsupported

dopri5 = <class 'condor.solvers.sweeping_gradient_method.SolverSciPyDopri5'>
dop853 = <class 'condor.solvers.sweeping_gradient_method.SolverSciPyDop853'>
construct(model, state_solver=None, adjoint_solver=None, solver=Solver.dopri5, **kwargs)

Iterative Solvers

class condor.implementations.iterative.AlgebraicSystem(model_instance)

Implementation for AlgebraicSystem model.

Options:
  • atol (float) – absolute tolerance (default 1e-12)

  • rtol (float) – relative tolerance (default 1e-12)

  • warm_start (bool) – flag indicating whether subsequent calls should initialize the variable values to the last-run solution (default True)

  • max_iter (int) – maximum number of iterations before terminating solver (default 100)

  • error_on_fail (bool) – flag indicating whether to raise an error if the solver fails to converge within specified tolerance before reaching max_iter (default False)

construct(model, atol=1e-12, rtol=1e-12, warm_start=True, exact_hessian=True, max_iter=100, re_initialize=None, default_initializer=0.0, error_on_fail=False)
class condor.implementations.iterative.OptimizationProblem(model_instance)

Implementation base class for OptimizationProblem model.

Options:
  • init_callback (callable) – callback with signature , called when an optimization problem is evalauted. Once when embedded or every time as a standalone.

  • iter_callback (callable) – callback with signature , called at each iteration of the CasadiNlpsolImplementation (only IPOPT) and SciPyBase subclass optimization implementations.

make_warm_start(x0=None, lam_g0=None, lam_x0=None)
default_options = {}
construct(model, iter_callback=None, init_callback=None, **options)
load_initializer(model_instance)
class condor.implementations.iterative.CasadiNlpsolImplementation(model_instance)

Implementation layer for casadi nlpsol for OptimizationProblem models.

Options:
  • method (CasadiNlpsolImplementation.Method) – value from method enum to specify supported methods

  • exact_hessian (bool) – flag to use second order gradient information; use limited Broyden update otherwise

  • calc_lam_x (bool) – flag to calculate the lagrange multipliers solution, used for IPOPT to perform a true warm start

  • **options – remaining keyword arguments are passed to casadi’s nlpsol’s constructor’s solver-specific options argument. See method_default_options for the defaults

class Method(*values)
ipopt = 1
snopt = 2

currently unsupported

qrsqp = 3
fatrop = 4
method_strings = {Method.fatrop: 'fatrop', Method.ipopt: 'ipopt', Method.qrsqp: 'sqpmethod', Method.snopt: 'snopt'}
method_default_options = {Method.ipopt: {'sb': 'yes', 'warm_start_init_point': 'yes'}, Method.snopt: {'warm_start_init_point': False}}
property default_options

derived property to get a copy of method_default_options or an empty dict

construct(model, exact_hessian=True, method=Method.ipopt, calc_lam_x=False, **options)
run_optimizer(model_instance)
class condor.implementations.iterative.ScipyMinimizeBase(model_instance)

Base implementation class for SciPy minimize for OptimizationProblem models.

Options:

**options – keyword options are passed directly to scipy.minimize’s options keyword argument

construct(model, **options)
prepare_constraints(extra_args)
run_optimizer(model_instance)
class condor.implementations.iterative.ScipyCG(model_instance)
method_string = 'CG'
class condor.implementations.iterative.ScipySLSQP(model_instance)
method_string = 'SLSQP'
construct(model, *args, **kwargs)
prepare_constraints(extra_args)
class condor.implementations.iterative.ScipyTrustConstr(model_instance)
method_string = 'trust-constr'
construct(model, exact_hessian=True, keep_feasible=True, **options)
prepare_constraints(extra_args)