FRAMES NO FRAMES

Class IloSolutionPool

Definition file: ilsolver/iimpool.h
Include file: <ilsolver/iim.h>
A pool of solutions.

Solution pools are bags of solutions which can be used:

For example, the following code uses the buffer pool to store intermediate solutions which will be processed by the consumer processor, then stored in the result pool:

 IloSolutionPool buffer(env);
 IloSolutionPool result(env);
 IloPoolProc producer = ...; // a processor which generates solutions
 IloPoolProc consumer = ...; // a processor which transforms solutions

 IloPoolProc proc = producer >> buffer >> consumer >> result;
 
Note
IIM provides a default visitor for IloSolutionPool. Thus, selection of a solution from a pool can be performed without specification of a visitor.

See Also:

Constructor Summary
public IloSolutionPool(const IloAnyPool & obj)
public IloSolutionPool(IloEnv env, const char * name=0)
Method Summary
public voidadd(IloSolution elt) const
public voidaddAll(IloSolutionPool pool) const
public voidaddListener(IloListener listener) const
public voidcopy(IloSolutionPool pool) const
public voidend()
public voidendSolutions() const
public IloComparator< IloSolution >getDefaultComparator() const
public IloEnvgetEnv() const
public IloIntgetSize() const
public IloComparator< IloSolution >getSortComparator() const
public voidremove(IloInt index) const
public voidremove(IloSolution elt) const
public voidremoveAll() const
public voidremoveAll(IloSolutionPool pool) const
public voidremoveListener(IloListener listener) const
public voidsetSortComparator(IloComparator< IloSolution > cmp) const
public voidsort() const
public voidsort(IloComparator< IloSolution > cmp) const
Inner Class
IloSolutionPool::AddedEvent
IloSolutionPool::EndEvent
IloSolutionPool::Event
IloSolutionPool::Iterator
IloSolutionPool::RemovedEvent
Constructor Detail

IloSolutionPool

public IloSolutionPool(const IloAnyPool & obj)
brief Constructs an 0 from an 1.

Type checking is performed to make sure that obj was constructed as an 0. If this was not the case an exception is thrown (an instance of IloException).


IloSolutionPool

public IloSolutionPool(IloEnv env, const char * name=0)
brief Creates a pool for storing objects of type 1.

This constructor creates a pool for storing objects of type 1 on the environment env.


Method Detail

add

public void add(IloSolution elt) const
brief Adds an element to the pool.

This function adds an element elt, an instance of 1, to the pool.


addAll

public void addAll(IloSolutionPool pool) const
brief Adds all the instances of 1 contained in the given pool to the invoking pool.

This function adds all the instances of 1 in the pool pool to the invoking pool.


addListener

public void addListener(IloListener listener) const
brief Adds a listener to the pool.

This function adds a listener listener to the pool. According to the event type of the listener, the listener will be called when the pool has an element added or deleted, or when the pool itself is destroyed.

See Also:


copy

public void copy(IloSolutionPool pool) const
brief Copies elements from another pool into the invoking pool.

This function copies elements from the pool pool into the invoking pool. All elements previously in the invoking pool will first be removed. After execution, both pools will contain the same elements.


end

public void end()
brief Destroy the pool.

This function destroys the invoking pool, but not its contents.


endSolutions

public void endSolutions() const
brief Destroys all items contained in this 0.

This function destroys all items contained in this 0.


getDefaultComparator

public IloComparator< IloSolution > getDefaultComparator() const
brief Returns the default object comparator which is inherent to the type of pool.

This function returns the default object comparator which is inherent to the type of pool. Normally, you would never call this function directly. It is typically called from getSortComparator when no sorting comparator has been set on the pool. For example, IloSolutionPool delivers IloBestSolutionComparator here.

See Also:


getEnv

public IloEnv getEnv() const
brief Delivers the environment passed at construction time.

This function returns the environment passed in the constructor.


getSize

public IloInt getSize() const
brief Delivers the number of elements comprising the pool.

This function returns the number of elements in the pool.


getSortComparator

public IloComparator< IloSolution > getSortComparator() const
brief Returns the comparator used for comparing elements of the pool.

This function returns the comparator previously set using setSortComparator. If no sorting comparator has been set, then the comparator returned is that from getDefaultComparator.


remove

public void remove(IloInt index) const
brief Removes the 1 located at the given index from the pool.

This function removes the instance of 1 located at the given index index from the pool.


remove

public void remove(IloSolution elt) const
brief Removes the given 1 from the pool.

This function removes elt, an instance of 1, from the pool.


removeAll

public void removeAll() const
brief Removes all the instances of 1 from the pool.

This function removes all the instances of 1 from the pool.


removeAll

public void removeAll(IloSolutionPool pool) const
brief Removes from this pool all the instances of 1 contained in the given pool.

This function removes all the instances of 1 contained in the pool pool.


removeListener

public void removeListener(IloListener listener) const
brief Removes a listener from a pool.

This function removes the listener listener from the invoking pool. After execution of this member function, listener will no longer be called when the pool is modified or destroyed.


setSortComparator

public void setSortComparator(IloComparator< IloSolution > cmp) const
brief Sets the comparator used for comparing elements of the pool.

This function sets the comparator cmp used for comparing elements of the pool. The comparator set by this method will be used by the pool for comparing elements, particularly during the sorting of the pool, and in retrieving the best and worst elements.

See Also:


sort

public void sort() const
brief Sorts the pool using the comparator returned from getSortComparator.

This function sorts the pool using the comparator returned from getSortComparator. After sorting, the indices of the sorted elements are smaller for preferred elements. In other words, the objects are ranked "best first".

See Also:


sort

public void sort(IloComparator< IloSolution > cmp) const
brief Sorts the pool using the given comparator.

This function sorts the pool using the comparator cmp. After sorting, the indices of the sorted elements are smaller for preferred elements. In other words, the objects are ranked "best first".