Exemplo n.º 1
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)
Exemplo n.º 2
0
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',
Exemplo n.º 3
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)
Exemplo n.º 4
0
              description='Sieve region size')
qmin = Parameter(kind='integer',
                 default=qmin_def,
                 bound=(qmin_min, qmin_max),
                 name='qmin',
                 description='Special-q lower bound')
bkthresh1 = Parameter(kind='integer',
                      default=bkthresh1_def,
                      bound=(bkthresh1_min, bkthresh1_max),
                      name='bkthresh1',
                      description='Level-2 bucket sieve bound')
# OPAL begins by modifying the first parameters below, thus we should put
# first the most important parameters.
# Warning: if you change the order of parameters, please also change the
# lines I_opt=`head -1 $f` and so on in optimize.sh
LAS.add_param(I)
LAS.add_param(qmin)
LAS.add_param(lim0)
LAS.add_param(lim1)
LAS.add_param(bkthresh1)
LAS.add_param(lpb0)
LAS.add_param(lpb1)
LAS.add_param(mfb0)
LAS.add_param(mfb1)
LAS.add_param(ncurves0)
LAS.add_param(ncurves1)

# Define relevant measure and register with algorithm.
sievetime = Measure(kind='real',
                    name='SIEVETIME',
                    description='Time in the sieving')
Exemplo n.º 5
0
# 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)
DFO.add_param(delta)
DFO.add_param(pp)
DFO.add_param(scale)
DFO.add_param(iprint)

# Define the feasible region.
DFO.add_parameter_constraint('DELTA >= DELMIN')

# Define and register measures.
Exemplo n.º 6
0
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',
                          default=1.000,
Exemplo n.º 7
0
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, rational side')
lim1 = Parameter(kind='integer', default=lim1_def, bound=(lim1_min, lim1_max), name='lim1', description='Factor base bound, algebraic side')
lpb0 = Parameter(kind='integer', default=lpb0_def, bound=(lpb0_min, lpb0_max), name='lpb0', description='Large prime bound, rational side')
lpb1 = Parameter(kind='integer', default=lpb1_def, bound=(lpb1_min, lpb1_max), name='lpb1', description='Large prime bound, algebraic side')
mfb0 = Parameter(kind='integer', default=mfb0_def, bound=(mfb0_min, mfb0_max), name='mfb0', description='Cofactorization bound, rational side')
mfb1 = Parameter(kind='integer', default=mfb1_def, bound=(mfb1_min, mfb1_max), name='mfb1', description='Cofactorization bound, algebraic side')
ncurves0 = Parameter(kind='integer', default=ncurves0_def, bound=(ncurves0_min,ncurves0_max), name='ncurves0', description='Cofactorization curves, side 0')
ncurves1 = Parameter(kind='integer', default=ncurves1_def, bound=(ncurves1_min,ncurves1_max), name='ncurves1', description='Cofactorization curves, side 1')
I = Parameter(kind='integer', default=I_def, bound=(I_min, I_max), name='I', description='Sieve region size')
LAS.add_param(lim0)
LAS.add_param(lim1)
LAS.add_param(lpb0)
LAS.add_param(lpb1)
LAS.add_param(mfb0)
LAS.add_param(mfb1)
LAS.add_param(ncurves0)
LAS.add_param(ncurves1)
LAS.add_param(I)

# Define relevant measure and register with algorithm.
sievetime = Measure(kind='real', name='SIEVETIME', description='Time in the sieving')
rels = Measure(kind='integer', name='RELATIONS', description='Relations found in the sieving')
LAS.add_measure(sievetime)
LAS.add_measure(rels)
Exemplo n.º 8
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)
Exemplo n.º 9
0
#                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",
               description="Learning rate")
NN.add_param(lr)
l1 = Parameter(kind="real",
               default=.0001,
               bound=(0., 1.),
               name="reg_l1",
               description="L1 regularization")
NN.add_param(l1)
l2 = Parameter(kind="real",
               default=.0001,
               bound=(0., 1.),
               name="reg_l2",
               description="L2 regularization")
NN.add_param(l2)
m = Parameter(kind="real",
              default=.01,
              bound=(0., 1.),
Exemplo n.º 10
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='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)
Exemplo n.º 11
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'))