Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from jungtaekkim/0.1.7
0.1.7
- Loading branch information
Showing
106 changed files
with
7,201 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# | ||
# author: Jungtaek Kim (jtkim@postech.ac.kr) | ||
# last updated: December 30, 2022 | ||
# | ||
|
||
import numpy as np | ||
|
||
from bayeso_benchmarks.benchmark_base import Function | ||
|
||
|
||
def fun_target(bx, dim_bx): | ||
assert len(bx.shape) == 1 | ||
assert bx.shape[0] == dim_bx | ||
|
||
y = 100.0 * (bx[0]**2 - bx[1])**2 | ||
y += (bx[0] - 1.0)**2 | ||
y += (bx[2] - 1.0)**2 | ||
y += 90.0 * (bx[2]**2 - bx[3])**2 | ||
y += 10.1 * ((bx[1] - 1.0)**2 + (bx[3] - 1.0)**2) | ||
y += 19.8 * (bx[1] - 1.0) * (bx[3] - 1.0) | ||
|
||
return y | ||
|
||
|
||
class Colville(Function): | ||
def __init__(self, seed=None): | ||
assert isinstance(seed, (type(None), int)) | ||
|
||
dim_bx = 4 | ||
bounds = np.array([ | ||
[-10.0, 10.0], | ||
[-10.0, 10.0], | ||
[-10.0, 10.0], | ||
[-10.0, 10.0], | ||
]) | ||
assert bounds.shape[0] == dim_bx | ||
assert bounds.shape[1] == 2 | ||
|
||
global_minimizers = np.array([ | ||
[1.0, 1.0, 1.0, 1.0], | ||
]) | ||
global_minimum = 0.0 | ||
function = lambda bx: fun_target(bx, dim_bx) | ||
|
||
try: | ||
super().__init__(dim_bx, bounds, global_minimizers, global_minimum, function, seed=seed) | ||
except: | ||
super(Colville, self).__init__(dim_bx, bounds, global_minimizers, global_minimum, function, seed=seed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# | ||
# author: Jungtaek Kim (jtkim@postech.ac.kr) | ||
# last updated: January 6, 2023 | ||
# | ||
|
||
import numpy as np | ||
|
||
from bayeso_benchmarks.benchmark_base import Function | ||
|
||
|
||
def fun_target(bx, dim_bx): | ||
assert len(bx.shape) == 1 | ||
assert bx.shape[0] == dim_bx | ||
|
||
first_term = np.sum(bx**2 / 4000.0) | ||
|
||
second_term = 1.0 | ||
for ind in range(1, dim_bx + 1): | ||
second_term *= np.cos(bx[ind - 1] / np.sqrt(ind)) | ||
|
||
y = first_term - second_term + 1.0 | ||
return y | ||
|
||
|
||
class Griewank(Function): | ||
def __init__(self, dim_problem, seed=None): | ||
assert isinstance(dim_problem, int) | ||
assert isinstance(seed, (type(None), int)) | ||
|
||
dim_bx = np.inf | ||
bounds = np.array([ | ||
[-600.0, 600.0], | ||
]) | ||
global_minimizers = np.array([ | ||
[0.0], | ||
]) | ||
global_minimum = 0.0 | ||
dim_problem = dim_problem | ||
|
||
function = lambda bx: fun_target(bx, dim_problem) | ||
|
||
try: | ||
super().__init__(dim_bx, bounds, global_minimizers, global_minimum, function, dim_problem=dim_problem, seed=seed) | ||
except: | ||
super(Griewank, self).__init__(dim_bx, bounds, global_minimizers, global_minimum, function, dim_problem=dim_problem, seed=seed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# | ||
# author: Jungtaek Kim (jtkim@postech.ac.kr) | ||
# last updated: December 29, 2022 | ||
# | ||
|
||
import numpy as np | ||
|
||
from bayeso_benchmarks.benchmark_base import Function | ||
|
||
|
||
def fun_target(bx, dim_bx, | ||
): | ||
assert len(bx.shape) == 1 | ||
assert bx.shape[0] == dim_bx | ||
|
||
bw = [] | ||
for x in bx: | ||
w = 1.0 + (x - 1.0) / 4.0 | ||
bw.append(w) | ||
bw = np.array(bw) | ||
|
||
y = np.sin(np.pi * bw[0])**2 | ||
|
||
for w in bw[:-1]: | ||
y += (w - 1.0)**2 * (1.0 + 10.0 * np.sin(np.pi * w + 1.0)**2) | ||
|
||
y += (bw[-1] - 1.0)**2 * (1.0 + np.sin(2.0 * np.pi * bw[-1])**2) | ||
return y | ||
|
||
|
||
class Levy(Function): | ||
def __init__(self, dim_problem, seed=None): | ||
assert isinstance(dim_problem, int) | ||
assert isinstance(seed, (type(None), int)) | ||
|
||
dim_bx = np.inf | ||
bounds = np.array([ | ||
[-10.0, 10.0], | ||
]) | ||
global_minimizers = np.array([ | ||
[1.0], | ||
]) | ||
global_minimum = 0.0 | ||
dim_problem = dim_problem | ||
|
||
function = lambda bx: fun_target(bx, dim_problem) | ||
|
||
try: | ||
super().__init__(dim_bx, bounds, global_minimizers, global_minimum, function, dim_problem=dim_problem, seed=seed) | ||
except: | ||
super(Levy, self).__init__(dim_bx, bounds, global_minimizers, global_minimum, function, dim_problem=dim_problem, seed=seed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# | ||
# author: Jungtaek Kim (jtkim@postech.ac.kr) | ||
# last updated: December 20, 2022 | ||
# | ||
|
||
import numpy as np | ||
|
||
from bayeso_benchmarks.benchmark_base import Function | ||
|
||
|
||
def fun_target(bx, dim_bx): | ||
assert len(bx.shape) == 1 | ||
assert bx.shape[0] == dim_bx | ||
|
||
y = 10.0 * dim_bx | ||
|
||
for ind in range(0, dim_bx): | ||
y += bx[ind]**2 - 10.0 * np.cos(2.0 * np.pi * bx[ind]) | ||
|
||
return y | ||
|
||
|
||
class Rastrigin(Function): | ||
def __init__(self, dim_problem, seed=None): | ||
assert isinstance(dim_problem, int) | ||
assert isinstance(seed, (type(None), int)) | ||
|
||
dim_bx = np.inf | ||
bounds = np.array([ | ||
[-5.12, 5.12], | ||
]) | ||
global_minimizers = np.array([ | ||
[0.0], | ||
]) | ||
global_minimum = 0.0 | ||
dim_problem = dim_problem | ||
|
||
function = lambda bx: fun_target(bx, dim_problem) | ||
|
||
try: | ||
super().__init__(dim_bx, bounds, global_minimizers, global_minimum, function, dim_problem=dim_problem, seed=seed) | ||
except: | ||
super(Rastrigin, self).__init__(dim_bx, bounds, global_minimizers, global_minimum, function, dim_problem=dim_problem, seed=seed) |
Oops, something went wrong.