DC1-DTLZ3 with 3 objectives
The problem
Li, Chen, Fu and Yao (2019) proposed C-TAEA, a two-archive algorithm for constrained problems, and, to test it, the DC-DTLZ problems: DTLZ1 and DTLZ3 with constraints on the decision variables, where Jain and Deb's C-DTLZ problems constrain the objectives. Type 1 (DC1) constrains the first variable and cuts the front into cones from the origin; type 2 (DC2) constrains the distance function g and leaves almost nothing but the front feasible, with local optima of the violation on the way; type 3 (DC3) does both, on every position variable. The paper's supplement defines them (section 1.2) with parameters a and b, and gives a = 3 and b = 0.5 for DC1 only; genoxide takes the others from the code of the authors' laboratory, EMOC, and the docs of multi::problems::Dc1Dtlz1 say what else the supplement leaves open and how genoxide settles it.
DC1-DTLZ3 with 3 objectives and 12 variables in [0, 1]:
minimize f₁ = (1 + g) cos(πx₁/2) cos(πx₂/2)
f₂ = (1 + g) cos(πx₁/2) sin(πx₂/2)
f₃ = (1 + g) sin(πx₁/2)
g = 100 (10 + Σᵢ₌₃¹² ((xᵢ − 0.5)² − cos(20π (xᵢ − 0.5))))
subject to cos(aπx₁) ≥ b, a = 3, b = 0.5
DTLZ3's front is the unit sphere's octant, reached with the distance variables at 0.5, where g = 0. The constraint keeps x₁ in [0, 1/9] or [5/9, 7/9], and the front is the parts of the sphere with f₃ = sin(πx₁/2) in [0, sin(π/18)] or [sin(5π/18), sin(7π/18)]: a band along the base of the octant and one around its upper half. Its ideal point is (0, 0, 0) and its nadir point (1, 1, sin(7π/18)) = (1, 1, 0.9397). The supplement gives no front; genoxide derives it (g = 0 is feasible under every constraint, and the position constraints don't involve g, so DTLZ3's front points are optimal wherever their position variables are feasible, and no other point is), and it agrees with the sampled front that EMOC ships.
What makes it hard
DTLZ3's g, with 3¹⁰ − 1 local fronts (Deb et al.), spheres of larger radii, which the population climbs down, all of them cut into the same feasible cones. Then the bands: the lower one, along the base, is narrow, a sixth of the octant's height, and NSGA-III's reference directions between the bands, which point into the infeasible gap, attach solutions at its edges.
Representation
A Real genome of 12 genes in [0, 1]. The problem is genoxide's Dc1Dtlz3, whose fitness is the three objectives and the total constraint violation, 0 when it is feasible; in Python, gx.problems.Dc1Dtlz3(). Solutions compare by constrained dominance: a feasible solution beats an infeasible one, of two infeasible ones the smaller violation wins, and of two feasible ones Pareto dominance decides.
Algorithm
Two runs, with a population of 92 for 4,000 generations each:
- NSGA-III (Deb and Jain, 2014; Jain and Deb, 2014, IEEE Transactions on Evolutionary Computation 18(4): 577-601 and 602-622) with the settings that the C-TAEA paper gives its C-NSGA-III (supplement, tables 3 and 4): the 91 reference directions of Das and Dennis's method with 12 divisions and a population of 92, simulated binary crossover with η = 30 at a rate of 1, and polynomial mutation with η = 20 at a rate of 1/n per gene, for 4,000 generations (the supplement gives no budget for the DC-DTLZ problems; DTLZ3's local fronts take longer than DTLZ1's, and with 2,000, as on DC2-DTLZ3 and DC3-DTLZ3, 13 runs of 20 reach the target here and the rest come within 2% of it);
- SMS-EMOA (Beume, Naujoks and Emmerich, 2007, European Journal of Operational Research 181(3): 1653-1669), which keeps the solutions that add the most hypervolume, with the same operators and as many children a generation as the population.
Output
A line per run: the size of its final front, how many of its solutions the problem finds feasible, their IGD+ and hypervolume, and the hypervolume as a share of that of a sample of the optimal front with at least as many points as the population. Then the hypervolumes of the whole front and of the sample.
The indicators use the objectives normalized by the front's ideal and nadir points, so that the front spans [0, 1] in each. IGD+ (Ishibuchi et al., 2015, EMO 2015, LNCS 9019: 110-125) averages, over 2,000 points of the optimal front from genoxide's optimal_front, the distance to the nearest feasible solution of the found front, counting only the objectives in which the solution is worse. Smaller is better; a front of as many points as the population can't cover the 2,000 exactly, and the sample shows what it can. The hypervolume (Zitzler and Thiele, 1999, IEEE Transactions on Evolutionary Computation 3(4): 257-271) is the volume the feasible solutions dominate up to the reference point (1.1, 1.1, 1.1). Larger is better; the whole front's is computed from 3,000 of its points, and the sample's is what a front of that many points reaches. In Python, run evaluates the problem in Rust, so both versions print the same.
The page plays the runs back side by side, each population as the problem scores it: its feasible non-dominated solutions, its infeasible ones (hollow, at most 100 a frame), and the optimal front, sampled.
The project page plays these runs back.
Good results
The target: every solution feasible, and 99% of the hypervolume of the sample of 100 points of the front, about what a front of 92 solutions spread like it has.
NSGA-III's run with seed 1 ends with 92 solutions, 92 feasible, IGD+ 0.0170, hypervolume 0.6236, 99.4% of the sample's; SMS-EMOA's with 92 solutions, 92 feasible, IGD+ 0.0507, hypervolume 0.5268, 84.0% of the sample's. Over seeds 1 to 20, NSGA-III ends with IGD+ from 0.0156 to 0.0174 and 99.2% to 99.7% of the sample's hypervolume, every run reaching the target, and SMS-EMOA with IGD+ from 0.0501 to 0.0583 and 79.4% to 84.3% of the sample's hypervolume, no run reaching the target. NSGA-III needs the 4,000 generations: after 2,000, 13 runs reach the target and the rest are within 2% of it, the directions that point into the gap between the bands spending solutions on its edges. SMS-EMOA, whose hypervolume selection favours the upper band, leaves the lower one thin. The C-TAEA paper's C-NSGA-III ends with a median IGD of 0.272 (its table 3), and C-TAEA with 0.147.
Known optimum: two bands of the unit sphere's octant, f₃ in [0, sin(π/18)] or [sin(5π/18), sin(7π/18)]; ideal point (0, 0, 0), nadir point (1, 1, sin(7π/18)) = (1, 1, 0.9397); hypervolume 0.6529 (normalized objectives, reference point (1.1, 1.1, 1.1))
Source: examples/dc1_dtlz3_3obj
Interactive run: tachsin.gr/projects/genoxide/examples/dc1-dtlz3-3obj
cargo run --release --example dc1_dtlz3_3obj
//! DC1-DTLZ3 with 3 objectives: minimize three objectives of DTLZ3 subject to a constraint on the
//! first variable, whose front is two bands of DTLZ's, with NSGA-III and SMS-EMOA.
//!
//! From genoxide's `multi::problems::Dc1Dtlz3`. Runs NSGA-III with the settings of the C-TAEA
//! paper's C-NSGA-III and SMS-EMOA, a population of 92 for 4,000 generations each, with constraint
//! dominance. Prints each final front's size, how many of its solutions are feasible, their IGD+ to
//! 2,000 points of the optimal front and their hypervolume, with the objectives normalized by the
//! front's ideal and nadir points, as a share of that of a sample of the front with at least as
//! many points as the population; then the hypervolumes of the whole front and of the sample.
//!
//! With `GENOXIDE_TRACE=<file>`, it also writes a trace of its runs for the plot on the example's
//! page, with `trace.rs`.
//!
//! ```text
//! cargo run --release --example dc1_dtlz3_3obj
//! ```
mod trace;
use genoxide::Objective::Minimize;
use genoxide::multi::MultiFitnessFunction;
use genoxide::multi::indicator::{hypervolume, igd_plus};
use genoxide::multi::problems::{Dc1Dtlz3, MultiProblem};
use genoxide::prelude::*;
// the reference point of the hypervolume, with the objectives normalized by the front's ideal and
// nadir points
pub const REFERENCE: [f64; 3] = [1.1, 1.1, 1.1];
fn main() -> Result<()> {
let problem = Dc1Dtlz3::<3>::default();
// with GENOXIDE_TRACE=<file>, a trace of the runs for the plot on the example's page
let mut trace = trace::Trace::from_env();
// the sample: at least as many points of the optimal front as the population has, about what
// a front of that many solutions can be
let sample = normalized(&problem, &problem.optimal_front(92).expect("known"));
let rate = 1.0 / problem.variables() as f64;
// NSGA-III with the settings of the C-TAEA paper's C-NSGA-III
let algorithm = Nsga3::builder(
problem.representation(),
[Minimize; 3],
multi::das_dennis::<3>(12),
)
.population_size(92)
.crossover(SimulatedBinaryCrossover::new(30.0)?)
.crossover_rate(1.0)
.mutate(PolynomialMutation::per_gene(rate, 20.0)?)
.seed(1)
.build()?;
run(
&problem, "NSGA-III", algorithm, problem, 4_000, &sample, &mut trace,
)?;
// SMS-EMOA, which keeps the solutions that add the most hypervolume
let algorithm = SmsEmoa::builder(problem.representation(), [Minimize; 3])
.population_size(92)
.crossover(SimulatedBinaryCrossover::new(30.0)?)
.mutate(PolynomialMutation::per_gene(rate, 20.0)?)
.seed(1)
.build()?;
run(
&problem, "SMS-EMOA", algorithm, problem, 4_000, &sample, &mut trace,
)?;
let whole = normalized(&problem, &problem.optimal_front(3_000).expect("known"));
println!(
"the whole front: hypervolume {:.4}; a sample of {} of its points: {:.4}",
hypervolume(&whole, &REFERENCE, &[Minimize; 3]),
sample.len(),
hypervolume(&sample, &REFERENCE, &[Minimize; 3])
);
trace.write(&problem);
Ok(())
}
// runs `algorithm` on `fitness` for `generations`, and prints its final front's size, how many of
// its solutions the problem finds feasible, their IGD+ to 2,000 points of the optimal front and
// their hypervolume, with normalized objectives, as a share of the sample's
fn run<A, F>(
problem: &Dc1Dtlz3<3>,
name: &'static str,
algorithm: A,
fitness: F,
generations: u64,
sample: &[[f64; 3]],
trace: &mut trace::Trace,
) -> Result<()>
where
A: MultiObjectiveAlgorithm<3, Genome = Reals>,
F: MultiFitnessFunction<Reals, 3> + Sync,
{
let mut record = trace.front(name, *problem);
let outcome = MultiEngine::new(algorithm, fitness)
.stop_when(Stop::generations(generations))
.on_generation(|snapshot| record(snapshot))
.run()?;
let scores: Vec<([f64; 3], f64)> = outcome
.front()
.iter()
.map(|x| problem.evaluate(x.genome()))
.collect();
let feasible: Vec<[f64; 3]> = scores.iter().filter(|s| s.1 == 0.0).map(|s| s.0).collect();
let noun = if scores.len() == 1 {
"solution"
} else {
"solutions"
};
print!(
"{name}, {generations} generations: {} {noun}, ",
scores.len()
);
if feasible.is_empty() {
let least = scores.iter().map(|s| s.1).fold(f64::INFINITY, f64::min);
println!("none feasible, the least violation {least:.4}");
return Ok(());
}
let found = normalized(problem, &feasible);
let optimal = normalized(problem, &problem.optimal_front(2_000).expect("known"));
let distance = igd_plus(&found, &optimal, &[Minimize; 3]);
let volume = hypervolume(&found, &REFERENCE, &[Minimize; 3]);
let percent = 100.0 * volume / hypervolume(sample, &REFERENCE, &[Minimize; 3]);
println!(
"{} feasible, IGD+ {distance:.4}, hypervolume {volume:.4}, {percent:.1}% of the \
sample's",
feasible.len()
);
Ok(())
}
// the objectives normalized by the front's ideal and nadir points: the front spans [0, 1] in each
pub fn normalized(problem: &Dc1Dtlz3<3>, points: &[[f64; 3]]) -> Vec<[f64; 3]> {
let ideal = problem.ideal_point().expect("known");
let nadir = problem.nadir_point().expect("known");
let scale = |p: &[f64; 3]| std::array::from_fn(|j| (p[j] - ideal[j]) / (nadir[j] - ideal[j]));
points.iter().map(scale).collect()
}
python examples/dc1_dtlz3_3obj/main.py
"""DC1-DTLZ3 with 3 objectives: minimize three objectives of DTLZ3 subject to a constraint on the
first variable, whose front is two bands of DTLZ's, with NSGA-III and SMS-EMOA.
From genoxide's problems.Dc1Dtlz3; run evaluates it in Rust. Runs NSGA-III with the settings of the
C-TAEA paper's C-NSGA-III and SMS-EMOA, a population of 92 for 4,000 generations each, with
constraint dominance. Prints each final front's size, how many of its solutions are feasible, their
IGD+ to 2,000 points of the optimal front and their hypervolume, with the objectives normalized by
the front's ideal and nadir points, as a share of that of a sample of the front with at least as
many points as the population; then the hypervolumes of the whole front and of the sample.
With ``GENOXIDE_TRACE=<file>``, it also writes a trace of its runs for the plot on the example's
page, with trace.py.
python examples/dc1_dtlz3_3obj/main.py
"""
import genoxide as gx
from trace import Trace
# the reference point of the hypervolume, with the objectives normalized by the front's ideal and
# nadir points
REFERENCE = [1.1, 1.1, 1.1]
problem = gx.problems.Dc1Dtlz3()
ideal, nadir = problem.ideal_point, problem.nadir_point
rate = 1 / problem.dimensions
def normalized(points):
"""The objectives normalized by the front's ideal and nadir points: the front spans [0, 1] in
each."""
return (points - ideal) / (nadir - ideal)
# with GENOXIDE_TRACE=<file>, a trace of the runs for the plot on the example's page
trace = Trace(problem, normalized, REFERENCE)
# the sample: at least as many points of the optimal front as the population has, about what a
# front of that many solutions can be
sample = normalized(problem.optimal_front(92))
def run(name, algorithm, fitness, generations):
"""Runs ``algorithm`` on ``fitness`` for ``generations``, and prints its final front's size,
how many of its solutions the problem finds feasible, their IGD+ to 2,000 points of the
optimal front and their hypervolume, with normalized objectives, as a share of the
sample's."""
result = algorithm.run(fitness, generations=generations, on_generation=trace.front(name))
objectives, violations = problem.evaluate(result.front_genomes)
feasible = objectives[violations == 0]
noun = "solution" if len(objectives) == 1 else "solutions"
start = f"{name}, {generations} generations: {len(objectives)} {noun}, "
if len(feasible) == 0:
print(start + f"none feasible, the least violation {violations.min():.4f}")
return
optimal = normalized(problem.optimal_front(2_000))
distance = gx.indicators.igd_plus(normalized(feasible), optimal)
volume = gx.indicators.hypervolume(normalized(feasible), REFERENCE)
percent = 100 * volume / gx.indicators.hypervolume(sample, REFERENCE)
print(
start + f"{len(feasible)} feasible, IGD+ {distance:.4f}, hypervolume {volume:.4f}, "
f"{percent:.1f}% of the sample's"
)
# NSGA-III with the settings of the C-TAEA paper's C-NSGA-III
algorithm = gx.Nsga3(
problem.genome,
objectives=problem.objectives,
reference_directions=gx.das_dennis(3, 12),
population_size=92,
crossover=gx.SimulatedBinaryCrossover(30),
crossover_rate=1.0,
mutation=gx.PolynomialMutation(20, rate=rate),
seed=1,
)
run("NSGA-III", algorithm, problem, 4_000)
# SMS-EMOA, which keeps the solutions that add the most hypervolume
algorithm = gx.SmsEmoa(
problem.genome,
objectives=problem.objectives,
population_size=92,
crossover=gx.SimulatedBinaryCrossover(30),
mutation=gx.PolynomialMutation(20, rate=rate),
seed=1,
)
run("SMS-EMOA", algorithm, problem, 4_000)
whole = normalized(problem.optimal_front(3_000))
print(
f"the whole front: hypervolume {gx.indicators.hypervolume(whole, REFERENCE):.4f}; "
f"a sample of {len(sample)} of its points: "
f"{gx.indicators.hypervolume(sample, REFERENCE):.4f}"
)
trace.write()
What it prints, from a seeded run:
NSGA-III, 4000 generations: 92 solutions, 92 feasible, IGD+ 0.0170, hypervolume 0.6236, 99.4% of the sample's
SMS-EMOA, 4000 generations: 92 solutions, 92 feasible, IGD+ 0.0507, hypervolume 0.5268, 84.0% of the sample's
the whole front: hypervolume 0.6529; a sample of 100 of its points: 0.6273