ConditionalJuMP.jl
ConditionalJuMP.jl copied to clipboard
Really like this feature, but it doesn't seem to work for me.
I'm trying to use the conditional @implies and it seems that it's not working quite right. I have two variables declared (with lower and upper bounds) as follows:
Assets = range(1,1,nAssets);
Tasks = range(1,1,nTasks);
MAX_LB = -1000; # These are arbitrary. I wouldn't declare these if ConditionalJuMP didn't require them
MAX_UB = 1000;
@variables m begin
MAX_LB <= X[Assets,Tasks] <= MAX_UB, Int
MAX_LB <= XPrime[Assets,Tasks] <= MAX_UB, Int
end
for as in Assets, ts in Tasks
@implies(m,(XPrime[as,ts] <= -1) => (X[as,ts] == 0))
@implies(m,(XPrime[as,ts] >= 0) => (X[as,ts] == XPrime[as,ts]))
end
Then when I print the resulting values, all are set to -1000, instead of whatever else I might expect. Any idea if this is an indication of something else in my code or something wrong with the way I'm using your syntax? I really like this, by the way. All of the proprietary solvers have similar conditionals, and this is a great addition to JuMP.
I think the issue may be with your formulation. The result I get (using Gurobi) is that X is set to its lower bound and XPrime is set to all -1. That's essentially consistent with your formulation: given the constraints you've written down, if XPrime
is in (-1, 0)
there are no constraints on X
at all. Strictly speaking, that should disallow a value of exactly -1.0
, but I don't think we can really distinguish between < -1
and <= -1
in an optimization problem like this.