Skip to content

Solutions

Methods to access, rank and print solutions after a solve.


Solution pool

getNumberOfSolutions

int getNumberOfSolutions()

Returns the number of solutions in the pool.

rankSolutions

void rankSolutions(std::string criteria = "objective")

Ranks the solution pool according to the given criteria.

  • criteria (std::string) — ranking key. Use "objective" to sort by objective value.

clearSolutions

void clearSolutions()

Clears the solution pool.

getAllSolutions

std::vector<Path> getAllSolutions()

Returns all solutions in the pool.

getBestSolutions

std::vector<Path> getBestSolutions(int pool_size = 1)

Returns the best solutions in the pool.

  • pool_size (int) — number of solutions to return.

getBestSolution

Path getBestSolution()

Returns the best solution found.


Accessing solutions

getSolution

Path* getSolution(int id)

Returns a pointer to the solution at position id in the pool.

  • id (int) — solution position in the pool.

getSolutionStatus

int getSolutionStatus(int id)

Returns the status of a solution.

  • id (int) — solution position in the pool.

getSolutionObjective

double getSolutionObjective(int id)

Returns the objective value of a solution.

  • id (int) — solution position in the pool.

getSolutionArcCost

double getSolutionArcCost(int id)

Returns the total arc cost of a solution.

  • id (int) — solution position in the pool.

getSolutionNodeCost

double getSolutionNodeCost(int id)

Returns the total node cost of a solution.

  • id (int) — solution position in the pool.

getSolutionTour

std::vector<int> getSolutionTour(int id)

Returns the tour of a solution as a list of node ids.

  • id (int) — solution position in the pool.

getSolutionTourAsString

std::string getSolutionTourAsString(int id)

Returns the tour of a solution as a space-separated string of node ids.

  • id (int) — solution position in the pool.

Output

printStatus

void printStatus()

Prints the current solver status.

printBestSolution

void printBestSolution()

Prints the best solution found.

printAllSolutions

void printAllSolutions()

Prints all solutions in the pool.

printAlgorithmsStatus

void printAlgorithmsStatus()

Prints the status of all algorithms.

printNodeCosts

void printNodeCosts()

Prints the cost of all nodes.