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

Getters of multipliers associated to labeled constraints #116

Open
ocots opened this issue Mar 3, 2023 · 6 comments
Open

Getters of multipliers associated to labeled constraints #116

ocots opened this issue Mar 3, 2023 · 6 comments
Assignees
Labels
enhancement New feature or request march2023

Comments

@ocots
Copy link
Member

ocots commented Mar 3, 2023

A user should have the possibility to get the dual variables of a constraint he has labeled, as in JuMP (cf. the dual function). See also #131

@PierreMartinon
Copy link
Member

PierreMartinon commented Mar 30, 2023

Current state in CTDirect:

  • retrieve and pass to the OCP solution the multipliers for specific types of constraints (tested on state, should be identical for control and mixed constraints)
  • same for box multipliers (need to parse them first but we do have the values returned by ipopt so there should be no difficulty)
  • retrieve the corresponding labels from ocp

@ocots ocots added the enhancement New feature or request label Jul 26, 2024
@PierreMartinon
Copy link
Member

PierreMartinon commented Jul 26, 2024

Small update: in the latest version only the adjoints are retrieved, other multipliers are skipped. Putting them back is easy since the previous code is still there.

While we're at it, it would be nice to add proper fields in OptimalControlSolution for these multipliers (I used to dump them in info).

@ocots, @jbcaillau I let you pick the names and add the fields, then I complete the parsing back ?

@jbcaillau
Copy link
Member

jbcaillau commented Jul 26, 2024

@PierreMartinon I guess we should stick to the current vocabulary (check constraint! here):

  • boundary (nonlinear fun of $([t_0,]x_0,[t_f],x_f)$
  • control (pure)
  • state (pure)
  • mixed
  • variable

Choose whatever name you want as long as you don't mix CamlCase_and_snake 🙃...

@PierreMartinon
Copy link
Member

PierreMartinon commented Jul 31, 2024

By the way we probably want to retrieve the different constraints as well (parsing is the same so there is no extra effort).
So maybe something like this, to keep reasonably short names:

  • [mult_]boundary_constraints
  • [mult_]state_constraints
  • [mult_]control_constraints
  • [mult_]mixed_constraints
  • [mult_]variable_constraints

@jbcaillau
Copy link
Member

@PierreMartinon as pointed by @ocots there is still an interest in having labels for our constraints (abstract form) as one might want to retrieve the constraint associated with such a specific label:

@def ocp begin
    t  [ 0, 1 ], time
    x  R², state
    u  R, control
    x(0) == [ -1, 0 ], (1)
    x(1) == [ 0, 0 ]
    (t) == [ x₂(t), u(t) ]
    ( 0.5u(t)^2 )  min
end

@ocots ocots mentioned this issue Aug 1, 2024
@PierreMartinon
Copy link
Member

PierreMartinon commented Aug 1, 2024

Ok, in the solution parsing I can sort the different kinds of constraints and their associated multipliers, then interpolate the functions as we already do for the state and control (and costate) variables.

For the labels part, I guess it would be the same as retrieving a state/control by its name ?

By the way this will need a joint release of CTDirect / CTBase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request march2023
Projects
None yet
Development

No branches or pull requests

3 participants