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

Simulation does not end #26

Closed
jholderieath opened this issue Jul 2, 2019 · 3 comments
Closed

Simulation does not end #26

jholderieath opened this issue Jul 2, 2019 · 3 comments

Comments

@jholderieath
Copy link

jholderieath commented Jul 2, 2019

I have a simulation that does not seem to end. I have stop conditions in both the model and the nlrx code. I am running on a domino data lab server with plenty of resources left. The results object is just never generated. I am sitting here with the stop sign waiting in my RStudio session. I have uploaded my NetLogo model as a text file.

Any ideas?

image

Summer19.txt


# Unix default NetLogo installation path (adjust to your needs!):
netlogopath <- file.path("/opt/NetLogo/NetLogo 6.1.0")
modelpath <- file.path("/mnt/Summer19.nlogo")
outpath <- file.path("/mnt/results/out")

nl <- nl(nlversion = "6.1.0",
         nlpath = netlogopath,
         modelpath = modelpath,
         jvmmem = 1024)

nl@experiment <- experiment(expname="wild-pigs",
                            outpath=outpath,
                            repetition=1,
                            tickmetrics="true",
                            idsetup="setup",
                            idgo="go",
                            runtime=16,
                            evalticks=seq(1,15),
                            metrics=c("count sows", "count boars","count sounders"),
                            metrics.turtles=list("households" = c("who", "HH_income", "wealthi")),
                            variables = list('sex_ratio' = list(min=0, max=1, step=0.25),
                                             'cdecay' = list(min=0, max=1, step=0.25),
                                             'rule' = list(values=c("\"at-random\"",
                                                                    "\"myopic-pmax\"", 
                                                                    "\"at-random-with-uniform-removal\""))),
                            constants = list("y_corn" = 1500,
                                             "y_soy" = 400,
                                             "y_crp" = 10,
                                             "p_corn" = 4,
                                             "p_soy" = 10,
                                             "p_crp" = 75,
                                             "vc_corn" = 100,
                                             "vc_soy" = 100,
                                             "vc_crp" = 1,
                                             "defaultLitter" = 8,
                                             "minSounderN" = 5,
                                             "maxSounderN" = 20,
                                             "pig_range" = 20,
                                             "brange" = 10,
                                             "init_sounder" = 5,
                                             "init_hh" = 45,
                                             "epsilon" = 1.19E-7,
                                             "too-close" = 1.1,
                                             "too-far" = 4.1,
                                             "step-size" = 1,
                                             "uniform_removal" = 0.5,
                                             "max_pigs" = 500)
                            )



nl@simdesign <- simdesign_simple(nl=nl,
                              nseeds=3)

results <- run_nl_one(nl, seed = getsim(nl, "simseeds")[1], siminputrow = 1)

# Attach results to nl object:
setsim(nl, "simoutput") <- results

# Write output to outpath of experiment within nl
write_simoutput(nl)

# Do further analysis:
analyze_nl(nl)
@nldoc
Copy link
Contributor

nldoc commented Jul 3, 2019

Thank you very much for your feedback.
I checked your model code and I am quite sure that the problem is connected to the R extension you are using in your model (see issue #24). Please try to stop the underlying r session manually, by adding r:stop to the idfinal field of the experiment,

@jholderieath
Copy link
Author

Yes. Thank you! This is great BTW.

@nldoc
Copy link
Contributor

nldoc commented Jul 4, 2019

Good news and thank you for the positive feedback 😃

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