Skip to content

faq 176947201

Billy Charlton edited this page Sep 5, 2018 · 2 revisions

What is the weight of strategy actually mean?

by Enoch Lee on 2018-02-16 06:57:04


Once I have made some mistakes on my code, so that the strategy setting was as follows:

<parameterset type="strategysettings" >

 	<!-- iteration after which strategy will be disabled.  most useful for ``innovative'' strategies (new routes, new times, ...). Normally, better use fractionOfIterationsToDisableInnovation -->
 	<param name="disableAfterIteration" value="-1"/>

 	<!-- path to external executable (if applicable) -->
 	<param name="executionPath" value="null"/>

 	<!-- strategyName of strategy.  Possible default names: SelectRandomBestScoreKeepLastSelectedChangeExpBetaSelectExpBetaSelectPathSizeLogit (selectors), ReRoute TimeAllocationMutator ChangeLegMode TimeAllocationMutator_ReRoute ChangeSingleLegMode ChangeSingleTripMode SubtourModeChoice ChangeTripMode TripSubtourModeChoice  (innovative strategies). -->
 	<param name="strategyName" value="TimeAllocationMutator"/>

 	<!-- subpopulation to which the strategy applies. "null" refers to the default population, that is, the set of persons for which no explicit subpopulation is defined (ie no subpopulation attribute) -->
 	<param name="subpopulation" value="person_TCS"/>

 	<!-- weight of a strategy: for each agent, a strategy will be selected with a probability proportional to its weight -->
 	<param name="weight" value="0.05"/>
 </parameterset>

 <parameterset type="strategysettings" >

 	<!-- iteration after which strategy will be disabled.  most useful for ``innovative'' strategies (new routes, new times, ...). Normally, better use fractionOfIterationsToDisableInnovation -->
 	<param name="disableAfterIteration" value="-1"/>

 	<!-- path to external executable (if applicable) -->
 	<param name="executionPath" value="null"/>

 	<!-- strategyName of strategy.  Possible default names: SelectRandomBestScoreKeepLastSelectedChangeExpBetaSelectExpBetaSelectPathSizeLogit (selectors), ReRoute TimeAllocationMutator ChangeLegMode TimeAllocationMutator_ReRoute ChangeSingleLegMode ChangeSingleTripMode SubtourModeChoice ChangeTripMode TripSubtourModeChoice  (innovative strategies). -->
 	<param name="strategyName" value="ReRoute"/>

 	<!-- subpopulation to which the strategy applies. "null" refers to the default population, that is, the set of persons for which no explicit subpopulation is defined (ie no subpopulation attribute) -->
 	<param name="subpopulation" value="person_TCS"/>

 	<!-- weight of a strategy: for each agent, a strategy will be selected with a probability proportional to its weight -->
 	<param name="weight" value="0.05"/>
 </parameterset>

 <parameterset type="strategysettings" >

 	<!-- iteration after which strategy will be disabled.  most useful for ``innovative'' strategies (new routes, new times, ...). Normally, better use fractionOfIterationsToDisableInnovation -->
 	<param name="disableAfterIteration" value="-1"/>

 	<!-- path to external executable (if applicable) -->
 	<param name="executionPath" value="null"/>

 	<!-- strategyName of strategy.  Possible default names: SelectRandomBestScoreKeepLastSelectedChangeExpBetaSelectExpBetaSelectPathSizeLogit (selectors), ReRoute TimeAllocationMutator ChangeLegMode TimeAllocationMutator_ReRoute ChangeSingleLegMode ChangeSingleTripMode SubtourModeChoice ChangeTripMode TripSubtourModeChoice  (innovative strategies). -->
 	<param name="strategyName" value="ChangeTripMode"/>

 	<!-- subpopulation to which the strategy applies. "null" refers to the default population, that is, the set of persons for which no explicit subpopulation is defined (ie no subpopulation attribute) -->
 	<param name="subpopulation" value="person_TCS"/>

 	<!-- weight of a strategy: for each agent, a strategy will be selected with a probability proportional to its weight -->
 	<param name="weight" value="0.05"/>
 </parameterset>

 <parameterset type="strategysettings" >

 	<!-- iteration after which strategy will be disabled.  most useful for ``innovative'' strategies (new routes, new times, ...). Normally, better use fractionOfIterationsToDisableInnovation -->
 	<param name="disableAfterIteration" value="-1"/>

 	<!-- path to external executable (if applicable) -->
 	<param name="executionPath" value="null"/>

 	<!-- strategyName of strategy.  Possible default names: SelectRandomBestScoreKeepLastSelectedChangeExpBetaSelectExpBetaSelectPathSizeLogit (selectors), ReRoute TimeAllocationMutator ChangeLegMode TimeAllocationMutator_ReRoute ChangeSingleLegMode ChangeSingleTripMode SubtourModeChoice ChangeTripMode TripSubtourModeChoice  (innovative strategies). -->
 	<param name="strategyName" value="ChangeExpBeta"/>

 	<!-- subpopulation to which the strategy applies. "null" refers to the default population, that is, the set of persons for which no explicit subpopulation is defined (ie no subpopulation attribute) -->
 	<param name="subpopulation" value="person_TCS"/>

 	<!-- weight of a strategy: for each agent, a strategy will be selected with a probability proportional to its weight -->
 	<param name="weight" value="0.85"/>
 </parameterset>

 <! -- Some other strategies in between -->

 <parameterset type="strategysettings" >

 	<!-- iteration after which strategy will be disabled.  most useful for ``innovative'' strategies (new routes, new times, ...). Normally, better use fractionOfIterationsToDisableInnovation -->
 	<param name="disableAfterIteration" value="-1"/>

 	<!-- path to external executable (if applicable) -->
 	<param name="executionPath" value="null"/>

 	<!-- strategyName of strategy.  Possible default names: SelectRandomBestScoreKeepLastSelectedChangeExpBetaSelectExpBetaSelectPathSizeLogit (selectors), ReRoute TimeAllocationMutator ChangeLegMode TimeAllocationMutator_ReRoute ChangeSingleLegMode ChangeSingleTripMode SubtourModeChoice ChangeTripMode TripSubtourModeChoice  (innovative strategies). -->
 	<param name="strategyName" value="ReRoute"/>

 	<!-- subpopulation to which the strategy applies. "null" refers to the default population, that is, the set of persons for which no explicit subpopulation is defined (ie no subpopulation attribute) -->
 	<param name="subpopulation" value="person_TCS"/>

 	<!-- weight of a strategy: for each agent, a strategy will be selected with a probability proportional to its weight -->
 	<param name="weight" value="0.05"/>
 </parameterset>

 <! -- Some other strategies in between -->

 <parameterset type="strategysettings" >

 	<!-- iteration after which strategy will be disabled.  most useful for ``innovative'' strategies (new routes, new times, ...). Normally, better use fractionOfIterationsToDisableInnovation -->
 	<param name="disableAfterIteration" value="-1"/>

 	<!-- path to external executable (if applicable) -->
 	<param name="executionPath" value="null"/>

 	<!-- strategyName of strategy.  Possible default names: SelectRandomBestScoreKeepLastSelectedChangeExpBetaSelectExpBetaSelectPathSizeLogit (selectors), ReRoute TimeAllocationMutator ChangeLegMode TimeAllocationMutator_ReRoute ChangeSingleLegMode ChangeSingleTripMode SubtourModeChoice ChangeTripMode TripSubtourModeChoice  (innovative strategies). -->
 	<param name="strategyName" value="ReRoute"/>

 	<!-- subpopulation to which the strategy applies. "null" refers to the default population, that is, the set of persons for which no explicit subpopulation is defined (ie no subpopulation attribute) -->
 	<param name="subpopulation" value="person_TCS"/>

 	<!-- weight of a strategy: for each agent, a strategy will be selected with a probability proportional to its weight -->
 	<param name="weight" value="0.05"/>
 </parameterset>

And it turned out that the simulation still runs until the end, what is the meaning for strategies with total weight higher than 1? Would there be some agents re-plan twice?

Thank you at advance.


Comments: 1


Re: What is the weight of strategy actually mean?

by Johan W. Joubert on 2018-02-16 07:46:51

Hi Enoch, as the XML comment suggests: "...a strategy will be selected with a probability proportional to its weight..."

And it is precisely for the reason of "finger faults" and typos that MATSim uses weights, and do not interpret them as probabilities. That is, say each strategy i's weight is denoted w_i, then the probability of that strategy being chosen is w_i/sum_of_all(w_i).

Alternatively MATSim should have thrown an error saying: "hey, your weights/probabilities don't add up to one". That might have been a bit of a nuisance (although I see that there is value in that too). Instead, it is precisely interpreted as that: a weight (and not a probability).

Clone this wiki locally