From 5d6490f73467010c54a60fe898394a7525fa51e4 Mon Sep 17 00:00:00 2001 From: Remi Ehounou Date: Mon, 5 Apr 2021 00:46:44 -0400 Subject: [PATCH] added more fumctions for testing --- SourceCode/AlgorithmAnalyser.py | 8 ++++---- SourceCode/SampleAlgorithms/SimmulatedAnnealing.py | 2 +- SourceCode/TestFunctions/Bukin4.py | 2 ++ SourceCode/TestFunctions/Bukin6.py | 5 +++++ 4 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 SourceCode/TestFunctions/Bukin4.py create mode 100644 SourceCode/TestFunctions/Bukin6.py diff --git a/SourceCode/AlgorithmAnalyser.py b/SourceCode/AlgorithmAnalyser.py index 090db9e..b38d085 100644 --- a/SourceCode/AlgorithmAnalyser.py +++ b/SourceCode/AlgorithmAnalyser.py @@ -11,11 +11,11 @@ r.seed(int(time.time())) heuristicpath = "/home/remi/Documents/MDAF-GitLAB/SourceCode/SampleAlgorithms/SimmulatedAnnealing.py" heuristic_name = "SimmulatedAnnealing" -testfunctionpaths = ["/home/remi/Documents/MDAF-GitLAB/SourceCode/TestFunctions/Bukin2.py"] -funcnames = ["Bukin2"] +testfunctionpaths = ["/home/remi/Documents/MDAF-GitLAB/SourceCode/TestFunctions/Bukin2.py", "/home/remi/Documents/MDAF-GitLAB/SourceCode/TestFunctions/Bukin4.py", "/home/remi/Documents/MDAF-GitLAB/SourceCode/TestFunctions/Bukin6.py"] +funcnames = ["Bukin2", "Bukin4", "Bukin6"] objs = 0 -args = {"high": 200, "low": -200, "t": 100, "p": 0.8} -scale = 3 +args = {"high": 200, "low": -200, "t": 100, "p": 0.95} +scale = 2.5 def doe(heuristicpath, heuristic_name, testfunctionpaths, funcnames, objs, args, scale): diff --git a/SourceCode/SampleAlgorithms/SimmulatedAnnealing.py b/SourceCode/SampleAlgorithms/SimmulatedAnnealing.py index 419f701..a6eaf3a 100644 --- a/SourceCode/SampleAlgorithms/SimmulatedAnnealing.py +++ b/SourceCode/SampleAlgorithms/SimmulatedAnnealing.py @@ -72,7 +72,7 @@ def main(func, obj, S, args, connection): route.append(Best[:]) print(route) - if t < 0 or Quality(Best,y,func) > 1000: + if t < 0 or Quality(Best,y,func) > 50: break #print('the Best Quality obtained was:{}'.format(Quality(Best,y))) print("Final Quality is: {}".format(Quality(Best,y,func))) diff --git a/SourceCode/TestFunctions/Bukin4.py b/SourceCode/TestFunctions/Bukin4.py new file mode 100644 index 0000000..c192bdf --- /dev/null +++ b/SourceCode/TestFunctions/Bukin4.py @@ -0,0 +1,2 @@ +def main(args): + return 100*args[1]**2+0.01*abs(args[0]+10) \ No newline at end of file diff --git a/SourceCode/TestFunctions/Bukin6.py b/SourceCode/TestFunctions/Bukin6.py new file mode 100644 index 0000000..f3cc653 --- /dev/null +++ b/SourceCode/TestFunctions/Bukin6.py @@ -0,0 +1,5 @@ +from math import sqrt, fabs + + +def main(args): + return 100*sqrt(fabs(args[1]-0.01*args[0]**2))+0.01*fabs(args[0]+10) \ No newline at end of file