Skip to content

CurrinExp

Luigi Nardi edited this page Dec 20, 2019 · 4 revisions

In this example we show how to use HyperMapper to optimize a CurrinExp function. We look for minimizing the value of this function given two parameters x1, x2.

The Objective Function

The CurrinExp objective function can be defined as:

factor1 = 1 - math.exp(-1/(2*x2))
factor2 = 2300*x1*x1*x1 + 1900*x1*x1 + 2092*x1 + 60
factor3 = 100*x1*x1*x1 + 500*x1*x1 + 4*x1 + 20
y_value = factor1*factor2/factor3
y_energy = x1 + x2

An example of this code can be found in currinexp.py, together with the communication interface between CurrinExp and HyperMapper.

The JSON Configuration File

The json configuration file for this example is:

{
    "application_name": "currinexp",
    "optimization_objectives": ["Value", "Energy"],
    "optimization_iterations": 50,
    "input_parameters" : {
        "x1": {
            "parameter_type" : "ordinal",
            "values" : [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1],
            "parameter_default" : 0
        },
        "x2": {
            "parameter_type" : "ordinal",
            "values" : [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1],
            "parameter_default" : 0.1
        }
    }
}

You can find this json in currinexp_scenario.json.

Run HyperMapper

Remember to add the scripts folder to your $PYTHONPATH. In order to run this example, we use:

cd $HYPERMAPPER_HOME
python3 example_scenarios/synthetic/currinexp/currinexp.py

An example of stdout output can be found here.

The result of this script is a csv file called currinexp_output_dse_samples.csv.

Clone this wiki locally