Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print ocp #84

Closed
jbcaillau opened this issue May 24, 2023 · 5 comments
Closed

Print ocp #84

jbcaillau opened this issue May 24, 2023 · 5 comments
Assignees

Comments

@jbcaillau
Copy link
Member

@ocots for the record (there might no be a block)

julia> @def o t  [ t0, t0 + 4 ], time
Error showing value of type OptimalControlModel{Autonomous, Fixed}:
ERROR: AssertionError: ocp.model_expression.head == :block
Stacktrace:
  [1] show(io::IOContext{Base.TTY}, #unused#::MIME{Symbol("text/plain")}, ocp::OptimalControlModel{Autonomous, Fixed})
    @ CTBase ~/CTBase.jl/src/print.jl:23
@ocots
Copy link
Member

ocots commented May 24, 2023

This part must be udpated:

if !isnothing(ocp.model_expression)

Can you give the dump of o.model_expression?

@jbcaillau
Copy link
Member Author

julia> t0 = 0
0

julia> @def o t  [ t0, t0 + 4 ], time
Error showing value of type OptimalControlModel{Autonomous, Fixed}:
ERROR: AssertionError: ocp.model_expression.head == :block
Stacktrace:
  [1] show(io::IOContext{Base.TTY}, #unused#::MIME{Symbol("text/plain")}, ocp::OptimalControlModel{Autonomous, Fixed})
    @ CTBase ~/CTBase.jl/src/print.jl:23
  [2] (::REPL.var"#43#44"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::Any)
    @ REPL ~/julia-1.8.5/share/julia/stdlib/v1.8/REPL/src/REPL.jl:267
  [3] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/julia-1.8.5/share/julia/stdlib/v1.8/REPL/src/REPL.jl:521
  [4] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
    @ REPL ~/julia-1.8.5/share/julia/stdlib/v1.8/REPL/src/REPL.jl:260
  [5] display(d::REPL.REPLDisplay, x::Any)
    @ REPL ~/julia-1.8.5/share/julia/stdlib/v1.8/REPL/src/REPL.jl:272
  [6] display(x::Any)
   [...]

julia> o.model_expression
:((t  [t0, t0 + 4], time))

julia> @dump :((t  [t0, t0 + 4], time))
Expr
  head: Symbol quote
  args: Array{Any}((1,))
    1: Expr
      head: Symbol tuple
      args: Array{Any}((2,))
        1: Expr
          head: Symbol call
          args: Array{Any}((3,))
            1: Symbol 
            2: Symbol t
            3: Expr
              head: Symbol vect
              args: Array{Any}((2,))
                1: Symbol t0
                2: Expr
        2: Symbol time

@ocots
Copy link
Member

ocots commented May 30, 2023

Fixed.

@ocots ocots closed this as completed May 30, 2023
@ocots ocots mentioned this issue May 30, 2023
@jbcaillau
Copy link
Member Author

@ocots thanks. I see that it has been merged in develop, not main

@ocots
Copy link
Member

ocots commented May 30, 2023

Yes and then develop into main. I have removed develop since it is not useful anymore. We can add it if we have a big update to make.

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

No branches or pull requests

2 participants