org.opt4j.tutorial.salesman.SalesmanDecoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of opt4j-tutorial Show documentation
Show all versions of opt4j-tutorial Show documentation
The tutorial classes for Opt4J
package org.opt4j.tutorial.salesman;
import org.opt4j.core.genotype.PermutationGenotype;
import org.opt4j.core.problem.Decoder;
import org.opt4j.tutorial.salesman.SalesmanProblem.City;
public class SalesmanDecoder implements Decoder, SalesmanRoute> {
public SalesmanRoute decode(PermutationGenotype genotype) {
SalesmanRoute salesmanRoute = new SalesmanRoute();
for (City city : genotype) {
salesmanRoute.add(city);
}
return salesmanRoute;
}
}