Skip to content

feat: redesign Solution display — single tree, conditional fields, CTBase palette#375

Merged
ocots merged 1 commit into
mainfrom
feat/solution-display-redesign
Jul 13, 2026
Merged

feat: redesign Solution display — single tree, conditional fields, CTBase palette#375
ocots merged 1 commit into
mainfrom
feat/solution-display-redesign

Conversation

@ocots

@ocots ocots commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

Redesigns the Solution REPL display for clarity and consistency with the CTBase palette conventions.

Before

• Solver:
  ✓ Successful  : true
  │  Status     : Solve_Succeeded
  │  Message    : Solve_Succeeded
  │  Iterations : 10
  │  Objective  : 0.5
  └─ Constraints violation : 1.0e-9

• Variable: v = 1.5

• Boundary duals: [1.2, -0.8]

After

Single tree, no bullet points, fields omitted when not provided:

Solution  ✓ successful
  │  Objective : 0.5
  │  T : 1.5
  │  ├─ dual lb : [0.0]
  │  └─ dual ub : [0.3]
  │  Boundary duals : [1.2, -0.8]
  │
  │  Iterations : 10
  │  Status : first_order
  │  Message : optimal
  └─ Constraints violation : 1.0e-9

Flow result (no solver metadata):

Solution  ✓ successful
  │  Objective : 0.5
  └─ Message : Solution computed by CTFlows OCP flow

Changes

src/Solutions/solution_types.jl

  • SolverInfos: iterations, status, message, constraints_violation are now Union{T, Core.NotProvidedType} instead of mandatory concrete types.

src/Solutions/build_solution.jl

  • Both build_solution overloads: the four fields above default to Core.NotProvided.
  • Accessor return-type annotations removed (they now return Union{T, NotProvidedType}).

src/Solutions/show.jl

  • Complete rewrite: single tree using /└─/├─, fmt.muted for structural chars, fmt.label/fmt.value for content.
  • Empty separator appears between primal data (objective, variable, duals) and solver metadata (iterations, status, message, cv) when both sections are non-empty.
  • NotProvided fields are silently omitted.

Tests

  • test_solution_show.jl: 4 test cases, including a NotProvided-omission case.
  • test_empty_dual_model.jl: "Solver""Solution" string check.

docs/src/solution/overview.md

  • New "Displaying a solution" section with 4 executable @repl examples.

Related

…Base palette

- SolverInfos: iterations/status/message/constraints_violation are now
  Union{T, NotProvidedType}, defaulting to NotProvided in build_solution
- show.jl: single tree rooted at "Solution", │/└─ connectors, fmt.muted
  for structural chars, separator │ between primal data and solver metadata;
  fields absent (NotProvided) are silently omitted
- Remove fixed return-type annotations from the four optional accessors
- test_solution_show: 4 test cases including NotProvided-omission test
- test_empty_dual_model: update "Solver" → "Solution" string check
- docs/solution/overview.md: add "Displaying a solution" section with 4
  executable @repl examples (full solver, flow, variable, duals)
@ocots
ocots merged commit 159c0c7 into main Jul 13, 2026
6 checks passed
@ocots
ocots deleted the feat/solution-display-redesign branch July 13, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant