Page 1 of 1

Coordinate format in DIMA

Posted: Fri Nov 18, 2016 2:36 pm
by Flegregeois
A partner have a question about the DIMA and the coordinate use by the DIMA:
Apparently the coordinate format in the DIMA is only SMARTUNIT.
If we create a DIMA with xDima, and we specify dimaCoordFormat="GEODECIMAL", the coordinate format in the DIMA is still SMARTUNIT.
And if we want to use this DIMA in xTour, if we still specify <ns5:CallerContextProperty key="CoordFormat" value="PTV_GEODECIMAL" /> and we send some point that are already in the DIMA, xTour calculate new distance and period and add them in the DIMA and not use the dist/period who are already in the DIMA.

Do you have an explanation?

Best regards
François

Re: Coordinate format in DIMA

Posted: Fri Nov 18, 2016 3:09 pm
by Bernd Welter
Hello Francois,

good question - I don't have the answer but I guess this might be related to the following circumstances:
  • xDima expects coordinates given as INTEGER
  • xTour consumes DOUBLE
If you create the dima with xDIma your application is responsible for some rounding "strategies".
Within the dima the primary key for identifying a row/column is the INT_X,INT_Y.

If you use xTour with double input coordinates the xServer has to transform them into whatever, there might be some rounding AND transformation issues.
And if the effective coordinate is determined and added to the DIMA and it might be different than the primary key that is already there.

But: not sure whether the impact (on quality) is that significant. Anyhow: it might increase the size of the dima more than necessary.

I forwarded this post to DEV to request detailed info - hopefully they answer fast.

Best regards Bernd

Re: Coordinate format in DIMA

Posted: Mon Nov 21, 2016 2:28 pm
by Flegregeois
Hello,

I just made some test yesterday, so I can add some information:
1. I create a DIMA with xDima:
important: the dimaCoordFormat is equal to GEODECIMAL.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <createDima xmlns="http://types.xdima.xserver.ptvag.com" xmlns:ns2="http://baseservices.service.jabba.ptvag.com" xmlns:ns3="http://wrappertypes.service.jabba.ptvag.com" xmlns:ns4="http://xdima.xserver.ptvag.com" xmlns:ns5="http://exception.core.jabba.ptvag.com" xmlns:ns6="http://common.xserver.ptvag.com">
      <int_1>34</int_1>
      <DimaProfile_2 optimization="90" speedTable="135,70,125,35,85,25,60,25,50,20,40,18,16,9,6,4" routingType="RT1TON" linkType="LTSEGMENT" dimaCoordFormat="GEODECIMAL" vehicleType="VTTRUCK" description="MyDima"/>
      <CallerContext_3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
    </createDima>
  </soap:Body>
</soap:Envelope>
2. I add some dist/period with the following request:

Code: Select all

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <setDistPeriod xmlns="http://types.xdima.xserver.ptvag.com" xmlns:ns2="http://baseservices.service.jabba.ptvag.com" xmlns:ns3="http://wrappertypes.service.jabba.ptvag.com" xmlns:ns4="http://xdima.xserver.ptvag.com" xmlns:ns5="http://exception.core.jabba.ptvag.com" xmlns:ns6="http://common.xserver.ptvag.com">
      <int_1>34</int_1>
      <ArrayOfRelationValue_2>
        <ns4:RelationValue>
          <ns4:distPeriod period="8000" dist="8500"/>
          <ns4:relation>
            <ns4:destinationLocation y="4898950" x="220537"/>
            <ns4:startLocation y="4860375" x="258130"/>
          </ns4:relation>
        </ns4:RelationValue>
        <ns4:RelationValue>
          <ns4:distPeriod period="9000" dist="950"/>
          <ns4:relation>
            <ns4:destinationLocation y="4860375" x="258130"/>
            <ns4:startLocation y="4898950" x="220537"/>
          </ns4:relation>
        </ns4:RelationValue>
      </ArrayOfRelationValue_2>
      <CallerContext_3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
    </setDistPeriod>
  </soap:Body>
