Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default setting for 'mutationRangeStep ' #3647

Closed
lukknapen opened this issue Dec 27, 2024 · 3 comments
Closed

Default setting for 'mutationRangeStep ' #3647

lukknapen opened this issue Dec 27, 2024 · 3 comments

Comments

@lukknapen
Copy link

  • Does the default setting
   <module name="timeAllocationMutator" >
      <!-- Mutation Range Step, default = 1 second -->
      <param name="mutationRangeStep" value="1.0" />
   </module>

make sense ? In org/matsim/core/population/algorithms/PlanMutateTimeAllocation.java
and org/matsim/core/population/algorithms/PlanMutateTimeAllocationSimplified.java the second term in

double t = time.seconds() + (int)((this.random.nextDouble() * 2.0 - 1.0) * this.mutationRange);

always equals zero for the default setting due to the 'double to int' type casting.
Hence, the default value does not induce timeMutation.

This is because (int)(someDoubleValue) uses the 'rounding to zero method';
see https://docs.oracle.com/javase/specs/jls/se17/html/jls-5.html#jls-5.1.3

  • Was this default value chosen on purpose ? If so, it is useful to extend the comment for this setting in the logFile.log It now just says <!-- Mutation Range Step, default = 1 second --> which is correct but may be insufficient.
@jfbischoff
Copy link
Collaborator

Hi Luk,
I have worked a bit on the TimeAllocationMutator during the last code sprint, there is only one TimeMutator now left:
https://github.com/matsim-org/matsim-libs/blob/fb982e55294034d1afe44084b7b0322bcd9d17a0/matsim/src/main/java/org/matsim/core/population/algorithms/MutateActivityTimeAllocation.java

There is now a mutationRangeStep and a mutationRange. The step is indeed set by default to 1 second, whereas the mutationRange is 1800 seconds.
The step can be set to e.g., 60 seconds or 5 minutes to achieve more relevant time mutations.

@lukknapen
Copy link
Author

lukknapen commented Jan 13, 2025 via email

@lukknapen
Copy link
Author

  • my comment was that the default value (which disables timeMutation) should be documented at least in the notes that come in the logFile
  • the default value 'an sich' is not a problem but the MATSim guide advises to start from the default settings and as far as i can see there is no warning that this disables time mutation. I only discovered it by code reading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants