Skip to content

Commit

Permalink
added more documentation to opti.py
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdsharpe committed Jan 18, 2021
1 parent 98487ce commit cb44cb7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion aerosandbox/optimization/opti.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pytest
import json


class Opti(cas.Opti):
def __init__(self,
variable_categories_to_freeze: List[str] = [],
Expand Down Expand Up @@ -260,7 +261,7 @@ def get_solution_dict_from_cache(self):
def solve(self,
parameter_mapping: Dict[cas.MX, float] = None,
max_iter: int = 3000,
callback: Callable = None, # A Callable that takes in the argument opti
callback: Callable = None,
solver: str = 'ipopt'
) -> cas.OptiSol:
"""
Expand All @@ -282,6 +283,16 @@ def solve(self,
>>> }
>>> )
max_iter: [Optional] The maximum number of iterations allowed before giving up.
callback: [Optional] A function to be called at each iteration of the optimization algorithm.
Useful for printing progress or displaying intermediate results.
The callback function `func` should have the syntax `func(iteration_number)`, where iteration_number
is an integer corresponding to the current iteration number. In order to access intermediate quantities
of optimization variables, use the `Opti.debug.value(x)` syntax for each variable `x`.
solve: [Optional] Which optimization backend do you wish to use? [str] Only tested with "ipopt".
Returns: An OptiSol object that contains the solved optimization problem. To extract values, use
OptiSol.value(variable).
Expand Down

0 comments on commit cb44cb7

Please sign in to comment.