Skip to content

Commit

Permalink
Merge pull request #92 from smohsinali/michalewicz
Browse files Browse the repository at this point in the history
Add michalewicz test function
  • Loading branch information
mfeurer committed Jul 13, 2015
2 parents 156c9e1 + 4c29fc2 commit e65ff6a
Show file tree
Hide file tree
Showing 14 changed files with 259 additions and 0 deletions.
58 changes: 58 additions & 0 deletions benchmarks/michalewicz/.nfs0000000007b204940000008f
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
##
# wrapping: A program making it easy to use hyperparameter
# optimization software.
# Copyright (C) 2013 Katharina Eggensperger and Matthias Feurer
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

__authors__ = ["Mohsin Ali"]
__contact__ = ["automl.org"]
__credits__ = ["Sonja Surjanovic, Derek Bingham,"]
__function__= ["MICHALEWICZ FUNCTION"]

import time

import HPOlib.benchmarks.benchmark_util as benchmark_util

def michal(xx,m):
import math

d=len(xx);
sum=0;
for ii in range(d):
xi=xx[ii];
i=ii+1;
new=math.sin(xi) * math.pow((math.sin(i*math.pow(xi,2)/math.pi)),(2*m));
sum=sum+new;

return -sum;



def main(params, **kwargs):
print 'Params: ', params;
print 'kwargs: ', kwargs;

xx=[float(params["x"]),float(params["y"])];

y = michal(xx,10);
return y;

if __name__ == "__main__":
starttime = time.time()
args, params = benchmark_util.parse_cli()
result = main(params, **args)
duration = time.time() - starttime
print "Result for ParamILS: %s, %f, 1, %f, %d, %s" % \
("SAT", abs(duration), result, -1, str(__file__))
1 change: 1 addition & 0 deletions benchmarks/michalewicz/ROAR_smac_2_06_01-dev
1 change: 1 addition & 0 deletions benchmarks/michalewicz/ROAR_smac_2_08_00-master
1 change: 1 addition & 0 deletions benchmarks/michalewicz/ROAR_smac_2_10_00-dev
2 changes: 2 additions & 0 deletions benchmarks/michalewicz/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__authors__ = ["Katharina Eggensperger", "Matthias Feurer"]
__contact__ = "automl.org"
14 changes: 14 additions & 0 deletions benchmarks/michalewicz/config.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[SMAC]
p = params.pcs

[TPE]
space = space.py

[SPEARMINT]
config = config.pb

[HPOLIB]
console_output_delay = 2.0
function = python ../michalewicz.py
number_of_jobs = 50
result_on_terminate = 3
13 changes: 13 additions & 0 deletions benchmarks/michalewicz/hyperopt_august2013_mod/space.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from hyperopt import hp

space = {'x1': hp.uniform('x1', 0, 3.14159265359),
'x2': hp.uniform('x2', 0, 3.14159265359),
'x3': hp.uniform('x3', 0, 3.14159265359),
'x4': hp.uniform('x4', 0, 3.14159265359),
'x5': hp.uniform('x5', 0, 3.14159265359),
'x6': hp.uniform('x6', 0, 3.14159265359),
'x7': hp.uniform('x7', 0, 3.14159265359),
'x8': hp.uniform('x8', 0, 3.14159265359),
'x9': hp.uniform('x9', 0, 3.14159265359),
'x10': hp.uniform('x10', 0, 3.14159265359)
}
62 changes: 62 additions & 0 deletions benchmarks/michalewicz/michalewicz.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
##
# wrapping: A program making it easy to use hyperparameter
# optimization software.
# Copyright (C) 2013 Katharina Eggensperger and Matthias Feurer
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

__authors__ = ["Mohsin Ali"]
__contact__ = ["automl.org"]
__credits__ = ["Sonja Surjanovic", "Derek Bingham",]
__function__= ["MICHALEWICZ FUNCTION"]

import time

