An issue with duplicate bounds when solving a MILP

43 views
Skip to first unread message

zoh...@gmail.com

unread,
Jun 3, 2025, 5:07:13 PMJun 3
to mosek

Michal Adamaszek

unread,
Jun 4, 2025, 3:35:34 AMJun 4
to mosek
LI bound     X449      0
MI bound     X449    
 
Mosek writes this to indicate an unbounded integer. CPLEX will reject a file where a variable bound is defined twice, but Mosek accepts it. Strictly speaking you could claim that Mosek writes an illegal CPLEX MPS file, but that's how we do it now.

By removing the MI bound you have changed the variable from free integer to nonnegative integer, so you are solving a different problem after pruning. If you want to keep the variable as free you have to sue the INTORG section in the MPS file, which Mosek never writes.

You may want to experiment with the LP format instead.

Regarding the actual solve - it finds some integer point reasonably soon. We will investigate it more.

Michal

On Tuesday, June 3, 2025 at 11:07:13 PM UTC+2 zoh...@gmail.com wrote:
The story:

Michal Adamaszek

unread,
Jun 4, 2025, 4:14:16 AMJun 4
to mosek
Regarding SCIP you write:

Therefore, limiting the number of solutions was crucial.

Of course you can do the same with Mosek:


With Mosek 11.0.21 I get the first solution after no more than a minute (will depend on the number of threads). I would use the latest 11.0 since there were some fixes in the MIP solver since the 11.0.8 you mention and they seem relevant here.

Michal

zoh...@gmail.com

unread,
Jun 4, 2025, 5:46:32 AMJun 4
to mosek
"LI bound     X449      0" says: X is integer and X >= 0.
"MI bound    X449      0" says: X is integer and X >= -inf.

Are you saying that these aren't two constraints, but the first should be ignored, and the second overshadows it?

I'll consider .LP next time.

---

I also noted in my post how to limit the solutions in mosek and gurobi.

I updated mosek, and still no solution after 5min (see below). Is this a seed thing, and you got super lucky?

