added dynamic objectives and optimization space

This commit is contained in:
Remi Ehounou
2021-09-11 16:07:25 -04:00
parent 14190110b4
commit 769a14c1fc
38 changed files with 41 additions and 6 deletions

View File

@ -231,7 +231,7 @@ def representfunc(funcpath, forced = False):
def doe(heuristicpath, testfunctionpaths, args, measurementSampleSize = 30):
def doe(heuristicpath, testfunctionpaths, heuristic_args, measurementSampleSize = 30):
for i,funpath in enumerate(testfunctionpaths):
if funpath.find('@') == 0:
testfunctionpaths[i] = path.dirname(__file__) + '/TestFunctions/' + funpath[1:]
@ -251,9 +251,14 @@ def doe(heuristicpath, testfunctionpaths, args, measurementSampleSize = 30):
# loading the test functions into the namespace and memory
for idx, funcpath in enumerate(testfunctionpaths):
funcname = funcnames[idx]
#getting the representation
repr = representfunc(funcpath, True)
heuristic_args['objs'] = repr['opti']
heuristic_args['lower'] = repr['lower']
heuristic_args['upper'] = repr['upper']
# Creating the connection objects for communication between the heuristic and this module
connections[funcname] = multiprocessing.Pipe(duplex=False)
proc.append(multiprocessing.Process(target=measure, name=funcname, args=(heuristicpath, funcpath, args, connections[funcname][1], measurementSampleSize)))
proc.append(multiprocessing.Process(target=measure, name=funcname, args=(heuristicpath, funcpath, heuristic_args, connections[funcname][1], measurementSampleSize)))
# defining the response variables
responses = {}
@ -266,7 +271,7 @@ def doe(heuristicpath, testfunctionpaths, args, measurementSampleSize = 30):
# Waiting for all the runs to be done
for process in proc: process.join()
for process in proc:
for i,process in enumerate(proc):
run = process.name
if process.exitcode == 0: responses[run] = connections[run][0].recv()
else:
@ -274,6 +279,7 @@ def doe(heuristicpath, testfunctionpaths, args, measurementSampleSize = 30):
failedfunctions[run] = process.exitcode
connections[run][0].close()
connections[run][1].close()
print('Test Function Completed: '+str(i)+'/'+str(len(proc)))
# display output
@ -369,7 +375,7 @@ if __name__== "__main__":
#visualize2D('@Easom.py', -10,10)
#feats = array([representfunc(testfun, True)['ela_meta'] for testfun in testfuns])
#plotfuncs(['@Bukin2.py','@Bukin6.py'], 'ela_meta')
#perf = doe('@SimmulatedAnnealing.py', testfuns[3:4],{"t": 1000, "p": 0.95, "objs": 0},measurementSampleSize=30)
perf = doe('@SimmulatedAnnealing.py', testfuns[0:1],{"t": 1000, "p": 0.95, "objs": 0, "lower": [-10], "upper": [10]},measurementSampleSize=2)
#perfs = array([[perf[func][0]['cpuTime'][0], perf[func][0]['numCalls'][0], perf[func][0]['quality'][0], perf[func][0]['convRate'][0]] for func in perf.keys()])
#features = array(feats)

View File

@ -38,8 +38,8 @@ def main(func, S, args):
y = args["objs"]
t = args["t"]
p = args["p"]
high = 20
low = -20
high = max([args["upper"]])
low = max([args["lower"]])
Best = list()
Best[:] = cp.deepcopy(S)

View File

@ -7,6 +7,7 @@ def main(args):
#_# upper: 32
#_# lower: -32
#_# minimum: [0, 0]
#_# opti: -200
>>> main([0, 0])
-200.0

View File

@ -10,6 +10,7 @@ def main(args):
#_# upper: 10
#_# lower: -10
#_# minimum: [0,0]
#_# opti: 0
#_# cm_angle: array([[1.51864326e+00], [5.34186818e-01], [1.13769921e+00], [6.01461615e-01], [1.04599092e+02], [4.22931285e+01], [3.99368522e-01], [1.77424245e-01], [0.00000000e+00], [4.10000000e-02]])
#_# cm_conv: array([[0.46153846], [0.25 ], [0.48076923], [0.51923077], [0. ], [0.012 ]])

View File

@ -8,6 +8,7 @@ def main(args):
#_# upper: 4
#_# lower: -1
#_# minimum: 0
#_# opti: 0
#_# cm_angle: array([[4.38674589e+00], [1.19556006e+00], [4.47966360e+00], [1.19983352e+00], [5.60286032e+00], [1.07792176e+01], [2.25826784e-03], [2.51639450e-02], [0.00000000e+00], [2.62000000e-01]])

View File

