Skip to content

Ordinal Multi‐objective Branin

arturluis edited this page Feb 17, 2021 · 7 revisions

Here, we will show how to use HyperMapper to optimize a multi-objective Branin function with ordinal variables. We look for minimizing the value of this function and a fake energy estimation given two ordinal parameters x1, x2.

The Objective Function

Our objective function is defined as:

def Branin(x1, x2):
    a = 1.0
    b = 5.1 / (4.0 * math.pi * math.pi)
    c = 5.0 / math.pi
    r = 6.0
    s = 10.0
    t = 1.0 / (8.0 * math.pi)
    y_value = a * (x2 - b * x1 * x1 + c * x1 - r) ** 2 + s * (1 - t) * math.cos(x1) + s
    y_energy = x1 + x2
    return y_value, y_energy

An example of this code can be found in ordinal_multiobjective_branin.py.

The JSON Configuration File

The json configuration file for this example is:

{
    "application_name": "ordinal_multiobjective_branin",
    "optimization_objectives": ["Value", "Energy"],
    "optimization_iterations": 50,
    "input_parameters" : {
        "x1": {
            "parameter_type" : "real",
            "values" : [-5, 10],
            "parameter_default" : 0
        },
        "x2": {
            "parameter_type" : "real",
            "values" : [0, 15],
            "parameter_default" : 0
        }
    }
}

You can find this json in ordinal_multiobjective_branin_scenario.json.

Run HyperMapper

In order to run this example, we use:

python3 example_scenarios/synthetic/ordinal_multiobjective_branin/ordinal_multiobjective_branin.py

An example of stdout output can be found here.

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

Compute Pareto

After running HyperMapper, we can compute the Pareto front using:

hm-compute-pareto example_scenarios/synthetic/ordinal_multiobjective_branin/ordinal_multiobjective_branin_scenario.json

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

Visualize Pareto

We can also visualize the Pareto front using:

hm-plot-pareto example_scenarios/synthetic/ordinal_multiobjective_branin/ordinal_multiobjective_branin_scenario.json

The result of this script is a pdf image ordinal_multiobjective_branin_output_pareto.pdf.

Clone this wiki locally