```
MOSEK Version 11.0.21 (Build date: 2025-5-28 08:02:29)
Copyright (c) MOSEK ApS, Denmark WWW: mosek.com
Platform: Windows/64-X86

Open file 'mosek_model.mps'
Reading started.
Using 'OBJ' as objective vector
Read 1488709 number of A nonzeros in 0.36 seconds.
Using 'rhs' as rhs vector
Using 'bound' as bound vector
Reading terminated. Time: 0.40

Read summary
  Type                     : LO (linear optimization problem)
  Objective sense          : minimize
  Scalar variables         : 10465      
  Matrix variables         : 0          
  Scalar constraints       : 33550      
  Affine conic constraints : 0          
  Disjunctive constraints  : 0          
  Cones                    : 0          
  Integers                 : 5536        
  Time                     : 0.4    

Problem
  Name                   :                
  Objective sense        : minimize        
  Type                   : LO (linear optimization problem)
  Constraints            : 33550          
  Affine conic cons.     : 0              
  Disjunctive cons.      : 0              
  Cones                  : 0              
  Scalar variables       : 10465          
  Matrix variables       : 0              
  Integer variables      : 5536            

Optimizer started.
Mixed integer optimizer started.
Threads used: 6
Presolve started.
Presolve terminated. Time = 2.66, probing time =  1.66
Presolved problem: 4779 variables, 13650 constraints, 54037 non-zeros
Presolved problem: 14 general integer, 962 binary, 3803 continuous
Clique table size: 55487
BRANCHES RELAXS   ACT_NDS  DEPTH    BEST_INT_OBJ         BEST_RELAX_OBJ       REL_GAP(%)  TIME  
0        0        1        0        NA                   NA                   NA          2.9  
0        1        1        0        NA                   1.3933649172e-11     NA          3.4  
Root cut generation started.
0        1        1        0        NA                   1.3933649265e-11     NA          4.6  
0        2        1        0        NA                   -5.8451767475e-08    NA          6.1  
Root cut generation terminated. Time = 1.74
6        13       7        3        NA                   1.3933649265e-11     NA          7.8  
20       30       21       7        NA                   1.3933649265e-11     NA          8.7  
38       53       39       10       NA                   1.3933649265e-11     NA          9.0  
74       91       75       16       NA                   1.3933649265e-11     NA          9.3  
146      163      147      28       NA                   1.3933649265e-11     NA          9.8  
290      307      291      52       NA                   1.3933649265e-11     NA          10.9  
480      497      481      77       NA                   1.3933649265e-11     NA          12.4  
715      732      716      118      NA                   1.3933649265e-11     NA          13.9  
855      872      856      144      NA                   1.3933649265e-11     NA          15.1  
1017     1032     1014     160      NA                   1.3933649265e-11     NA          16.3  
1165     1210     1152     198      NA                   1.3933649265e-11     NA          17.6  
1267     1331     1220     110      NA                   1.3933649265e-11     NA          18.5  
1311     1470     1256     139      NA                   1.3933649265e-11     NA          20.2  
1349     1604     1294     28       NA                   1.3933649265e-11     NA          21.6  
1389     1780     1334     80       NA                   1.3933649265e-11     NA          22.7  
1430     1923     1367     42       NA                   1.3933649265e-11     NA          23.8  
1485     2036     1422     138      NA                   1.3933649265e-11     NA          24.8  
1563     2184     1500     193      NA                   1.3933649265e-11     NA          26.4  
1672     2310     1605     158      NA                   1.3933649265e-11     NA          27.8  
1763     2447     1694     183      NA                   1.3933649265e-11     NA          29.2  
1826     2521     1755     185      NA                   1.3933649265e-11     NA          30.2  
1925     2638     1854     49       NA                   1.3933649265e-11     NA          31.7  
2023     2756     1950     75       NA                   1.3933649265e-11     NA          33.0  
2083     2868     2006     186      NA                   1.3933649265e-11     NA          34.3  
2169     2965     2088     144      NA                   1.3933649265e-11     NA          35.6  
2275     3141     2190     71       NA                   1.3933649265e-11     NA          37.5  
2378     3336     2289     14       NA                   1.3933649265e-11     NA          39.2  

Performed MIP restart 1.
Presolve started.
Presolve terminated. Time = 3.67, probing time =  2.51
Presolved problem: 4779 variables, 14011 constraints, 55406 non-zeros
Presolved problem: 14 general integer, 962 binary, 3803 continuous
Clique table size: 55221
BRANCHES RELAXS   ACT_NDS  DEPTH    BEST_INT_OBJ         BEST_RELAX_OBJ       REL_GAP(%)  TIME  
2522     3578     1        0        NA                   1.3933649265e-11     NA          42.1  
Root cut generation started.
2522     3579     1        0        NA                   1.3933649265e-11     NA          43.2  
2522     3580     1        0        NA                   1.3933649265e-11     NA          43.9  
2522     3581     1        0        NA                   1.3933649265e-11     NA          44.7  
Root cut generation terminated. Time = 3.69
2527     3591     6        3        NA                   1.3933649265e-11     NA          45.3  
2545     3613     24       5        NA                   1.3933649265e-11     NA          45.8  
2569     3641     48       9        NA                   1.3933649265e-11     NA          46.0  
2613     3686     92       17       NA                   1.3933649265e-11     NA          46.3  
2703     3776     182      32       NA                   1.3933649265e-11     NA          47.0  
2866     3934     333      62       NA                   1.3933649265e-11     NA          48.0  
3045     4116     512      94       NA                   1.3933649265e-11     NA          49.7  
3228     4300     689      133      NA                   1.3933649265e-11     NA          51.1  
3418     4493     875      173      NA                   1.3933649265e-11     NA          52.6  
3544     4673     981      194      NA                   1.3933649265e-11     NA          54.0  
3695     4933     1114     197      NA                   1.3933649265e-11     NA          55.6  
3827     5187     1242     199      NA                   1.3933649265e-11     NA          57.3  
3957     5459     1358     202      NA                   1.3933649265e-11     NA          59.0  
4063     5766     1434     205      NA                   1.3933649265e-11     NA          61.0  
4172     6020     1525     172      NA                   1.3933649265e-11     NA          63.1  
4299     6309     1648     114      NA                   1.3933649265e-11     NA          65.2  
4379     6798     1728     171      NA                   1.3933649265e-11     NA          67.2  
4455     7139     1804     174      NA                   1.3933649265e-11     NA          68.6  
4527     7485     1868     177      NA                   1.3933649265e-11     NA          70.3  
4595     7759     1932     178      NA                   1.3933649265e-11     NA          71.7  
4717     7957     2050     188      NA                   1.3933649265e-11     NA          73.2  
4818     8167     2139     201      NA                   1.3933649265e-11     NA          74.9  
4978     8415     2295     177      NA                   1.3933649265e-11     NA          76.7  
5104     8623     2407     205      NA                   1.3933649265e-11     NA          78.2  
5168     8788     2463     180      NA                   1.3933649265e-11     NA          80.1  
5288     9021     2565     204      NA                   1.3933649265e-11     NA          81.9  
5403     9212     2660     194      NA                   1.3933649265e-11     NA          83.6  
5544     9449     2785     182      NA                   1.3933649265e-11     NA          85.2  
5642     9643     2859     159      NA                   1.3933649265e-11     NA          87.0  
5760     9848     2955     177      NA                   1.3933649265e-11     NA          88.7  
5902     10062    3075     124      NA                   1.3933649265e-11     NA          90.6  
6017     10257    3176     173      NA                   1.3933649265e-11     NA          92.5  
6158     10485    3265     176      NA                   1.3933649265e-11     NA          94.3  
6295     10710    3352     178      NA                   1.3933649265e-11     NA          96.2  
6425     10918    3424     184      NA                   1.3933649265e-11     NA          97.9  
6580     11160    3515     176      NA                   1.3933649265e-11     NA          99.7  
6741     11412    3600     199      NA                   1.3933649265e-11     NA          101.3
6915     11672    3686     180      NA                   1.3933649265e-11     NA          103.0
7070     11931    3813     177      NA                   1.3933649265e-11     NA          104.8
7234     12192    3929     191      NA                   1.3933649265e-11     NA          106.5
7408     12458    4039     116      NA                   1.3933649265e-11     NA          108.3
7587     12719    4150     172      NA                   1.3933649265e-11     NA          110.2
7745     12985    4266     198      NA                   1.3933649265e-11     NA          111.8
7898     13245    4381     198      NA                   1.3933649265e-11     NA          113.6
8050     13497    4517     199      NA                   1.3933649265e-11     NA          115.2
8240     13727    4665     111      NA                   1.3933649265e-11     NA          117.2
8427     13950    4822     156      NA                   1.3933649265e-11     NA          119.0
8597     14169    4968     178      NA                   1.3933649265e-11     NA          120.8
8771     14358    5128     206      NA                   1.3933649265e-11     NA          122.7
8924     14558    5261     160      NA                   1.3933649265e-11     NA          124.5
9036     14781    5349     162      NA                   1.3933649265e-11     NA          126.6
9193     14949    5404     166      NA                   1.3933649265e-11     NA          128.7
9371     15135    5490     171      NA                   1.3933649265e-11     NA          130.5
9482     15278    5591     173      NA                   1.3933649265e-11     NA          132.5
9585     15431    5664     172      NA                   1.3933649265e-11     NA          134.4
9720     15605    5773     196      NA                   1.3933649265e-11     NA          136.3
9871     15780    5872     176      NA                   1.3933649265e-11     NA          138.4
9983     15948    5936     185      NA                   1.3933649265e-11     NA          140.2
10135    16145    6040     185      NA                   1.3933649265e-11     NA          142.1
10240    16296    6123     186      NA                   1.3933649265e-11     NA          144.0
10391    16499    6250     188      NA                   1.3933649265e-11     NA          145.7
10527    16750    6356     199      NA                   1.3933649265e-11     NA          147.3
10724    17015    6501     205      NA                   1.3933649265e-11     NA          149.1
10894    17209    6613     209      NA                   1.3933649265e-11     NA          150.7
11091    17431    6764     100      NA                   1.3933649265e-11     NA          152.4
11300    17651    6969     138      NA                   1.3933649265e-11     NA          154.4
11516    17871    7185     175      NA                   1.3933649265e-11     NA          156.2
11731    18107    7398     204      NA                   1.3933649265e-11     NA          158.2
11906    18429    7569     208      NA                   1.3933649265e-11     NA          161.7
12029    18675    7662     184      NA                   1.3933649265e-11     NA          163.5
12216    18886    7823     75       NA                   1.3933649265e-11     NA          165.7
12400    19096    7995     124      NA                   1.3933649265e-11     NA          167.7
12601    19297    8196     160      NA                   1.3933649265e-11     NA          169.0
12798    19560    8393     191      NA                   1.3933649265e-11     NA          170.9
12869    19971    8464     194      NA                   1.3933649265e-11     NA          173.4
12925    20284    8500     154      NA                   1.3933649265e-11     NA          175.4
13061    20556    8624     108      NA                   1.3933649265e-11     NA          177.9
13168    20760    8717     90       NA                   1.3933649265e-11     NA          180.6
13274    21079    8801     118      NA                   1.3933649265e-11     NA          185.6

Performed MIP restart 2.
Presolve started.
Presolve terminated. Time = 4.24, probing time =  2.95
Presolved problem: 4779 variables, 14100 constraints, 56523 non-zeros
Presolved problem: 14 general integer, 962 binary, 3803 continuous
Clique table size: 48955
BRANCHES RELAXS   ACT_NDS  DEPTH    BEST_INT_OBJ         BEST_RELAX_OBJ       REL_GAP(%)  TIME  
13423    21285    1        0        NA                   1.3933649265e-11     NA          189.2
Root cut generation started.
13423    21286    1        0        NA                   1.3933649265e-11     NA          190.0
13423    21287    1        0        NA                   1.3933649265e-11     NA          190.4
13423    21288    1        0        NA                   1.3933649265e-11     NA          191.0
Root cut generation terminated. Time = 5.03
13428    21298    6        3        NA                   1.3933649265e-11     NA          191.7
13446    21319    22       8        NA                   1.3933649265e-11     NA          192.2
13464    21339    40       11       NA                   1.3933649265e-11     NA          192.4
13500    21377    76       17       NA                   1.3933649265e-11     NA          192.7
13572    21449    148      29       NA                   1.3933649265e-11     NA          193.3
13709    21586    285      53       NA                   1.3933649265e-11     NA          194.4
13972    21849    548      97       NA                   1.3933649265e-11     NA          196.4
14081    22017    651      113      NA                   1.3933649265e-11     NA          198.1
14131    22312    697      115      NA                   1.3933649265e-11     NA          199.6
14166    22681    728      118      NA                   1.3933649265e-11     NA          202.1
14186    23100    740      121      NA                   1.3933649265e-11     NA          204.4
14211    23479    765      126      NA                   1.3933649265e-11     NA          206.4
14238    23857    776      145      NA                   1.3933649265e-11     NA          208.4
14252    24028    790      145      NA                   1.3933649265e-11     NA          209.4
14277    24180    799      146      NA                   1.3933649265e-11     NA          211.1
14342    24437    824      127      NA                   1.3933649265e-11     NA          213.0
14422    24591    900      124      NA                   1.3933649265e-11     NA          214.6
14499    24800    977      132      NA                   1.3933649265e-11     NA          216.7
14563    24938    1041     131      NA                   1.3933649265e-11     NA          218.2
14641    25093    1119     133      NA                   1.3933649265e-11     NA          220.0
14720    25243    1198     134      NA                   1.3933649265e-11     NA          221.6
14788    25391    1266     143      NA                   1.3933649265e-11     NA          223.3
14860    25543    1334     146      NA                   1.3933649265e-11     NA          225.3
14938    25684    1408     148      NA                   1.3933649265e-11     NA          227.1
15031    25838    1483     138      NA                   1.3933649265e-11     NA          229.0
15099    25955    1535     139      NA                   1.3933649265e-11     NA          230.4
15171    26064    1587     138      NA                   1.3933649265e-11     NA          232.2
15235    26181    1633     145      NA                   1.3933649265e-11     NA          233.8
15315    26300    1687     145      NA                   1.3933649265e-11     NA          235.5
15435    26436    1725     153      NA                   1.3933649265e-11     NA          237.7
15542    26569    1786     163      NA                   1.3933649265e-11     NA          239.8
15647    26704    1861     161      NA                   1.3933649265e-11     NA          241.7
15713    26807    1909     162      NA                   1.3933649265e-11     NA          243.1
15776    26894    1948     145      NA                   1.3933649265e-11     NA          244.4
15853    27013    2007     146      NA                   1.3933649265e-11     NA          246.2
15942    27133    2084     148      NA                   1.3933649265e-11     NA          247.8
16034    27264    2162     134      NA                   1.3933649265e-11     NA          249.1
16087    27388    2215     160      NA                   1.3933649265e-11     NA          250.9
16185    27531    2295     141      NA                   1.3933649265e-11     NA          252.9
16265    27682    2365     139      NA                   1.3933649265e-11     NA          255.1
16349    27824    2443     163      NA                   1.3933649265e-11     NA          256.8
16435    27941    2523     134      NA                   1.3933649265e-11     NA          258.2
16519    28054    2589     138      NA                   1.3933649265e-11     NA          259.4
16572    28133    2620     139      NA                   1.3933649265e-11     NA          260.4
16674    28282    2700     164      NA                   1.3933649265e-11     NA          262.1
16767    28396    2777     163      NA                   1.3933649265e-11     NA          263.9
16826    28477    2798     163      NA                   1.3933649265e-11     NA          265.0
16929    28643    2895     131      NA                   1.3933649265e-11     NA          266.6
17007    28789    2959     139      NA                   1.3933649265e-11     NA          268.0
17093    28931    3023     143      NA                   1.3933649265e-11     NA          269.8
17195    29084    3101     138      NA                   1.3933649265e-11     NA          271.5
17325    29243    3185     132      NA                   1.3933649265e-11     NA          273.4
17415    29358    3239     137      NA                   1.3933649265e-11     NA          274.7
17492    29449    3282     149      NA                   1.3933649265e-11     NA          275.8
17575    29553    3345     155      NA                   1.3933649265e-11     NA          277.2
17678    29662    3416     163      NA                   1.3933649265e-11     NA          278.5
17754    29742    3456     141      NA                   1.3933649265e-11     NA          279.5
17822    29814    3486     146      NA                   1.3933649265e-11     NA          281.0
17908    29944    3552     136      NA                   1.3933649265e-11     NA          282.7
18031    30092    3647     138      NA                   1.3933649265e-11     NA          284.4
18140    30231    3738     162      NA                   1.3933649265e-11     NA          286.2
18232    30346    3802     136      NA                   1.3933649265e-11     NA          288.0
18353    30498    3891     161      NA                   1.3933649265e-11     NA          289.6
18468    30643    3982     145      NA                   1.3933649265e-11     NA          291.4
18564    30781    4058     133      NA                   1.3933649265e-11     NA          293.5
18676    30923    4118     163      NA                   1.3933649265e-11     NA          295.9
18770    31041    4178     138      NA                   1.3933649265e-11     NA          297.6
18855    31159    4239     133      NA                   1.3933649265e-11     NA          299.3
18934    31249    4298     158      NA                   1.3933649265e-11     NA          300.2
19039    31391    4383     132      NA                   1.3933649265e-11     NA          301.9
19141    31528    4463     156      NA                   1.3933649265e-11     NA          303.3
19251    31678    4543     167      NA                   1.3933649265e-11     NA          305.4
19366    31817    4608     163      NA                   1.3933649265e-11     NA          307.1
19446    31917    4644     133      NA                   1.3933649265e-11     NA          308.6
19555    32060    4717     157      NA                   1.3933649265e-11     NA          310.5
19667    32178    4799     169      NA                   1.3933649265e-11     NA          311.9
19820    32346    4896     164      NA                   1.3933649265e-11     NA          313.9
19929    32496    4973     160      NA                   1.3933649265e-11     NA          316.1
20009    32593    5005     135      NA                   1.3933649265e-11     NA          317.4
20091    32691    5045     127      NA                   1.3933649265e-11     NA          318.8
20168    32776    5070     92       NA                   1.3933649265e-11     NA          320.1
20276    32910    5146     96       NA                   1.3933649265e-11     NA          322.2
20427    33132    5277     103      NA                   1.3933649265e-11     NA          324.5
20516    33425    5350     127      NA                   1.3933649265e-11     NA          329.0
20558    33897    5392     130      NA                   1.3933649265e-11     NA          331.4
20578    34304    5410     133      NA                   1.3933649265e-11     NA          333.1
CTRLC-C has been pressed.

Objective of best integer solution : Not available.
Best objective bound               : 1.393364926477e-11      
Initial feasible solution objective: Undefined
Construct solution objective       : Not employed
User objective cut value           : Not employed
Number of cuts generated           : 5068
  Number of Gomory cuts            : 575
  Number of CMIR cuts              : 1074
  Number of clique cuts            : 2230
  Number of implied bound cuts     : 1186
  Number of knapsack_cover cuts    : 3
Number of branches                 : 20578
Number of relaxations solved       : 34304
Number of interior point iterations: 26
Number of simplex iterations       : 683173
Time spend presolving the root     : 4.24
Time spend optimizing the root     : 0.70
Mixed integer optimizer terminated. Time: 333.11

Optimizer terminated. Time: 333.17  


Integer solution solution summary
  Problem status  : UNKNOWN
  Solution status : UNKNOWN
  Primal.  obj: 0.0000000000e+00    nrm: 0e+00    Viol.  con: 3e+03    var: 0e+00    itg: 0e+00  

Optimizer summary
  Optimizer                 -                        time: 333.17  
    Interior-point          - iterations : 26        time: 0.49    
    Simplex                 - iterations : 2138977   time: 0.00    
    Mixed integer           - relaxations: 34304     time: 333.11  

Open file 'mosek_model.int'
Writing started.
Writing terminated. Time: 0.06
Return code - 100007  [MSK_RES_TRM_USER_CALLBACK]
```

