Skip to content

Optimization Results

openscvx.results.OptimizationResults dataclass

Structured container for optimization results from the Successive Convexification (SCP) solver.

This class provides a type-safe and organized way to store and access optimization results, replacing the previous dictionary-based approach. It includes core optimization data, iteration history for convergence analysis, post-processing results, and flexible storage for plotting and application-specific data.

Attributes:

Name Type Description
converged bool

Whether the optimization successfully converged

t_final float

Final time of the optimized trajectory

u Control

Optimized control trajectory at discretization nodes

x State

Optimized state trajectory at discretization nodes

x_history list[ndarray]

State trajectories from each SCP iteration

u_history list[ndarray]

Control trajectories from each SCP iteration

discretization_history list[ndarray]

Time discretization from each iteration

J_tr_history list[ndarray]

Trust region cost history

J_vb_history list[ndarray]

Virtual buffer cost history

J_vc_history list[ndarray]

Virtual control cost history

t_full Optional[ndarray]

Full time grid for interpolated trajectory

x_full Optional[ndarray]

Interpolated state trajectory on full time grid

u_full Optional[ndarray]

Interpolated control trajectory on full time grid

cost Optional[float]

Total cost of the optimized trajectory

ctcs_violation Optional[ndarray]

Continuous-time constraint violations

plotting_data dict[str, Any]

Flexible storage for plotting and application data

get(key: str, default: Any = None) -> Any

Get a value from the results, similar to dict.get().

Parameters:

Name Type Description Default
key str

The key to look up

required
default Any

Default value if key is not found

None

Returns:

Type Description
Any

The value associated with the key, or default if not found

to_dict() -> dict[str, Any]

Convert the results to a dictionary for backward compatibility.

Returns:

Type Description
dict[str, Any]

Dictionary representation of the results

update(other: dict[str, Any])

Update the results with additional data from a dictionary.

Parameters:

Name Type Description Default
other dict[str, Any]

Dictionary containing additional data

required
update_plotting_data(**kwargs)

Update the plotting data with additional information.

Parameters:

Name Type Description Default
**kwargs

Key-value pairs to add to plotting_data

{}