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&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")