12.07.2015 Views

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The following lines in the C++ API tell <strong>ILOG</strong> <strong>CPLEX</strong> to continue branching as it wouldnormally do:if ( !isIntegerFeasible() )AndGoal(BranchAsCplexGoal(getEnv()), this);Solution GoalA solution goal is a goal that injects a solution, such as a solution supplied by you or asolution found by <strong>ILOG</strong> <strong>CPLEX</strong> during the search.For example, here is a sample in the C++ API which injects a solution at the beginning ofbranch & bound and then uses a branching goal:if (getNnodes() == 0)goal = AndGoal(OrGoal(SolutionGoal(goalvar,startVals),AndGoal(MyBranchGoal(getEnv(), var), goal)),goal);elsegoal = AndGoal(MyBranchGoal(getEnv(), var), goal);return goal;For more about this kind of special goal, see Injecting Heuristic Solutions on page 439.Aggregating GoalsSince And goals and Or goals take other goals as arguments, goals can be combined intoaggregate goals. In fact, this is how goals are typically used for specifying a branchingstrategy. A typical return goal of a user-written execute method for C++ looks like this:return AndGoal(OrGoal(var = IloFloor(val)+1), this);and for Java, it looks like this:return cplex.and(cplex.or(cplex.leGoal(var, Math.floor(val)),cplex.geGoal(var, Math.floor(val)+1)), this);and for C#.NET, it looks like this:return cplex.And(cplex.Or(cplex.GeGoal(_vars[bestj], System.Math.Floor(x[bestj])+1),cplex.LeGoal(_vars[bestj], System.Math.Floor(x[bestj]))),this);For the C++ case, note that since this statement would be called from the execute methodof a subclass of IloCplex::GoalI, the full name IloCplex::GoalI::OrGoal can beabbreviated to OrGoal. Likewise, the full name IloCplex::GoalI::AndGoal can beabbreviated to AndGoal.432 <strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!