Skip to content

Commit

Permalink
Merge branch 'develop' into feature/solution-quality-evaluator
Browse files Browse the repository at this point in the history
  • Loading branch information
zaibod committed Nov 25, 2024
2 parents 2fc4dac + b82e1d2 commit fba2117
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,25 @@ public Mono<Solution<String>> solve(
ProcessRunner.INPUT_FILE_PATH,
"--output-file", ProcessRunner.OUTPUT_FILE_PATH
)
.writeInputFile(input, "problem.vrp")
.writeInputFile(adaptInput(input), "problem.vrp")
.readOutputFile("problem.sol")
.run(getProblemType(), solution.getId());

return Mono.just(processResult.applyTo(solution));
}

/**
* LKH-3 solver has an issue when the "EOF" tag.
* This method removes this substring.
*
* @param originalInput original input of the TSP problem
* @return adapted input with "EOF"
*/
private String adaptInput(String originalInput) {
String inputAsVrp = originalInput;
if (inputAsVrp.endsWith("EOF")) {
inputAsVrp = inputAsVrp.replaceAll("EOF$", "");
}
return inputAsVrp;
}
}

0 comments on commit fba2117

Please sign in to comment.