Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
  • 1.  Model size of a MIP after PreSolve in CPLEX 12.7.1

    Posted Wed May 02, 2018 02:16 AM

    Originally posted by: VishalFPM


    How to access the model size (number of variables and number of constraints) of a MIP (Mixed Integer Program) after PreSolve stage of CPLEX 12.7.1 without printing the whole output (that includes branch and bound tree) of cplex solver?

     

    I understand that in order to access the model size before PreSolve, we can use getNcols() and getNrows().


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Model size of a MIP after PreSolve in CPLEX 12.7.1

    Posted Wed May 02, 2018 03:18 AM

    Do I understand correctly that you are using the Concert API (either in C++ or Java)?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Model size of a MIP after PreSolve in CPLEX 12.7.1

    Posted Wed May 02, 2018 03:22 AM

    Originally posted by: VishalFPM


    Yes. I am using Concert API in C++ using Microsoft Visual Studio Project.


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Model size of a MIP after PreSolve in CPLEX 12.7.1

    Posted Wed May 02, 2018 03:47 AM

    Since Concert does not provide access to the presolved model, this information is not available in Concert. You will have to pick it up from the log. Note that using setOut() you can redirect the log to a stream that parses the log without printing anything.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Model size of a MIP after PreSolve in CPLEX 12.7.1

    Posted Wed May 02, 2018 03:55 AM

    Originally posted by: VishalFPM


    If I understand you correctly, I can redirect the log to a text file. But 2 things are problematic for me here:

     

    1. This increases the computational time required by the .cpp program significantly for large instances.

    2. I have to manually go through the logs in that file in order to extract the model size.


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Model size of a MIP after PreSolve in CPLEX 12.7.1

    Posted Wed May 02, 2018 04:06 AM

    Text file is one option. But you can also redirect to a stream that does not store the log in any place. It just looks at the log line by line and discards it after parsing it.

    Computational overhead: I don't think it would be significant. Parsing a log line should we super fast, in particular since you are only looking for a particular string/regex. So the only thing that could hurt you is the sheer number of log lines to process. This can be reduced by setting CPX_PARAM_MIPINTERVAL to a very large value. Setting it to the maximum value will essentially disable the node log during tree search. Hence you only have to parse the log output for the root node and that should not be much overhead.


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Model size of a MIP after PreSolve in CPLEX 12.7.1

    Posted Wed May 02, 2018 05:56 AM

    Originally posted by: VishalFPM


    Thanks a lot for your advice, Daniel.

    I will try to implement this first.


    #CPLEXOptimizers
    #DecisionOptimization