printing
Column
dataclass
¶
Specification for a single column in the iteration table.
Source code in openscvx/utils/printing.py
Verbosity
¶
Bases: IntEnum
Verbosity levels for iteration table output.
Source code in openscvx/utils/printing.py
build_header_format(columns: list[Column]) -> str
¶
build_separator(columns: list[Column]) -> str
¶
Generate separator line matching the total width of active columns.
color_J_nonlin(value: Any, params: Any, data: dict) -> Optional[str]
¶
color_J_tr(value: Any, params: Any, data: dict) -> Optional[str]
¶
Color J_tr green if within tolerance, red otherwise.
color_J_vb(value: Any, params: Any, data: dict) -> Optional[str]
¶
Color J_vb green if within tolerance, red otherwise.
color_J_vc(value: Any, params: Any, data: dict) -> Optional[str]
¶
Color J_vc green if within tolerance, red otherwise.
color_acceptance_ratio(value: Any, params: Any, data: dict) -> Optional[str]
¶
Color acceptance ratio based on success level.
<= 0.1: red (unsuccessful) 0.1 < ratio <= 0.8: somewhat successful (green) 0.8 < ratio <= 1.5: very successful (blue)
1.5: overly successful (magenta)
Source code in openscvx/utils/printing.py
color_adaptive_state(value: Any, params: Any, data: dict) -> Optional[str]
¶
Color adaptive state green if acceptable, red otherwise.
Source code in openscvx/utils/printing.py
color_prob_stat(value: Any, params: Any, data: dict) -> Optional[str]
¶
footer(columns: list[Column]) -> None
¶
Print the table footer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
columns
|
list[Column]
|
List of Column specs defining the table structure |
required |
format_value(col: Column, value: Any, params: Any, data: dict) -> str
¶
Format a single value and apply coloring if needed.
Source code in openscvx/utils/printing.py
header(columns: list[Column]) -> None
¶
Print the table header for the given columns.
Source code in openscvx/utils/printing.py
intermediate(print_queue: queue.Queue, params: Any, columns: list[Column]) -> None
¶
Process and print iteration data from the queue.
This function runs in a loop, reading data from the print queue and displaying formatted iteration rows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_queue
|
Queue
|
Queue containing iteration data dicts |
required |
params
|
Any
|
Settings object (used for color threshold comparisons) |
required |
columns
|
list[Column]
|
List of Column specs defining the table structure |
required |
Source code in openscvx/utils/printing.py
print_batch_results_summary(result: OptimizationResults, timing_post: float, timing_init: Optional[float], timing_solve: Optional[float], *, timing_compile: Optional[float] = None) -> None
¶
Print a results summary box for a batched post-processed solve.
Mirrors :func:print_results_summary for the output of
:meth:~openscvx.problem.Problem.post_process_batched.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
OptimizationResults
|
Post-processed :class: |
required |
timing_post
|
float
|
Propagation wall-clock time in seconds. |
required |
timing_init
|
Optional[float]
|
Initialize wall-clock time in seconds ( |
required |
timing_solve
|
Optional[float]
|
Batched-solve execution time in seconds ( |
required |
timing_compile
|
Optional[float]
|
XLA/AOT compile time in seconds for the batched solve
( |
None
|
Source code in openscvx/utils/printing.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | |
print_problem_summary(settings: Config, lowered: Any, solver: ConvexSolver, algorithm: Algorithm, discretizer: Discretizer) -> None
¶
Print the problem summary box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
Config
|
Configuration settings containing problem information |
required |
lowered
|
Any
|
LoweredProblem from lower_symbolic_problem() |
required |
solver
|
ConvexSolver
|
Initialized ConvexSolver with built problem |
required |
algorithm
|
Algorithm
|
Algorithm instance (e.g., PenalizedTrustRegion) |
required |
discretizer
|
Discretizer
|
Discretizer instance (e.g., LinearizeDiscretize) |
required |
Source code in openscvx/utils/printing.py
print_results_summary(result: OptimizationResults, timing_post, timing_init, timing_solve)
¶
Print the results summary box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
OptimizationResults
|
Optimization results object |
required |
timing_post
|
float
|
Post-processing time |
required |
timing_init
|
float
|
Initialization time |
required |
timing_solve
|
float
|
Solve time |
required |
Source code in openscvx/utils/printing.py
print_row(columns: list[Column], data: dict, params: Any) -> None
¶
Print a single data row for the given columns.
print_summary_box(lines, title='Summary')
¶
Print a centered summary box with the given lines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lines
|
list
|
List of strings to display in the box |
required |
title
|
str
|
Title for the box (default: "Summary") |
'Summary'
|