03 Benchmark showcase: ZDT1 with 10 parameters - LucieKubickova/CFDNNetAdapt GitHub Wiki
Benchmark showcase: ZDT1 with 10 parameters
This section showcases the ten-parameter ZDT1 benchmark supplied in
example/ZDTS/ZDT1_10/. ZDT1 is a two-objective
problem and it does not require an external CFD solver.
ZDT1 definition
The function is defined in src/testFunctions.py.
Its parameters are
$$ x_i \in [0,1],\quad i = 1,\ldots,n, $$
where $n = 10$ is the number of parameters.
Its objective values are
$$ \begin{aligned} f_1(\mathbf{x}) &= x_1,\ f_2(\mathbf{x}) &= g(\mathbf{x}) \left[1-\sqrt{\frac{x_1}{g(\mathbf{x})}}\right],\ g(\mathbf{x}) &= 1 + 9 \left(\sum_{i=2}^{n}x_i\right)/(n-1). \end{aligned} $$
Both objectives are minimized. The Pareto-optimal set is
$$ x_1 \in [0,1],\quad x_i = 0,\quad i = 2,\ldots,n, $$
and the Pareto-optimal front is
$$ f_1 \in [0,1],\quad f_2 = 1-\sqrt{f_1}. $$
Running the example
From the repository root:
cd example/ZDTS/ZDT1_10
python Allrun.py
Allrun.py settings
Allrun.py configures a CFDNNetAdaptV3
run as follows:
nPars = 10-- number of decision variablesnObjs = 2-- number of objectivesnOuts = 2-- number of surrogate outputs (optional)nSam = 10-- initial sample countdeltaNSams = [10, 30, 50, 100, 300, 500, 1000]-- sample count increments over iterationsnNN = 4-- number of neural networks generated in each iterationminN = 2-- minimum number of neurons in a hidden layermaxN = 20-- maximum number of neurons in a hidden layernHidLay = 3-- number of hidden layersdRN = 1-- decrement of variability in hidden layer sizetol = 1e-5-- optimization toleranceiMax = 200-- maximum number of iterationsnComps = 16-- number points chosen for verificationnSeeds = 4-- number of seeds for DNN trainingtrainPro = 75-- training percentage splitvalPro = 15-- validation percentage splittestPro = 10-- testing percentage splitkMax = 10000-- maximum number of iterations in DNN trainingrEStop = 1e-5-- relative error for stopping DNN trainingpopSize = 100-- population size of MOEA algorithmoffSize = 100-- offspring size of MOEA algorithmnGens = 250-- number of MOEA generations
Outputs
Allrun.py saves data to 01_algoRuns in a dedicated run_* folder
including a log.out file and folders for each optimization step
step_*.
The log.out file stores data about:
- used settings;
- architectures of all tested DNNs;
- architecture of the best-found DNN;
- points chosen for verification with DNN-predicted values and values calculated by the model (CFD if required); and
- verification errors.
Each step_* folder includes:
- weights and metadata of each trained DNN; and
- MOEA results from each DNN-based optimization.
Indicators
computeIndicators.py reads
the optimization log, locates the best DNNs found in each iteration, and reads
their optimization results. It then plots the convergence of inverted
generational distance and hypervolume difference as the number of samples
increases.
Inverted generational distance
The script uses 100 points from the analytical Pareto-optimal set
$\mathcal{P}_\mathrm{opt}$ and the Pareto-optimal set predicted by DNN
$\mathcal{P}_\mathrm{dnn}$ to calculate:
$$ \mathrm{IGD} = \frac{1}{\lVert\mathcal{P}\mathrm{opt}\rVert} \sum{\mathbf{x}\in\mathcal{P}\mathrm{opt}} \min{\mathbf{y}\in\mathcal{P}_\mathrm{dnn}} \lVert\mathbf{x}-\mathbf{y}\rVert. $$
Hypervolume difference
The script uses 3000 points from the analytical Pareto-optimal front
$\mathcal{O}_\mathrm{opt}$ and the Pareto-optimal front predicted by DNN but
recalculated by the model $\mathcal{O}_\mathrm{dnn}$ to calculate:
$$ \Delta\mathrm{HV} = \frac{\mathrm{HV}(\mathcal{O}\mathrm{opt}) -\mathrm{HV}(\mathcal{O}\mathrm{dnn})} {\mathrm{HV}(\min(\mathcal{O}_\mathrm{opt}))}. $$
The hypervolume (HV) is calculated using the Platypus hypervolume implementation and the data-derived objective bounds.
The resulting figure indicators.png is saved to the run folder.

Visualization in objective space
postProcess.py creates the final
objective-space comparison. It plots:
- the analytical Pareto-optimal front;
- the NSGA-II sample data;
- the DNN-predicted objectives from the best DNNs listed in
log.out; and - recomputed best-DNN objectives by the model.
The resulting figure objSpacePlot.png is saved to the run folder.