</soap:Envelope>
3. I try to plan a basic tour with the following request:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header />
   <env:Body>
      <ns8:planBasicTours xmlns:ns8="http://types.xtour.xserver.ptvag.com" xmlns:ns2="http://exception.core.jabba.ptvag.com" xmlns:ns3="http://wrappertypes.service.jabba.ptvag.com" xmlns:ns4="http://common.xserver.ptvag.com" xmlns:ns5="http://baseservices.service.jabba.ptvag.com" xmlns:ns6="http://xroute.xserver.ptvag.com" xmlns:ns7="http://xtour.xserver.ptvag.com">
         <ns8:ArrayOfTransportOrder_1>
            <ns7:TransportOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns7:TransportAB" trailerLoadingForbidden="false" id="1" priority="9" productId="9">
               <ns7:quantities>
                  <ns7:wrappedQuantities>
                     <ns3:Int>300000</ns3:Int>
                     <ns3:Int>0</ns3:Int>
                  </ns7:wrappedQuantities>
               </ns7:quantities>
               <ns7:transportPointA allowServiceSplit="false" coDriverRequired="false" openingIntervalConstraint="COMPLETE_SERVICE" servicePeriod="1" tourSection="0" useServicePeriodForRecreation="false" id="3" siteId="1" uploadingFunctionId="1">
                  <ns7:location>
                     <ns4:point x="258130" y="4860375" />
                  </ns7:location>
                  <ns7:wrappedOpeningIntervals>
                     <ns7:Interval from="1476662400" till="1476748800" />
                  </ns7:wrappedOpeningIntervals>
               </ns7:transportPointA>
               <ns7:transportPointB allowServiceSplit="false" coDriverRequired="false" openingIntervalConstraint="COMPLETE_SERVICE" servicePeriod="1" tourSection="0" useServicePeriodForRecreation="false" id="4" siteId="2" unloadingFunctionId="2">
                  <ns7:location>
                     <ns4:point x="220537" y="4898950" />
                  </ns7:location>
                  <ns7:wrappedOpeningIntervals>
                     <ns7:Interval from="1476691200" till="1476698400" />
                  </ns7:wrappedOpeningIntervals>
               </ns7:transportPointB>
            </ns7:TransportOrder>
         </ns8:ArrayOfTransportOrder_1>
         <ns8:ArrayOfDepot_2>
            <ns7:Depot id="7">
               <ns7:location>
                  <ns4:point x="258130" y="4860375" />
               </ns7:location>
               <ns7:wrappedOpeningIntervals />
            </ns7:Depot>
            <ns7:Depot id="8">
               <ns7:location>
                  <ns4:point x="258130" y="4860375" />
               </ns7:location>
               <ns7:wrappedOpeningIntervals />
            </ns7:Depot>
         </ns8:ArrayOfDepot_2>
         <ns8:Fleet_3>
            <ns7:wrappedVehicles>
               <ns7:Vehicle id="2" ignoreIntermediatePeriodBeforeFirstTour="false" dimaId="34" ignoreTransportPointServicePeriod="false" isPreloaded="false" toursMustFitIntoSingleOperatingInterval="true" depotIdEnd="8" depotIdStart="8">
                  <ns7:wrappedOperatingIntervals>
                     <ns7:Interval from="1476673200" till="1476727200" />
                  </ns7:wrappedOperatingIntervals>
                  <ns7:capacities>
                     <ns7:wrappedCapacities>
                        <ns7:Quantities>
                           <ns7:wrappedQuantities>
                              <ns3:Int>3100000</ns3:Int>
                              <ns3:Int>2000000</ns3:Int>
                           </ns7:wrappedQuantities>
                        </ns7:Quantities>
                     </ns7:wrappedCapacities>
                  </ns7:capacities>
                  <ns7:costs costsPerChain="30.0" costsPerHourDriverOnly="0.0" costsPerHourWithCoDriver="0.0" costsPerKm="30.0" fixedCosts="0.0" />
               </ns7:Vehicle>
            </ns7:wrappedVehicles>
         </ns8:Fleet_3>
         <ns8:PlanningParams_4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns7:StandardParams" constructionStep="true" endSequencingStep="true" improvementStep="true" maximumNumberOfUnscheduledOrdersToBeAnalyzed="2" middleSequencingStep="true" tourReductionStep="true" coDriverTransportPointsInSeparateTours="false">
            <ns7:wrappedDistanceMatrixCalculation>
               <ns7:DistanceMatrixCalculation xsi:type="ns7:DistanceMatrixByRoad"  deleteAfterUsage="false" deleteBeforeUsage="false" dimaId="34"/>
            </ns7:wrappedDistanceMatrixCalculation>
            <ns7:wrappedLoadingFunctions>
               <ns7:LoadingFunction fixedPeriod="0" fixedSitePeriod="599" id="1">
                  <ns7:quantityDependentPeriods>
                     <ns7:wrappedSecondsPerQuantityUnit>
                        <ns3:Double>6.363636363636363E-4</ns3:Double>
                        <ns3:Double>0.0</ns3:Double>
                     </ns7:wrappedSecondsPerQuantityUnit>
                  </ns7:quantityDependentPeriods>
               </ns7:LoadingFunction>
               <ns7:LoadingFunction fixedPeriod="0" fixedSitePeriod="599" id="2">
                  <ns7:quantityDependentPeriods>
                     <ns7:wrappedSecondsPerQuantityUnit>
                        <ns3:Double>6.363636363636363E-4</ns3:Double>
                        <ns3:Double>0.0</ns3:Double>
                     </ns7:wrappedSecondsPerQuantityUnit>
                  </ns7:quantityDependentPeriods>
               </ns7:LoadingFunction>
               <ns7:LoadingFunction fixedPeriod="0" fixedSitePeriod="599" id="4">
                  <ns7:quantityDependentPeriods>
                     <ns7:wrappedSecondsPerQuantityUnit>
                        <ns3:Double>6.363636363636363E-4</ns3:Double>
                        <ns3:Double>0.0</ns3:Double>
                     </ns7:wrappedSecondsPerQuantityUnit>
                  </ns7:quantityDependentPeriods>
               </ns7:LoadingFunction>
            </ns7:wrappedLoadingFunctions>
            <ns7:wrappedProductIncompatibilities />
            <ns7:goalImportance chainPeriodRank="1" tourCountRank="1" tourDistanceRank="1" tourDrivingPeriodRank="1" tourPeriodRank="1" unplannedOrdersRank="3" vehicleCountRank="3" />
         </ns8:PlanningParams_4>
         <ns8:CallerContext_6 log1="" log2="" log3="">
            <ns5:wrappedProperties>
               <ns5:CallerContextProperty key="CoordFormat" value="PTV_GEODECIMAL" />
               <ns5:CallerContextProperty key="ResponseGeometry" value="PLAIN" />
               <ns5:CallerContextProperty key="Profile" value="default" />
            </ns5:wrappedProperties>
         </ns8:CallerContext_6>
      </ns8:planBasicTours>
   </env:Body>
