PySLSQP
Before using PySLSQP, make sure to have pyslsqp installed on your machine.
You can use pip install pyslsqp to install from PyPI.
To use PySLSQP, you can follow the same process for other optimizers
except when importing the optimizer.
You need to import the optimizer as shown in the following code:
from modopt import PySLSQP
Options could be set by just passing them within the solver_options dictionary when
instantiating the PySLSQP optimizer object.
For example, we can set the maximum number of iterations maxiter
and the accuracy goal acc for the final solution as shown below.
optimizer = PySLSQP(prob, solver_options={'maxiter': 20, 'acc': 1e-6})
The complete list of options available for the PySLSQP solver in modOpt are given in the following table. Please visit the pySLSQP documentation for more details.
Option |
Type (default value) |
Description |
|---|---|---|
|
int ( |
Maximum number of iterations. |
|
float ( |
Accuracy (optimality) of the solution. |
|
int ( |
Verbosity of the console output. |
|
callable ( |
Function to be called after each major iteration. |
|
str ( |
Name of the readable summary file. |
|
bool ( |
Set to |
|
list (see description) |
List of scalar variables to visualize. |
|
bool ( |
If |
|
str ( |
Name of the file to save the visualized plot. |
|
str ( |
Set to |
|
list (see description) |
List of variables to save. |
|
str ( |
Name of the saved file. |
|
str ( |
File to load the previous solution/iterates for warm/hot start. |
|
bool ( |
Set to |
|
bool ( |
If |