control.optimal.OptimalControlResult
- class control.optimal.OptimalControlResult(ocp, res, return_states=True, print_summary=False, transpose=None, squeeze=None)[source]
Bases:
OptimizeResult
Result from solving an optimal control problem.
This class is a subclass of
scipy.optimize.OptimizeResult
with additional attributes associated with solving optimal control problems. It is used as the return type for optimal control problems.- Parameters
- ocpOptimalControlProblem
Optimal control problem that generated this solution.
- resscipy.minimize.OptimizeResult
Result of optimization.
- print_summarybool, optional
If True (default), print a short summary of the computation.
- squeezebool, optional
If True and if the system has a single output, return the system output as a 1D array rather than a 2D array. If False, return the system output as a 2D array even if the system is SISO. Default value set by
config.defaults['control.squeeze_time_response']
.
- Attributes
- inputsndarray
The optimal inputs associated with the optimal control problem.
- statesndarray
If
return_states
was set to true, stores the state trajectory associated with the optimal input.- successbool
Whether or not the optimizer exited successful.
- costfloat
Final cost of the return solution.
- system_simulations, cost_evaluations, constraint_evaluations, eqconst_evaluationsint
Number of system simulations and evaluations of the cost function, (inequality) constraint function, and equality constraint function performed during the optimization.
- cost_process_time, constraint_process_time, eqconst_process_timefloat
If logging was enabled, the amount of time spent evaluating the cost and constraint functions.
Methods
Create a new dictionary with keys from iterable and values set to value.
Return the value for key if key is in the dictionary, else default.
If the key is not found, return the default if given; otherwise, raise a KeyError.
Remove and return a (key, value) pair as a 2-tuple.
Insert key with a value of default if key is not in the dictionary.
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- __class_getitem__()
See PEP 585
- __contains__(key, /)
True if the dictionary has the specified key, else False.
- __delattr__(key, /)
Delete self[key].
- __delitem__(key, /)
Delete self[key].
- __dir__()
Default dir() implementation.
- __eq__(value, /)
Return self==value.
- __ge__(value, /)
Return self>=value.
- __getattribute__(name, /)
Return getattr(self, name).
- __getitem__(key, /)
Return self[key].
- __gt__(value, /)
Return self>value.
- __hash__ = None
- __ior__(value, /)
Return self|=value.
- __iter__(/)
Implement iter(self).
- __le__(value, /)
Return self<=value.
- __len__(/)
Return len(self).
- __lt__(value, /)
Return self<value.
- __ne__(value, /)
Return self!=value.
- __new__(*args, **kwargs)
- __or__(value, /)
Return self|value.
- __reversed__(/)
Return a reverse iterator over the dict keys.
- __ror__(value, /)
Return value|self.
- __setattr__(key, value, /)
Set self[key] to value.
- __setitem__(key, value, /)
Set self[key] to value.
- __sizeof__() size of D in memory, in bytes
- clear() None. Remove all items from D.
- copy() a shallow copy of D
- fromkeys(iterable, value=None, /)
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)
Return the value for key if key is in the dictionary, else default.
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- pop(key, default=<unrepresentable>, /)
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem(/)
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault(key, default=None, /)
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update([E, ]**F) None. Update D from dict/iterable E and F.
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values() an object providing a view on D's values