Make an AI assistant to correct / update a definition of an optimal control problem.
aidefinition(
code="ocp = @def begin
t ∈ [0, 1], time
x ∈ R², state
u ∈ R, control
x(0) == [ -1, 0 ]
x(2) == [ 0, 0 ] # this should be x(1)
ẋ(t) == [ x₂(t), u(t) ]
∫( 0.5u(t)^2 ) → min
end",
prompt=""
)
and this correct the definition. The argument prompt is something we can write which is added to the inner prompt. For instance, we could write:
aidefinition(
code="ocp = @def begin
t ∈ [0, 1], time
x ∈ R², state
u ∈ R, control
x(0) == [ -1, 0 ]
x(2) == [ 0, 0 ] # this should be x(1)
ẋ(t) == [ x₂(t), u(t) ]
∫( 0.5u(t)^2 ) → min
end",
prompt="Replace the state x by q."
)
Remark. The function returns the corrected code and a log if asked to explain the changes.
Make an AI assistant to correct / update a definition of an optimal control problem.
and this correct the definition. The argument
promptis something we can write which is added to the inner prompt. For instance, we could write:Remark. The function returns the corrected code and a log if asked to explain the changes.