Originally posted by: SystemAdmin
Thank you very much for your help!
When I use a plain solve() and provide a MIP start before, this doesn't produce the same quick solution, but instead it does this:
1 of 1 MIP starts provided solutions. MIP start
'm1' defined initial solution with objective 14601.6000. Tried aggregator 2 times. MIP Presolve eliminated 58690 rows and 19777 columns. MIP Presolve modified 12268 coefficients. Aggregator did 17 substitutions. Reduced MIP has 11226 rows, 15174 columns, and 60884 nonzeros. Reduced MIP has 14896 binaries, 0 generals, 0 SOSs, and 0 indicators. Probing time = 0.01 sec. Tried aggregator 1 time. MIP Presolve modified 22 coefficients. Reduced MIP has 11226 rows, 15174 columns, and 60884 nonzeros. Reduced MIP has 14896 binaries, 0 generals, 0 SOSs, and 0 indicators. Presolve time = 0.17 sec. Probing time = 0.01 sec. Clique table members: 13245. MIP emphasis: balance optimality and feasibility. MIP search method: dynamic search. Parallel mode: deterministic, using up to 8 threads. Root relaxation solution time = 0.24 sec. Nodes Cuts/ Node Left Objective IInf Best Integer Best Bound ItCnt Gap * 0+ 0 14601.6000 2305 --- 0 0 6829.0580 408 14601.6000 6829.0580 2305 53.23% * 0+ 0 14558.4000 6829.0580 4019 53.09% 0 0 7098.2328 450 14558.4000 Cuts: 2906 4019 51.24% 0 0 7175.3509 436 14558.4000 Cuts: 2883 6379 50.71% 0 0 7202.9259 447 14558.4000 Cuts: 2906 8598 50.52% 0 0 7210.0576 359 14558.4000 Cuts: 2906 9138 50.47% 0 0 7211.9976 367 14558.4000 Cuts: 1582 9565 50.46% 0 0 7213.0228 373 14558.4000 Cuts: 1172 9964 50.45% 0 0 7213.5708 399 14558.4000 Cuts: 1464 10394 50.45% 0 0 7213.7150 390 14558.4000 Cuts: 1058 10616 50.45% 0 0 7213.8830 377 14558.4000 Cuts: 781 10905 50.45% 0 0 7219.0452 392 14558.4000 Cuts: 468 11288 50.41% 0 0 7232.6891 376 14558.4000 Cuts: 1901 11696 50.32% 0 0 7232.7644 391 14558.4000 Cuts: 1187 12038 50.32% 0 0 7232.9083 344 14558.4000 Cuts: 557 12263 50.32% 0 0 7233.2617 358 14558.4000 Cuts: 1599 12711 50.32% 0 2 7233.2617 308 14558.4000 7233.2617 12711 50.32% Elapsed real time = 21.98 sec. (tree size = 0.01 MB, solutions = 2) 3 5 7326.0538 343 14558.4000 7254.5238 14092 50.17% 10 12 7457.4622 342 14558.4000 7254.5238 14684 50.17% 11 13 7431.2665 372 14558.4000 7260.1962 16186 50.13% 20 22 7274.3916 347 14558.4000 7260.1962 25194 50.13% 27 29 7261.7543 366 14558.4000 7260.9019 29588 50.13% 37 39 7348.2788 356 14558.4000 7260.9019 31624 50.13% 45 47 7276.9944 360 14558.4000 7260.9019 33487 50.13% 108 110 7363.1960 347 14558.4000 7273.7419 43729 50.04% 113 115 7633.7196 338 14558.4000 7273.7419 44711 50.04% 180 182 7361.9128 355 14558.4000 7274.3916 58914 50.03% Elapsed real time = 32.86 sec. (tree size = 1.94 MB, solutions = 2) 392 383 7422.5157 337 14558.4000 7274.3916 77989 50.03% 493 484 8207.3813 252 14558.4000 7274.3916 90783 50.03% 574 559 7384.5115 368 14558.4000 7274.3916 97632 50.03% 791 776 7868.4767 388 14558.4000 7274.3916 119862 50.03% 976 947 7883.7320 374 14558.4000 7274.3916 137808 50.03% 1319 1275 7281.0398 360 14558.4000 7274.3916 165152 50.03% 1681 1631 10212.5736 189 14558.4000 7274.3916 190033 50.03% 1739 1689 7497.9951 364 14558.4000 7274.3916 198159 50.03% 2118 2035 11177.2155 170 14558.4000 7274.3916 228851 50.03% 2194 2108 7778.7904 417 14558.4000 7274.3916 240094 50.03% Elapsed real time = 74.80 sec. (tree size = 231.62 MB, solutions = 2) Nodefile size = 94.75 MB (72.02 MB after compression) 2474 2364 7793.4509 411 14558.4000 7274.3916 267515 50.03% 2605 2495 7921.8589 351 14558.4000 7274.3916 283420 50.03% 2942 2810 7844.6079 355 14558.4000 7274.3916 314100 50.03% 3041 2909 7753.1512 386 14558.4000 7274.3916 325649 50.03% 3145 3002 7855.3195 347 14558.4000 7274.3916 335826 50.03% 3444 3289 7495.5990 282 14558.4000 7495.5990 384843 48.51% 3446 3290 7745.3891 359 14558.4000 7497.3791 385822 48.50% 3447 3291 7542.5425 327 14558.4000 7497.3791 386446 48.50% 3450 3294 7554.2165 320 14558.4000 7497.3791 387692 48.50% 3453 3295 7557.3007 348 14558.4000 7530.0914 389400 48.28% Elapsed real time = 154.07 sec. (tree size = 127.82 MB, solutions = 2) 3459 3299 7565.5245 332 14558.4000 7530.0914 392180 48.28% 3470 3306 7567.2823 323 14558.4000 7539.3823 398030 48.21% 3490 3319 7802.5363 313 14558.4000 7539.3823 402868 48.21% 3506 3325 7561.4480 314 14558.4000 7539.3823 409018 48.21% 3514 3329 7659.7242 286 14558.4000 7539.3823 413672 48.21% 3563 3357 7994.3552 331 14558.4000 7539.3823 426081 48.21% 3580 3368 7635.6824 344 14558.4000 7539.3823 430441 48.21% 3610 3386 7599.9264 333 14558.4000 7539.3823 436656 48.21% 3658 3414 7982.7474 394 14558.4000 7539.3823 450108 48.21% 3736 3453 7650.9891 372 14558.4000 7539.3823 474727 48.21% Elapsed real time = 186.61 sec. (tree size = 129.62 MB, solutions = 2) 3838 3512 8209.0515 280 14558.4000 7539.3823 488915 48.21% 3956 3578 8735.2891 332 14558.4000 7539.3823 502149 48.21% 4077 3650 8786.1274 310 14558.4000 7539.3823 516446 48.21% 4251 3743 8171.1861 245 14558.4000 7539.3823 533343 48.21% 4469 3872 9050.3863 287 14558.4000 7539.3823 550792 48.21% 4557 3923 7812.2853 298 14558.4000 7539.3823 556831 48.21% 4651 3981 9462.2525 291 14558.4000 7539.3823 562350 48.21% 4842 4086 7926.6313 284 14558.4000 7539.3823 575196 48.21% 5223 4278 8321.9387 263 14558.4000 7539.3823 590904 48.21% 5679 4550 8381.8508 284 14558.4000 7539.3823 611281 48.21% Elapsed real time = 226.92 sec. (tree size = 281.47 MB, solutions = 2) Nodefile size = 48.54 MB (36.87 MB after compression) 5863 4656 8363.0906 286 14558.4000 7539.3823 618961 48.21% 6353 4931 8235.9909 279 14558.4000 7539.3823 634427 48.21% 6650 5103 8446.2112 245 14558.4000 7539.3823 641128 48.21% 6978 5295 8492.2053 242 14558.4000 7539.3823 655359 48.21% 7568 5652 8614.3770 253 14558.4000 7539.3823 668725 48.21% 7976 5876 8794.3936 254 14558.4000 7539.3823 681472 48.21% 8701 6298 8723.3049 268 14558.4000 7539.3823 698677 48.21% 9117 6528 9616.8959 275 14558.4000 7539.3823 714258 48.21% 9537 6770 10926.3001 231 14558.4000 7539.3823 724708 48.21% 9882 6960 11000.0653 214 14558.4000 7539.3823 732550 48.21% Elapsed real time = 267.25 sec. (tree size = 773.58 MB, solutions = 2) Nodefile size = 605.19 MB (464.39 MB after compression) 10186 7126 11232.8293 263 14558.4000 7539.3823 745054 48.21% 10606 7358 11526.7273 220 14558.4000 7539.3823 760337 48.21% 10740 7438 7694.0488 313 14558.4000 7539.3823 771502 48.21% 10820 7486 7702.9264 308 14558.4000 7539.3823 775474 48.21% 11406 7909 11653.3846 217 14558.4000 7539.3823 803465 48.21% 11457 7959 11655.1339 228 14558.4000 7539.3823 806930 48.21% 11510 8010 7795.2364 339 14558.4000 7539.3823 812052 48.21% 11526 8026 7800.4157 406 14558.4000 7539.3823 817879 48.21% 11947 8426 7730.1152 393 14558.4000 7539.3823 840179 48.21% 11971 8447 7720.5839 407 14558.4000 7539.3823 847009 48.21% Elapsed real time = 314.17 sec. (tree size = 1004.13 MB, solutions = 2) Nodefile size = 852.23 MB (663.23 MB after compression) 12551 9008 8296.9228 326 14558.4000 7545.7835 895563 48.17% 12592 9049 7584.1165 338 14558.4000 7545.7835 900533 48.17% 12738 9194 7776.3339 333 14558.4000 7545.7835 912230 48.17% 12796 9252 8462.0674 333 14558.4000 7545.7835 918211 48.17% 13169 9604 8439.7556 357 14558.4000 7545.7835 943445 48.17% 13181 9616 7677.7719 422 14558.4000 7545.7835 949348 48.17% 13277 9706 7984.5226 360 14558.4000 7545.7835 959552 48.17% 13312 9739 7620.6343 394 14558.4000 7545.7835 970016 48.17% 13664 10089 7662.6784 365 14558.4000 7545.7835 999193 48.17% 13765 10190 8183.6833 390 14558.4000 7545.7835 1011762 48.17% Elapsed real time = 358.38 sec. (tree size = 1211.79 MB, solutions = 2) Nodefile size = 1054.02 MB (808.82 MB after compression) 13848 10273 7837.0115 391 14558.4000 7545.7835 1024791 48.17% 13953 10378 8399.2848 274 14558.4000 7545.7835 1033390 48.17% 14502 10927 9414.2531 253 14558.4000 7545.7835 1066577 48.17% 14533 10958 7875.3300 313 14558.4000 7545.7835 1072676 48.17% 14565 10990 7880.4708 312 14558.4000 7545.7835 1076490 48.17% 14613 11038 7905.2660 285 14558.4000 7545.7835 1080756 48.17% 14865 11290 8473.1882 280 14558.4000 7545.7835 1099645 48.17% 14940 11365 7978.4004 324 14558.4000 7545.7835 1108031 48.17% 14988 11413 8020.5341 334 14558.4000 7545.7835 1113306 48.17% 15076 11501 8098.1261 323 14558.4000 7545.7835 1120236 48.17% Elapsed real time = 405.31 sec. (tree size = 1387.68 MB, solutions = 2) Nodefile size = 1227.22 MB (947.68 MB after compression) 16172 12573 7552.4028 352 14558.4000 7545.7835 1174324 48.17% 16173 12574 7664.7188 399 14558.4000 7545.7835 1177685 48.17% 16189 12590 7649.9320 436 14558.4000 7545.7835 1186868 48.17% 17180 13579 7676.9505 412 14558.4000 7545.7835 1248619 48.17% 17188 13586 7682.2001 422 14558.4000 7545.7835 1252364 48.17% 17196 13594 7662.2583 477 14558.4000 7545.7835 1256785 48.17% 17682 14076 7674.7033 464 14558.4000 7545.7835 1297463 48.17% 17698 14092 7880.6274 375 14558.4000 7545.7835 1301957 48.17% 17802 14196 7749.9900 355 14558.4000 7545.7835 1315064 48.17% 18232 14609 7612.4141 456 14558.4000 7552.7117 1377587 48.12% Elapsed real time = 483.26 sec. (tree size = 1833.21 MB, solutions = 2) Nodefile size = 1678.21 MB (1315.60 MB after compression) 18546 14923 7860.0983 504 14558.4000 7567.2989 1422659 48.02% 19111 15467 7699.2119 395 14558.4000 7567.2989 1489906 48.02% 19462 15810 8667.8479 291 14558.4000 7567.2989 1554873 48.02% 19484 15832 8127.6012 472 14558.4000 7567.2989 1570465 48.02% 19865 16210 8482.8412 468 14558.4000 7588.6436 1640379 47.87% 20159 16492 7629.9402 482 14558.4000 7588.6436 1701834 47.87% 20498 16831 7709.6665 383 14558.4000 7588.6436 1772310 47.87% 20634 16967 8366.8917 350 14558.4000 7588.6436 1799673 47.87% 21126 17459 8016.2006 380 14558.4000 7612.4904 1864803 47.71% 21298 17631 8459.4869 329 14558.4000 7612.4904 1914012 47.71% Elapsed real time = 656.38 sec. (tree size = 2254.36 MB, solutions = 2) Nodefile size = 2094.76 MB (1651.94 MB after compression) 21628 17961 8104.2918 377 14558.4000 7612.4904 1962432 47.71% 21924 18257 9338.5815 312 14558.4000 7612.4904 2006051 47.71% 22097 18430 8194.3926 397 14558.4000 7612.4904 2035902 47.71% 22586 18918 7713.9679 437 14558.4000 7622.9336 2106462 47.64% 22682 19014 8087.7677 447 14558.4000 7622.9336 2131224 47.64% 23148 19479 8025.7727 373 14558.4000 7622.9336 2220982 47.64% 23592 19919 7695.6122 491 14558.4000 7622.9336 2297844 47.64% 23683 20007 7923.4937 453 14558.4000 7631.7499 2319159 47.58% 24302 20622 8052.9749 480 14558.4000 7631.7499 2416248 47.58% 24446 20766 8228.7055 377 14558.4000 7631.7499 2455685 47.58% Elapsed real time = 835.75 sec. (tree size = 2504.75 MB, solutions = 2) Nodefile size = 2350.12 MB (1868.06 MB after compression) 24952 21270 7880.8414 393 14558.4000 7631.7499 2534351 47.58% 25030 21348 8760.5681 461 14558.4000 7631.7499 2563724 47.58% 25329 21634 8010.0332 329 14558.4000 7634.3597 2646300 47.56% 25414 21714 8866.3435 430 14558.4000 7634.3597 2671295 47.56% 25916 22212 7658.5452 430 14558.4000 7634.3597 2745681 47.56% 25973 22269 7776.7461 443 14558.4000 7634.3597 2764532 47.56% 26085 22381 8068.6388 421 14558.4000 7634.3597 2784176 47.56% 26465 22758 7748.4394 494 14558.4000 7636.2988 2852419 47.55% 26544 22837 7808.2807 489 14558.4000 7636.2988 2895161 47.55% 26879 23172 7893.8243 399 14558.4000 7636.2988 2984394 47.55% Elapsed real time = 994.40 sec. (tree size = 2808.22 MB, solutions = 2) Nodefile size = 2654.40 MB (2131.15 MB after compression) 26975 23268 8148.4050 400 14558.4000 7636.2988 3014898 47.55% 27481 23774 8150.9262 394 14558.4000 7636.2988 3097257 47.55% 27603 23895 8509.9553 516 14558.4000 7636.2988 3133046 47.55% 27722 24014 8598.2643 438 14558.4000 7636.2988 3163706 47.55% 28246 24537 7769.3601 441 14558.4000 7639.7004 3244314 47.52% 28320 24611 8760.5274 355 14558.4000 7639.7004 3274482 47.52% 28769 25060 7754.7691 505 14558.4000 7639.7004 3380876 47.52% 28849 25140 8124.6031 514 14558.4000 7639.7004 3407803 47.52% 29553 25843 8587.5945 498 14558.4000 7640.0546 3528168 47.52% 29715 26002 8357.9852 419 14558.4000 7640.0546 3571889 47.52% Elapsed real time = 1181.09 sec. (tree size = 3232.90 MB, solutions = 2) Nodefile size = 3077.22 MB (2505.43 MB after compression) 30031 26317 8430.2097 489 14558.4000 7640.0546 3654350 47.52% 30289 26575 8553.5077 430 14558.4000 7640.0546 3702151 47.52% 30353 26638 8605.0755 400 14558.4000 7640.0546 3724003 47.52% 30651 26935 7810.4309 485 14558.4000 7640.0546 3786837 47.52% 30836 27120 8307.9323 455 14558.4000 7641.7750 3848508 47.51% 30913 27197 8525.7253 394 14558.4000 7641.7750 3886578 47.51% 31268 27552 8479.2805 496 14558.4000 7641.7750 3966950 47.51% 31332 27616 8693.5740 429 14558.4000 7641.7750 3988349 47.51% 31926 28208 8105.8833 497 14558.4000 7641.7750 4110619 47.51% 32009 28291 9281.3322 390 14558.4000 7641.7750 4137163 47.51% Elapsed real time = 1353.52 sec. (tree size = 3352.37 MB, solutions = 2) Nodefile size = 3199.19 MB (2603.13 MB after compression) 32250 28531 8369.3808 327 14558.4000 7641.7750 4200271 47.51% 32485 28766 8466.1167 364 14558.4000 7641.7750 4256605 47.51% 32655 28936 7921.9327 338 14558.4000 7644.4385 4303559 47.49% 32767 29048 8191.9619 306 14558.4000 7644.4385 4335143 47.49% 33241 29521 7698.8735 467 14558.4000 7644.4385 4448643 47.49% 33270 29550 7731.4241 489 14558.4000 7644.4385 4467560 47.49% 33318 29598 7848.1284 390 14558.4000 7644.4385 4484960 47.49% 34045 30325 8827.0543 254 14558.4000 7644.4385 4607871 47.49% 34162 30442 7919.3276 404 14558.4000 7644.4385 4640594 47.49% 34250 30530 8026.0980 453 14558.4000 7644.4385 4669250 47.49% Elapsed real time = 1530.41 sec. (tree size = 3590.88 MB, solutions = 2) Nodefile size = 3439.17 MB (2809.95 MB after compression) 34825 31105 8580.3300 365 14558.4000 7648.3749 4797690 47.46% 34904 31184 8388.7942 380 14558.4000 7648.3749 4821452 47.46% 35048 31328 8446.7553 354 14558.4000 7648.3749 4854102 47.46% 35486 31766 8283.7263 501 14558.4000 7648.3749 4975946 47.46% 35553 31833 8671.9220 348 14558.4000 7648.3749 5006610 47.46% 35776 32056 8303.4765 302 14558.4000 7648.3749 5057720 47.46% 36134 32411 7776.7516 513 14558.4000 7648.3749 5110240 47.46% 36135 32412 8678.0349 375 14558.4000 7650.1451 5110465 47.45% 36137 32414 8326.6778 340 14558.4000 7650.1451 5111192 47.45% 36148 32424 7702.6055 452 14558.4000 7650.1451 5129247 47.45% Elapsed real time = 1708.73 sec. (tree size = 3760.64 MB, solutions = 2) Nodefile size = 3739.73 MB (3056.41 MB after compression) 36188 32464 7810.0734 416 14558.4000 7650.1451 5157704 47.45% 36343 32619 8330.7435 365 14558.4000 7650.1451 5238194 47.45% 36798 33073 8507.0233 349 14558.4000 7652.3310 5333085 47.44% 36932 33205 8319.3973 393 14558.4000 7652.3310 5369809 47.44% 37712 33973 7716.0417 503 14558.4000 7652.3310 5478374 47.44% 37798 34059 8868.6090 412 14558.4000 7652.3744 5507553 47.44% 38514 34775 8751.7146 241 14558.4000 7652.3744 5593572 47.44% 39149 35408 7720.2624 488 14558.4000 7652.3744 5658082 47.44% 39224 35483 7774.8764 523 14558.4000 7652.3744 5682004 47.44% 39336 35595 8173.6028 448 14558.4000 7652.3744 5706703 47.44% Elapsed real time = 1906.64 sec. (tree size = 4235.04 MB, solutions = 2) Nodefile size = 4086.43 MB (3368.72 MB after compression) 39885 36118 8756.9468 381 14558.4000 7652.7539 5861459 47.43% 39912 36143 8298.3827 496 14558.4000 7652.7539 5885338 47.43% 39984 36211 8350.8681 371 14558.4000 7652.7539 5925459 47.43%
and then cplex crashes again.
Here is a snippet / pseudocode mixin:
IloIntVar[][] x; IloNumVar[] B; IloNumVar[] Q; ... read in problem... IloCplex cplex =
new IloCplex(); cplex.setParam(IloCplex.DoubleParam.TiLim, 3600);
//set time limit cplex.setOut(outputStream);
//store output in file x =
new IloIntVar[numberOfVars][];
for(i = 0; ...)
{ x[i] =
new IloIntVar[numberOfVars];
for(j = 0; ...)
{ x[i][j] = cplex.boolVar(
"x_"+i+
","+j);
}
} ... generate equalities like \sum_i x_ij = 1 \forall j ... cplex.addEq(...); B =
new IloNumVar[numberOfVars];
for(i = 0; ...) B[i] = cplex.numVar(lower bound, upper bound,
"B"+i); ... Q is the same as B ... ... generate inequalities ... cplex.addGe(...); ...generate IloNumExpr \sum_ij c_ij * x_ij ... IloNumExpr sum = cplex.constant(0);
for(i ...)
for(j ...) sum = cplex.sum(cplex.prod(c[i][j], x[i][j])); cplex.addObjective(IloObjectiveSense.Minimize,sum); BranchGoal myGoal =
new BranchGoal(x, Q, B, parameters...);
//setup my own goal ... read in heuristic solution... myGoal.injectSolution(solutionFile);
//reads in solution and creates new, flattened varArray und valueArray Goal solution = cplex.solutionGoal(myGoal.varArray, myGoal.valueArray); cplex.solve(cplex.and(solution, myGoal));
and that was it. In BranchGoal (which extends Goal), I do the following:
public BranchGoal(IloIntVar[][]x, IloNumVar[] B, IloNumVar[] Q, parameters)
{ this.x = x; this.B = B; this.Q = Q; parameters = parameters;
}
public Goal execute(IloCplex cplex)
{ Goal goal =
this; IloCplex.IntegerFeasibilityStatus[][] feas = getFeasibilites(x);
double minInfeasVal = 0.5;
//I want to find the variable which is the nearest to 0.5
int infeasI = 0;
int infeasJ = 0;
boolean infeasFound =
false;
for(
int i = 0; i < feas.length; i++)
{
for(
int j = 0; j < feas[i].length; j++)
{
if(feas[i][j].equals(IntegerFeasibilityStatus.Infeasible))
{ infeasibleFound =
true;
if(Math.abs(getValue(x[i][j]) - 0.5) < minInFeas)
{ infeasI = i; infeasJ = j; minInFeas = Math.abs(getValue(x[i][j]) - 0.5);
}
}
}
}
if(infeasibleFound)
{
//branch on this variable
return cplex.and(cplex.or(cplex.eqGoal(x[infeasI][infeasJ], 1),cplex.eqGoal(x[infeasI][infeasJ], 0)), goal);
}
//now we have an integer solution
//I'm searching for violated inequalities that were not in the model yet
//and potentially add them as new global cuts ... searching ...
if(found violated inequality)
{ goal = cplex.and(cplex.globalCutGoal(cplex.ge(cplex.constant(S.size()-2), sum)),goal);
return goal;
}
return
null;
}
private IntegerFeasibilityStatus[][] getFeasibilites(IloIntVar[][] var)
{
//I don't need this parameter, don't know why it is still there IloCplex.IntegerFeasibilityStatus[][] arr =
new IntegerFeasbilityStatus[x.length][x.length];
for(
int i = 0; i < x.length; i++)
{ arr[i] = getFeasibilites(x[i]);
}
return arr;
}
I hope that you can help me.
#CPLEXOptimizers#DecisionOptimization