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.

When <strong>ILOG</strong> <strong>CPLEX</strong> processes one of the subnodes that have been created by the Or goal, itwill pop and execute the first goal from the node's goal stack. As you just saw, this will be alocal cut goal. Thus <strong>ILOG</strong> <strong>CPLEX</strong> adds the constraint to the node problem and re-solves therelaxation. Next, this will be popped from the goal stack and executed. This means that thesame search strategy as implemented in the original goal is applied at that node.Memory Management and GoalsJava and .NET use garbage collection to handle all memory management issues. Thus thefollowing applies only to the C++ library. Java or .NET users may safely skip ahead to Cutsand Goals on page 437.To conserve memory, in the C++ API, <strong>ILOG</strong> <strong>CPLEX</strong> only stores active nodes of the tree anddeletes nodes as soon as they become inactive. When deleting nodes, <strong>ILOG</strong> <strong>CPLEX</strong> alsodeletes the goal stacks associated with them, including all goals they may still contain. Inother words, <strong>ILOG</strong> <strong>CPLEX</strong> takes over memory management for goals.It does so by keeping track of how many references to every goal are in use. As soon as thisnumber drops to zero (0), the goal is automatically deleted. This technique is known asreference counting.<strong>ILOG</strong> <strong>CPLEX</strong> implements reference counting in the handle class IloCplex::Goal. EveryIloCplex::GoalI object maintains a count of how many IloCplex::Goal handleobjects refer to it. The assignment operator, the constructors, and the destructor of classIloCplex::Goal are implemented in such a way as to keep the reference count up-to-date.This means that users should always access goals through handle objects, rather thankeeping their own pointers to implementation objects.Other than that, nothing special needs to be observed when dealing with goals. In particular,goals don't have end methods like other handle classes in the C++ API of <strong>ILOG</strong> ConcertTechnology. Instead, <strong>ILOG</strong> <strong>CPLEX</strong> goal objects are automatically deleted when no morereferences to them exist.Local cut goals contain IloRange objects. Since the IloRange object is only applied whenthe goal is executed, method end must not be called for a range constraint from which alocal cut goal is built. The goal will take over memory management for the constraints andcall method end when the goal itself is destroyed. Also, an IloRange object can only beused in exactly one local cut goal. Similarly, method end must not be called forIloRangeArray objects that are passed to local cut goals. Also such arrays must notcontain duplicate elements.Going back to example ilogoalex1.cpp, you see that the method end is called for thetemporary arrays x, obj, and feas at the end of the execute method. Though a bit hidden,two IloRange constraints are constructed for the goal, corresponding to the arguments ofthe Or goal. <strong>ILOG</strong> <strong>CPLEX</strong> takes over memory management for these two constraints as436 <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!