5. pyopus.problems
— Test problems for optimizaion algorithms
Test function suites module
Test problems with a common problem interface (CPI).
- 5.1.
pyopus.problems.cpi
— Common problem interface - 5.2.
pyopus.problems.glbc
— Global optimization test functions - 5.3.
pyopus.problems.cec13
— Problems from the IEEE CEC 2013 competition - 5.4.
pyopus.problems.mgh
— More-Garbow-Hillstrom set of test functions - 5.5.
pyopus.problems.mwbm
— More-Wild set of test functions for DFO, data profile generation - 5.6.
pyopus.problems.madsprob
— Mesh adaptive direct search test problems - 5.7.
pyopus.problems.lvns
— Lukšan-Vlček set of nonsmooth problems - 5.8.
pyopus.problems.lvu
— Lukšan-Vlček set of unconstrained problems - 5.9.
pyopus.problems.karmitsa
— Large scale nonsmooth test functions (Karmitsa set) - 5.10.
pyopus.problems.cuter
— Wrapper for accessing CUTEr problems - 5.11.
pyopus.problems.cutermgr
— CUTEr problem manager - 5.12.
pyopus.problems.cuteritf
— CUTEr problem binary interace source code
Example - adding a random delay to a function evaluation (for benchmarking) file delay_wrapper.py in folder demo/problems/
# Delaying the evaluation of a test function.
from pyopus.optimizer.base import RandomDelay
from pyopus.problems.mgh import Rosenbrock
from platform import system
if system()=='Windows':
# perf_counter() is the most precise timer in Windows
from time import perf_counter as timer
else:
# time() is the most precise timer in Linux
from time import time as timer
def myfunc(x):
return 2.0*x
if __name__=='__main__':
callf=myfunc
xini=10.0
# Delay is chonen randomly from [1.0, 2.0] with uniform distribution.
delayedCallable=RandomDelay(callf, [1.0, 2.0])
print("Starting evaluation of myfunc() without delay.")
t1=timer()
f=callf(xini)
dt=timer()-t1
print("Evaluation took %.3fs, f=%e." % (dt, f))
print("\nStarting evaluation of myfunc() with delay.")
t1=timer()
f=delayedCallable(xini)
dt=timer()-t1
print("Evaluation took %.3fs, f=%e." % (dt, f))
# Calling a test suite function evaluates both f and g. To delay
# the call to f() or g() method, use wrapper objects.
rosenbrockObject=Rosenbrock()
xini=rosenbrockObject.initial
# Delaying function evaluation
delayedF=RandomDelay(rosenbrockObject.cpi()['f'], [1.0, 2.0])
print("\n\nStarting Rosenbrock f evaluation with delay.")
t1=timer()
f=delayedF(xini)
dt=timer()-t1
print("Evaluation took %.3fs, f=%e" % (dt, f))
# Delaying gradient evaluation
delayedG=RandomDelay(rosenbrockObject.cpi()['g'], [1.0, 2.0])
print("\nStarting Rosenbrock g evaluation with delay.")
t1=timer()
g=delayedG(xini)
dt=timer()-t1
print("Evaluation took %.3fs, g=%s" % (dt, str(g)))