コード例 #1
0
ファイル: ipopt_declaration.py プロジェクト: Gansakumar/opal
from opal.core.algorithm import Algorithm
from opal.core.parameter import Parameter
from opal.core.measure import Measure

# Define new algorithm.
IPOPT = Algorithm(name='IPOPT', description='Interior Point for OPTimization')

# Register executable for IPOPT.
IPOPT.set_executable_command('python ipopt_run.py')

# Define parameters.

# 5. Line search parameters
IPOPT.add_param(Parameter(name='tau_min',
                          kind='real',
                          bound=[0, 1],
                          default=0.99,
                          description='For fraction-to-boundary rule'))
IPOPT.add_param(Parameter(name='s_theta',
                          kind='real',
                          bound=[0, None],
                          default=1.1,
                          description='Exponent for current constraint ' +\
                          'violation'))
IPOPT.add_param(Parameter(name='s_phi',
                          kind='real',
                          bound=[0, None],
                          default=2.3,
                          description='Exponent for linear barrier function ' +\
                          'model'))
IPOPT.add_param(Parameter(name='delta',
コード例 #2
0
# Description of the foward finite-difference "algorithm".
from opal.core.algorithm import Algorithm
from opal.core.parameter import Parameter
from opal.core.measure import Measure

# Define Algorithm object.
LAS = Algorithm(name='LAS', description='Lattice Siever')

# Register executable for LAS.
LAS.set_executable_command('python las_run.py')

# Register parameter file used by black-box solver to communicate with LAS.
#LAS.set_parameter_file('las.param')  # Should be chosen automatically and hidden.

# Define parameter and register it with algorithm.
lim0 = Parameter(kind='integer',
                 default=lim0_def,
                 bound=(lim0_min, lim0_max),
                 name='lim0',
                 description='Factor base bound, side 0')
lim1 = Parameter(kind='integer',
                 default=lim1_def,
                 bound=(lim1_min, lim1_max),
                 name='lim1',
                 description='Factor base bound, side 1')
lpb0 = Parameter(kind='integer',
                 default=lpb0_def,
                 bound=(lpb0_min, lpb0_max),
                 name='lpb0',
                 description='Large prime bound, side 0')
lpb1 = Parameter(kind='integer',
コード例 #3
0
ファイル: fd_declaration.py プロジェクト: Gansakumar/opal
# Description of the foward finite-difference "algorithm".
from opal.core.algorithm import Algorithm
from opal.core.parameter import Parameter
from opal.core.measure   import Measure

# Define Algorithm object.
FD = Algorithm(name='FD', description='Forward Finite Differences')

# Register executable for FD.
FD.set_executable_command('python fd_run.py')

# Register parameter file used by black-box solver to communicate with FD.
#FD.set_parameter_file('fd.param')  # Should be chosen automatically and hidden.

# Define parameter and register it with algorithm.
h = Parameter(kind='real', default=0.5, bound=(0, None),
              name='h', description='Step size')
FD.add_param(h)

# Define relevant measure and register with algorithm.
error = Measure(kind='real', name='ERROR', description='Error in derivative')
FD.add_measure(error)
コード例 #4
0
ファイル: trunk_declaration.py プロジェクト: demonalex1/opal
# Description of TRUNK.
from opal.core.algorithm import Algorithm
from opal.core.parameter import Parameter
from opal.core.parameter import ParameterConstraint
from opal.core.measure   import Measure

# Define Algorithm object.
trunk = Algorithm(name='TRUNK',
                  description='Trust Region for UNConstrained problems')

# Register executable command.
trunk.set_executable_command('python trunk_run.py')

# Register parameters.
trunk.add_param(Parameter(name='eta1',
                          kind='real',
                          default=0.25,
                          bound=[0, 1],
                          description='Gradient scaling cut-off'))
trunk.add_param(Parameter(name='eta2',
                          kind='real',
                          default=0.75,
                          bound=[0,1],
                          description='Trust-region increase threashold'))
trunk.add_param(Parameter(name='gamma1',
                          kind='real',
                          default=0.5,
                          bound=[0,1],
                          description='Trust-region shrink factor'))
trunk.add_param(Parameter(name='gamma2',
                          kind='real',
コード例 #5
0
# Description of ABySS.
from opal.core.algorithm import Algorithm
from opal.core.parameter import Parameter
from opal.core.measure import Measure

kd = int(raw_input("k-default: "))
kl = int(raw_input("k-lower: "))
ku = int(raw_input("k-upper: "))

# Define Algorithm object.
AB = Algorithm(name='AB', description='ABySS')

# Register executable command.
AB.set_executable_command('python abyss_run.py')

# Define parameter and register it with algorithm.
#200k-test k = 30; 16, 48
k = Parameter(kind='integer',
              default=kd,
              bound=(kl, ku),
              name='k',
              description='Step size')
AB.add_param(k)

# Define relevant measure and register with algorithm.
n50 = Measure(kind='integer', name='N50', description='N50 value')
AB.add_measure(n50)

#error = Measure(kind='real', name='ERROR', description='Error in derivative')
#AB.add_measure(error)
コード例 #6
0
ファイル: dfo_declaration.py プロジェクト: demonalex1/opal
from opal.core.algorithm import Algorithm
from opal.core.parameter import Parameter
from opal.core.measure   import Measure

# Define new algorithm.
DFO = Algorithm(name='DFO', description='Derivative-free Optimization')

# Register executable for DFO.
DFO.set_executable_command('python dfo_run.py')

# Define parameters.
nx = Parameter(kind='integer', default=1, name='NX')
maxit = Parameter(kind='integer', default=5000, name='MAXIT')
maxef = Parameter(kind='integer', default=9500, name='MAXNF')
stpcrtr = Parameter(kind='integer', default=2, name='STPCRTR')
delmin = Parameter(default=1.0e-4, name='DELMIN',bound=(1.0e-8,1.0e-3))
stpthr = Parameter(default=1.0e-3, name='STPTHR',bound=(0,None))
cnstol = Parameter(default=1.0e-5, name='CNSTOL',bound=(0,0.1))
delta = Parameter(default=1.0e0, name='DELTA',bound=(1.0e-8,None))
pp = Parameter(default=1.0e0, name='PP',bound=(1,None))
scale = Parameter(kind='integer', default=0, name='SCALE')
iprint = Parameter(kind='integer', default=1, name='IPRINT')

# Register parameters with algorithm.
DFO.add_param(nx)
DFO.add_param(maxit)
DFO.add_param(maxef)
DFO.add_param(stpcrtr)
DFO.add_param(delmin)
DFO.add_param(stpthr)
DFO.add_param(cnstol)
コード例 #7
0
# Description of the foward finite-difference "algorithm".
from opal.core.algorithm import Algorithm
from opal.core.parameter import Parameter
from opal.core.measure import Measure

# Define Algorithm object.
FD = Algorithm(name='FD', description='Forward Finite Differences')

# Register executable for FD.
FD.set_executable_command('python fd_run.py')

# Register parameter file used by black-box solver to communicate with FD.
#FD.set_parameter_file('fd.param')  # Should be chosen automatically and hidden.

# Define parameter and register it with algorithm.
h = Parameter(kind='real',
              default=0.5,
              bound=(0, None),
              name='h',
              description='Step size')
FD.add_param(h)

# Define relevant measure and register with algorithm.
error = Measure(kind='real', name='ERROR', description='Error in derivative')
FD.add_measure(error)
コード例 #8
0
ファイル: declaration.py プロジェクト: jennifer19/hyperNN
from opal.core.algorithm import Algorithm
from opal.core.parameter import Parameter
from opal.core.measure import Measure

# Define Algorithm object.
NN = Algorithm(name="hyperNN", description="Hyperparameter optimisation")

# Register executable for NN.
NN.set_executable_command("python hyperMads/runner.py")

# Register parameter file used by black-box solver to communicate with NN.
# NN.set_parameter_file("fd.param")
# Should be chosen automatically and hidden.

# Define parameter and register it with algorithm.
# ac = Parameter(kind="categorical", default="relu",
#                name="ac", description='Activation',
#                neighbors={"relu":    ["tanh", "sigmoid"],
#                           "tanh":    ["relu", "sigmoid"],
#                           "sigmoid": ["relu", "tavnh"]})
# NN.add_param(ac)
# nv = Parameter(kind="categorical", default="True",
#                name="nv", description="Nesterov",
#                neighbors={"True":  ["False"],
#                           "False": ["True"]})
# NN.add_param(nv)

lr = Parameter(kind="real",
               default=.001,
               bound=(0., 1.),
               name="learning_rate",
コード例 #9
0
ファイル: tabu_declaration.py プロジェクト: Kuifje02/MISC
# Description of the foward finite-difference "algorithm".
from opal.core.algorithm import Algorithm
from opal.core.parameter import Parameter
from opal.core.measure   import Measure

# Define Algorithm object.
FD = Algorithm(name='FD', description='tabu tenure')

# Register executable for FD.
FD.set_executable_command('python tabu_run.py')

# Register parameter file used by black-box solver to communicate with FD.
#FD.set_parameter_file('fd.param')  # Should be chosen automatically and hidden.

# Define parameter and register it with algorithm.
longueur_T = Parameter(kind='integer', default=14, bound=(0, None),
              name='longueur_T', description='Tabu tenure')
FD.add_param(longueur_T)

# Define relevant measure and register with algorithm.
error = Measure(kind='real', name='ERROR', description='Error in theta')
FD.add_measure(error)
コード例 #10
0
from opal.core.algorithm import Algorithm
from opal.core.parameter import Parameter
from opal.core.measure import Measure

# Define new algorithm.
coopsort = Algorithm(name='CoopSort', description='Sort Algorithm')

# Register executable.
coopsort.set_executable_command('python coopsort_run.py')

# Define parameters.

# The following coop tree amounts to 5522522 (in base 6.)
coopsort.add_param(Parameter(name='coopTree',
                             kind='categorical',
                             default=275378,
                             #default=284354431,
                             description='Encoded cooperation tree'))

# This dummy parameter is just there to circumvent a bug in NOMAD
# that occurs when the problem has a single parameter and this parameter
# is categorical.
coopsort.add_param(Parameter(name='nothing',
                             kind='integer',
                             default=0,
                             description='To avoid a bug in NOMAD'))

coopsort.add_measure(Measure(name='TIME',
                             kind='real',
                             description='Computing time'))