Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Confusion about the example ilogoalex2.cpp for CPLEX 11.2

    Posted 11/16/10 11:37 PM

    Originally posted by: SystemAdmin


    Hi, there,

    I am currently learning Goal to control B&B. When I tried to get through the section of "cuts and goals", I found that in the manual page 1175, it was saying that before any global cut goals are added, the goal is initialized as:
    IloCplex::Goal goal = AndGoal (BranchAsCplexGoal(getEnv()), this)
    

    while I found in the code, it said
    IloCplex::Goal goal = AndGoal (BranchAsCplexGoal(getEnv()), goal)
    


    I think these 2 expressions should be different. But which one should be correct? Thanks
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Confusion about the example ilogoalex2.cpp for CPLEX 11.2

    Posted 11/17/10 03:17 AM

    Originally posted by: SystemAdmin


    At least in the CPLEX 12.2 version of this example, the code reads as follows:
    IloCplex::Goal goal = this;
    ...
    for (...) {
       ...
       goal = AndGoal (BranchAsCplexGoal(getEnv()), goal);
       ...
    }
    

    So, the code and the manual are correct. Your second version is certainly wrong because you cannot use "goal" already in the line where it is initialized.
    Tobias
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Confusion about the example ilogoalex2.cpp for CPLEX 11.2

    Posted 11/17/10 11:00 AM

    Originally posted by: SystemAdmin


    Hi, Tobias. Thank you for the answer. Another question (might be too stupid to ask) is that

    If I replace the "goal" in the AndGoal by "this", like the following
    IloCplex::Goal goal = this;
    ...
    for (...) {
       ...
       goal = AndGoal (BranchAsCplexGoal(getEnv()), this);
       ...
    }
    


    Is this still equivalent to the code in your reply? I think it is not, but I just cannot figure out how and why very clearly. Let's suppose we are talking about the example "Cuts and goals" in User's Manual for CPLEX > Advanced programming techniques > Using goals > Cuts and goals. Thank you for your time and any help.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Confusion about the example ilogoalex2.cpp for CPLEX 11.2

    Posted 11/17/10 11:51 AM

    Originally posted by: SystemAdmin


    I think about it for while, the thing which makes me confused is which class object instance the "this" pointer is pointing to within this Macro "ILOCPLEXGOAL3". Here is my guess:

    "this" is the pointer to the instance "CutGoal",

    By replacing "goal" by "this", AndGoal will first process BranchAsCplexGoal(getEnv()) first, then process "CutGoal" which has only the "GlobalCuts" goal and may not know what to do for any node not violating the cut constraints?

    This still seems not right.

    Thanks for any correction.
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Confusion about the example ilogoalex2.cpp for CPLEX 11.2

    Posted 11/23/10 06:24 AM

    Originally posted by: SystemAdmin


    Using "this" instead of "goal" is not equivalent. The point in this loop is to construct a chain of goals that are concatenated by "and", like AndGoal(GlobalCutGoal(lhsn-1 <= rhsn-1), AndGoal(GlobalCutGoal(lhsn-2 <= rhsn-2), AndGoal(...))).
    If you replace "goal" by "this" inside the loop, then you would just overwrite your previous goal with the new goal, effectively only using the last cut that you found.
    #CPLEXOptimizers
    #DecisionOptimization