2016-03-15 90 views
0

我試圖執行Jsprit CostMatrixExample在此link提供。 我正在使用Jsprit 1.6.2發行版來測試此功能。我在我的程序中修改了以下兩件事。時間值[X = 1.0] [Y = 1.0]至[X = 3.0] [Y = 3.0]不存在

  1. 在使用VRP註冊服務時使用setLocation函數而不是setLocationID,如下所示。我猜setLocationID不在最新版本中,所以不能使用這個函數。

    業務S1 = Service.Builder.newInstance( 「1」)addSizeDimension(0,1).setLocation(Location.newInstance(1, 1))構建()。;

  2. 修改了radialRuinAndRecreate到randomRuinAndRecreate在fastalgo.xml如實際上在測試此與此調用堆棧打破程序在此link

提及。

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) 

我可以知道造成這種故障的原因嗎?你能幫我解決這個問題嗎?

回答

0

我能解決這個問題。我可以觀察到兩個因素link

  1. 無法在當前版本中使用setLocationId(1),因此使用setLocation(1,1)。

  2. addTransportTime和addTransportDistance從和到串中的特定的格式期望。這些不是位置的id,也不是像(1,1)這樣的位置座標。位置座標需要像下面的字符串那樣轉換,並將這些字符串傳遞給這些函數。 假設你的座標是(1,1)和(2,2),那麼這些座標需要像[x = 1.0] [y = 1.0]和[x = 2.0] [y = 2.0]那樣轉換。

如果你傳遞這些值,那麼這個錯誤在使用這個程序時不會出現,並且能夠看到VRP結果。

相關問題