-
Notifications
You must be signed in to change notification settings - Fork 26
DTLZ1
Here, we will show how to use HyperMapper to optimize the adapted DTLZ1 function presented in ParEGO. We look for minimizing the two values of this function given six parameters. The Pareto front of this function consists of all solutions where all but the first parameter are equal to 0.5.
The values of the DTLZ1 function are defined as:
def dtlz1_function(x1, x2, x3, x4, x5, x6):
x1 = X['x1']
x2 = X['x2']
x3 = X['x3']
x4 = X['x4']
x5 = X['x5']
x6 = X['x6']
g_sum = (x2 - 0.5)**2 + (x3 - 0.5)**2 + (x4 - 0.5)**2 + (x5 - 0.5)**2 + (x6 - 0.5)**2
g_cos = math.cos(2*math.pi*(x2 - 0.5)) + math.cos(2*math.pi*(x3 - 0.5)) + math.cos(2*math.pi*(x4 - 0.5))\
+ math.cos(2*math.pi*(x5 - 0.5)) + math.cos(2*math.pi*(x6 - 0.5))
g = 100*(5 + g_sum - g_cos)
f1_value = 0.5*x1*(1 + g)
f2_value = 0.5*(1 - x1)*(1 + g)
output = {}
output['f1_value'] = f1_value
output['f2_value'] = f2_value
return output
An example of this code can be found in dtlz1.py.
The json configuration file for this example is:
{
"application_name": "dtlz1",
"optimization_objectives": ["f1_value", "f2_value"],
"optimization_iterations": 185,
"design_of_experiment": {
"doe_type": "standard latin hypercube",
"number_of_samples": 65
},
"input_parameters" : {
"x1": {
"parameter_type" : "real",
"values" : [0, 1]
},
"x2": {
"parameter_type" : "real",
"values" : [0, 1]
},
"x3": {
"parameter_type" : "real",
"values" : [0, 1]
},
"x4": {
"parameter_type" : "real",
"values" : [0, 1]
},
"x5": {
"parameter_type" : "real",
"values" : [0, 1]
},
"x6": {
"parameter_type" : "real",
"values" : [0, 1]
}
}
}
You can find this json in dtlz1_scenario.json.
In order to run this example, we use:
python3 example_scenarios/synthetic/dtlz1/dtlz1.py
An example of stdout output can be found here.
The result of this script is a csv file called dtlz1_output_samples.csv.
After running HyperMapper, we can compute the Pareto front using:
hm-compute-pareto example_scenarios/synthetic/dtlz1/dtlz1_scenario.json
The result of this script is a csv file called dtlz1_output_pareto.csv.
We can also visualize the Pareto front using:
hm-plot-pareto example_scenarios/synthetic/dtlz1/dtlz1_scenario.json
The result of this script is a pdf image dtlz1_output_pareto.pdf.