import HPOlib.benchmarks.benchmark_util as benchmark_util

def michal(xx,m):
import math

d=len(xx);
sum=0;
for ii in range(d):
xi=xx[ii];
i=ii+1;
new=math.sin(xi) * math.pow((math.sin(i*math.pow(xi,2)/math.pi)),(2*m));
sum=sum+new;

return -sum;



def main(params, **kwargs):
print 'Params: ', params;
print 'kwargs: ', kwargs;

xx=[float(params["x1"]),float(params["x2"]),
float(params["x3"]),float(params["x4"]),
float(params["x5"]),float(params["x6"]),
float(params["x7"]),float(params["x8"]),
float(params["x9"]),float(params["x10"]),];

y = michal(xx,10);
return y;

if __name__ == "__main__":
starttime = time.time()
args, params = benchmark_util.parse_cli()
result = main(params, **args)
duration = time.time() - starttime
print "Result for ParamILS: %s, %f, 1, %f, %d, %s" % \
("SAT", abs(duration), result, -1, str(__file__))
1 change: 1 addition & 0 deletions benchmarks/michalewicz/random_hyperopt_august2013_mod
10 changes: 10 additions & 0 deletions benchmarks/michalewicz/smac_2_06_01-dev/params.pcs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
x1 real [0, 3.14159265359] [1.7]
x2 real [0, 3.14159265359] [1.7]
x3 real [0, 3.14159265359] [1.7]
x4 real [0, 3.14159265359] [1.7]
x5 real [0, 3.14159265359] [1.7]
x6 real [0, 3.14159265359] [1.7]
x7 real [0, 3.14159265359] [1.7]
x8 real [0, 3.14159265359] [1.7]
x9 real [0, 3.14159265359] [1.7]
x10 real [0, 3.14159265359] [1.7]
1 change: 1 addition & 0 deletions benchmarks/michalewicz/smac_2_08_00-master
10 changes: 10 additions & 0 deletions benchmarks/michalewicz/smac_2_10_00-dev/params.pcs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
x1 real [0, 3.14159265359] [1.7]
x2 real [0, 3.14159265359] [1.7]
x3 real [0, 3.14159265359] [1.7]
x4 real [0, 3.14159265359] [1.7]
x5 real [0, 3.14159265359] [1.7]
x6 real [0, 3.14159265359] [1.7]
x7 real [0, 3.14159265359] [1.7]
x8 real [0, 3.14159265359] [1.7]
x9 real [0, 3.14159265359] [1.7]
x10 real [0, 3.14159265359] [1.7]
84 changes: 84 additions & 0 deletions benchmarks/michalewicz/spearmint_april2013_mod/config.pb
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
language: PYTHON
name: "spearmint_to_HPOlib"

variable {
name: "x1"
type: FLOAT
size: 1
min: 0
max: 3.14159265359
}

variable {
name: "x2"
type: FLOAT
size: 1
min: 0
max: 3.14159265359
}

variable {
name: "x3"
type: FLOAT
size: 1
min: 0
max: 3.14159265359
}

variable {
name: "x4"
type: FLOAT
size: 1
min: 0
max: 3.14159265359
}

variable {
name: "x5"
type: FLOAT
size: 1
min: 0
max: 3.14159265359
}

variable {
name: "x6"
type: FLOAT
size: 1
min: 0
max: 3.14159265359
}

variable {
name: "x7"
type: FLOAT
size: 1
min: 0
max: 3.14159265359
}

variable {
name: "x8"
type: FLOAT
size: 1
min: 0
max: 3.14159265359
}

variable {
name: "x9"
type: FLOAT
size: 1
min: 0
max: 3.14159265359
}

variable {
name: "x10"
type: FLOAT
size: 1
min: 0
max: 3.14159265359
}


1 change: 1 addition & 0 deletions benchmarks/michalewicz/spearmint_gitfork_mod

0 comments on commit e65ff6a

Please sign in to comment.