API for Custom Solver
Main solver API
The main solver functions are in the table below.
Function |
Description |
---|---|
|
Sets the default settings |
|
Loads the default problem data |
|
Solves the problem with qoco_custom |
Settings
The settings are defined in the workspace.h
file of qoco_custom
and are identical to the QOCO settings which are described in settings. To change the settings, directly modify the settings struct as shown in the code snippet in calling.
Solution
The solution struct is within the workspace struct. To see how to access members fo the solution struct refer to the code snippet in calling (for example work.sol.obj
returns the objective value). The members of the solution struct are given below.
Member |
Description |
---|---|
|
Primal solution |
|
Slack variable for conic constraints |
|
Dual solution for equality constraints |
|
Dual solution for conic constraints |
|
Number of iterations |
|
Objective value |
|
Primal residual |
|
Dual residual |
|
Duality gap |
|
Solve status see exitflags |
Status Flags
The solution struct contains the solve status flag. The various flags are given in the table below.
Status |
Status Code |
Value |
---|---|---|
Solver hasn’t been called |
|
0 |
Solved to desired accuracy |
|
1 |
Solved to low accuracy |
|
2 |
Numerical error or infeasible |
|
3 |
Iteration limit reached |
|
4 |
Changing problem instance
Since the custom solvers are generated for a given problem family, users can solve any problem with identical sparsity patterns. This means that users can change
the vector data c
, b
, and h
, as well as the nonzero values in P
, A
, and G
. To change the values, the user should directly
modify the data within the Workspace
struct as shown in calling.