ptr
PTR_step(params, settings: Config, state: SolverState, prob: cp.Problem, discretization_solver: callable, cpg_solve, emitter_function, jax_constraints: LoweredJaxConstraints) -> bool
¶
Performs a single SCP iteration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Problem parameters |
required | |
settings
|
Config
|
Configuration object |
required |
state
|
SolverState
|
Solver state (mutated in place) |
required |
prob
|
Problem
|
CVXPy problem |
required |
discretization_solver
|
callable
|
Discretization solver function |
required |
cpg_solve
|
CVXPyGen solver (if enabled) |
required | |
emitter_function
|
Function to emit iteration data |
required | |
jax_constraints
|
LoweredJaxConstraints
|
JAX-lowered non-convex constraints |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if converged, False otherwise |
Source code in openscvx/algorithms/ptr.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
format_result(problem, state: SolverState, converged: bool) -> OptimizationResults
¶
Formats the solver state as an OptimizationResults object.
Directly passes trajectory arrays from solver state to results - no object construction needed. Results store pure arrays, settings store metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
The Problem instance (for symbolic metadata and settings). |
required | |
state
|
SolverState
|
The SolverState to extract results from. |
required |
converged
|
bool
|
Whether the optimization converged. |
required |
Returns:
| Type | Description |
|---|---|
OptimizationResults
|
OptimizationResults containing the solution data. |