Optimisation Calculations
Akumen has a calculation function for performing basic optimisations. Optimisations come in 3 types:
- Optimise - Runs multiple iterations until the target value is reached by the objective function
- Minimise - Runs multiple iterations with an attempt to minimise the objective function
- Maximise - Runs multiple iterations with an attempt to maximise the objective function
The syntax for Optimise is:
optimise(numParticles, maxIterations, [evaluationNode], targetValue, solvePrecision, [first_input], first_input_lower_bound, first_input_upper_bound, ...)
The syntax for Minimise and Maximise is:
minimise(numParticles, maxIterations, [evaluationNode], [first_input], first_input_lower_bound, first_input_upper_bound, ...)
maximise(numParticles, maxIterations, [evaluationNode], [first_input], first_input_lower_bound, first_input_upper_bound, ...)
where:
Parameter | Description |
---|---|
numParticles |
This is the size of the solution space. Start of small (eg 10), then work up from there. Remember, the larger the solution space, the longer it’ll take to solve |
maxIterations |
The maximum number of iterations before the solver will stop. Again, start of small, and if it’s not solver increase this. Note that this will also impact on performance of your driver model if it’s too large |
evaluationNode |
This is the node that will be evaluated, ie the objective function |
targetValue |
Only used for the optimise mode - the value that the optimiser will try and hit |
solvePrecision |
Only used for the optimise mode - precision to use when trying to hit the target, for example 2 would solve to 2 decimal places |
first_input |
The first input to use in the solve |
first_input_lower_bound |
The lower bound (constraint) of the first input |
first_input_upper_bound |
The upper bound (constraint) of the first input |
The minimum requirement is one input. If any more are required, follow the same pattern as above - input, lower, upper.
There is a hard maximum of 5 inputs that can be used to perform an optimisation
There are performance implications on large settings for numParticles and maxIterations. Ensure these are set at an appropriate level to manage the performance of the driver model.
Getting the inputs
Occasionally the min/max or optimised value is not the only result that is required. You might also need to access the inputs that were used to generate the optimal result. This can be done using a second calculation node, and using:
optimiseinput([optimiseNode], [optimiseInputNode])
minimiseinput([minimiseNode], [minimiseInputNode])
maximiseinput([maximiseNode], [maximiseInputNode])
To determine if optimise has converged, create a new calculation node using the following expression:
optimiseerror([optimiseNode])
This will show how far away from the target value was achieved.