CPLEX doesn't solve linear regression

271 views
Skip to first unread message

Alba Victoria

unread,
Oct 16, 2015, 8:58:13 AM10/16/15
to AMPL Modeling Language
Hi all!

I am trying to solve a linear regression problem with some integer variables and constraints. As cplex does not work with my main problem, I've tried to solve the simple linear regression problem without any constraints, and I receive the following message CPLEX 12.6.2.0: infeasible or unbounded in presolve. However, I am able to obtain the optimal solution with Gurobi. Does anybody knows where that problem comes from? 
I show you the outputs now and enclose the model, data and run files:

---------------------------------------------------------------------------------------
CPLEX 12.6.2.0: mipdisplay 2
CPLEX 12.6.2.0: infeasible or unbounded in presolve.
No basis.
beta[j] [*] :=
 1  0
 2  0
 3  0
 4  0
 5  0
 6  0
 7  0
 8  0
 9  0
10  0
;

ccc = 0

fun = 0.954353

_solve_time = 0.0312002

--------------------------------------------------------------------------------------
Gurobi 6.0.4: optimal solution; objective 0.4839446894
2 barrier iterations
No basis.
beta[j] [*] :=
 1  -0.0176257
 2  -0.176981
 3   0.31599
 4   0.155322
 5  -0.512201
 6   0.23831
 7   0.128978
 8   0.181449
 9   0.467183
10   0.0847727
;

ccc = -0.0202149

fun = 0.483945

_solve_time = 0.0312002
------------------------------------------------------------------------------------------------


linear_regression_0.txt
param_diabetes_0.txt
comandos_diabetes_0.txt

Robert Fourer

unread,
Oct 19, 2015, 12:47:15 PM10/19/15
to am...@googlegroups.com
We are looking into this problem but do not have an immediate answer. An unconstrained quadratic objective like this is optimized easily by any of the general nonlinear solvers (such as Knitro, CONOPT, SNOPT, MINOS, Ipopt) but solving it with the quadratic extensions to a linear solver is trickier and it is possible that the unconstrained case is not being handled properly.

Bob Fourer
am...@googlegroups.com

=======

Robert Fourer

unread,
Oct 19, 2015, 6:27:43 PM10/19/15
to am...@googlegroups.com
We found that there was a bug in the AMPL-CPLEX interface affecting this problem, but it was fixed in the version dated 20151005. With that version, CPLEX solves your problem as expected:

ampl: model linear_regression_0.txt;
ampl: data param_diabetes_0.txt;
ampl: option solver cplex;
ampl: solve;
CPLEX 12.6.2.0: optimal solution; objective 0.4839446894
2 QP barrier iterations
No basis.
ampl: display beta;
beta [*] :=
1 -0.0176257
2 -0.176981
3 0.31599
4 0.155322
5 -0.512201
6 0.23831
7 0.128977
8 0.181449
9 0.467183
10 0.0847727
;

Bob Fourer
am...@googlegroups.com

=======

From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of Alba Victoria
Sent: Friday, October 16, 2015 7:58 AM
To: AMPL Modeling Language
Subject: [AMPL 10758] CPLEX doesn't solve linear regression

I am trying to solve a linear regression problem with some integer variables and constraints. As cplex does not work with my main problem, I've tried to solve the simple linear regression problem without any constraints, and I receive the following message CPLEX 12.6.2.0: infeasible or unbounded in presolve. However, I am able to obtain the optimal solution with Gurobi. Does anybody knows where that problem comes from? ...


Alba Victoria

unread,
Oct 20, 2015, 8:22:46 AM10/20/15
to AMPL Modeling Language, 4...@ampl.com
Thank you very much for your quick answer!  However, when I add  some simple contraints with binary variables to the linear regression problem, neither CPLEX nor Gurobi are able to solve (they break with the same exit code as I mentioned previously).  The MINLP is being quickly solved in Neos server, so I suspect it can be the same bug you found on my AMPL version. Could you please try to run the code with my main problem to see if it works with the new version of AMPL? If so, how can I get the new version? We purchased an academic floating license a couple months ago...
comandos_diabetes_1.txt
linear_reg_epsilon.txt
param_diabetes_1.txt

Robert Fourer

unread,
Oct 21, 2015, 11:30:01 AM10/21/15
to am...@googlegroups.com
I am not seeing any error when I run CPLEX and Gurobi on your model and data. The log output is copied below. I suggest checking the versions that are being used, with the following commands which will produce output as shown:

ampl: shell "cplex -v";
AMPL/CPLEX 12.6.2.0 (Microsoft XP64, icl 10.1.029), driver(20151005), ASL(20151005)
...
ampl: shell "gurobi -v";
Gurobi 6.0.4 (Microsoft XP64, icl 10.1.029), driver(20151004), ASL(20151005)

The strings like "20151005" represent dates in yyyymmdd form. If you see earlier dates then you will need to download the latest versions. Otherwise please add these commands to your script, run it again, and send us the complete output.

