Optimization Algorithms#
Class Family Overview#
All optimization algorithms, regardless of their nature, are represented by classes implementing the OptimizationAlgorithm
interface. Since optimization algorithms are very diverse, the OptimizationAlgorithm
interface only requires a single method to be implemented: the minimize
method.
Summary of Optimization Algorithm Classes#
Class Name |
Class Type |
Class Description |
---|---|---|
|
Abstract |
Interface for all optimization algorithm child classes. |
|
Abstract |
Interface for all optimization algorithm child classes optimizing problems in binary decision spaces. |
|
Abstract |
Interface for all optimization algorithm child classes optimizing problems in integer decision spaces. |
|
Abstract |
Interface for all optimization algorithm child classes optimizing problems in real decision spaces. |
|
Abstract |
Interface for all optimization algorithm child classes optimizing problems in subset decision spaces. |
|
Concrete |
General genetic algorithm for optimizing single-objective problems in binary decision spaces. |
|
Concrete |
General genetic algorithm for optimizing single-objective problems in integer decision spaces. |
|
Concrete |
General genetic algorithm for optimizing single-objective problems in real decision spaces. |
|
Concrete |
General genetic algorithm for optimizing single-objective problems in subset decision spaces. |
|
Concrete |
NSGA-II genetic algorithm for optimizing multi-objective problems in binary decision spaces. |
|
Concrete |
NSGA-II genetic algorithm for optimizing multi-objective problems in integer decision spaces. |
|
Concrete |
NSGA-II genetic algorithm for optimizing multi-objective problems in real decision spaces. |
|
Concrete |
NSGA-II genetic algorithm for optimizing multi-objective problems in subset decision spaces. |
|
Concrete |
Steepest descent hill-climbing algorithm for optimizing single-objective problems in subset decision spaces. |
Loading Optimization Algorithm Modules#
Importing optimization algorithm classes can be accomplished using the following import statements:
# import OptimizationAlgorithm classes (abstract interface classes)
from pybrops.opt.algo.OptimizationAlgorithm import OptimizationAlgorithm
from pybrops.opt.algo.BinaryOptimizationAlgorithm import BinaryOptimizationAlgorithm
from pybrops.opt.algo.IntegerOptimizationAlgorithm import IntegerOptimizationAlgorithm
from pybrops.opt.algo.RealOptimizationAlgorithm import RealOptimizationAlgorithm
from pybrops.opt.algo.SubsetOptimizationAlgorithm import SubsetOptimizationAlgorithm
# import Genetic Algorithm classes (concrete implementation classes)
from pybrops.opt.algo.BinaryGeneticAlgorithm import BinaryGeneticAlgorithm
from pybrops.opt.algo.IntegerGeneticAlgorithm import IntegerGeneticAlgorithm
from pybrops.opt.algo.RealGeneticAlgorithm import RealGeneticAlgorithm
from pybrops.opt.algo.SubsetGeneticAlgorithm import SubsetGeneticAlgorithm
# import NSGA-II Genetic Algorithm classes (concrete implementation classes)
from pybrops.opt.algo.NSGA2BinaryGeneticAlgorithm import NSGA2BinaryGeneticAlgorithm
from pybrops.opt.algo.NSGA2IntegerGeneticAlgorithm import NSGA2IntegerGeneticAlgorithm
from pybrops.opt.algo.NSGA2RealGeneticAlgorithm import NSGA2RealGeneticAlgorithm
from pybrops.opt.algo.NSGA2SubsetGeneticAlgorithm import NSGA2SubsetGeneticAlgorithm
# import steepest descent hill climber algorithm (concrete implementation class)
from pybrops.opt.algo.SteepestDescentSubsetHillClimber import SteepestDescentSubsetHillClimber
Constructing Optimization Algorithms#
Within PyBrOpS there are several pre-built optimization problems. The following code examples below illustrate the construction of example single- and multi-objective optimization algorithms.
Single-objective optimization algorithms#
The code below demonstrates the construction of a single-objective real-valued genetic algorithm.
# create a real-valued single-objective genetic algorithm
soalgo = RealGeneticAlgorithm(ngen = 100, pop_size = 100)
Multi-objective optimization algorithms#
The code below demonstrates the construction of a multi-objective real-valued NSGA-II genetic algorithm.
# create a real-valued multi-objective genetic algorithm
moalgo = NSGA2RealGeneticAlgorithm(ngen = 100, pop_size = 100)
Minimizing Optimization Problems#
Minimizing an optimization problem can be accomplished using the minimize
method. Examples of how to use this method for single- and multi-objective problems are illustrated below. Intuitively, single-objective optimization algorithms should be used to optimize single-objective optimization problems, and multi-objective optimization algorithms should be used to optimize multi-objective optimization problems.
Optimization of single-objective problems#
# minimize single-objective problem and get solution
sosoln = soalgo.minimize(prob = soprob)
Optimization of multi-objective problems#
# minimize multi-objective problem and get solution
mosoln = moalgo.minimize(prob = moprob)