Are semi continuous variables supported in Knitro solver?

17 views
Skip to first unread message

Aswin Dhamodharan

unread,
Jul 24, 2009, 2:16:36 AM7/24/09
to KNITRO Nonlinear Optimization Solver
Hi,
Am trying to solve an inventory problem using MIP and Non linear
model.
I have a need where the value of an expression, say( A -B), should be
zero when A - B is negative, else the value itself.
So I have decided to use a semi continuous variable whose value is
either (A - B) or >= 0.
Does Knitro solver support these variables? If so how do I declare or
use them?
Where do I look for it?
Please help me regarding above issue.

Other ideas of solving the above problem are also welcome.
I have tried using the standard if then statement using binary
variables.
However I feel using more binary variables is unnecessarily
complicating the problem.
Moreover, it increases the number of binary variables very highly
thereby making the solving inefficient.

Thanks
Aswin

R Waltz

unread,
Jul 24, 2009, 2:09:43 PM7/24/09
to KNITRO Nonlinear Optimization Solver
Hi Aswin,

KNITRO does not currently allow for semi-continuous variables (perhaps
in future releases).

The constraint you describe seems to be a "switch-off" constraint
which implies that the constraint is active if certain conditions
hold, otherwise it is inactive. These types of constraints can, I
think, almost always be formulated as complementarity constraints and
KNITRO does support the modeling of complementarity constraints. See
Section 10.5 of the KNITRO 6.0 User's Manual found at:

http://ziena.com/documentation.htm

A complementarity constraint is a constraint that represents a
disjunctive condition and has the form

0 <= z1 complements z2 >=0 (1)

where the condition above means EITHER z1=0 OR z2=0 and both z1 and z2
are non-negative variables. This can be expressed algebraically as

z1*z2=0 (2)
z1>=0, z2>=0.

However, these constraints are known to be degenerate and difficult so
they should not be modeled in the algebraic form (2). Rather they
should be identified as complementarity constraints and sent to KNITRO
in the form (1) so that KNITRO recognizes them as complementarity
constraints and can provide special treatment to them to try to handle
the degeneracy.

In your particular case I think you can model your condition as

z1-z2=A-B
0 <= z1 complements z2 >=0

and then the variable z1 is the variable you are interested in since
z1=A-B when A-B>=0 and z1=0 otherwise.

Hope this helps.
-Richard Waltz

Aswin Dhamodharan

unread,
Jul 26, 2009, 12:15:00 PM7/26/09
to KNITRO Nonlinear Optimization Solver

Hi Richard,

Thank you for your reply.
Your idea is exactly what I was looking for.
It has definitely helped me reduce the number of binary variavles
drastically.
However I have not been able to upload as the NEOS server has been
down for quiite a time.
I would let you know if it has perfectly worked for me once I get the
results.

Thanks
Aswin

R Waltz

unread,
Jul 26, 2009, 6:19:44 PM7/26/09
to KNITRO Nonlinear Optimization Solver
Aswin,

A word of warning concerning the reformulation I proposed. Adding
complementarity constraints adds non-convexities to your model
which often creates different local minima. If you need to find the
global minima, you may be better off with a model using only binary
variables. Also the model can be very difficult to solve if it has a
large number of complementarity constraints (especially if it also
still
has binary variables); perhaps no easier that a formulation with lots
of
binary variables.

You could define a continuous variable z subject to the two
constraints

z >= 0
z >= A - B

In many situations it is possible to deduce that z will equal the
greater of
0 and A - B in any optimal solution, which is what is desired. If
this can't
be deduced then a zero-one variable u is needed, with additional
constraints
of some sort; I think it works to require

z <= (A - B) + K * u
z <= 0 + K * (1-u)

where K is an upper bound on A - B.

-Richard
Reply all
Reply to author
Forward
0 new messages