Reading Input Arguments for the Incrementation Value and Iteration Number

  1. Reading input arguments for the increment value and the number of iteration
  2. Registering the variables to increment
  3. Registering the targets to have in the report
  4. Implementing the incrementation of the variables
  5. Implementing the reception of the new measures
  6. Implementing the check to finish the iteration loop
  7. Outputting a report file

The plugin must implement a constructor that takes a string for arguments. For the example, a simple comma separated list is used to keep everything simple.

This code provides you with the arguments of your optimization.

To do this, you have to change the scaffolding constructor to have the following:

private double _incrementValue = 0;
private int _iterationNumber = 0;

public PluginSample(string arguments)
{
    // splint the list of parameters
    var argumentsList=  arguments.Split(',');

    // check that the argument list represents the number of arguments that we need
    if(argumentsList.Length != 2)
    {
        throw new ArgumentException("We should only have two arguments");
    }

    // try to read the first argument as the increment value
    if (double.TryParse(argumentsList[0], out var incrementValue))
    {
        _incrementValue = incrementValue;
    }
    else
    {
        throw new ArgumentException("first argument cannot be read as a double for increment value");
    }

    // try the read the second argument as the iteration number
    if (int.TryParse(argumentsList[1], out var iterationNumber))
    {
        _iterationNumber = iterationNumber;
    }
    else
    {
        throw new ArgumentException("second argument cannot be read as a int for iteration number");
    }
}