The problems are used to evaluate the performance of the surrogate models. Now, we are implementing a set of problems, they are used for modeling, unconstrained optimization, constrained optimization, and multi-objective optimization.
Note
Till now, we only implement problems for unconstrained single-objective optimization, unconstrained multi-fidelity single-objective optimization, constrained single-objective optimization.
Problems class structure¶
Now, we want to introduce the basic Functions
class:
class Functions(ABC):
@staticmethod
def f(x: np.ndarray) -> np.ndarray:
...
@staticmethod
def f_der(x: np.ndarray) -> np.ndarray:
...
@staticmethod
def hf(x: np.ndarray) -> np.ndarray:
...
@staticmethod
def lf(x: np.ndarray, factor: float) -> np.ndarray:
...
@staticmethod
def hf_der(x: np.ndarray) -> np.ndarray:
...
@staticmethod
def lf_der(x: np.ndarray) -> np.ndarray:
...
@staticmethod
def f_cons(x: np.ndarray) -> np.ndarray:
...
@staticmethod
def hf_cons(x: np.ndarray) -> np.ndarray:
...
@staticmethod
def lf_cons(x: np.ndarray) -> np.ndarray:
...
Single fidelity problems¶
Example for single fidelity function¶
Here, an example of using function sf_functions
is given.
The Forrester function Forrester
is used to illustrate:
import numpy as np
from mfpml.problems.sf_functions import Forrester
from mfpml.design_of_experiment.sf_samplers import LatinHyperCube
# Initialize the single-fidelity function
function = Forrester()
print("Input domain:", function.input_domain)
# Sample input space using Latin Hypercube Sampling
sampler = LatinHyperCube(design_space=function.input_domain)
sample_x = sampler.get_samples(num_samples=2, seed=1)
print("Sampled inputs:", sample_x)
# Evaluate the function
sample_y = function.f(sample_x)
print("Function outputs:", sample_y)
Implemented single fidelity Functions¶
Methods |
API of sampling methods |
---|---|
Forrester |
|
Branin |
|
Hartmann3 |
|
Hartmann6 |
|
Sixhump |
|
GoldPrice |
|
Sasena |
|
Ackley |
|
AckleyN2 |
|
Thevenot |
Multi fidelity problems¶
Example for multi fidelity function¶
Here, an example of using function mf_functions
is given.
The Forrester_1a function is used to illustrate:
import numpy as np
from mfpml.problems.mf_functions import Forrester_1b
from mfpml.design_of_experiment.mf_samplers import MFSobolSequence
# Initialize the multi-fidelity function
function = Forrester_1b()
design_space = function.input_domain
print("Input domain:", design_space)
# Sample input space using Multi-Fidelity Sobol Sequence
sampler = MFSobolSequence(design_space=design_space, num_fidelity=2, nested=True)
samples = sampler.get_samples(num_samples=[4, 11])
print("Sampled inputs at two fidelities:", samples)
# Evaluate the function
sample_y = function(samples)
print("Function outputs:", sample_y)
Implemented multi fidelity Functions¶
Methods |
API of sampling methods |
---|---|
Forrester_1a |
|
Forrester_1b |
|
Forrester_1c |
|
mf_Hartmann3 |
|
mf_Hartmann6 |
|
mf_Sixhump |
|
mf_Discontinuous |
|
PhaseShiftedOscillations |
|
ContinuousNonlinearCorrelation1D |