Optimization Plugin Template

The following code corresponds to the basic scaffolding of the optimization plugin.

In the Plugin Complete page, you can see the full plugin example written based on this scaffolding.

namespace OptimPluginSample
{
    public class PluginSample
    {
        private readonly string _arguments;
        public PluginSample(string arguments)
        {
            _arguments=arguments;
        }
        /// <summary>
        ///     Callback called upon starting the optimization loop (optional)
        /// <summary>
        public void StartRun()
        {
        }
        /// <summary>
        ///     Callback called upon starting a new iteration in the optimization loop
        /// <summary>
        /// <param name="iteration">the iteration that is starting</param>
        /// <returns> whether we should continue on this iteration or not</returns>
        public bool StartIteration(int iteration)
        {
            return false;
        }
        /// <summary>
        ///     Callback called upon ending an iteration   (optional)
        /// <summary>
        /// <param name="iteration">the iteration that is ending</param>
        public void EndIteration(int iteration)
        {
        }
        /// <summary>
        ///     Called to return the new value to set for this parameter
        /// <summary>
        public double GetNewValue(string parameterId)
        {
            return 0;
        }
        /// <summary>
        ///     Called to register a new variable as input
        /// <summary>
        public void AddVariable(string parameterId, string parameterUserName, double startingValue, double min, double max)
        {
        }
        /// <summary>
        ///    Called to register a new target as output (optional)
        /// <summary>
        public void AddTarget(string parameterId, string parameterUserName, double startingValue, double targetValue, double weight)
        {
        }
        /// <summary>
        ///     Callback called after the simulation's update to update the values of the targets
        /// <summary>
        /// <param name="parameterId"/>
        /// <param name="value"/>
        public void SetMeasures(string parameterId, double value)
        {
        }
        /// <summary>
        ///     Callback called to inform the simulation details
        /// <summary>
        /// <param name="simulationName"/>
        /// <param name="reportPath"/>
        public void SetSimulationInfos(string simulationName, string reportPath)
        {
        }
    }
}