zoh...@gmail.com

unread,
Jun 4, 2025, 7:47:52 AMJun 4
to mosek
I tried to save a .lp the same way I saved a .mps:

mosekopt( 'write(mosek_model.lp)', prob, param )

I got an error:

Mosek error: MSK_RES_ERR_WRITE_LP_INVALID_VAR_NAMES (Invalid variable name. Cannot write valid LP file.)

I attached the data from yalmip.

I also noted in the doc: "The LP format is not a completely well-defined standard and hence different optimization packages may interpret the same LP file in slightly different ways."

I don't understand how people benchmark problems if there isn't even a proper standard.
mosek_model.mat

Michal Adamaszek

unread,
Jun 4, 2025, 7:57:05 AMJun 4
to mosek
It is possible that my run was more lucky in the MIP path taken.

There is a parameter to write the files with generic names, it should write the file when you set it https://docs.mosek.com/latest/capi/parameters.html#mosek.iparam.write_generic_names

As you can see the standard is only a standard until one gets to the rare corner cases and the interpretations of the standard also differ. Additionally vendors have their own extensions to the standards. 

I will write with any suggestions we have from running your model later.

Michal

Michal Adamaszek

unread,
Jun 10, 2025, 2:40:35 AMJun 10
to mosek
Better late than never: You can get an MPS file compatible with CPLEX by setting the parameter

zoh...@gmail.com

unread,
Jun 11, 2025, 5:10:44 PMJun 11
to mosek
Thanks for the tip, but I moved to .LP, per your advice, which seems more consistent, and I'm happy with it so far.

However, I'm less happy about mosek performance on my MILP problems. But I guess its forte is SOCP rather than MI.

Erling D. Andersen

unread,
Jun 12, 2025, 5:17:17 AMJun 12
to mosek
We are investing a significant amount of resources in improving the MIP optimizer. However, as we say in Europe:

Rome was not built in one day.

Reply all
Reply to author
Forward
0 new messages