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

Using log_() changes outcome of simulation run #136

Closed
MichiSchmid opened this Issue Jan 17, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@MichiSchmid

MichiSchmid commented Jan 17, 2018

Through a coincidence I found a special behaviour of log_(). The usage of log_() changes the outcome of a running simulation. How is that possible? I would expect simulation results to be equivalent no matter if a log_() is used or not.

As a reproduciple exmaple i used the code of the vignette "Advanced Trajectory Usage" for the function set_distribution(), set_trajectory().

Original vignette code => log_() in t2 is commented out

t1 <- trajectory() %>%
    timeout(1)

t2 <- trajectory() %>%
    # log_("traj_2") %>%
    set_distribution("dummy", function() 1) %>%
    set_trajectory("dummy", t1) %>%
    timeout(2)

simmer() %>%
    add_generator("dummy", trajectory = t2, distribution = function() 2) %>%
    run(10) %>%
    get_mon_arrivals()

#      name start_time end_time activity_time finished replication
#  1 dummy0          2        4             2     TRUE           1
#  2 dummy1          3        4             1     TRUE           1
#  3 dummy2          4        5             1     TRUE           1
#  4 dummy3          5        6             1     TRUE           1
#  5 dummy4          6        7             1     TRUE           1
#  6 dummy5          7        8             1     TRUE           1
#  7 dummy6          8        9             1     TRUE           1

Adapted vignette code => log_() in t2 is commented in

t1 <- trajectory() %>%
    timeout(1)

t2 <- trajectory() %>%
    log_("traj_2") %>%
    set_distribution("dummy", function() 1) %>%
    set_trajectory("dummy", t1) %>%
    timeout(2)

simmer() %>%
    add_generator("dummy", trajectory = t2, distribution = function() 2) %>%
    run(10) %>%
    get_mon_arrivals()

#  2: dummy0: traj_2
#  4: dummy1: traj_2
#      name start_time end_time activity_time finished replication
#  1 dummy0          2        4             2     TRUE           1
#  2 dummy1          4        6             2     TRUE           1
#  3 dummy2          5        6             1     TRUE           1
#  4 dummy3          6        7             1     TRUE           1
#  5 dummy4          7        8             1     TRUE           1
#  6 dummy5          8        9             1     TRUE           1

The different behaviour of dummy1 is a puzzle to me. Am I overseeing something?

@Enchufa2 Enchufa2 added the bug label Jan 17, 2018

@Enchufa2

This comment has been minimized.

Member

Enchufa2 commented Jan 17, 2018

In DES, weird stuff arise when things happen simultaneously. Thanks, looking into it.

@Enchufa2 Enchufa2 closed this in b9ebd8f Jan 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment