FRAMES NO FRAMES

Class IloPoolOperator

Definition file: ilsolver/iimoperator.h
Include file: <ilsolver/iim.h>
The pool operator class.

Pool operators are ILOG Solver related entities which take an input in the form of a solution pool and instantiate Solver's constrained variables to create a solution therein. Importantly, operators can be cast to processors (IloPoolProc). This cast operator results in a processor which will transform the so-instantiated solver into an instance of IloSolution, based on a given solution prototype.

You can define custom operators by using the ILOIIMOP0 macro (or a variant). Numerous built-in operators are also provided, easily accessible from IloEAOperatorFactory.

For the most part, pool operators can be thought of as standard Solver goals with the additional property that they have access to an input pool of solutions which they use to influence their behavior.

See Also:

Constructor Summary
public IloPoolOperator(IloGoal goal)

Creates an operator from a goal.

Method Summary
public voidaddListener(IloListener listener) const

Adds a listener to the operator.

public voidend()
public const char *getDisplayName() const

Get the display name of an operator.

public IloEnvgetEnv() const
public const char *getName() const
public IloAnygetObject() const
public IloSolutiongetPrototype() const

Returns the solution prototype.

public operator IloPoolProc() const

Casts a pool operator to a pool processor.

public IloPoolProcoperator()(IlcInt size) const

Specify the number of solutions to produce.

public voidremoveListener(IloListener listener) const

Removes a listener from an operator.

public voidsetName(const char * name) const
public voidsetObject(IloAny obj) const
public voidsetPrototype(IloSolution prototype) const

Sets the solution prototype.

Inner Class
IloPoolOperator::Event Event produced by pool operators.
IloPoolOperator::InvocationEvent The event produced by pool operators when they are invoked.
IloPoolOperator::SuccessEvent The event produced by pool operators when they are involved in the production of a solution.
Constructor Detail

IloPoolOperator

public IloPoolOperator(IloGoal goal)
Creates an operator from a goal.

This constructor creates an operator from a goal. When the created operator is executed, it will behave exactly as goal. Most often this constructor is useful when an operator needs to be combined with a goal using goal && op or op && goal. The constructor makes sure that a goal can be cast to an operator so that the && operator on pool operators can then be applied.

See Also:


Method Detail

addListener

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

This member function adds a listener to the operator. Depending on the type of listener added to the operator, based on either IloPoolOperator::InvocationEvent or IloPoolOperator::SuccessEvent, the listener will be activated when the operator is invoked, or when the operator participates in the production of a solution.

See Also:


end

public void end()
brief Destroys the object.

This function deletes the object from the environment on which it was allocated and sets the implementation pointer to zero.


getDisplayName

public const char * getDisplayName() const
Get the display name of an operator.

This member function returns the display name of the operator, which is useful for display purposes when type information is required on the operator. The name returned will be based on the function of the operator.


getEnv

public IloEnv getEnv() const
brief Returns the allocation environment.

This function returns the environment on which the invoking object was allocated.


getName

public const char * getName() const

This member function returns a character string specifying the name of the invoking object (if there is one).


getObject

public IloAny getObject() const

This member function returns the object associated with the invoking object (if there is one). Normally, an associated object contains user data pertinent to the invoking object.


getPrototype

public IloSolution getPrototype() const
Returns the solution prototype.

This member function returns the solution prototype set in the previous call to IloPoolOperator::setPrototype or an empty handle if none was set.


operator IloPoolProc

public operator IloPoolProc() const
Casts a pool operator to a pool processor.

This operator casts a pool operator to a pool processor. Objects of type IloPoolOperator can do very little work on their own; it is only in casting one to a processor that more useful work can be done with it.

When the cast operator is invoked, a pool processor is created which performs the following when invoked:

The resulting pool processor can be used with selectors and other processors via >> to create chains.


operator()

public IloPoolProc operator()(IlcInt size) const
Specify the number of solutions to produce.

This operator specifies the number of solutions to produce, which will be at least size solutions. The code op(n) is shorthand for IloPoolProc(op)(n) where op is of type IloPoolOperator and n is an integer.


removeListener

public void removeListener(IloListener listener) const
Removes a listener from an operator.

This member function removes a previously added listener from an operator. After the removal, listener will no longer be called when the operator is invoked or succeeds.


setName

public void setName(const char * name) const

This member function assigns name to the invoking object.


setObject

public void setObject(IloAny obj) const

This member function associates obj with the invoking object. The member function getObject accesses this associated object afterward. Normally, obj contains user data pertinent to the invoking object.


setPrototype

public void setPrototype(IloSolution prototype) const
Sets the solution prototype.

This member function sets the solution prototype. It indicates to an operator how the solution produced in constrained variables should be saved. When a solution needs to be created, the prototype is cloned and the Solver variables specified in the clone are saved using the IloSolution::store.

Setting the prototype in this manner is not normally necessary, unless quite specialized behavior is required for a particular operator. Normally, the prototype can be set more simply on an operator factory, ensuring that all operators produced by the factory will have the correct prototype. Even if this is not done, a prototype can be found by examination of the input pool of the processor which calls the operator.