Beispiel #1
0

# Return the error measure.
def total_time(parameters, measures):
    with open("measures", "a") as f:
        f.write("parameters = %r, measures = %r\n" % (parameters, measures))
    # Now with numerical integration, we want to minimize total time, not the time/rel
    # return sum(map(float, measures["TIME"])) / sum(map(float, measures["RELATIONS"]))
    return sum(map(float, measures["SIEVETIME"]))


# Define parameter optimization problem.
data = ModelData(LAS)
struct = ModelStructure(objective=total_time)  # Unconstrained
model = Model(modelData=data, modelStructure=struct)

# Solve parameter optimization problem.
NOMAD.set_parameter(
    name='DISPLAY_STATS',
    value='%3dBBE  %7.1eSOL  %8.3eOBJ  %5.2fTIME %5.2SIEVETIME')
# to limit the number of evaluations, define the environment variable
# NOMAD_MAX_BB_EVAL, for example:
# NOMAD_MAX_BB_EVAL=100 ./optimize.sh ...
import os
max_bb_eval = os.getenv("NOMAD_MAX_BB_EVAL")
if max_bb_eval != None:
    NOMAD.set_parameter(name='MAX_BB_EVAL', value=int(max_bb_eval))
if MPI > 1:
    NOMAD.set_mpi_config("np", MPI)
NOMAD.solve(blackbox=model)
Beispiel #2
0
                                                             'EIGENALS',
                                                             'FMINSRF2',
                                                             'FMINSURF',
                                                             'GENROSE',
                                                             'HIELOW',
                                                             'MANCINO',
                                                             'NCB20',
                                                             'NCB20B',
                                                             'NONDQUAR',
                                                             'POWER',
                                                             'SENSORS',
                                                             'SINQUAD',
                                                             'TESTQUAD',
                                                             'TRIDIA',
                                                             'WOODS']]

# Define parameter optimization problem.
data = ModelData(algorithm=trunk,
                 problems=problems,
                 parameters=params)
struct = ModelStructure(objective=get_error,
                        constraints=[])  # Unconstrained
blackbox = Model(modelData=data, modelStructure=struct)

# Solve parameter optimization problem.
NOMADMPI.set_mpi_config(name='np', value=8)
NOMADMPI.set_mpi_config(name='-host', value='lin01,lin02,lin03,lin04')
NOMADMPI.set_parameter(name='MAX_BB_EVAL', value=50)
NOMADMPI.set_parameter(name='DISPLAY_DEGREE', value=2)
NOMADMPI.solve(model=blackbox)
def get_error(parameters, measures):
    val = sum(measures["FEVAL"])
    return val


# Parameters being tuned and problem list.
par_names = ['eta1', 'eta2', 'gamma1', 'gamma2', 'gamma3']
params = [param for param in trunk.parameters if param.name in par_names]

problems = [
    problem for problem in CUTEr if problem.name in [
        'BDQRTIC', 'BROYDN7D', 'BRYBND', 'CURLY10', 'CURLY20', 'CURLY30',
        'CRAGGLVY', 'DIXON3DQ', 'EIGENALS', 'FMINSRF2', 'FMINSURF', 'GENROSE',
        'HIELOW', 'MANCINO', 'NCB20', 'NCB20B', 'NONDQUAR', 'POWER', 'SENSORS',
        'SINQUAD', 'TESTQUAD', 'TRIDIA', 'WOODS'
    ]
]

# Define parameter optimization problem.

data = ModelData(algorithm=trunk, problems=problems, parameters=params)
struct = ModelStructure(objective=get_error, constraints=[])  # Unconstrained
model = Model(modelData=data, modelStructure=struct, platform=SMP)

# Solve parameter optimization problem.
NOMADMPI.set_mpi_config(name='np', value=5)
NOMADMPI.set_parameter(name='MAX_BB_EVAL', value=5)
NOMADMPI.set_parameter(name='DISPLAY_DEGREE', value=2)
NOMADMPI.solve(blackbox=model)
Beispiel #4
0
def get_error(parameters, measures):
    val = sum(measures["FEVAL"])
    return val


# Parameters being tuned and problem list.
par_names = ['eta1', 'eta2', 'gamma1', 'gamma2', 'gamma3']
params = [param for param in trunk.parameters if param.name in par_names]

problems = [
    problem for problem in CUTEr if problem.name in [
        'BDQRTIC', 'BROYDN7D', 'BRYBND', 'CURLY10', 'CURLY20', 'CURLY30',
        'CRAGGLVY', 'DIXON3DQ', 'EIGENALS', 'FMINSRF2', 'FMINSURF', 'GENROSE',
        'HIELOW', 'MANCINO', 'NCB20', 'NCB20B', 'NONDQUAR', 'POWER', 'SENSORS',
        'SINQUAD', 'TESTQUAD', 'TRIDIA', 'WOODS'
    ]
]

# Define parameter optimization problem.
data = ModelData(algorithm=trunk, problems=problems, parameters=params)
struct = ModelStructure(objective=get_error, constraints=[])  # Unconstrained
blackbox = Model(modelData=data, modelStructure=struct)

# Solve parameter optimization problem.
NOMADMPI.set_mpi_config(name='np', value=8)
NOMADMPI.set_mpi_config(name='-host', value='lin01,lin02,lin03,lin04')
NOMADMPI.set_parameter(name='MAX_BB_EVAL', value=50)
NOMADMPI.set_parameter(name='DISPLAY_DEGREE', value=2)
NOMADMPI.solve(model=blackbox)
        "EIGENALS",
        "FMINSRF2",
        "FMINSURF",
        "GENROSE",
        "HIELOW",
        "MANCINO",
        "NCB20",
        "NCB20B",
        "NONDQUAR",
        "POWER",
        "SENSORS",
        "SINQUAD",
        "TESTQUAD",
        "TRIDIA",
        "WOODS",
    ]
]


# Define parameter optimization problem.

data = ModelData(algorithm=trunk, problems=problems, parameters=params)
struct = ModelStructure(objective=get_error, constraints=[])  # Unconstrained
model = Model(modelData=data, modelStructure=struct, platform=SMP)

# Solve parameter optimization problem.
NOMADMPI.set_mpi_config(name="np", value=5)
NOMADMPI.set_parameter(name="MAX_BB_EVAL", value=5)
NOMADMPI.set_parameter(name="DISPLAY_DEGREE", value=2)
NOMADMPI.solve(blackbox=model)