@ -8,6 +8,7 @@ def main(args):
#_# upper: [-5, 3]
#_# lower: [-15, -3]
#_# minimum: [-10,0]
#_# opti: 0
#_# cm_angle: array([[3.49881571e-01], [1.07838645e-01], [3.22906733e-01], [1.09086923e-01], [1.36740093e+02], [3.72333248e+01], [6.24743683e-02], [1.45683932e-02], [0.00000000e+00], [7.70000000e-02]])

View File

@ -8,6 +8,7 @@ def main(args):
#_# upper: [-5, 3]
#_# lower: [-15, -3]
#_# minimum: [-10,0]
#_# opti: 0
#_# cm_angle: array([[3.46336319e-01], [1.11596448e-01], [3.32688632e-01], [1.10567852e-01], [1.26709762e+02], [3.96040507e+01], [1.47616482e-01], [9.06041269e-02], [0.00000000e+00], [7.90000000e-02]])

View File

@ -10,6 +10,7 @@ def main(args):
#_# upper: [-5, 3]
#_# lower: [-15, -3]
#_# minimum: [-10,1]
#_# opti: 0
#_# cm_angle: array([[6.66400060e-01], [1.57197492e-01], [6.33211887e-01], [1.78907191e-01], [1.44244246e+02], [3.10372115e+01], [2.04871341e-01], [7.98873206e-02], [0.00000000e+00], [4.70000000e-02]])

View File

