Topic
  • 10 replies
  • Latest Post - ‏2013-02-22T19:51:29Z by BerkUstun
BerkUstun
BerkUstun
100 Posts

Pinned topic MIP tuning tool only runs for a few seconds in MATLAB CPLEX API

‏2013-02-21T03:35:52Z |
I've been trying to use the tuning tool to improve CPLEX's performance on an MIP. In this case, the MIP is 895 rows and 456 columns

As described in the manual, I typically set


LP.Param.timelimit = 1800


and sometimes I even set


LP.Param.tune.timelimit.Cur = 1800.


However, the tuning itself always takes less than 10 seconds. Does anyone know why? I've posted a copy of the output below.


Tuning on problem 
'CPLEX' Test 
'dual': Optimal. Time = 0.00 sec. (0.00 ticks)  Objective = 0   Tuning progress: 69%   Test 
'primal': Optimal. Time = 0.00 sec. (0.00 ticks)  Objective = 0   Tuning progress: 81%   Test 
'barrier': Optimal. Time = 0.00 sec. (0.00 ticks)  Objective = 0   Tuning progress: 90%   Test 
'network': Optimal. Time = 0.00 sec. (0.00 ticks)  Objective = 0   Tuning progress: 94%   Test 
'primal_devex': Optimal. Time = 0.00 sec. (0.00 ticks)  Objective = 0   Tuning progress: 96%   Test 
'primal_partial': Optimal. Time = 0.00 sec. (0.00 ticks)  Objective = 0   Tuning progress: 98%   Test 
'primal_steep': Optimal. Time = 0.00 sec. (0.00 ticks)  Objective = 0   Tuning progress: 99%   Test 
'simplex_perturb': Optimal. Time = 0.00 sec. (0.00 ticks)  Objective = 0 Default test: Time = 0.00 sec. Best test: 
'dual'  Time = 0.00 sec.   134 end >> GetTuningParameters   Tuning on problem 
'CPLEX' Test 
'dual': Optimal. Time = 0.00 sec. (0.00 ticks)  Objective = 0   Tuning progress: 73%   Test 
'primal': Optimal. Time = 0.00 sec. (0.00 ticks)  Objective = 0   Tuning progress: 84%   Test 
'barrier': Optimal. Time = 0.00 sec. (0.00 ticks)  Objective = 0   Tuning progress: 92%   Test 
'network': Optimal. Time = 0.00 sec. (0.00 ticks)  Objective = 0   Tuning progress: 95%   Test 
'primal_devex': Optimal. Time = 0.00 sec. (0.00 ticks)  Objective = 0   Tuning progress: 97%   Test 
'primal_partial': Optimal. Time = 0.00 sec. (0.00 ticks)  Objective = 0   Tuning progress: 98%   Test 
'primal_steep': Optimal. Time = 0.00 sec. (0.00 ticks)  Objective = 0   Tuning progress: 99%   Test 
'simplex_perturb': Optimal. Time = 0.00 sec. (0.00 ticks)  Objective = 0 Default test: Time = 0.00 sec. Best test: 
'dual'  Time = 0.00 sec.
Updated on 2013-02-22T19:51:29Z at 2013-02-22T19:51:29Z by BerkUstun
  • SystemAdmin
    SystemAdmin
    7929 Posts

    Re: MIP tuning tool only runs for a few seconds in MATLAB CPLEX API

    ‏2013-02-21T07:03:04Z  
    From the output it looks like the problem instance you are using for tuning is just too easy: CPLEX always solves the problem to optimality in almost no time -- so there is not much that can be tuned.
    Does the same happen if you solve the problem instance without the tuning tool?
  • BerkUstun
    BerkUstun
    100 Posts

    Re: MIP tuning tool only runs for a few seconds in MATLAB CPLEX API

    ‏2013-02-21T08:04:19Z  
    From the output it looks like the problem instance you are using for tuning is just too easy: CPLEX always solves the problem to optimality in almost no time -- so there is not much that can be tuned.
    Does the same happen if you solve the problem instance without the tuning tool?
    No unfortunately. For some reason the tuning yields an optimal value of 0 for the MIP. However when I use the LP.solve command (before and after the tuning tool), the MIP solves to a value of about 0.18. I'm pasting the first few lines of the output from LP.solve. I'd also be happy to send over the problem instance if required.

    
    LP.solve Tried aggregator 2 times. MIP Presolve eliminated 1 rows and 1 columns. MIP Presolve modified 24971 coefficients. Aggregator did 1 substitutions. Reduced MIP has 1947 rows, 980 columns, and 13499 nonzeros. Reduced MIP has 967 binaries, 13 generals, 0 SOSs, and 0 indicators. Presolve time = 0.08 sec. (135.47 ticks) Found incumbent of value 0.554033 after 0.08 sec. (137.70 ticks) Probing fixed 0 vars, tightened 6 bounds. Probing time = 0.01 sec. (8.94 ticks) Tried aggregator 1 time. Presolve time = 0.01 sec. (3.58 ticks) Probing time = 0.00 sec. (1.91 ticks) Clique table members: 8. MIP emphasis: balance optimality and feasibility. MIP search method: dynamic search. Parallel mode: none, using 1 thread. Root relaxation solution time = 0.07 sec. (91.51 ticks)   Nodes                                         Cuts/  Node  Left     Objective  IInf  Best Integer    Best Bound    ItCnt     Gap   *     0+    0                            0.5540        0.0000      957  100.00% 0     0        0.0001   858        0.5540        0.0001      957   99.98% *     0+    0                            0.4872        0.0001      957   99.97% Repeating presolve. Tried aggregator 1 time. MIP Presolve eliminated 544 rows and 272 columns. Reduced MIP has 1403 rows, 708 columns, and 9691 nonzeros. Reduced MIP has 695 binaries, 13 generals, 0 SOSs, and 0 indicators. Presolve time = 0.01 sec. (5.24 ticks) Probing time = 0.00 sec. (1.33 ticks) Tried aggregator 1 time. Presolve time = 0.00 sec. (2.57 ticks) Represolve time = 0.02 sec. (9.98 ticks) Probing time = 0.00 sec. (1.33 ticks) MIP emphasis: balance optimality and feasibility. MIP search method: dynamic search. Parallel mode: none, using 1 thread. Root relaxation solution time = 0.04 sec. (43.46 ticks)   Nodes                                         Cuts/  Node  Left     Objective  IInf  Best Integer    Best Bound    ItCnt     Gap   *     0+    0                            0.4872        0.0001     1643   99.97% 0     0        0.0001   593        0.4872        0.0001     1643   99.97% *     0+    0                            0.4590        0.0001     1643   99.97% 0     2        0.0001   593        0.4590        0.0001     1643   99.97% Elapsed time = 0.43 sec. (549.17 ticks, tree = 0.00 MB, solutions = 3)
    
  • SystemAdmin
    SystemAdmin
    7929 Posts

    Re: MIP tuning tool only runs for a few seconds in MATLAB CPLEX API

    ‏2013-02-21T09:43:59Z  
    • BerkUstun
    • ‏2013-02-21T08:04:19Z
    No unfortunately. For some reason the tuning yields an optimal value of 0 for the MIP. However when I use the LP.solve command (before and after the tuning tool), the MIP solves to a value of about 0.18. I'm pasting the first few lines of the output from LP.solve. I'd also be happy to send over the problem instance if required.

    <pre class="jive-pre"> LP.solve Tried aggregator 2 times. MIP Presolve eliminated 1 rows and 1 columns. MIP Presolve modified 24971 coefficients. Aggregator did 1 substitutions. Reduced MIP has 1947 rows, 980 columns, and 13499 nonzeros. Reduced MIP has 967 binaries, 13 generals, 0 SOSs, and 0 indicators. Presolve time = 0.08 sec. (135.47 ticks) Found incumbent of value 0.554033 after 0.08 sec. (137.70 ticks) Probing fixed 0 vars, tightened 6 bounds. Probing time = 0.01 sec. (8.94 ticks) Tried aggregator 1 time. Presolve time = 0.01 sec. (3.58 ticks) Probing time = 0.00 sec. (1.91 ticks) Clique table members: 8. MIP emphasis: balance optimality and feasibility. MIP search method: dynamic search. Parallel mode: none, using 1 thread. Root relaxation solution time = 0.07 sec. (91.51 ticks) Nodes Cuts/ Node Left Objective IInf Best Integer Best Bound ItCnt Gap * 0+ 0 0.5540 0.0000 957 100.00% 0 0 0.0001 858 0.5540 0.0001 957 99.98% * 0+ 0 0.4872 0.0001 957 99.97% Repeating presolve. Tried aggregator 1 time. MIP Presolve eliminated 544 rows and 272 columns. Reduced MIP has 1403 rows, 708 columns, and 9691 nonzeros. Reduced MIP has 695 binaries, 13 generals, 0 SOSs, and 0 indicators. Presolve time = 0.01 sec. (5.24 ticks) Probing time = 0.00 sec. (1.33 ticks) Tried aggregator 1 time. Presolve time = 0.00 sec. (2.57 ticks) Represolve time = 0.02 sec. (9.98 ticks) Probing time = 0.00 sec. (1.33 ticks) MIP emphasis: balance optimality and feasibility. MIP search method: dynamic search. Parallel mode: none, using 1 thread. Root relaxation solution time = 0.04 sec. (43.46 ticks) Nodes Cuts/ Node Left Objective IInf Best Integer Best Bound ItCnt Gap * 0+ 0 0.4872 0.0001 1643 99.97% 0 0 0.0001 593 0.4872 0.0001 1643 99.97% * 0+ 0 0.4590 0.0001 1643 99.97% 0 2 0.0001 593 0.4590 0.0001 1643 99.97% Elapsed time = 0.43 sec. (549.17 ticks, tree = 0.00 MB, solutions = 3) </pre>
    That is strange. Your problem is a MIP, yet the output of the tuning tool suggests that you were tuning a plain LP. Are you sure you don't change the model type?
    How exactly do you invoke the tuning tool? Did you change any parameter settings other than the time limits? Does the problem persist if you do not change any of the time limits?
  • BerkUstun
    BerkUstun
    100 Posts

    Re: MIP tuning tool only runs for a few seconds in MATLAB CPLEX API

    ‏2013-02-21T13:05:43Z  
    That is strange. Your problem is a MIP, yet the output of the tuning tool suggests that you were tuning a plain LP. Are you sure you don't change the model type?
    How exactly do you invoke the tuning tool? Did you change any parameter settings other than the time limits? Does the problem persist if you do not change any of the time limits?
    The problem persists whether I change the time limits or not. As a matter of fact, the problem persists even if I do not change of the parameter settings after building the model (at the same point, solve would yield at previous output). I am sure that I do not change the model type either.
  • SystemAdmin
    SystemAdmin
    7929 Posts

    Re: MIP tuning tool only runs for a few seconds in MATLAB CPLEX API

    ‏2013-02-21T13:21:11Z  
    • BerkUstun
    • ‏2013-02-21T13:05:43Z
    The problem persists whether I change the time limits or not. As a matter of fact, the problem persists even if I do not change of the parameter settings after building the model (at the same point, solve would yield at previous output). I am sure that I do not change the model type either.
    OK, that is weird and sounds like a potential bug.
    Could you please attach your model and maybe also show the relevant parts of your code? If you don't want to disclose that here you may send it directly me: daniel(dot)junglas(at)de(dot)ibm(dot)com
    What CPLEX and matlab version do you use? What operating system?
  • BerkUstun
    BerkUstun
    100 Posts

    Re: MIP tuning tool only runs for a few seconds in MATLAB CPLEX API

    ‏2013-02-21T17:28:36Z  
    OK, that is weird and sounds like a potential bug.
    Could you please attach your model and maybe also show the relevant parts of your code? If you don't want to disclose that here you may send it directly me: daniel(dot)junglas(at)de(dot)ibm(dot)com
    What CPLEX and matlab version do you use? What operating system?
    OK some progress.

    It seems as if invoking the tuning function immediately after setting up the MIP yields an error (as shown above, the tuning function thinks that the MIP is an LP). That said, if I first solve the MIP and then call the tuning function then it seems to behave as it should.

    I am attaching a MAT file which contains my model file. Right now I'm running CPLEX 12.5 on MATLAB 2011b and Mac OS X 10.8.2. The code to run this example is shown below:

    data = load('tuning_error.mat')
    Model = data.Model;
     
    %setup CPLEX Model
    MIP = Cplex();
    MIP.Model = Model;
     
    %Call the tuning function (DOES NOT WORK)
    MIP.tuneParam;
     
    %Solve the MIP (DOES WORK)
    MIP.Param.timelimit.Cur = 30; %
    MIP.solve; 
     
    %Note: after solving once, the tuning function appears to work as it should
    MIP.tuneParam;
    
    Updated on 2014-03-24T22:39:25Z at 2014-03-24T22:39:25Z by iron-man
  • SystemAdmin
    SystemAdmin
    7929 Posts

    Re: MIP tuning tool only runs for a few seconds in MATLAB CPLEX API

    ‏2013-02-22T08:01:19Z  
    • BerkUstun
    • ‏2013-02-21T17:28:36Z
    OK some progress.

    It seems as if invoking the tuning function immediately after setting up the MIP yields an error (as shown above, the tuning function thinks that the MIP is an LP). That said, if I first solve the MIP and then call the tuning function then it seems to behave as it should.

    I am attaching a MAT file which contains my model file. Right now I'm running CPLEX 12.5 on MATLAB 2011b and Mac OS X 10.8.2. The code to run this example is shown below:

    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">data = load('tuning_error.mat') Model = data.Model; %setup CPLEX Model MIP = Cplex(); MIP.Model = Model; %Call the tuning function (DOES NOT WORK) MIP.tuneParam; %Solve the MIP (DOES WORK) MIP.Param.timelimit.Cur = 30; % MIP.solve; %Note: after solving once, the tuning function appears to work as it should MIP.tuneParam; </pre>
    Thank you. With your code and data I reproduced the problem here.
    Unfortunately, this is a bug in the matlab connector :-(
    The problem is a missing internal update. To work around this issue you can
    • perform a solve() with a time limit of 0 or
    • export the model to a file.
    These actions should trigger the update that is missing in tuneParam() and after that tuneParam() should work as expected.
  • BerkUstun
    BerkUstun
    100 Posts

    Re: MIP tuning tool only runs for a few seconds in MATLAB CPLEX API

    ‏2013-02-22T14:28:15Z  
    Thank you. With your code and data I reproduced the problem here.
    Unfortunately, this is a bug in the matlab connector :-(
    The problem is a missing internal update. To work around this issue you can
    • perform a solve() with a time limit of 0 or
    • export the model to a file.
    These actions should trigger the update that is missing in tuneParam() and after that tuneParam() should work as expected.
    Ah so the work around isn't that bad at all. Thanks again!
  • BerkUstun
    BerkUstun
    100 Posts

    Re: MIP tuning tool only runs for a few seconds in MATLAB CPLEX API

    ‏2013-02-22T19:51:05Z  
    • BerkUstun
    • ‏2013-02-22T14:28:15Z
    Ah so the work around isn't that bad at all. Thanks again!
    Unfortunately, there seems to be another issue with this example in that the tuning function only works when the presolve function is turned on.

    I've posted an example below which you should be able to recreate this using the same mat file as my previous post:

    %Load CPLEX Model
    data = load('tuning_error.mat')
    Model = data.Model;
     
    %Call the tuning function with presolve off (DOES NOT WORK... CPLEX finds an objective value of 0)
    MIP = Cplex();
    MIP.Model = Model;
     
    MIP.Param.preprocessing.presolve = false;
    MIP.Param.timelimit = 1;
    MIP.solve;
     
    MIP.Param.timelimit.Cur = 30;
    MIP.tuneParam; %this DOES NOT work
     
    MIP.solve %After tuning, the objective value stays at 0
    


    In comparison, the following does work:

    %Call the tuning function (DOES NOT WORK... CPLEX finds an objective value of 0)
    MIP = Cplex();
    MIP.Model = Model;
     
    MIP.Param.preprocessing.presolve = false;
    MIP.Param.timelimit = 1;
    MIP.solve;
     
    MIP.Param.timelimit.Cur = 30;
    MIP.tuneParam; %this DOES work
     
    MIP.solve %After tuning, the LP behaves as it should
    
    Updated on 2014-03-24T22:39:09Z at 2014-03-24T22:39:09Z by iron-man
  • BerkUstun
    BerkUstun
    100 Posts

    Re: MIP tuning tool only runs for a few seconds in MATLAB CPLEX API

    ‏2013-02-22T19:51:29Z  
    • BerkUstun
    • ‏2013-02-22T19:51:05Z
    Unfortunately, there seems to be another issue with this example in that the tuning function only works when the presolve function is turned on.

    I've posted an example below which you should be able to recreate this using the same mat file as my previous post:

    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">%Load CPLEX Model data = load('tuning_error.mat') Model = data.Model; %Call the tuning function with presolve off (DOES NOT WORK... CPLEX finds an objective value of 0) MIP = Cplex(); MIP.Model = Model; MIP.Param.preprocessing.presolve = false; MIP.Param.timelimit = 1; MIP.solve; MIP.Param.timelimit.Cur = 30; MIP.tuneParam; %this DOES NOT work MIP.solve %After tuning, the objective value stays at 0 </pre>

    In comparison, the following does work:

    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">%Call the tuning function (DOES NOT WORK... CPLEX finds an objective value of 0) MIP = Cplex(); MIP.Model = Model; MIP.Param.preprocessing.presolve = false; MIP.Param.timelimit = 1; MIP.solve; MIP.Param.timelimit.Cur = 30; MIP.tuneParam; %this DOES work MIP.solve %After tuning, the LP behaves as it should </pre>
    Sorry! the second (working) example should be

    %Call the tuning function (DOES NOT WORK... CPLEX finds an objective value of 0)
    MIP = Cplex();
    MIP.Model = Model;
     
    MIP.Param.preprocessing.presolve = true;
    MIP.Param.timelimit = 1;
    MIP.solve;
     
    MIP.Param.timelimit.Cur = 30;
    MIP.tuneParam; %this DOES work
     
    MIP.solve %After tuning, the LP behaves as it should
    
    Updated on 2014-03-24T22:39:04Z at 2014-03-24T22:39:04Z by iron-man