Bob Fourer
am...@googlegroups.com


/////// CPLEX

sw: ampl
ampl: model linear_reg_epsilon.txt
ampl: data param_diabetes_1.txt
ampl: option solver cplex;
ampl: option cplex_options 'mipdisplay 2 mipinterval 100';
ampl: solve;
CPLEX 12.6.2.0: mipdisplay 2
mipinterval 100
Found incumbent of value 0.954353 after 0.00 sec. (0.00 ticks)
Reduced MIQP has 30 rows, 31 columns, and 80 nonzeros.
Reduced MIQP has 20 binaries, 0 generals, 0 SOSs, and 0 indicators.
Reduced MIQP objective Q matrix has 121 nonzeros.
Probing time = 0.00 sec. (0.01 ticks)
Reduced MIQP has 30 rows, 31 columns, and 80 nonzeros.
Reduced MIQP has 20 binaries, 0 generals, 0 SOSs, and 0 indicators.
Reduced MIQP objective Q matrix has 121 nonzeros.
Probing time = 0.00 sec. (0.01 ticks)
Clique table members: 10.
MIP emphasis: balance optimality and feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 4 threads.
Root relaxation solution time = 0.02 sec. (0.48 ticks)

Nodes Cuts/
Node Left Objective IInf Best Integer Best Bound ItCnt Gap

* 0+ 0 0.9544 ---
0 0 0.4839 11 0.9544 0.4839 10 49.29%
* 0+ 0 0.5371 0.4839 9.90%
0 2 0.4839 11 0.5371 0.4839 10 9.90%
Elapsed time = 0.03 sec. (1.59 ticks, tree = 0.00 MB)
* 30 17 integral 0 0.5358 0.4890 69 8.73%
* 31 16 integral 0 0.5357 0.4890 71 8.71%
* 47 24 integral 0 0.5271 0.4894 111 7.16%
* 60 26 integral 0 0.4911 0.4894 164 0.36%
* 70 17 integral 0 0.4903 0.4894 196 0.19%

Root node processing (before b&c):
Real time = 0.03 sec. (1.54 ticks)
Parallel b&c, 4 threads:
Real time = 0.03 sec. (1.31 ticks)
Sync time (average) = 0.01 sec.
Wait time (average) = 0.02 sec.
------------
Total (root+branch&cut) = 0.06 sec. (2.85 ticks)
CPLEX 12.6.2.0: optimal integer solution; objective 0.4903069048
227 MIP simplex iterations
81 branch-and-bound nodes
No basis.

/////// Gurobi

ampl: reset;
ampl: model linear_reg_epsilon.txt
ampl: data param_diabetes_1.txt
ampl: option solver gurobi;
ampl: option gurobi_options 'outlev 1';
ampl: solve;
Gurobi 6.0.4: outlev 1
Optimize a model with 30 rows, 31 columns and 80 nonzeros
Model has 66 quadratic objective terms
Coefficient statistics:
Matrix range [2e-01, 2e+00]
Objective range [6e-02, 1e+00]
Bounds range [1e+00, 1e+00]
RHS range [1e+00, 1e+00]
Found heuristic solution: objective 4e+18
Presolve time: 0.00s
Presolved: 30 rows, 31 columns, 80 nonzeros
Presolved model has 66 quadratic objective terms
Variable types: 11 continuous, 20 integer (20 binary)

Root relaxation: objective 4.839447e-01, 54 iterations, 0.00 seconds

Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time

0 0 0.48394 0 11 4.0000e+18 0.48394 100% - 0s
H 0 0 0.5603635 0.48394 13.6% - 0s
H 0 0 0.5513407 0.48394 12.2% - 0s
H 0 0 0.4903069 0.48394 1.30% - 0s
0 0 0.48997 0 4 0.49031 0.48997 0.07% - 0s

Explored 0 nodes (76 simplex iterations) in 0.02 seconds
Thread count was 2 (of 4 available processors)

Optimal solution found (tolerance 1.00e-04)
Best objective 4.903069047903e-01, best bound 4.903069047903e-01, gap 0.0%
Optimize a model with 30 rows, 31 columns and 80 nonzeros
Model has 66 quadratic objective terms
Coefficient statistics:
Matrix range [2e-01, 2e+00]
Objective range [6e-02, 1e+00]
Bounds range [1e+00, 1e+00]
RHS range [1e+00, 1e+00]
Iteration Objective Primal Inf. Dual Inf. Time
0 9.5435334e-01 0.000000e+00 3.079401e+00 0s
18 4.9030690e-01 0.000000e+00 0.000000e+00 0s

Solved in 18 iterations and 0.00 seconds
Optimal objective 4.903069048e-01
Gurobi 6.0.4: optimal solution; objective 0.4903069048
76 simplex iterations
plus 18 simplex iterations for intbasis
Reply all
Reply to author
Forward
0 new messages