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

Naming of slack variables? #32

Closed
dourouc05 opened this issue Jul 29, 2019 · 5 comments
Closed

Naming of slack variables? #32

dourouc05 opened this issue Jul 29, 2019 · 5 comments

Comments

@dourouc05
Copy link

I am dualising a model with nonnegative variables, so I expect to have dual constraints >= 0, but I have slack variables. I did not see a way of disabling these slack variables (or is there a reason they are used?).

The "meat" of this issue: these slack variables have no real name, I see things like _1 and _1_1 when exporting the dual model through MathOptFormat.jl (I suspect that the second name comes from renaming to ensure that all variables have distinct names without forbidden symbols when exporting to LP). Would it be possible to automatically name those slack variables? Like slack_var1 for the dual constraint associated with the primal variable var1.

@blegat
Copy link
Member

blegat commented Jul 29, 2019

I am dualising a model with nonnegative variables, so I expect to have dual constraints >= 0, but I have slack variables. I did not see a way of disabling these slack variables (or is there a reason they are used?).

See #9

@guilhermebodin
Copy link
Collaborator

For the naming you can try this dualize(primal_model, dual_names = Dualization.DualNames("", "slack_var"). With this dual_names variable, you can change the prefix for the dual variable associated with primal constraint and also for the dual constraint associated with the primal variables.

@dourouc05
Copy link
Author

It doesn't seem to work as expected… Here, s_m is a JuMP model:

dualize(backend(s_m), dual_names=Dualization.DualNames("", "slack_var"))

In the LP file (or if I convert the MOI model into a JuMP model), I still get names like _1.

(By the way, could you make the first part of https://github.com/guilhermebodin/Dualization.jl/blob/master/test/optimize_abstract_models.jl#L5 a standalone function to get a JuMP model? Maybe both from a ModelLike and directly from a DualProblem?)

@guilhermebodin
Copy link
Collaborator

Yes, that's in the plan, input a JuMP model and output a dualized JuMP model :)

Could you share the script of this model so I can get more intuition on what is not working properly?

@dourouc05
Copy link
Author

I'm trying to reduce it (in order not to send you a few thousands lines of code 😛).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants