Page 1 of 2

How to add one ore more ordes to an existing trip.

Posted: Fri Oct 07, 2016 8:46 am
by columbs
Hi everybody,

I have a question about a basic use case (at leat for those that are familiar with PTV smartour or Intertour).
  • 1. how can I add an order (or several orders) to an existing trip without changing the actual sequence of the stops?

    2. additionaly, how can ensure that no new stops is planned before stop N? Example: my truck is alread at stop 4 and the dispatcher wants to assign a pickup order to the truck. Since the first 4 stopps are already completed, it makes no sense to plan a stopp before stopp 4.
As I have understood by reading here http://xserver.ptvgroup.com/forum/viewt ... ?f=6&t=143 , I have to "deactivate" all sequencing and improvment steps and use only the constructionStep (CON).

Additional question, is it possible to perfom this by using the function planBasictour? Or does it work only with planSequence? Since our developpers already developped methods for PlanBasicTour, it would be better for us.

Many thanks in advance and greetins from Bern.
Sebastiano

Re: How to add one ore more ordes to an existing trip.

Posted: Fri Oct 07, 2016 9:54 am
by Joost
I think the easiest way to deal with this is to use the tourSection attribute on the tranportPoint class. xTour will always build up the tour with the tour points in an ascending order. So If you have already a plan, simply set the tour section in order they are present in the input plan. To prevent xTour from moving orders from one tour to another tour you can set the tourfixation in the input plan on the plan.chain[n].tour[n] .

This will make sure that xTour keeps you input plan intact the way you already have it.

When you are adding new orders you can manipulate the tourSection to you needs.

Can the order be planned in anywhere in the planned tour ? use 0 as value.
Do the orders have to be always planned at the end a planned tour? Use 999 as value.
This should cover case 1.

Case 2 is a bit trickier this way. Common practice is to force the first stop in order with this technique, and give the rest of the stops the 999 value. This does mean that the xTour can change the order around of the rest of the trip. Usually this is wanted behavior. If you also want the rest of the trip to maintain the planned order I'm not sure I know of an easy solution to achieve this.

When implementing this keep in mind that 1 and 1000 are special values (see documentation) as in there can only be a single tranportPointwith 1 and a single tranportPoint with 1000 as tourSection in a Tour. When dealing with keeping a trip in order I advise to avoid those values unless you are sure that their limitation suite your use case.

With this technique you still can use all the planning steps to get the optimal result.

Re: How to add one ore more ordes to an existing trip.

Posted: Mon Jan 23, 2017 11:01 am
by columbs
Hi Joost,

sorry for my late answer, we had to left this topic frozen for a while. Many thanks for your detailed answer! We have already implemented the case 1 and it seems to work great.
I havn't tested case 2, but in theory it must work. I'll say , when we will implement this use case (probably in some month).

Best regards,
Sebastiano

Re: How to add one ore more ordes to an existing trip.

Posted: Mon Jan 23, 2017 4:40 pm
by columbs
Hi Joost,

I have celebrated our triumph a bit too early. :cry:

We have got a case, where xTour cannot insert an additional order to the trip and we don't understand the reason. could you please help us?
See Request in the attachment.

I have made also following test: I have converted all order from type AB to transportDepot, changed the vehicle parameter depotIdEnd="-1" depotIdStart="-1" and I have added the DepotPoints at the begin and at the end of the chain. In this was in works. The Problem is that it is not always possible to use transportDepot orders, that's way we prefere to use the general way of transportAB , when possible.
Thank you in advance for your help!
Regards,
Sebastiano

Re: How to add one ore more ordes to an existing trip.

Posted: Tue Jan 24, 2017 7:52 am
by Joost
Hello Sebastiano,

I think you forgot to attache the request.

About converting the orders from TransportAB to TransportDepot, why is this needed? I'm not seeing a direct need for this in your use case you described up till now.

With regards,
Joost

Re: How to add one ore more ordes to an existing trip.

Posted: Tue Jan 24, 2017 8:35 am
by columbs
Hi Joost,
I should have uploaded the file now. I had to compress the file because it is not allowed to attach .xml files.

Code: Select all

 About converting the orders from TransportAB to TransportDepot, why is this needed? I'm not seeing a direct need for this in your use case you described up till now.
I (and our developper) hope too, that is not needed. I have just done a test to see, if there is a difference.

Thanks a lot in advance for your help!

Sebastiano

Re: How to add one ore more ordes to an existing trip.

Posted: Tue Jan 24, 2017 9:05 am
by Joost
When I execute your request everything gets planned in. You sure this is the right request?
I (and our developper) hope too, that is not needed. I have just done a test to see, if there is a difference.
From a theoretical standpoint: yes there could be a difference. Normally xTour divides the orders among the depots as a start situation for it's planning algorithm. Planning depot free leads to a different internal start situation. If it will lead to an difference in the quality of the result is debatable. In practice I have almost seen no cases where this leads to an improvement.

Re: How to add one ore more ordes to an existing trip.

Posted: Tue Jan 24, 2017 9:17 am
by columbs
Hello Joost,

I have attached the support package including request and response from our local xtour server. (But our Program use the xServer Internet, we use the local xTour only for debugging).

Regards,
Sebastiano

Re: How to add one ore more ordes to an existing trip.

Posted: Tue Jan 24, 2017 10:45 am
by Bernd Welter
Your inputplan is violated...

Code: Select all

<TourPoint  id="9" remainPlanned="false" tourFixed="false" type="TRANSPORT_POINT">
	<result xsi:nil="true"/>
</TourPoint>
<TourPoint  id="7" remainPlanned="false" tourFixed="false" type="TRANSPORT_POINT">
	<result xsi:nil="true"/>
</TourPoint>
<TourPoint  id="10" remainPlanned="false" tourFixed="false" type="TRANSPORT_POINT">
	<result xsi:nil="true"/>
</TourPoint>
<TourPoint  id="8" remainPlanned="false" tourFixed="false" type="TRANSPORT_POINT">
	<result xsi:nil="true"/>
</TourPoint>
But the orders section id's are
order 9: section 2
order 7: section 2
order 10: section 5
order 8: section 4

There are some threads dealing with this info, maybe they can help:
http://xserver.ptvgroup.com/forum/viewt ... ?f=6&t=159
http://xserver.ptvgroup.com/forum/viewt ... ?f=6&t=143

Best regards
Bernd

Re: How to add one ore more ordes to an existing trip.

Posted: Tue Jan 24, 2017 11:46 am
by columbs
Hi Bernd,

thank you very much for your help!
Your hint about violated chain helps us a lot!

Best regards,
Sebastiano