What is maxCost in getObjectiveFunction?

Hi, I’m just playing around with jsprit for two weeks. Thank to stefan for this library. I run a lot of your examples as long as instances, but I still got troubles while making a custom CostCalculator.
I know that I have to implement SolutionCostCalculator interface so I read your default method
com.graphhopper.jsprit.core.algorithm.box.Jsprit.getObjectiveFunction(VehicleRoutingProblem vrp, double maxCosts)
And, the maxCosts makes me quite unclear about it. So, can anybody explain for me about it?

Add: I did read the method, but still have no clue what it is!

    final double maxCosts;
        maxCosts = Double.parseDouble(getProperty(Parameter.MAX_TRANSPORT_COSTS.toString()));
        maxCosts = jobNeighborhoods.getMaxDistance();

jsprit wants to estimate a reasonable value for unassigned cost, and it uses this maxCosts as a benchmark. if it is not set in the parameters, it uses the value of maximum pair-wise distance between jobs.

note that sometimes this value could be too small. just imagine the case where all the jobs are at the same location and thus maxCosts would be 0.

1 Like