@Service
public class AntAlgorithmSettingsBuilder {
public AntAlgorithmSettings buildFromRequest(String request) {
AntAlgorithmSettings antAlgorithmSettings = new AntAlgorithmSettings();
ObjectMapper mapper = new ObjectMapper();
try {
JsonNode antAlgorithmSettingsJsonNode = mapper.readTree(request).get("antAlgorithmSettings");
antAlgorithmSettings
.setAlpha(antAlgorithmSettingsJsonNode.get("alpha").getValueAsDouble())
.setBeta(antAlgorithmSettingsJsonNode.get("beta").getValueAsDouble())
.setInitialPheromoneAmount(antAlgorithmSettingsJsonNode.get("initialPheromoneAmount").getValueAsInt())
.setMaximalNumberOfAnts(antAlgorithmSettingsJsonNode.get("maximalNumberOfAnts").getValueAsInt())
.setMaximalNumberOfIterations(antAlgorithmSettingsJsonNode.get("maximalNumberOfIterations").getValueAsInt())