In previous posts we talked about how to compile and run the Borg Matlab wrapper on Windows and OSX/Linux. To run the optimization after everything is compiled, the function call looks like this:
[vars, objs] = borg(11, 2, 0, @DTLZ2, 1000, zeros(1,11), ones(1,11), 0.01*ones(1,2), parameters);
In order, the arguments are:
- number of decision variables - number of objectives - number of constraints - handle to function to be optimized - number of function evaluations to perform - decision lower bounds - decision upper bounds - epsilon values - parameters
The last argument parameters
is the topic of this post. This is a cell array that allows you to set the parameters without recompiling anything. For example, to set the random seed, you might do this:
parameters = {'rngstate', 12345, 'initialPopulationSize', 200, 'de.stepSize', 0.3}
before running the borg()
function with parameters
as the last argument. Notice this follows the Matlab cell array options format of {key, value, key, value ...}
, so there must be an even number of items in the cell array.
Using the nativeborg.cpp
file I tracked down all of the parameters (string keys) that the user can choose:
'rngstate': random seed 'initialPopulationSize' 'minimumPopulationSize' 'maximumPopulationSize' 'injectionRate' 'selectionRatio' 'maxMutationIndex' 'frequency': (for saving approximation sets during runtime) // these two are enumerated types in the C code, not advised to change them 'restartMode' 'probabilityMode' // operator-specific parameters 'pm.rate' 'pm.distributionIndex' 'sbx.rate' 'sbx.distributionIndex' 'de.crossoverRate' 'de.stepSize' 'um.rate' 'spx.parents' 'spx.epsilon' 'pcx.parents' 'pcx.eta' 'pcx.zeta' 'undx.parents' 'undx.zeta' 'undx.eta'
That’s all, thanks to Liz Houle at Boulder for the suggestion.
Pingback: Water Programming Blog Guide (Part I) – Water Programming: A Collaborative Research Blog
Pingback: Update on setting up the Borg Matlab Wrapper on Windows and tips for its use – Water Programming: A Collaborative Research Blog