Optimization Solutions#
Class Family Overview#
All optimization solutions in PyBrOpS
are represented using classes derived from the Solution
interface in the pybrops.opt.soln
submodule. All classes derived from the Solution
interface contain metadata pertaining to the decision space, the objective space, inequality and equality constraints, and the identified solution(s) for the optimization. The purpose of the Solution
family of classes is essentially to store the results of an optimization.
Summary of Optimization Solution Classes#
Optimization solution interfaces and implemented classes can be found in the pybrops.opt.soln
module within PyBrOpS. These classes are summarized below.
Class Name |
Class Type |
Class Description |
---|---|---|
|
Semi-Abstract |
Interface for all optimization solution child classes. |
|
Concrete |
Class representing optimization solutions in binary decision spaces. |
|
Concrete |
Class representing optimization solutions in integer decision spaces. |
|
Concrete |
Class representing optimization solutions in real decision spaces. |
|
Concrete |
Class representing optimization solutions in subset decision spaces. |
Loading Optimization Solution Modules#
Importing optimization solution classes can be accomplished using the following import statements:
# import the Solution class (a semi-abstract interface class)
from pybrops.opt.soln.Solution import Solution
# import the BinarySolution class (a semi-abstract interface class)
from pybrops.opt.soln.BinarySolution import BinarySolution
# import the IntegerSolution class (a semi-abstract interface class)
from pybrops.opt.soln.IntegerSolution import IntegerSolution
# import the RealSolution class (a semi-abstract interface class)
from pybrops.opt.soln.RealSolution import RealSolution
# import the SubsetSolution class (a semi-abstract interface class)
from pybrops.opt.soln.SubsetSolution import SubsetSolution
Constructing Solutions#
Optimization solutions can be created using their corresponding constructors. The two examples below illustrate the construction of the single- and multi-objective optimization solutions for a real decision space.
Construct a single-objective solution#
# solution parameters
ndecn = 10
decn_space_lower = numpy.repeat(-1.0, ndecn)
decn_space_upper = numpy.repeat(1.0, ndecn)
decn_space = numpy.stack([decn_space_lower, decn_space_upper])
nobj = 1
nsoln = 5
# construct solution
sosoln = RealSolution(
ndecn = ndecn,
decn_space = decn_space,
decn_space_lower = decn_space_lower,
decn_space_upper = decn_space_upper,
nobj = nobj,
obj_wt = 1.0,
nineqcv = None,
ineqcv_wt = None,
neqcv = None,
eqcv_wt = None,
nsoln = 5,
soln_decn = numpy.random.uniform(-1.0, 1.0, (nsoln,ndecn)),
soln_obj = numpy.random.random((nsoln,nobj)),
soln_ineqcv = None,
soln_eqcv = None
)
Construct a multi-objective solution#
# solution parameters
ndecn = 10
decn_space_lower = numpy.repeat(-1.0, ndecn)
decn_space_upper = numpy.repeat(1.0, ndecn)
decn_space = numpy.stack([decn_space_lower, decn_space_upper])
nobj = 2
nsoln = 5
# construct solution
mosoln = RealSolution(
ndecn = ndecn,
decn_space = decn_space,
decn_space_lower = decn_space_lower,
decn_space_upper = decn_space_upper,
nobj = nobj,
obj_wt = 1.0,
nineqcv = None,
ineqcv_wt = None,
neqcv = None,
eqcv_wt = None,
nsoln = 5,
soln_decn = numpy.random.uniform(-1.0, 1.0, (nsoln,ndecn)),
soln_obj = numpy.random.random((nsoln,nobj)),
soln_ineqcv = None,
soln_eqcv = None
)
Optimization Problem Properties#
All optimization solutions have a set of common properties. The table below summarizes these solution properties.
Property |
Description |
---|---|
|
Number of decision variables. |
|
Decision space boundaries. |
|
Lower boundary of the decision space. |
|
Upper boundary of the decision space. |
|
Number of objectives. |
|
Objective function weights. |
|
Number of inequality constraint violation functions. |
|
Inequality constraint violation function weights. |
|
Number of equality constraint violations. |
|
Equality constraint violation function weights. |
|
Number of solutions to the problem. |
|
Matrix of solution vectors in the decision space. |
|
Solution objective function values. |
|
Solution inequality constraint violation function values. |
|
Solution equality constraint violation function values. |