FRAMES NO FRAMES

Class IloPoolProc

Definition file: ilsolver/iimiloproc.h
Include file: <ilsolver/iim.h>
Pool processor.

An IloPoolProc is an object dedicated to solution pool processing. Such pool processors can be chained together using the >> operator of the C++ language. This chaining specifies how pool elements flow between processors. For example, the following code solves a goal composed by chaining solution processors:

 IloSolutionPool initialPool = ...;
 IloPoolProc producer = ...;
 IloPoolProc consumer = ...;
 IloSolutionPool resultPool = ...;
 solver.solve(IloExecuteProcessor(
   initialPool >> producer(10) >> consumer >> resultPool
 ));
 

The >> operator is overloaded so that:

The () operator is overloaded and used to specify how many pool elements should be generated by a processor. In the above example, the code specifies that producer should generate ten solutions.

Constructor Summary
public IloPoolProc(IloSolutionPool pool)

Creates a pool processor from a solution pool.

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

Get the "display name" of a processor.

public IloEnvgetEnv() const
public const char *getName() const
public IloAnygetObject() const
public IloPoolProcoperator()(IlcInt size) const

Specifies the desired number of outputs to a processor.

public voidsetName(const char * name) const
public voidsetObject(IloAny obj) const
Constructor Detail

IloPoolProc

public IloPoolProc(IloSolutionPool pool)
Creates a pool processor from a solution pool.

This constructor creates a processor from a solution pool. The created processor acts as a type of synchronizer such that the solutions transferred on the resulting processor's output port will also be placed in the solution pool pool passed as argument.

The behavior of the created processor will depend upon its environment, and in particular, if the processor is supplied an input using a >> to its left. If the processor is supplied an input, then the processor places that input into pool, while also transferring to the output. If, on the other hand, the processor is not supplied any input, then the contents of pool are placed on the output.

Assuming you have "population" and "offspring" pools as well as a processor "proc" able to process the population to produce offspring, you can perform a processing chain such as:

  IloPoolProc chain = population >> proc >> offspring;
 

where the population pool feeds the processor proc, whose result is stored in the offspring pool.

Note
It is often convenient to insert a pool in a processing chain for debugging purposes. For monitoring pool dynamics, you can add listeners to the pool to be notified when its state changes.

See Also:


Method Detail

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 a processor.

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


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.


operator()

public IloPoolProc operator()(IlcInt size) const
Specifies the desired number of outputs to a processor.

This operator creates a new pool processor that wraps the invoked pool processor and retrieves the number of elements specified by size. This operator is used to specify the number of outputs to a processor.

The following code initializes a population with populationSize solutions. In this particular case, the () operator is applied to the processor returned by the randomize method of the IloEAOperatorFactory factory:

    solver.solve(IloExecuteProcessor(
      env, factory.randomize("rand")(populationSize) >> population
    ));

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.