@ -10,6 +10,7 @@ def main(args):
#_# upper: 100
#_# lower: -100
#_# minimum: [3.1415, 3.1415]
#_# opti: -1
'''
return -1*math.cos(args[0])*math.cos(args[1])*math.exp(-(args[0]-math.pi)**2-(args[1]-math.pi)**2)

View File

@ -11,6 +11,7 @@ def main(args):
#_# upper: 10
#_# lower: 0.01
#_# minimum: [0, 1.39325]
#_# opti: 0
#_# cm_angle: array([[7.13994878e-01], [2.04021604e-01], [7.26144234e-01], [1.75288688e-01], [1.18714400e+02], [2.56929617e+01], [2.29691859e-01], [1.84411364e-01], [0.00000000e+00], [4.50000000e-02]])
#_# cm_conv: array([[0.30769231], [0.34615385], [0.51923077], [0.48076923], [0. ], [0.014 ]])

View File

@ -11,6 +11,7 @@ def main(args):
#_# upper: 1.2
#_# lower: -1.2
#_# minimum: [1, 1]
#_# opti: 0
#_# cm_angle: array([[2.10542603e-01], [2.72828609e-02], [2.13436119e-01], [2.65579669e-02], [1.51992391e+02], [2.94589423e+01], [1.70644204e-01], [1.20347799e-01], [0.00000000e+00], [4.30000000e-02]])
#_# cm_conv: array([[0.15384615], [0.03846154], [0.96153846], [0.03846154], [0. ], [0.015 ]])

View File

@ -9,6 +9,7 @@ def main(args):
#_# upper: 10
#_# lower: -10
#_# minimum: [0, 0]
#_# opti: 0
#_# cm_angle: array([[1.67665613e+00], [3.12117578e-01], [1.77116080e+00], [2.14030392e-01], [1.54152066e+02], [3.01167436e+01], [1.73757960e-01], [1.29449566e-01], [0.00000000e+00], [3.88000000e-01]])
#_# cm_conv: array([[0.15384615], [0.03846154], [0.90384615], [0.09615385], [0. ], [0.069 ]])

View File

@ -8,6 +8,7 @@ def main(args):
#_# upper: [4, 3]
#_# lower: [-1.5, -3]
#_# minimum: [-0.547, -1.547]
#_# opti: 0
#_# cm_angle: array([[4.79655921e-01], [8.11936213e-02], [4.88211174e-01], [1.07483727e-01], [1.33682197e+02], [3.67619007e+01], [2.30397221e-01], [1.37221691e-01], [0.00000000e+00], [2.01000000e-01]])

View File

@ -10,6 +10,7 @@ def main(args):
#_# upper: 1
#_# lower: -1
#_# minimum: [0, 1, 1, 1]
#_# opti: 0
#_# cm_angle: array([[3.75299977e-01], [9.16367331e-02], [3.89890198e-01], [8.09797236e-02], [1.16758566e+02], [2.78473090e+01], [1.23458075e-02], [1.11111097e-01], [0.00000000e+00], [7.60000000e-02]])

View File

@ -10,6 +10,7 @@ def main(args):
#_# upper: 10
#_# lower: -10
#_# minimum: [0,0]
#_# opti: 0.9
#_# cm_angle: array([[1.75593580e+00], [2.65321236e-01], [4.87617228e-01], [2.59067658e-01], [1.31559946e+02], [4.22034384e+01], [8.81116275e-01], [6.32096982e-02], [0.00000000e+00], [6.81000000e-01]])
#_# cm_conv: array([[0.28846154], [0.32692308], [0.46153846], [0.53846154], [0. ], [0.13 ]])

View File

@ -8,6 +8,7 @@ def main(args):
#_# upper: 10
#_# lower: -10
#_# minimum: [0, 0]
#_# opti: 0
#_# cm_angle: array([[1.72687084e+00], [3.37616437e-01], [1.71737114e+00], [3.02628823e-01], [1.56338002e+02], [2.86853412e+01], [1.67456186e-01], [1.24716212e-01], [0.00000000e+00], [4.41000000e-01]])
#_# cm_conv: array([[0.15384615], [0.03846154], [0.90384615], [0.09615385], [0. ], [0.095 ]])

View File

@ -8,6 +8,7 @@ def main(args):
#_# upper: 500
#_# lower: -500
#_# minimum: [5, -5]
#_# opti: 0
#_# cm_angle: array([[8.42995060e+01], [1.48465167e+01], [8.85937471e+01], [1.22477660e+01], [1.56556548e+02], [1.64601666e+01], [2.62117969e-01], [1.07318701e-01], [0.00000000e+00], [3.81000000e-01]])
#_# cm_conv: array([[0.23076923], [0.01923077], [0.90384615], [0.09615385], [0. ], [0.077 ]])

View File

@ -10,6 +10,7 @@ def main(args):
#_# upper: 10
#_# lower: -10
#_# minimum: [0, 0]
#_# opti: 0.9
#_# cm_angle: array([[1.75661603e+00], [2.63859171e-01], [5.96095293e-01], [2.63941004e-01], [1.16275803e+02], [4.20577763e+01], [8.57863898e-01], [6.87176980e-02], [0.00000000e+00], [4.08000000e-01]])
#_# cm_conv: array([[0.30769231], [0.32692308], [0.48076923], [0.51923077], [0. ], [0.187 ]])

View File

@ -8,6 +8,7 @@ def main(args):
#_# upper: 1.28
#_# lower: -1.28
#_# minimum: [0,0]
#_# opti: 0
#_# cm_angle: array([[2.28732911e-01], [3.42198479e-02], [2.27981888e-01], [2.88543430e-02], [1.41047881e+02], [3.07397993e+01], [2.96369677e-01], [3.09950141e-01], [0.00000000e+00], [3.13000000e-01]])
#_# cm_conv: array([[0.34615385], [0.21153846], [0.75 ], [0.25 ], [0. ], [0.112 ]])

View File

@ -10,6 +10,7 @@ def main(args):
#_# upper: 5.12
#_# lower: -5.12
#_# minimum: [0,0]
#_# opti: 0
#_# cm_angle: array([[5.87139339e-01], [2.50148614e-01], [5.39132964e-01], [2.87449942e-01], [1.16642840e+02], [4.26135413e+01], [4.82701426e-01], [6.47550685e-02], [0.00000000e+00], [3.73000000e-01]])
#_# cm_conv: array([[0.26923077], [0.19230769], [0.44230769], [0.55769231], [0. ], [0.088 ]])

View File

@ -10,6 +10,7 @@ def main(args):
#_# upper: 100
#_# lower: -100
#_# minimum: [0,1.253115]
#_# opti: 0.292579
#_# cm_angle: array([[1.32397939e+01], [4.62172042e+00], [1.54725129e+01], [3.83824723e+00], [6.15596703e+01], [4.60528851e+01], [5.78960073e-02], [1.77211154e-01], [0.00000000e+00], [3.04000000e-01]])
#_# cm_conv: array([[0.28846154], [0.32692308], [0.59615385], [0.40384615], [0. ], [0.112 ]])

View File

@ -10,6 +10,7 @@ def main(args):
#_# upper: 100
#_# lower: -100
#_# minimum: [0,0]
#_# opti: 0
#_# cm_angle: array([[1.69171763e+01], [2.98716043e+00], [1.76778645e+01], [2.33433457e+00], [1.63370899e+02], [1.34109670e+01], [2.18294064e-01], [1.76744653e-01], [0.00000000e+00], [1.34000000e-01]])
#_# cm_conv: array([[0.23076923], [0.01923077], [0.94230769], [0.05769231], [0. ], [0.055 ]])

View File

@ -8,6 +8,7 @@ def main(args):
#_# upper: 100
#_# lower: -100
#_# minimum: [0,0]
#_# opti: 0
#_# cm_angle: array([[1.72215494e+01], [2.59186558e+00], [1.73080840e+01], [2.32553416e+00], [1.55317224e+02], [1.54411724e+01], [2.63099825e-01], [1.01400943e-01], [0.00000000e+00], [3.36000000e-01]])
#_# cm_conv: array([[0.23076923], [0.01923077], [0.92307692], [0.07692308], [0. ], [0.158 ]])

View File

@ -10,6 +10,7 @@ def main(args):
#_# upper: 100
#_# lower: -100
#_# minimum: [0,0]
#_# opti: 0
#_# cm_angle: array([[1.76951433e+01], [2.53449463e+00], [1.73770488e+01], [2.51496578e+00], [1.61069593e+02], [1.41112959e+01], [2.50578704e-01], [3.08199018e-02], [0.00000000e+00], [3.11000000e-01]])
#_# cm_conv: array([[0.23076923], [0.03846154], [0.67307692], [0.30769231], [0. ], [0.057 ]])

View File

@ -10,6 +10,7 @@ def main(args):
#_# upper: 100
#_# lower: -100
#_# minimum: [0,0]
#_# opti: 0
#_# cm_angle: array([[1.75512600e+01], [2.34210852e+00], [1.71483517e+01], [2.50786584e+00], [1.61753509e+02], [1.59072574e+01], [2.57240076e-01], [9.76587900e-02], [0.00000000e+00], [2.36000000e-01]])
#_# cm_conv: array([[0.23076923], [0.03846154], [0.92307692], [0.07692308], [0. ], [0.107 ]])

View File

@ -10,6 +10,7 @@ def main(args):
#_# upper: 5
#_# lower: -5
#_# minimum: [-2.903534,-2.903534]
#_# opti: -78.332
#_# cm_angle: array([[7.90389678e-01], [1.68330821e-01], [8.89556888e-01], [1.38622941e-01], [1.55135814e+02], [2.42794096e+01], [3.33747533e-01], [2.28197286e-01], [0.00000000e+00], [2.47000000e-01]])
#_# cm_conv: array([[0.46153846], [0.25 ], [0.5 ], [0.5 ], [0. ], [0.088 ]])

View File

@ -8,6 +8,7 @@ def main(args):
#_# upper: 10
#_# lower: -10
#_# minimum: [0,0]
#_# opti: 0
#_# cm_angle: array([[ 1.74423906], [ 0.27293964], [ 1.76075806], [ 0.29531509], [143.02933717], [ 24.06675059], [ 0.29793996], [ 0.16731295], [ 0. ], [ 0.285 ]])
#_# cm_conv: array([[0.30769231], [0.19230769], [0.73076923], [0.26923077], [0. ], [0.086 ]])

View File

@ -10,6 +10,7 @@ def main(args):
#_# upper: 100
#_# lower: -100
#_# minimum: [-2.903534,-2.903534]
#_# opti: 0
#_# cm_angle: array([[ 16.51016476], [ 2.57287474], [ 17.61177277], [ 2.41471473], [142.5140382 ], [ 28.5868278 ], [ 0.26952628], [ 0.39099627], [ 0. ], [ 0.369 ]])
#_# cm_conv: array([[0.25 ], [0.09615385], [0.76923077], [0.23076923], [0. ], [0.064 ]])

View File

@ -8,6 +8,7 @@ def main(args):
#_# upper: 10
#_# lower: -5
#_# minimum: [-0.0299,0]
#_# opti: 0
#_# cm_angle: array([[1.25068565e+00], [2.50004511e-01], [1.32505725e+00], [2.11320066e-01], [1.60855629e+02], [2.20138358e+01], [1.35843657e-01], [1.42306220e-01], [0.00000000e+00], [3.00000000e-01]])
#_# cm_conv: array([[0.23076923], [0. ], [1. ], [0. ], [0. ], [0.115 ]])

View File

@ -8,6 +8,7 @@ def main(args):
#_# upper: 10
#_# lower: -10
#_# minimum: [-1.0465,0]
#_# opti: -0.3523
#_# cm_angle: array([[ 1.6569554 ], [ 0.28633476], [ 1.79903684], [ 0.27796405], [143.11418389], [ 27.7392393 ], [ 0.29862645], [ 0.31215793], [ 0. ], [ 0.324 ]])
#_# cm_conv: array([[0.26923077], [0.15384615], [0.76923077], [0.23076923], [0. ], [0.09 ]])

Binary file not shown.

View File

@ -5,6 +5,7 @@ def main(args):
#_# upper: [-5, 3]
#_# lower: [-15, -3]
#_# minimum: [-10,0]
#_# opti: 0
#_# cm_angle: array([[6.58088621e-01], [1.35233171e-01], [6.54044152e-01], [1.52081329e-01], [1.45731844e+02], [2.98120983e+01], [1.28649809e-01], [1.73025064e-02], [0.00000000e+00], [6.40000000e-02]])