Skip to content

Commit 69e5afe

Browse files
authored
Add mc func (#12)
* Add MCMcCourt08 * Add classifier * bump version
1 parent 7fe710e commit 69e5afe

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed

evalset/multicriteria_test_funcs.py

+61
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,67 @@ def do_component_function(self, d, x):
478478
return -1 / (1 / numpy.linalg.norm(x - sol1) + 1 / numpy.linalg.norm(x - sol2))
479479

480480

481+
class MCMcCourt08(MulticriteriaTestFunction):
482+
def __init__(self, dim=12, verify=True):
483+
assert dim == 12
484+
super(MCMcCourt08, self).__init__(dim, verify)
485+
self.output_dim = 2
486+
self.bounds = (
487+
[700, 1277], [200, 1277], [30, 175], [50, 140], [18, 80], [5, 58],
488+
[51, 140], [30, 60], [0, 58], [175, 210], [0, 12], [5, 35],
489+
)
490+
self.frontier = numpy.array([
491+
[-0.973, -1.559], [-0.928, -1.601], [-0.951, -1.591], [-0.892, -1.612], [-0.935, -1.598],
492+
[-1.496, -0.785], [-0.840, -1.613], [-0.947, -1.593], [-0.921, -1.603], [-0.965, -1.577],
493+
[-0.933, -1.600], [-0.900, -1.609], [-0.954, -1.588], [-0.898, -1.610], [-0.941, -1.596],
494+
[-0.972, -1.564], [-0.940, -1.597], [-0.949, -1.592], [-0.967, -1.574], [-0.961, -1.581],
495+
[-0.904, -1.609], [-1.502, -0.779], [-1.503, -0.777], [-1.507, -0.769], [-0.931, -1.600],
496+
[-0.895, -1.611], [-0.970, -1.570], [-0.903, -1.609], [-1.496, -0.787], [-1.502, -0.777],
497+
[-0.912, -1.606], [-1.499, -0.784], [-1.501, -0.781], [-1.505, -0.774], [-1.505, -0.772],
498+
[-1.507, -0.770], [-1.508, -0.761], [-1.510, -0.749], [-1.513, -0.735], [-1.514, -0.730],
499+
[-1.515, -0.727], [-1.513, -0.737], [-0.815, -1.615], [-0.815, -1.615], [-0.820, -1.615],
500+
[-0.816, -1.615], [-0.829, -1.614], [-0.814, -1.615], [-1.435, -0.810], [-0.996, -1.499],
501+
[-1.385, -0.819], [-1.002, -1.480], [-1.009, -1.437], [-1.375, -0.826], [-1.006, -1.452],
502+
[-1.320, -0.833], [-1.326, -0.833], [-1.014, -1.401], [-1.016, -1.364], [-1.332, -0.832],
503+
[-1.018, -1.329], [-1.281, -0.841], [-1.020, -1.305], [-1.022, -1.265], [-1.021, -1.297],
504+
[-1.255, -0.846], [-1.256, -0.845], [-1.160, -0.858], [-1.222, -0.850], [-1.183, -0.853],
505+
[-1.179, -0.854], [-1.174, -0.855], [-1.024, -1.211], [-1.101, -0.865], [-1.091, -0.866],
506+
[-1.091, -0.866], [-1.095, -0.865], [-1.025, -1.204], [-1.028, -1.131], [-1.056, -0.870],
507+
[-1.028, -1.098], [-1.029, -1.065], [-1.029, -1.027], [-1.031, -0.893], [-1.030, -0.990],
508+
[-1.030, -0.970], [-0.916, -1.604], [-1.031, -0.923], [-0.896, -1.610], [-0.886, -1.612],
509+
[-0.886, -1.612], [-0.832, -1.614], [-1.081, -0.867], [-1.030, -1.015], [-1.030, -1.001],
510+
[-1.240, -0.848], [-1.018, -1.360], [-1.023, -1.255], [-1.125, -0.861], [-1.031, -0.941],
511+
[-1.030, -0.961], [-1.024, -1.250], [-1.026, -1.191], [-1.021, -1.296], [-0.977, -1.530],
512+
[-1.444, -0.797], [-1.467, -0.795], [-0.980, -1.501], [-1.420, -0.819], [-1.445, -0.795],
513+
])
514+
self.classifiers = ['nonconvex', 'rescaled']
515+
516+
def do_component_function(self, d, x):
517+
sx = numpy.empty(self.dim)
518+
for k, b in enumerate(self.bounds):
519+
b_min, b_max = b
520+
sx[k] = (x[k] - b_min) / (b_max - b_min)
521+
nonconvex_factor = 3
522+
if d == 0:
523+
scaling1 = numpy.linspace(1 / self.dim, 1.0, self.dim)
524+
scaling2 = numpy.linspace(1.3, 1 / self.dim, self.dim)
525+
distance1_sq = numpy.dot(sx - 1 / 3, scaling1 * (sx - 1 / 3))
526+
distance2_sq = numpy.dot(sx - 2 / 3, scaling2 * (sx - 2 / 3))
527+
return (
528+
-numpy.exp(-2 * distance1_sq * nonconvex_factor) -
529+
1.5 * numpy.exp(-1.6 * distance2_sq * nonconvex_factor)
530+
)
531+
else:
532+
scaling1 = numpy.linspace(1.3, 1 / self.dim, self.dim)
533+
scaling2 = numpy.linspace(1 / self.dim, 1.0, self.dim)
534+
distance1_sq = numpy.dot(sx - 0.25, scaling1 * (sx - 0.25))
535+
distance2_sq = numpy.dot(sx - 0.6, scaling2 * (sx - 0.6))
536+
return (
537+
-1.6 * numpy.exp(-1.2 * distance1_sq * nonconvex_factor) -
538+
.8 * numpy.exp(-1.7 * distance2_sq * nonconvex_factor)
539+
)
540+
541+
481542
class FonsecaFleming(MulticriteriaTestFunction):
482543
def __init__(self, dim=2, verify=True):
483544
assert dim == 2

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
setup(
66
name='evalset',
7-
version='1.2.2',
7+
version='1.2.3',
88
description='Benchmark suite of test functions suitable for evaluating black-box optimization strategies',
99
author='SigOpt',
1010
author_email='[email protected]',

0 commit comments

Comments
 (0)