Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Callback

    Posted 07/21/15 07:59 AM

    Originally posted by: mkadem


    hello

     

    I'm quite new to linear/mixed integer optimization. My question is this, I am using Concert for C++  and I have implemented a branch and cut algorithm using a UserCutCallback and a BranchCallback. My model is composed of two families of binary variable  x,y that are related by a certain number of constraints. i want to make cplex branching on the x variables (only x) by improving theirs priority, and after fixing them,  cplex should give me the control to update the  upper bound value.  i m using the UserCutCallback to inject the new upperbound value if all x variable are fixed and then BranchCallBack is used to prune the node. The problem is that cplex is branching on the two families of variables  and so he doesn't give me the hand.

     

     

    Many Thanks 

    Mkadem


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Callback

    Posted 08/11/15 01:51 AM

    Did you specify a priority order for the x/y variables? If not, then CPLEX may well branch on y variables if both x and y variables are fractional. Also, in any case, if y variables are fractional at a node but x variables are not, then CPLEX will branch on y variables. So you may have to extend your branch callback to make sure CPLEX keeps branch on x variables as long as there are unfixed x variables. If the values of the y variables are implied by the values of the x variables, could you just make your y variable continuous?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Callback

    Posted 08/26/15 07:59 AM

    Originally posted by: mkadem


    thank you for your response, it was very usefull. In fact,  i can't make y variable continuous because that will affect my objectif function. Now what i m trieng to do is to take the control when cplex had branched on all x variables and inject the solution  using an heuristic and then prune the node (i can determine the objectif value  when all x are fixed), i used the heuristic callback but i found some problems to prune the node. could you propose me a solution and thanks


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Callback

    Posted 09/02/15 01:44 AM

    What exactly are the problems you encountered and you need help with?

    Usually, in order to prune a node you would use the branch callback, do not create any branches and set *useraction_p to CPX_CALLBACK_SET.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Callback

    Posted 09/17/15 04:35 AM

    Originally posted by: mkadem


     i want to ask you something about callbacks (i m using cplex 12.6 ).
    My question is this, I am using Concert for C++  and I have implemented a branch and cut algorithm using a UserCutCallback, heuristicCallBack and BranchCallback. My model is composed of two families of binary variable  x,y that are related by a certain number of constraints. i 'm using cutcallback to inject some cuts (i want cplex to branch on x (++priority), so when all of x have binary value i inject some cuts to give them fractional values),the heuristic callback is used to  construct an integer feasible solution (when all x have binary values) and branchcalmlback is used to prune the node when all x are fixed.
    In the documentation, they said that the execution order is:

    1. IloCplex::CutCallbackI
    2. IloCplex::HeuristicCallbackI
    3. IloCplex::BranchCallbackI

    but in my case,  the branchCallBack is used before the heuristiccallback at each node. 
    Have you any ideas about the causes?? and thanks

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Callback

    Posted 09/21/15 02:54 PM

    First, adding cuts to force fractional values for integer variables strikes me as a bad idea. They would seem to cut off feasible (possibly even optimal?) solutions. If you want to branch on variables with integer values, I'm pretty sure you can engineer that in a BranchCallback without the extra cuts.

    Second, if you do add cuts that invalidate otherwise feasible integer solutions, you must use a LazyConstraintCallback rather than a UserCutCallback. Otherwise, CPLEX may make inappropriate reductions that can result in an incorrect solution.

    Neither of those has anything to do with the order in which callbacks are called. AFAIK the branch callback is always the last callback invoked at each node, so my best guess is that your code is incorrectly determining the order in which the callbacks are invoked. If you are checking/printing node IDs to determine the order, are you using the getNodeId() method in each callback to get the node ID (and immediately printing it)?


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Callback

    Posted 09/21/15 03:45 PM

    Originally posted by: mkadem


     

    Thank you Mr Rubin for your reply.

     

    First, adding cuts to force fractional values for integer variables strikes me as a bad idea. They would seem to cut off feasible (possibly even optimal?) solutions. If you want to branch on variables with integer values, I'm pretty sure you can engineer that in a BranchCallback without the extra cuts.

    >In fact, i tried to branch on X variables using branchcallBack, but, i wanted to give Cplex the hand to choose the right variable. i m adding cuts only if X variables have integer values and for the set A of X that aren't fixed and have 1 as value, i added the constraint sum_{X in A }(X)<=|A|-1. In this case, Cplex will give factional value to X variable and cplex will branch on it.

     

    Neither of those has anything to do with the order in which callbacks are called. AFAIK the branch callback is always the last callback invoked at each node, so my best guess is that your code is incorrectly determining the order in which the callbacks are invoked. If you are checking/printing node IDs to determine the order, are you using the getNodeId() method in each callback to get the node ID (and immediately printing it)?

    > i m printing the variables that are fixed by cplex at each callBack and the variable that i'm going to branch on (version without cuts and i m using BranchCallback to engineer the branching). i find that cut callback is the first to be called than branch call back and finally heuristicCallback. Moreover, when branch callback announces the variable that he will branch on, in heuristic callback it is not printed as fixed.   

     

     

     

     

     

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Callback

    Posted 09/28/15 10:47 AM

    Your added cut takes what appears to be a feasible solution and makes it infeasible. Doing that in a user cut callback violates an implicit "contract" that user cuts will not alter the set of integer feasible solutions, and can result in incorrect "solutions" being found. You should use a lazy constraint callback if you are intent on doing this.

    As far as the order of callbacks goes, I suggest printing the node IDs in each callback. I do not believe it is possible for the heuristic callback to be called at node X after the branch callback has been called there.


    #CPLEXOptimizers
    #DecisionOptimization