Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Accessing integer solution variable values during a MIP solve

    Posted 04/15/13 01:13 PM

    Originally posted by: AnORDude


    I am using C++ with Cplex 12.5.

    During a MIP solve, I want to access the variable values of feasible solutions found (not necessarily the best integer solution found, but any integer solution) during the solve process. What type of callback (if any) would I use for this? I don't need to modify the problem in any way or add cuts. I simply want to get the variable values for feasible solutions and record whether they satisfy a set of constraints (which are different from the problem's original constraints).

     

    Thank you!


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Accessing integer solution variable values during a MIP solve

    Posted 04/15/13 01:33 PM

    There are two things you can do here:

    1. The incumbent callback is invoked whenever a new integer feasible solution is found. So you can use an incumbent callback to get notified about all new solutions. The disadvantage of the incumbent callback is that it is a control callback and disables dynamic search.
    2. You can set the IntSolFilePrefix parameter to a non-empty string. This will cause CPLEX to write incumbents to disk. You can then use an InfoCallback and in that callback (or even outside of the optimization process in a different thread) check if new solutions have been written.

    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Accessing integer solution variable values during a MIP solve

    Posted 04/15/13 01:39 PM

    Originally posted by: AnORDude


    Thank you. Great answer. I was hoping for being able to do something like #1 without losing dynamic search. Such is life.


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Accessing integer solution variable values during a MIP solve

    Posted 04/15/13 01:44 PM

    Well, if you don't want to have a guarantee that you check all incumbents you can go with the info callback. That callback does not disable dynamic search and allows to query the best known integer feasible solution. So will see different solutions over time but there is no guarantee that you will see each integer feasible solution in the callback.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Accessing integer solution variable values during a MIP solve

    Posted 04/15/13 03:16 PM

    Originally posted by: AnORDude


    Another related question - if I use option 1, I want to know the time at which the solution was written (it could be CPU time since CPLEX solve started). Is there a way to write this info when it writes the incumbent to disk?


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Accessing integer solution variable values during a MIP solve

    Posted 04/15/13 03:30 PM

    No, unfortunately there is no way to include that information in the solution file. I can see two ways to get that time:

    1. Look at the creation time of the file.
    2. Use IloAlgorithm::setOut() to install a filter for the CPLEX log. Whenever CPLEX writes an incumbent file it issues a message "New incumbent written to file '<filename>.sol'. By looking for those strings you can roughly figure out when the files were written.

    #CPLEXOptimizers
    #DecisionOptimization