</env:Envelope>
and the xTour add new locations in the DIMA!!!
Why, all the locations are already in the DIMA and the coordFormat is the same: GEODECIMAL/PTV_GEODECIMAL.

If I export the DIMA, I can see
1. The locations I add with xDima, the coordFormat is GEODECIMAL
2. The new locations added by xTour and the coordFormat is SMARTUNITS

So the DIMA created by xTour must contains only SMARTUNITS?
how I can force xTour to use PTV_GEODECIMAL in the DIMA?
Why I can parameter the coordFormat in xDima if I can't use the same in xTour?

In the file dima.ini, generated by xDima, there is the coordFormat:

Code: Select all

COORDFORMAT=GEODEC
this parameter is not used by xTour, why?

In the file dima.ini, generated by xTour, there is the same parameter coordFormat:

Code: Select all

COORDFORMAT=SMARTUNIT
What is it possible to do to force xTour to use this parameter?

Regards,
François

Re: Coordinate format in DIMA

Posted: Mon Nov 21, 2016 2:43 pm
by Joost
So the DIMA created by xTour must contains only SMARTUNITS?
The xServer framework always recalculates Point objects to smart units before passing them to our engine. So the dima library of xTour will only see SmartUnits. This enable the xServers to work with many different coordinate formats without each of our engine having to understand them. Only the framework needs to understand them.
how I can force xTour to use PTV_GEODECIMAL in the DIMA?
You can't.
Why I can parameter the coordFormat in xDima if I can't use the same in xTour?
The xDima is a bit older and is still using the old Location objects instead of Point objects. Changing this would mean we would break the backwards compatibility, which we do not like to do within the xServer 1 family. This is something we intent to solve with xServer 2. With redoing the API it gives up the option to have all xServer use the same classes.

