Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Getting strong branching values from iloconcert

    Posted 05/10/11 07:05 AM

    Originally posted by: PabloFa


    Dear members of developerWorks,

    as part of my PhD thesis, I'm developing an specific strategy of branching for my problem. In my branch callback function I would like to initialize a subset of my variables with the strong branching values. I found a very useful function (CPXstrongbranching) to accomplish this goal, but I have already developed thousands of lines of code in C++ concert technology and I can't move to the C callable library at this point.

    Is there a way to call this function or can you suggest me an alternative way to compute this values (even a less efficient one could help).

    Thank you and best regards,
    Pablo

    PS: I'm still using cplex 10 and as this is the end of my thesis research I prefer not to move to cplex 12.
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Getting strong branching values from iloconcert

    Posted 05/10/11 08:20 AM

    Originally posted by: SystemAdmin


    I'm afraid there is no easy way to call CPXstrongbranch() from Concert code.
    What would work but is performance-wise not the best thing to do is:
    • Use IloCplex.exportModel() to write the model to a .sav file.
    • Write a small code snippet in C (you can even use the C++ compiler to compile that) that simply reads the .sav file, calls CPXstrongbranch() and queries the results.
    • Map the results obtained from CPXstrongbranch() back to your model in Concert.
    I know it is clumsy, but it is currently the best I can think of. At least, it should give you a quick start to see how far you can get using initialization by strong branching.

    The ControlCallback class offers functions getDownPseudoCost() and getUpPseudoCost(). Maybe these two functions can help you?
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Getting strong branching values from iloconcert

    Posted 05/10/11 08:34 AM

    Originally posted by: PabloFa


    Daniel, thank you for your quick and useful reply. I think that I will try your approach.

    With respect to using pseudocost... actually what I try to initialize with strong branching values IS pseudocost for a subset of my variables. As usual this is not a trivial problem and, as far as I see, cplex initialize pseudocosts with 0.01 for the functions in ControlCallbackI that you mentioned.

    If you can suggest me an alternative to get a better value for pseudocost in the first iterations, I'll be very glad.

    Thanks you again,
    Pablo
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Getting strong branching values from iloconcert

    Posted 05/10/11 09:27 AM

    Originally posted by: SystemAdmin


    Unfortunately, I think that Daniel's approach will not work very well. If you write out your MIP model to disk, it will not contain any presolve reductions or cutting planes. Basically, you need to use a callback to get this information. But as far as I know, Concert always operates on the original model (rather than the presolved model), so I don't see how you can access the nodelp, which you will need to calculate the strong branching values.
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Getting strong branching values from iloconcert

    Posted 05/10/11 10:23 AM

    Originally posted by: SystemAdmin


    Yes, Tobias is correct, what I suggested will not produce the expected results. The fundamental problem is that in Concert you cannot access the nodelp which contains cuts and presolve reductions.

    I discusses the problem with Tobias and we came up with the following solution which is ugly and cumbersome but we think it is the only way to achieve what you want to do (unless you want to switch to C):
    • Use the HeuristicCallback to do strong branching. Using HeuristicCallbackI::setBounds() you can temporarily fix variables and then do HeuristicCallbackI::solve() to solve the reduced problem. By doing so it should be rather simple to implement a strong branching algorithm.
    • Forward the information you calculated in the HeuristicCallback to the BranchCallback and use this information to make your branching decisions.
    • Unfortunately, the branch callback at a node is invoked before the heuristic callback is invoked. So there is more trickery to do: First create only one child in the BranchCallback by adding a dummy constraint or dummy bound change. Use user data at the nodes so that the current node can store a reference to the newly created child. When the HeuristicCallback is invoked on the current node then do strong branching and store all results in the newly created child (which you access through the reference stored in node's user data). When you process the child node then use the strong branching data stored in that node to perform a real branch.

    There are some implementation details to be worked out by you but we think that the general idea should be clear and should work.
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Getting strong branching values from iloconcert

    Posted 05/10/11 11:26 AM

    Originally posted by: PabloFa


    Daniel, I miss you answer since I was writing my own answer when you send it.

    Thanks both again,
    Pablo
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Getting strong branching values from iloconcert

    Posted 05/10/11 10:30 AM

    Originally posted by: PabloFa


    Ok, I understand Tobias...

    What I'm trying to do is to choose among a subset of variables using "pseudocost with strong branching initialization" or, even better, what you introduce as "reliable branching" in this paper:
    http://linkinghub.elsevier.com/retrieve/pii/S0167637704000501

    Do you think it is possible to do it with concert?

    Thanks again (Tobias and Daniel) for your feedback,
    Pablo
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Getting strong branching values from iloconcert

    Posted 05/13/11 04:39 AM

    Originally posted by: SystemAdmin


    Note that class IloCplex has an undocumented function
    IloCplex::getStrongBranch(IloNumArray downratio, IloNumArray upratio, const IloNumVarArray ind, IloInt itmax) const;
    

    and several overloads for it. I am not sure whether this existed in version 10 but you could check. Maybe that is all you need.
    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: Getting strong branching values from iloconcert

    Posted 05/13/11 11:52 AM

    Originally posted by: PabloFa


    I reruned the program catching the exception and I see:

    Concert exception caught: CPLEX Error 1017: Not available for mixed-integer programs.
    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: Getting strong branching values from iloconcert

    Posted 05/13/11 02:04 PM

    Originally posted by: SystemAdmin


    I think you ended up with the same issue: strong branching can only be applied to the nodelp (the LP relaxation of the MIP), and not to the MIP. But since you cannot access the nodelp from Concert, I think this is just not possible. Or does anyone else have an idea?
    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: Getting strong branching values from iloconcert

    Posted 05/13/11 11:39 AM

    Originally posted by: PabloFa


    Daniel, thank you so much for remembering my question. I found the function in my ilocplex.h file (version 10). I include a call to this function in my code and I have successfully compile and link. Nevertheless cplex throws the following exception trying to execute the function call:

    Concert exception caught: CPLEX Error 1006: Error during callback.

    As I found, this error code means that some information in unavailable... Should I give up?

    Thanks again!
    #CPLEXOptimizers
    #DecisionOptimization