Skip to content

Development Guide

Jake Mikouchi edited this page Jul 15, 2026 · 4 revisions

Adding Problem Modules

Code developers may want to add new problem modules to expand MIDAS capabilities and allow it to optimize the problem they desire. Given the modular nature of MIDAS, the only requirement of new modules is that the inputs and outputs are consistent. Despite this, for easier implementation of new modules, it is recommended that the problem modules have a primary function named 'evaluate' that all secondary functions are called from.

The input to every problem module is a single solution object (note that the problem module is called using the multiprocessing library) as well as the input object which contains all input values from the yaml file. The solution object contains many attributes unique to the problem solution including a name and the chromosome. MIDAS assumes that all functions required to evaluate the performance of the input chromosome are conducted in the problem module. This includes constructing input files for external codes, running external codes, and post processing values from the external codes. parcs343.py is a good point of reference to see how these functions can be performed.

The output of every problem module is the same solution object which has been updated to contain the deign objectives (called parameters internally) which are needed to perform the optimization. Old problem modules required that objectives had names matching the objectives defined in the yaml file, this has since been changed so that any name can be used, but a 'output_index' must be provided which designates that parameter of specified index is used in the optimization. levy_func.py is a good point of reference to see how this is done in practice.

Integrating into MIDAS

  1. Have completed module with 'evaluate' function
  2. Add new module to import block of optimizer.py.
  3. Define new eval_func in build_optimizer function of optimizer.py.
  4. (optional) Add new problem module to list of available codes in input_parser.py.

Adding Algorithm Modules

Code developers may want to add new algorithms modules to expand the optimization methods available in MIDAS. Given the modular nature of MIDAS, the only requirement of new modules is that the inputs and outputs are consistent. Despite this, for easier implementation of new modules, it is recommended that the algorithm modules have a primary function named 'reproduction' that all secondary functions are called from.

The input to every algorithm module is the population of solution objects from the previous generation and the generation object which holds the generation number. MIDAS assumes that all functions required to generate new chromosomes are performed within the algorithm module.

The output of every algorithm is a list containing each newly generated chromosomes. Developers should note that solution evaluation is performed through a separate module and this evaluation happens after the algorithm module creates the new set of chromosomes. Algorithms will often require that a solution be evaluated before secondary optimization functions occur. This can usually be worked around without affecting optimization dynamics by changing the sequence of events in the algorithm. This can be seen clearly in Simulated_Annealing.py where the primary individual is selected at the beginning of an iteration rather than the end where it is typical selected.

Integrating into MIDAS

  1. Have completed module with 'reproduction' function
  2. Add new module to import block of optimizer.py.
  3. Define new alogrithm in build_optimizer function of optimizer.py.
  4. (optional) Add new algorithm module to list of available codes in input_parser.py.

Adding New core sizes

Clone this wiki locally