Setup Optimo Version 0.0.5
1. Download Optimo .dll file Here.
2. Once you download the package, the .dll files might be blocked. In order to enable the dlls, right click on each file and click Properties. Under “General” tab, on the bottom check if there is Security item appears, then Click Unblock button to enable the dlls.
3. Open Dynamo 0.7.2 or a newer version, go to “Libraries” tab and click “Import Library…” and select the “Optimo.dll” from the folder that you have saved the .dll file.
Setup Dynamo Code for Optimo Version 0.0.5
Setting up the Dynamo code below:
The NSGA_II.InitialSolutionList node creates a list of numbers(initial population) within the range specified and with the number of defined variables. The number of variables can be changed by adding or removing an index to the List.Create node (both for upper and lower limits, they must have the same number of indexes).
The population size is simply the number of elements defined in the population node. The objectives are the functions that are going to be optimized.
The output of the NSGA_II.InitialSolutionList node is a list of lists (lists of variables and objectives). The objectives are all zero when they come out of InitialSolutionList and will be overwritten when the fitness functions are specified.
Any population can be taken from the initial list of populations and can be used as an input to the fitness functions. For instance, in the image below, the first and only variable list is being used to drive two fitness functions: x^2 and (x-2)^2. These functions form the SCH optimization problem, which is being used as an example. You can replace the SCH functions (Schaffer function N.1 http://en.wikipedia.org/wiki/Test_functions_for_optimization) in the main graph and NSGA-II function to create your own optimization problem.
Objective functions can be added and removed, but the numObjectives input has to match the number of objective functions.
After the objective functions are calculated, they overwrite the zeroes that were created in the initial population node. This happens in the NSGA_II-AssignFitnessFuncResults.
The Dynamo code below is contained inside of the NSGA_II Function custom node. The function of this node is to run the NSGA II algorithm recursively to generate the specified number of generations. The first input to this custom node, "init" is a list containing two elements.
The first element in the list is a counter which keeps track of the number of times the algorithm has run.
The second element in the list is the population from the previous generation. This gets fed into the NSGA_II.GenerationAlgorithm as an input along with the lowerLimits and upperLimits (which serve the same purpose as in the main Dynamo file). The Generation Algorithm creates a new population based on the previous generation. This new generation is then tested with the same fitness functions as the main Dynamo file (x^2 and (x-2)^2), and the fitness function results override the objectives in this new generation.
The NSGA_II.Sorting node takes the previous generation as well as the current generation, and re-arranges them in order based on their fitness (best results first).
The result gets added to a list which contains all of the previous generations' data. The data from all of the generations will be exported to a file when the algorithm finishes running.
The Dynamo code below is contained inside of the NSGA_II Loop custom node. This node is essentially running the code in the NSGA_II Function node recursively. The amount of times the code runs is dependent on the completionCheck input. The init input gets incremented by one each time the code runs, and once init reaches the same value as completionCheck, the loop ends and the Dynamo code continues. The mutator input is the result from the NSGA_II function (it becomes the input for the recursive call to the NSGA_II Function node).