What is OptMalus?

This forum deals with any kind of routing computation whether it is simple A:B-routing, calculation of isochrones, simple matrix computation or nearest search.
Post Reply
netquest34
Posts: 3
Joined: Mon Oct 16, 2017 4:45 pm

What is OptMalus?

Post by netquest34 »

For an xRoute profile, under Course -> AdditionalDataRules -> Legacy, it is possible to have
<KeyValue key="OptMalus3" enabled="false" threshold="0" malus="-50" />.
We are using xRoute to calculate thousands of distances and transit times for trucks, within the UK and the EU.
What are OptMalus1 through to OptMalus16, and are all index values 1 to 16 used?
If I don’t specify values for any of them, e.g. OptMalus12 is missing from my XML, then is this given default values?
Do I always need to have enabled="true" for the malus to have an effect?
Will a negative value of malus = -50 have any effect, maybe to encourage use of certain segments? What range of values is allowed / recommended?
Can you answer all the same questions also for DirOptCondMalus, please?
Joost
Posts: 307
Joined: Fri Apr 25, 2014 1:46 pm

Re: What is OptMalus?

Post by Joost »

Theory:
OptMalus[] attributes are not related to a specific type of blocking in general, but instead the program responsible for creating the layer is allowed to give it's own meaning to it. In the profile you only define with malus value will be applied to segments which have the OptMalus attribute assigned to them.

Practice:

OptMalus[1-8]
These only occur if you create your own blocking layers using the Road Editor use case of Map and Guide. In the Road editor use case you have 2 sliders for avoiding / preferring segments, 1 for trucks and one for cars. Depending of the state of the slide an OptMalus attribute will be assigned to the segment. See also screenshot.
Matching of the malus values to the PTV Map&amp;Guide Road Editor settings
Matching of the malus values to the PTV Map&Guide Road Editor settings
Most of the Optmalus[9-16] are used in a specific set for environmental zones.
9 - The Netherlands
10 - London
13 - Denmark
14 - Italy
15 - Sweden
16 - Portugal
Please note: This environmental is not part of our default map data. It is only prepared for the maps used by Map and Guide and TLNplanner and are distributed as part of the program, not with the map data.

Other OptMalus are currently not in use.

If you have layer where these values are present you need to define them in your profile to work properly. Below is an example of the values that map and guide is using. Please note that this is an example of a truck, hence the Optmalus[1-4] are not enabled since they were ment for cars. As for environmental zones, I'm only avoiding the dutch zones on my example.

Code: Select all

<Legacy>
	<KeyValue key="OptMalus1" enabled="false" threshold="0" malus="2000" />
	<KeyValue key="OptMalus2" enabled="false" threshold="0" malus="1000" />
	<KeyValue key="OptMalus3" enabled="false" threshold="0" malus="-50" />
	<KeyValue key="OptMalus4" enabled="false" threshold="0" malus="-99" />
	<KeyValue key="OptMalus5" enabled="true" threshold="0" malus="2000" />
	<KeyValue key="OptMalus6" enabled="true" threshold="0" malus="1000" />
	<KeyValue key="OptMalus7" enabled="true" threshold="0" malus="-50" />
	<KeyValue key="OptMalus8" enabled="true" threshold="0" malus="-99" />
	<KeyValue key="OptMalus9" enabled="true" threshold="0" malus="2500" />
	<KeyValue key="OptMalus10" enabled="true" threshold="0" malus="0" />
	<KeyValue key="OptMalus13" enabled="true" threshold="0" malus="0" />
	<KeyValue key="OptMalus14" enabled="true" threshold="0" malus="0" />
	<KeyValue key="OptMalus15" enabled="true" threshold="0" malus="0" />
	<KeyValue key="OptMalus16" enabled="true" threshold="0" malus="0" />
</Legacy>
To answer the rest of your questions:
If I don’t specify values for any of them, e.g. OptMalus12 is missing from my XML, then is this given default values?
Default value is that enabled will be set to false
Do I always need to have enabled="true" for the malus to have an effect?
Yes, if you set enable to false the attribuut wil be ignored (note that i purposely disable some attributes in my example since they are ment for cars and my example was for trucks.)
Will a negative value of malus = -50 have any effect, maybe to encourage use of certain segments?

Yes it wil prefer the route. The simplified explanation of a malus is:
When our routing engine is considering a segment for routing, it will pretend it is <Malus> percent longer then it really is.
So if a segment has a malus of -99 our engine will pretend it is -99% longer, So only 1% of its original length. that makes it much more an attractive choice for the engie to select for the route.
What range of values is allowed / recommended?
Allowed is -99 until 2501
Recommended: see my example.
Can you answer all the same questions also for DirOptCondMalus, please?
These only occure when you are using legacy truck attribute. With this I mean truck attributes build using road editor technolgy and not featurelayer technology. Their values are explained at
Use cases/xRoute/DSC_TruckAttributesFormat.htm (search for the "Truck attributes without a default meaning")
Joost Claessen
Senior Technical Consultant
PTV Benelux
Joost
Posts: 307
Joined: Fri Apr 25, 2014 1:46 pm

Re: What is OptMalus?

Post by Joost »

One extra remark about performance:

If you set any malus to a negative number in your profile this will have an effect on the performance of the xRoute. Almost all of them will cause a decrease in performance (up to 2.5 times slower for using a -99 value). The only exception on this rule if you set a malus for the preferred routes feature layer and the network you are using is a covering the region where you are routing in. (currently this is only for the Australia preferred routing networks).

I would recommend not to use negative malus values if you can in any way avoid using them.
Joost Claessen
Senior Technical Consultant
PTV Benelux
netquest34
Posts: 3
Joined: Mon Oct 16, 2017 4:45 pm

Re: What is OptMalus?

Post by netquest34 »

Joost, This is all very helpful, so thank you for your prompt and thorough answers.
Post Reply