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

setRHS is broken #470

Closed
mlubin opened this issue Jun 25, 2015 · 12 comments
Closed

setRHS is broken #470

mlubin opened this issue Jun 25, 2015 · 12 comments
Milestone

Comments

@mlubin
Copy link
Member

mlubin commented Jun 25, 2015

using JuMP

m = Model()
@defVar(m, x)
@setObjective(m, Max, x)

constr = @addConstraint(m, x + 5  10)
@show JuMP.rhs(m.linconstr[1])
solve(m)
@show getValue(x)
chgConstrRHS(constr, 11)
@show JuMP.rhs(m.linconstr[1])
solve(m)
@show getValue(x)

prints

JuMP.rhs(m.linconstr[1]) => 5.0
getValue(x) => 5.0
JuMP.rhs(m.linconstr[1]) => 11.0
getValue(x) => 11.0

Most people would reasonably expect the second solution to be 6, not 11.

@mlubin mlubin added this to the 0.10 milestone Jun 25, 2015
@joehuchette
Copy link
Contributor

I mean,

julia> constr = @addConstraint(m, x + 5  10)
x  5

I'm not sure how we can avoid this.

@mlubin
Copy link
Member Author

mlubin commented Jun 25, 2015

Can we keep the constant terms in the AffExpr up until we pass it to the solver?

@IainNZ
Copy link
Collaborator

IainNZ commented Jun 25, 2015

This was the same thing I was saying last night about the idea of asking for the "value" of a constraint is not very well defined

@mlubin
Copy link
Member Author

mlubin commented Jun 25, 2015

For two-sided constraints we already parse the lower bounds and upper bounds separately. I think we need to do the same for simple constraints also. If the RHS isn't a constant, we shouldn't allow chgConstrRHS. If it is a constant, we should do the right thing.

@mlubin
Copy link
Member Author

mlubin commented Jul 1, 2015

Gurobi has the same issue: https://groups.google.com/forum/#!topic/gurobi/CjZKKwvREKc

@joehuchette
Copy link
Contributor

It seems kind of crazy, but maybe an addToRhs(::LinearConstraint,::Number) function makes more sense.

@mlubin
Copy link
Member Author

mlubin commented Jul 1, 2015

That seems much simpler to explain

@mlubin
Copy link
Member Author

mlubin commented Jul 29, 2015

Okay to drop from 0.10? Doesn't seem like anyone has complained about this behavior up to this point.

@joehuchette
Copy link
Contributor

I know Seb was playing around with this type of thing, but I think he ended up just using the MPB level functions

@mlubin mlubin removed this from the 0.10 milestone Aug 5, 2015
@mlubin
Copy link
Member Author

mlubin commented Nov 22, 2016

My favorite solution at this point is to tell people to use fixed variables and update the bounds. (Thanks @FransdR)

@mlubin mlubin changed the title chgConstrRHS is broken setRHS is broken May 6, 2017
@mlubin
Copy link
Member Author

mlubin commented Jun 9, 2017

We should consider completely removing this function

@chriscoey chriscoey added this to the 1.0 milestone Jun 9, 2017
@mlubin
Copy link
Member Author

mlubin commented Feb 5, 2018

setRHS doesn't exist anymore, so closing this

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

4 participants