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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

MyBranchGoal and there is no helper function for creating an instance of that class (as themacro does in the case of C++).The goal is then used for solving the extracted node by calling:cplex.solve(MyBranchGoal(env, var));for C++, or for Java:cplex.solve(new MyBranchGoal(var));instead of the usual cplex.solve. The rest of the main function contains nothing new andwill not be discussed any further.In the implementation of the goal, or more precisely its method execute, starts by declaringand initializing some arrays. These arrays are then used by methods of classIloCplex::GoalI (IloCplex.Goal or Cplex.Goal) to query information about thenode subproblem and the solution of its relaxation. The method getValues is used to querythe solution values for the variables in vars, method getObjCoefs is used to query thelinear objective function coefficients for these variables, and method getFeasibilitiesis used to query feasibility statuses for them. The feasibility status of a variable indicateswhether IloCplex considers the current solution value of the variable to be integer feasibleor not. IloCplex::GoalI (IloCplex.Goal or Cplex.Goal) provides a wealth of otherquery methods. For details, see the <strong>ILOG</strong> <strong>CPLEX</strong> Reference <strong>Manual</strong>s.Once you have gathered information about the variables, their objective coefficients, andtheir current feasibility statuses, compute the index of an integer infeasible variable in varsthat has the largest objective coefficients among the variables with largest integerinfeasibility. That index is recorded in variable bestj.Then create a new goal handle object res. By default, this is initialized to an empty goal.However, if an integer infeasible variable was found among those in vars, then variablebestj will be ≥ 0 and a nonempty goal will be assigned to res:res = AndGoal(OrGoal(vars[bestj] >= IloFloor(x[bestj])+1,vars[bestj]

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

Saved successfully!

Ooh no, something went wrong!