cvxgrp / CVXR

An R modeling language for convex optimization problems.

Home Page:https://cvxr.rbind.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Applying reduction GLPK_MI appears to be in an infinite loop

getawitness opened this issue · comments

Describe the bug
I am using cvxpy (latest version) to solve a very large mixed integer problem for some of the subsets of data I get stuck on the "Applying reduction GLPK_MI" step. By get stuck I mean the code seems to be running indefinitely and clicking the interrupt button in my notebook won't kill it. I have to restart my cluster to get out of this. Most times things work perfectly, but for a few of my subsets I get this problem.

To Reproduce
It would be difficult to put that here. I have tried to find a minimal example which creates this issue, but so far the smallest one I can find is 1393 variables, 883 constraints.

Expected behavior
I expect that if my constraints are infeasible, that the problem will tell me that so that I can remove some constraints and try again. But I'm in the worst possible case, no errors, so I can't use a try:, except: block. It just gets stuck.

Output

(CVXPY) Sep 26 07:56:41 PM: Your problem has 1393 variables, 883 constraints, and 0 parameters.
(CVXPY) Sep 26 07:56:41 PM: It is compliant with the following grammars: DCP, DQCP
(CVXPY) Sep 26 07:56:41 PM: (If you need to solve this problem multiple times, but with different data, consider using parameters.)
(CVXPY) Sep 26 07:56:41 PM: CVXPY will first compile your problem; then, it will invoke a numerical solver to obtain a solution.

                              Compilation                                  

(CVXPY) Sep 26 07:56:42 PM: Compiling problem (target solver=GLPK_MI).
(CVXPY) Sep 26 07:56:42 PM: Reduction chain: FlipObjective -> Dcp2Cone -> CvxAttr2Constr -> ConeMatrixStuffing -> GLPK_MI
(CVXPY) Sep 26 07:56:42 PM: Applying reduction FlipObjective
(CVXPY) Sep 26 07:56:42 PM: Applying reduction Dcp2Cone
(CVXPY) Sep 26 07:56:43 PM: Applying reduction CvxAttr2Constr
(CVXPY) Sep 26 07:56:43 PM: Applying reduction ConeMatrixStuffing
(CVXPY) Sep 26 07:56:49 PM: Applying reduction GLPK_MI

(It is now 08:10 PM and my notebook is still "running command", most problems of this size finish in about 5 seconds.)
Version
I'm running in python 3.8 via a databricks notebook, spark runtime version 10.3. I'm using the latest versions of cvxpy and cvxopt

Here is a fairly small problem which induces this behavior

Maximize:
var2383[1] + var2383[2] + var2383[4] + var2383[5] + var2383[6] + var2383[8] + var2383[9] + var2383[11] + var2383[12] + var2383[13] + var2383[15] + var2383[16] + var2383[18] + var2383[19] + var2383[20] + var2383[22] + var2383[23] + var2383[25] + var2383[26] + var2383[27] + var2383[29] + var2383[32] + var2383[34] + var2383[36] + var2383[37] + var2383[39] + var2383[40] + var2383[41] + var2383[43] + var2383[44] + var2383[46] + var2383[47] + var2383[48] + var2383[50] + var2383[53] + var2383[57] + var2383[58] + var2383[60] + var2383[61] + var2383[62] + var2383[64] + var2383[65] + var2383[67] + var2383[68] + var2383[69] + var2383[71] + var2383[72] + var2383[74] + var2383[75] + var2383[76] + var2383[78] + var2383[79] + var2383[81] + var2383[82] + var2383[83]

Subject to:
0.0 <= var2383
Sum(var2383[0:7], None, False) <= 1.0
Sum(var2383[7:14], None, False) <= 1.0
Sum(var2383[14:21], None, False) <= 1.0
Sum(var2383[21:28], None, False) <= 1.0
Sum(var2383[28:35], None, False) <= 1.0
Sum(var2383[35:42], None, False) <= 1.0
Sum(var2383[42:49], None, False) <= 1.0
Sum(var2383[49:56], None, False) <= 1.0
Sum(var2383[56:63], None, False) <= 1.0
Sum(var2383[63:70], None, False) <= 1.0
Sum(var2383[70:77], None, False) <= 1.0
Sum(var2383[77:84], None, False) <= 1.0
Sum(var2383[1:84:7], None, False) + -Sum(var2383[2:84:7], None, False) <= 0.0
Sum(var2383[2:84:7], None, False) + -Sum(var2383[4:84:7], None, False) <= 0.0
Sum(var2383[4:84:7], None, False) + -Sum(var2383[5:84:7], None, False) <= 0.0
Sum(var2383[5:84:7], None, False) + -Sum(var2383[6:84:7], None, False) <= 0.0
Sum(var2383[6:84:7], None, False) + -Sum(var2383[1:84:7], None, False) <= 0.0

This is the CVXR repo, not CVXPY. In any case, we can't proceed unless we have a reasonably sized, complete, reproducible example.

Sorry,

Are you saying my example doesn't qualify as reasonably sized, complete or reproducible?