Rule Designer API

ilog.rules.dvs.core
Interface IlrParallelScenarioProvider

All Superinterfaces:
IlrInitializable, IlrScenarioProvider

public interface IlrParallelScenarioProvider
extends IlrScenarioProvider

IlrParallelScenarioProvider extends the capabilities of the IlrScenarioProvider interface to enable parallel execution of a simulation in the SSP.

You must implement IlrParallelScenarioProvider to perform parallel execution of a simulation. An instance of this provider specifies how a simulation is partitioned using a list of scenario suite parts. The SSP uses this list to distribute the simulation cases to multiple parallel processors or threads. Each part is then consolidated using the two step algorithm implemented by the IlrKPIResultAggregator KPI implementation.

The lifecycle of a parallel scenario provider is as following:
  1. The first instance of the parallel scenario provider is created by the SSP using reflection (a constructor that takes no arguments is expected for all implementations of IlrParallelScenarioProvider).
  2. The SSP then calls the IlrInitializable.initialize(IlrScenarioSuiteExecutionContext) method of the parallel scenario provider. At this stage, the IlrScenarioSuiteExecutionContext.getCurrentScenarioSuitePart() method of the initialization parameter returns null.
  3. After the initialization is performed, the SSP calls the getScenarioSuiteParts() method to retrieve the list of parts.
  4. After the simulation parts are retrieved, the SSP calls the IlrScenarioProvider.getScenarioCount() method to retrieve the total number of scenarios.
For each simulation part, the SSP performs the following operations:
  1. A new instance of the parallel scenario provider is created by the SSP using reflection.
  2. The SSP then calls the IlrInitializable.initialize(IlrScenarioSuiteExecutionContext) method of the new parallel scenario provider instance. At this stage, the IlrScenarioSuiteExecutionContext.getCurrentScenarioSuitePart() method returns the simulation part that initialized the parallel scenario provider instance.
  3. The SSP then calls @link #getScenarioAt(int)} for each of the indexes in the simulation part (starting from the first index, and finishing with the last).
  4. At the end of the execution, the SSP calls the IlrScenarioProvider.close() method. After all of the simulation parts are executed, the IlrScenarioProvider.close() method of the first parallel scenario provider instance is then called.

Example

The following example extends a non-parallel scenario provider to split a simulation into two parts of equal length:

 public class SampleParallelScenarioProvider extends AnExistingNonParallelScenarioProvider {
  
    public List getScenarioSuiteParts() {
        int numberOfScenario = getScenarioCount();
        int numberOfParts = 2;
        return IlrScenarioSuitePart.getBalancedListOfScenarioSuiteParts(numberOfScenario, numberOfParts);
    } 
 }
 

Since:
8.0
See Also:
IlrKPIResultAggregator

Nested Class Summary
static class IlrParallelScenarioProvider.IlrScenarioSuitePart
          Defines a simulation part that can be distributed by the SSP to a dedicated processor or thread.
 
Method Summary
 List<IlrParallelScenarioProvider.IlrScenarioSuitePart> getScenarioSuiteParts()
          Returns the list of parts to be used for the parallel execution of the simulation.
 
Methods inherited from interface ilog.rules.dvs.core.IlrScenarioProvider
close, getScenarioAt, getScenarioCount
 
Methods inherited from interface ilog.rules.dvs.core.IlrInitializable
initialize
 

Method Detail

getScenarioSuiteParts

List<IlrParallelScenarioProvider.IlrScenarioSuitePart> getScenarioSuiteParts()
                                                                             throws IlrScenarioProviderException
Returns the list of parts to be used for the parallel execution of the simulation.

Throws:
IlrScenarioProviderException
Returns:
The list of parts to be used by the SSP to execute a simulation concurrently in multiple processors or threads. For each part of the list, the SSP creates a new instance of the scenario provider and iterates through the range of indexes defined for the part. The KPI result calculated for each part is then consolidated by an instance of IlrKPIResultAggregator.

Rule Designer API

© Copyright IBM Corp. 1987, 2013