Utilities
Bisection Search (pywr.utils.bisect)
- class pywr.utils.bisect.BisectionSearchModel(**kwargs)
Bases:
Model
A Pywr model that performs a bisection search.
When a BisectionSearchModel is run it performs multiple simulations using a bisection algorithm to find the largest value of a parameter that satisfies all defined constraints. The bisection proceeds until a minimum gap (epsilon) is reached. After the bisection the best feasible value is re-run to ensure the model ends with corresponding recorder values. If no feasible solutions are found then an error is raised.
- Parameters
- bisect_parameterParameter
The parameter to vary during the bisection process. This parameter must have a double_size of 1 and have lower and upper bounds defined; the bisection is undertaken between these bounds.
- bisect_epsilonfloat
- The termination criterion for the bisection process. When the bisection has narrowed to a gap
of less than the bisect_epsilon the process is terminated.
- error_on_infeasiblebool (default True)
If true a ValueError is raised if no feasible solution is found during the bisection process. If false no error is raised if there is no feasible solution, and a solution using the lower bounds of the bisection parameter is the final result.
- run()
Perform a bisection search using repeated simulation.