Re: Coordinate format in DIMA

Posted: Tue Nov 22, 2016 7:38 am
by Bernd Welter
Hi guys,
and here is some more infro from Haba - just extending what Joost said:
The problem is the following: Since xTour 1.14 it is possible to use the coordinate format from the caller context. From that point on all internal distance calculations are on the basis of Smartunits. No matter which coordinate format is used in the request, it is always transformed to Smartunits. All other servers work like this with one exception: The xDima is the only server who is still able to use other coordinate formats in the distance matrix. As the xTour always expects Smartunits, the only possibility using a xDima distance matrix in xTour is to use Smartunits in the xDima request.
Best regards
Bernd

Re: Coordinate format in DIMA

Posted: Fri May 12, 2017 2:57 pm
by jose.bujalance
Hi,

Can anyone help me to convert Geodecimal coordinates (like the ones used on Google Maps) to PTV smart units so I can build a distance matrix with these converted coordinates ?

Thanks,
José

Re: Coordinate format in DIMA

Posted: Fri May 12, 2017 3:05 pm
by Flegregeois
Hi Jose,

have a look on this page:

https://xserver.ptvgroup.com/fileadmin/ ... sformation

at the bottom you can find two links to dl some code examples. In the Java examples you will find a class named Coordinates_Transformationwho can do the job.

best regards

Re: Coordinate format in DIMA

Posted: Fri May 12, 2017 3:13 pm
by Bernd Welter
Hi Jose,
For the question about transformation I recommend to create a topic in the generic forum as it might have an impact to other usecases as well.
About this topic here:
I understand your challenge a bit more generic:
You want to work with non-smartunits input coordinates in xTour. In other words: why is it necessary to create the dima via xDima? Maybe this approach can be solved in a different way? What are the real constraints behind your taks?
Best regards Bernd

Re: Coordinate format in DIMA

Posted: Mon May 15, 2017 1:46 pm
by jose.bujalance
Hi,

Thanks for your answer Flegregeois , it helped me out to convert the coordinates.

Bernd, I actually don't have the xTour service installed. What I am trying to do is to evaluate the performance of the xDima matrix creation in terms of processing time to see if it fits our expectations. Thus, I would like to build the matrix via xDima.
I have been able to transform the coordinates into PTV's smartUnits, but I am having now an Internal routing engine error (code: -101). I will create a new thread in the xDima forum to explain the problem.

Thanks,
José

Re: Coordinate format in DIMA

Posted: Mon May 15, 2017 2:17 pm
by Bernd Welter
Hello Jose,

thanks for the info. If you simply want to benchmark the calculation performance of "dima calculation" it is sufficient to use the xDima with the coordinates given in INT based values. OG_GEODECIMAL wouldn't work (due to the number range) but you can simply use PTV_GEODECIMAL by multiplying your given double values with 100'000.

Furthermore you can use the xDimaServer tester to stress xDima 1.
http://xserver.ptvgroup.com/en-uk/devel ... v-xserver/

Last statement:
Consider to use HIGH PERFORMANCE ROUTING to get fastes performance behaviour.

Best regards
Bernd