Rule Designer API

ilog.rules.dvs.core
Interface IlrKPIResultAggregator

All Superinterfaces:
IlrInitializable, IlrSimulationKPI

public interface IlrKPIResultAggregator
extends IlrSimulationKPI

IlrKPIResultAggregator is the interface for the calculated key performance indicators (KPIs) during the parallel execution of a simulation.

Overview

IlrKPIResultAggregator is the interface for the calculated key performance indicators (KPIs) during the parallel execution of a simulation. The DVS format must use an IlrParallelScenarioProvider scenario provider. IlrKPIResultAggregator is used in combination with an IlrKPI, which provides the KPI calculation for each simulation part that is executed in parallel.

To use the IlrKPIResultAggregator you must define the calculation of the KPI in two steps:

  1. The simulation part KPI calculation step: For each simulation part that is executed concurrently, the SSP creates an instance of the IlrKPI class associated with the IlrKPIResultAggregator. This class performs the calculation of the KPI for the part, and is defined by the getKPIClassName() method.
  2. The aggregation step: All of the results IlrKPIResult calculated during the simulation part KPI calculation step are consolidated by the add(IlrKPIResult) method. This method is called by the SSP for each simulation part after the execution is terminated.

After the aggregation step has consolidated all of the results from all of the parts, the IlrSimulationKPI.getKPIResult() method is called by the SSP to retrieve the final KPI value for the complete simulation.

Example

The following example defines a KPI Result Aggregator that consolidates the results returned by the IlrKPI instance my.KPI:

 public class MyKPIResultAggregator implements IlrKPIResultAggregator {
 
   private int value = 0;

   public String getKPIClassName() {
      return "my.KPI";
   }
 
   public void add(IlrKPIResult result) throws IlrKPIException
   {
     if (result != null && result instanceof IlrKPIResultInteger) {
        IlrKPIResultInteger intPartialResult = (IlrKPIResultInteger) result;
        this.value += intPartialResult.getValue();
     } else {
      throw new IlrKPIException(new StringBuffer ("Can't add KPI result ").append(result).toString(), null);
     }
   }

   public IlrKPIResult getKPIResult() throws IlrKPIException {
     IlrKPIResultInteger kpiResult = new IlrKPIResultInteger();
     kpiResult.setValue(this.value);
     kpiResult.setKPIClassName(this.getClass().getName());
     return kpiResult;
   }
 
 }
 

Since:
8.0

Method Summary
 void add(IlrKPIResult kpiResult)
          Adds the result of a KPI calculated for a part of the simulation, or scenario suite.
 String getKPIClassName()
          Returns the class name of the IlrKPI implementation that performs the KPI calculation for each part of the simulation.
 
Methods inherited from interface ilog.rules.dvs.core.IlrSimulationKPI
close, getKPIResult
 
Methods inherited from interface ilog.rules.dvs.core.IlrInitializable
initialize
 

Method Detail

getKPIClassName

String getKPIClassName()
Returns the class name of the IlrKPI implementation that performs the KPI calculation for each part of the simulation.

Returns:
The class name of the IlrKPI implementation that performs the KPI calculation for each part of the simulation.
See Also:
IlrKPI

add

void add(IlrKPIResult kpiResult)
         throws IlrKPIException
Adds the result of a KPI calculated for a part of the simulation, or scenario suite. This method is called at the end of the execution of each part.

Throws:
IlrKPIException
Parameters:
kpiResult - The result of the simulation part, which is calculated by the IlrKPI instance returned by the getKPIClassName() method.

Rule Designer API

© Copyright IBM Corp. 1987, 2013