Implementing the Reception of the New Measures
- Reading input arguments for the increment value and the number of iteration
- Registering the variables to increment
- Registering the targets to have in the report
- Implementing the incrementation of the variables
- Implementing the reception of the new measures
- Implementing the check to finish the iteration loop
- Outputting a report file
Here, you need to set the new value of the target and save them to create the report.
// list of the values for each iteration
private IList<IDictionary<string,double>> _iterationResults = new List<IDictionary<string,double>>();
/// ....
/// <summary>
/// Callback called upon ending an iteration (optional)
/// </summary>
/// <param name="iteration">the iteration that is ending</param>
public void EndIteration(int iteration)
{
// copying the list of values for this iteration
_iterationResults.Add(_targetValues.ToDictionary(entry => entry.Key, entry => entry.Value));
}
/// ....
/// <summary>
/// Callback called after the simulation's update to update the values of the targets
/// </summary>
/// <param name="parameterId"></param>
/// <param name="value"></param>
public void SetMeasures(string parameterId, double value)
{
_targetValues[parameterId] = value;
}