Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions src/OCP/Building/solution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1300,15 +1300,29 @@ function Base.show(io::IO, ::MIME"text/plain", sol::Solution)

# Variable (si définie)
if variable_dimension(sol) > 0
println(
io,
"\n• Variable: ",
variable_name(sol),
" = (",
join(variable_components(sol), ", "),
") = ",
variable(sol),
)
components = variable_components(sol)
var_name = variable_name(sol)

# Cas simplifié: dimension 1 et nom identique
if variable_dimension(sol) == 1 && var_name == components[1]
println(
io,
"\n• Variable: ",
var_name,
" = ",
variable(sol),
)
else
println(
io,
"\n• Variable: ",
var_name,
" = (",
join(components, ", "),
") = ",
variable(sol),
)
end
if dim_variable_constraints_box(sol) > 0
println(io, " │ Var dual (lb) : ", variable_constraints_lb_dual(sol))
println(io, " └─ Var dual (ub) : ", variable_constraints_ub_dual(sol))
Expand Down
2 changes: 1 addition & 1 deletion test/problems/solution_example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function solution_example(; fun=false)
CTModels.time!(pre_ocp; t0=0.0, tf=1.0)

# set state
CTModels.state!(pre_ocp, 2)
CTModels.state!(pre_ocp, 2, "x", ["q", "w"])

# set control
CTModels.control!(pre_ocp, 1)
Expand Down
Loading