Skip to content

[Dev] Definition assistant #336

@ocots

Description

@ocots

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.

Metadata

Metadata

Assignees

Labels

good first issueGood for newcomersinternal 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