# IPOPT solver auto-converts my binary variables to continuous

I hope this is the right stackexchange for this question; if not, please direct me there!

I'm on Linux. I've installed IPOPT and AMPL, and all the third-party stuff required: ASL, HSL, Lapack, Metis, Mumps.

When I run the solver from AMPL with binary or integer variables, IPOPT converts them to continuous. Does anyone know why or how to fix it? Here's a minimal example.

file test.mod:

option solver ipopt;
var x, integer;

maximize best: x;
s.t. cons1: x <= 5;

solve;


And when I run it (The second line of output being the problem):

\$ ampl t2.mod
Ipopt 3.10.2:
==> Warning: Treating 0 binary and 1 integer variables as continous.

******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
Ipopt is released as open source code under the Eclipse Public License (EPL).
******************************************************************************

NOTE: You are using Ipopt by default with the MUMPS linear solver.
Other linear solvers might be more efficient (see Ipopt documentation).

This is Ipopt version 3.10.2, running with linear solver mumps.

Number of nonzeros in equality constraint Jacobian...:        0
Number of nonzeros in inequality constraint Jacobian.:        0
Number of nonzeros in Lagrangian Hessian.............:        0
// lots more output


Thanks for any help!

IPOPT is not for integer programs so this is the rigth thing to do as far as IPOPT is concerned.

If you really have a MINLP problem at hand then try a MINLP solver. IPOPT is an NLP solver.

Since I do not solve MINLP (Mixed Integer NonLinear Programming) problems I could only Google too. Hopefully, someone else can suggest a solver here at scicomp.

• Glad to hear you have found it useful. Good luck!
– Ali
Mar 12 '12 at 22:58

I think the above answer (by Ali) is correct, so I am trying to offer some alternatives.

Mixed Integer, non linear, Problems are difficult to solve. While the terms "non linear" covers a wide view of problems in general, mixed integer linear problems are better researched (as far as I know).

Open source software you could use for both cases is SCIP (www.scip.zib.de), though it emphasizes on mixed integer programming, constraints can be modelled for the "non linear" case as well (though it is in beta-status there).

If you want to solve mixed integer linear problems (only), one could recommend the solvers GAMS, CPLEX and GUROBI (which are partially free for academic purposes) or the COIN-OR Project (open source, I think). Thought these solvers offer some support for nonlinear constraints (i.e. quadratic), I don't think they can cover the whole aspect of non-linear problems.

For completeness sake, the following annotations: In general it holds, that mixed integer problems are hard to solve, such that all of these solver can not guarantee an optimal solution in an adequate amount of time for all cases (in theory). Nevertheless I have made good experiences with SCIP, CPLEX and Gurobi, such that I would advise to give them a try, especially if you only want to run small examples (it sounds alike :) )

Best regards

• Cool, thanks very much for the suggestions! Is the definition of "quadratic" that any product contains at most two variables or one variable squared?
– usul
Mar 12 '12 at 15:19
• Yes, I think so :) Mar 12 '12 at 16:44

Bonmin is an open-source MINLP solver that uses IPOPT to solve the "relaxed" NLPs solutions. Bonmin has the following algorithms:

B-BB: NLP-based branch-and-bound algorithm B-OA: outer-approximation decomposition algorithm B-QG: implementation of Quesada and Grossmann's branch-and-cut algorithm B-Hyb: hybrid outer-approximation based branch-and-cut algorithm

Another option for MINLP problems is the APOPT solver which I'm currently working on developing. It has an interface to AMPL which it seems like you are currently using.