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
IPOPT.add_parameter_constraint('s_theta > 1')
IPOPT.add_parameter_constraint('s_phi > 1')
IPOPT.add_parameter_constraint('delta > 0')
IPOPT.add_parameter_constraint('eta_phi > 0')
IPOPT.add_parameter_constraint('eta_phi < 0.5')
IPOPT.add_parameter_constraint('theta_min_fact > 0')
IPOPT.add_parameter_constraint('theta_max_fact > 0')
IPOPT.add_parameter_constraint('gamma_theta > 0')
IPOPT.add_parameter_constraint('gamma_theta < 1')
IPOPT.add_parameter_constraint('gamma_phi > 0')
IPOPT.add_parameter_constraint('gamma_phi < 1')
IPOPT.add_parameter_constraint('kappa_soc > 0')
IPOPT.add_parameter_constraint('kappa_soc < 1')
# Define and register measures.
IPOPT.add_measure(Measure(name='CPU',
                          kind='real',
                          description='Computing time'))
IPOPT.add_measure(Measure(name='FEVAL',
                          kind='integer',
                          description='Number of evaluation of objective function'))
IPOPT.add_measure(Measure(name='EQCVAL',
                          kind='integer',
                          description='Number of evaluation of equality constraints'))
IPOPT.add_measure(Measure(name='INCVAL',
                          kind='integer',
                          description='Number of evaluation of inequality constraints'))
IPOPT.add_measure(Measure(name='GEVAL',
                          kind='integer',
                          description='Number of evaluation of function objective gradient'))
IPOPT.add_measure(Measure(name='EQJVAL',
                          kind='integer',
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
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')
rels = Measure(kind='integer',
               name='RELATIONS',
               description='Relations found in the sieving')
LAS.add_measure(sievetime)
LAS.add_measure(rels)
Exemplo n.º 5
0
                          default=0.1000,
                          description='Level, used for interpolation'))

# Register constraints on the parameters.

trunk.add_parameter_constraint(ParameterConstraint('eta1 < eta2'))
trunk.add_parameter_constraint(ParameterConstraint('eta1 > 0'))
trunk.add_parameter_constraint(ParameterConstraint('eta2 < 1'))
trunk.add_parameter_constraint(ParameterConstraint('gamma1 > 0'))
trunk.add_parameter_constraint(ParameterConstraint('gamma1 <= gamma2'))
#trunk.add_parameter_constraint(ParameterConstraint('gamma2 < 1'))
trunk.add_parameter_constraint(ParameterConstraint('gamma3 > 1'))

# Register atomic measures.
trunk.add_measure(Measure(name='CPU',
                          kind='real',
                          description='Computing time'))
trunk.add_measure(Measure(name='FEVAL',
                          kind='integer',
                          description='Number of function evaluations'))
trunk.add_measure(Measure(name='GEVAL',
                          kind='integer',
                          description='Number of gradient evaluations'))
trunk.add_measure(Measure(name='NITER',
                          kind='integer',
                          description='Number of iterations'))
trunk.add_measure(Measure(name='CGITER',
                          kind='integer',
                          description='Number of CG iterations'))
trunk.add_measure(Measure(name='RDGRAD',
                          kind='real',
Exemplo n.º 6
0
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.
exitcode = Measure(kind='integer', name='EXITCODE', description='Exit code')
fval = Measure(kind='real', name='FVAL', description='Function value')
cpu = Measure(kind='real', name='CPU', description='CPU time usage')
feval = Measure(kind='real', name='FEVAL',
                description='Number of function evaluations')

DFO.add_measure(exitcode)
DFO.add_measure(fval)
DFO.add_measure(cpu)
DFO.add_measure(feval)
Exemplo n.º 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)
Exemplo n.º 8
0
NN.add_param(m)
d = Parameter(kind="real",
              default=1e-6,
              bound=(0., .1),
              name="decay",
              description="Decay")
NN.add_param(d)

n1 = Parameter(kind="integer",
               default=200,
               bound=(0, 500),
               name="n1",
               description="Number of neurons in first layer")
NN.add_param(n1)
n2 = Parameter(kind="integer",
               default=200,
               bound=(0, 500),
               name="n2",
               description="Number of neurons in second layer")
NN.add_param(n2)
n3 = Parameter(kind="integer",
               default=0,
               bound=(0, 500),
               name="n3",
               description="Number of neurons in third layer")
NN.add_param(n3)

# Define relevant measure and register with algorithm.
error = Measure(kind="real", name="acc", description="Accuracy of the model")
NN.add_measure(error)
Exemplo n.º 9
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'))