Skip to content

[Dev] First parsing #36

@ocots

Description

@ocots

@AnasXbouali This idea is to convert this

ocp = @loss_def begin

    t  [ 0, tf ], time
    x  R^2, state
    u  R, control

    0.5   x₂(t)   3.5, loss_region

    x₁(0) == 0
    x₂(0) == 0
    x₂(tf) == 4

    -π/2    u(t)   π/2

    ∂x₁ = x₂(t) + cos(u(t))
    ∂x₂ = sin(u(t))

    (t) == [ ∂x₁, ∂x₂ ]

    -x₁(tf)  min

end

to

ocp = @loss_def begin

    t  [ 0, tf ], time
    x  R^2, state
    u  R, control

    x₁(0) == 0
    x₂(0) == 0
    x₂(tf) == 4

    -π/2    u(t)   π/2

    ∂x₁ = x₂(t) + cos(u(t))
    ∂x₂ = sin(u(t))

    (t) == [ ∂x₁, ∂x₂ ]

    -x₁(tf)  min

end

and then, to parse it with @def from CTBase.jl.

  • Remove all the lines with loss_region tag.
  • Parse the new expression with @def.

Warning

It is important to add some unit tests here.

Metadata

Metadata

Labels

internal devModification to the code is requested and should not affect user experiment

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions