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

Expose dual variables of constraints #113

Open
bchasnov opened this issue Jun 9, 2020 · 1 comment
Open

Expose dual variables of constraints #113

bchasnov opened this issue Jun 9, 2020 · 1 comment

Comments

@bchasnov
Copy link
Collaborator

bchasnov commented Jun 9, 2020

We want to expose the dual variables associated with the constraint of an optimization problem.

For example,

// initialize parameters and variables
prob pr;
par a(pr, ...);
par b(pr, ...);
var x(pr, ...);

// setup and solve problem
minimize(...);
cons &c = (a*x <= b)
pr.solve();

// output
x.col(0); // solution to x
cons.dual_value(...); // dual variable associated with constraint a*x <= b

The last line is wanted but unimplemented.

Places to take a look

  • csocp/solver_lib.h, structslvOut_t.y and slvOut_t.s. These are the slack variables that are computed by the csocp module.
  • cprs/source/prob.cpp, function prob::unparse(slvOut_t). This is where we want to iterate through m_cons_list and populate the data in there using pSO->y and pSO->x.
  • cprs/header/cons.h. We should add a public get variable to access the data set in the previous set. the cons::m_nSlacks variable shows how many slack variables are associated with this one constraint.
  • search for slack in the project to find references of where slack variables are being set. For example, line 727 of cprs/source/prob.cpp states that there is one slack variable per inequality.

Things to worry about

  • indexing
  • it looks like we want to subtract pSO->y - pSO->s for some dual variables.
@bchasnov
Copy link
Collaborator Author

bchasnov commented Jun 9, 2020

initial tests committed to dualvalues branch on cprs

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

1 participant