1

I am trying to execute the Jsprit CostMatrixExample provided at this link. I am using the Jsprit 1.6.2 release version to test this functionality. I modified the below two things in my program.

  1. Using the setLocation function rather setLocationID in registering the service with VRP as like below. I guess the setLocationID is not there in the latest version so not able to use this function.

    Service s1 = Service.Builder.newInstance("1").addSizeDimension(0,1).setLocation(Location.newInstance(1, 1)).build();

    1. Modified the radialRuinAndRecreate to randomRuinAndRecreate in fastalgo.xml as mentioned in this link

Actually in testing the program this is breaking with this callstack.

java.lang.IllegalStateException: time value for relation from [x=1.0][y=1.0] to [x=3.0][y=3.0] does not exist
    at jsprit.core.util.VehicleRoutingTransportCostsMatrix.getTime(VehicleRoutingTransportCostsMatrix.java:225)
    at jsprit.core.util.VehicleRoutingTransportCostsMatrix.getTransportTime(VehicleRoutingTransportCostsMatrix.java:206)
    at jsprit.core.problem.constraint.VehicleDependentTimeWindowConstraints.fulfilled(VehicleDependentTimeWindowConstraints.java:109)
    at jsprit.core.problem.constraint.HardActivityLevelConstraintManager.fulfilled(HardActivityLevelConstraintManager.java:83)
    at jsprit.core.problem.constraint.ConstraintManager.fulfilled(ConstraintManager.java:148)
    at jsprit.core.algorithm.recreate.ServiceInsertionCalculator.getInsertionData(ServiceInsertionCalculator.java:141)
    at jsprit.core.algorithm.recreate.JobCalculatorSwitcher.getInsertionData(JobCalculatorSwitcher.java:41)
    at jsprit.core.algorithm.recreate.VehicleTypeDependentJobInsertionCalculator.getInsertionData(VehicleTypeDependentJobInsertionCalculator.java:116)
    at jsprit.core.algorithm.recreate.BestInsertion.insertUnassignedJobs(BestInsertion.java:83)
    at jsprit.core.algorithm.recreate.AbstractInsertionStrategy.insertJobs(AbstractInsertionStrategy.java:89)
    at jsprit.core.algorithm.InsertionInitialSolutionFactory.createSolution(InsertionInitialSolutionFactory.java:56)
    at jsprit.core.algorithm.PrettyAlgorithmBuilder$2.informAlgorithmStarts(PrettyAlgorithmBuilder.java:144)
    at jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners.algorithmStarts(VehicleRoutingAlgorithmListeners.java:127)
    at jsprit.core.algorithm.VehicleRoutingAlgorithm.algorithmStarts(VehicleRoutingAlgorithm.java:296)
    at jsprit.core.algorithm.VehicleRoutingAlgorithm.searchSolutions(VehicleRoutingAlgorithm.java:196)
    at com.learning.testvrp.JSpiritVRP.buildPickers(JSpiritVRP.java:202)
    at com.learning.testvrp.JSpiritVRP.buildSoultion(JSpiritVRP.java:58)
    at com.learning.testvrp.TestVRPWS.generateSweep(TestVRPWS.java:101)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
    at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
    at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
    at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

May I know the reason for this failure? Could you help me in resolving this issue?

Sunny
  • 103
  • 8

1 Answers1

1

I am able to solve this problem. I could observe two factors link.

  1. Not able to use the setLocationId(1) in the present version so used the setLocation(1,1).

  2. addTransportTime and addTransportDistance expects the from and to string in a particular format. These are not id's of location and not just location coordinates like (1,1). The location coordinates needs to transform as like below string and pass those strings to these functions. Lets say your from and to coordinates are (1,1) and (2,2) then these coordinates need to be transformed like [x=1.0][y=1.0] and [x=2.0][y=2.0].

If you pass these values then this error is not turning up in using this program and able to see the VRP results.

Sunny
  • 103
  • 8