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

More flexible calibration #25

Merged
merged 34 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a487f0b
improved calibration to support multiple attributes
rakow Apr 14, 2023
d0d5492
add constraints, tune parameters
rakow Apr 17, 2023
2111ce2
Merge branch 'master' into calibration
rakow Sep 28, 2023
242fd92
restructure calibration for more modularity
rakow Sep 29, 2023
2e3710d
improve API for scenarios with different CLI
rakow Sep 29, 2023
e557d7f
fix imports and warnings
rakow Oct 4, 2023
8119a66
fix more warnings
rakow Oct 4, 2023
9dcfe2a
fix imports
rakow Oct 4, 2023
e80bd85
created new grouped asc calibration
rakow Oct 5, 2023
ced2854
first running version
rakow Oct 6, 2023
3cc8148
persist error metrics
rakow Oct 6, 2023
3e9a640
persist error metrics for normal asc as well
rakow Oct 6, 2023
ee965e4
write error metrics
rakow Oct 18, 2023
7e32279
reduce step size for correlated groups
rakow Oct 19, 2023
59d1dbd
fix corr correction
rakow Oct 20, 2023
d47f051
add functions for plotting
rakow Oct 23, 2023
119a0e7
with bug with incorrect datatype
rakow Oct 26, 2023
07b81dd
save rate and step for debugging
rakow Oct 26, 2023
450fef9
Merge branch 'master' into calibration
rakow Oct 27, 2023
b8f6d94
Merge branch 'master' into calibration
rakow Oct 27, 2023
d5408d5
Merge branch 'master' into calibration
rakow Oct 27, 2023
30ee1ab
prepare multi groups, fix some input value checks
rakow Oct 27, 2023
bf00be5
argument to deactivate the base calibration
rakow Oct 30, 2023
abddb18
change how the correction factor works
rakow Nov 22, 2023
96d30cf
save delta values as attributes
rakow Nov 23, 2023
0e17499
option to alternate base and group calibration
rakow Nov 24, 2023
e4d7f1e
alternate group calibration
rakow Nov 25, 2023
8896f08
better error message
rakow Nov 25, 2023
f697ff8
fix indent error
rakow Nov 25, 2023
5f53f4b
implement alternating updates in the update step method
rakow Nov 27, 2023
ed738d0
fix usage of multi groups
rakow Nov 30, 2023
55e5071
Merge branch 'master' into calibration
rakow Dec 1, 2023
650862d
update readme to new calibration
rakow Dec 1, 2023
f7615c1
fix typo
rakow Dec 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ Scenarios created with the `matsim-application` contrib provide an interface tha
# -------------------------------------------------------------------
# 5. CALIBRATION: Automatic calibration for MATSim scenario.

from matsim.calibration import create_calibration, ASCCalibrator, utils, study_as_df

modes = ["walk", "car", "pt", "bike"]
fixed_mode = "walk"
target = {
Expand All @@ -246,11 +248,29 @@ target = {
"car": 0.359
}

study, obj = calibration.create_mode_share_study("calib", "./matsim-scenario-1.0-SNAPSHOT.jar",
"./scenarios/input/scenario-v1.0-10pct.config.xml",
modes, fixed_mode, target)
def filter_persons(df):
return df[df.subpopulation == "person"]

def filter_modes(df):
return df[df.main_mode.isin(modes)]

study, obj = create_calibration("calib", ASCCalibrator(modes, initial, target, fixed_mode=fixed_mode,
lr=utils.linear_scheduler(start=0.25, interval=10)),
"./matsim-scenario-1.0-SNAPSHOT.jar",
"./scenarios/input/scenario-v1.0-10pct.config.xml",
args="--config:controler.lastIteration 400",
jvm_args="-Xmx12G -Xmx12G -XX:+AlwaysPreTouch -XX:+UseParallelGC",
transform_persons=filter_persons,
transform_trips=filter_modes,
chain_runs=utils.default_chain_scheduler, debug=False)

study.optimize(obj, 10)

df = study_as_df(study)
df.to_csv("report.csv")

from matsim.calibration.plot import plot_study

plot_study(study)

```
Loading