Open 15751593981 opened 4 years ago
The symptoms reported indicates apparently that you are trying to run your model from source which is not supported. It means that you cannot run a model indicating an Eclipse workspace, instead you must build and install the model using Repast. Please, try to build and install your model on you PC for using R/Repast.
Hello, do you mean there is something wrong with my version, or does it not support calling Repast's model from R?
------------------ 原始邮件 ------------------ 发件人: "Antonio Prestes García"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 下午3:16 收件人: "antonio-pgarcia/RRepast"<RRepast@noreply.github.com>; 抄送: "徐爽"<906667624@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [antonio-pgarcia/RRepast] 使用rrepast从R导入repast模型问题 (#1)
The symptoms reported indicates apparently that you are trying to run your model from source which is not supported. It means that you cannot run a model indicating an Eclipse workspace, instead you must build and install the model using Repast. Please, try to build and install your model on you PC for using R/Repast.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
The issue is not related to your Repast version. Apparently, you are trying to use R/Repast using the source directory of your model, but it is necessary to build and install the model. Have you installed your model?
The save path for the model I built with Repast Simphony is E:\eclipse-workspace and the model name is sy09.In the case I looked at, the model that calls Repast from R is the path that calls the model, so I'm using the model path here as well.Isn't the path that invokes the model the build path of the model?What is the installation path for the model?
------------------ 原始邮件 ------------------ 发件人: "Antonio Prestes García"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 下午3:54 收件人: "antonio-pgarcia/RRepast"<RRepast@noreply.github.com>; 抄送: "徐爽"<906667624@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [antonio-pgarcia/RRepast] 使用rrepast从R导入repast模型问题 (#1)
The issue is not related to your Repast version. Apparently, you are trying to use R/Repast using the source directory of your model, but it is necessary to build and install the model. Have you installed your model?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
The installation path is the actual location where you have installed your model on your device. In order to install a model, you should use the corresponding Repast option to generate a Model Installer file (an executable .jar). You may what to check the following link for some hints about the process https://spatialawareness.blog/2019/06/08/installing-repast-simulation-models-and-how-to-make-your-own-installer/
I recommend you to try out first the Predator-Prey example which come along Repast distribution, to get familiar with R/Repast using a validated model.
Once you have built and installed you model, please execute the following lines (The variable “v” should contain a data frame with the model output which holds the wolf and sheep population census.)
Easy.Setup("/usr/models/PredatorPrey") v<- Easy.Run("/usr/models/PredatorPrey", "Agent Counts", 600,1)
head(v) run tick Sheep.Count Wolf.Count 1 1 1 49 97 2 1 2 52 95 3 1 3 55 94 4 1 4 56 94 5 1 5 55 96 6 1 6 57 96
You may also consider checking out the companion paper https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5192867/
Just in case you need you may use the following link for a pre-built version of Predator-Prey model.
Ok, thank you very much!
------------------ 原始邮件 ------------------ 发件人: "Antonio Prestes García"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 晚上6:04 收件人: "antonio-pgarcia/RRepast"<RRepast@noreply.github.com>; 抄送: "徐爽"<906667624@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [antonio-pgarcia/RRepast] 使用rrepast从R导入repast模型问题 (#1)
Just in case you need you may use the following link for a pre-built version of Predator-Prey model.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Hello, sorry to bother you, I installed the model and used the following code to run from R: >obj<-Model(modeldir = "E:/eclipse-workspace/安装程序/sy09") >Run(obj) As a result, the error appears as follows: Error in rJava::.jcall(e, "[S", "getParameterNames") : java.lang.NullPointerException
Moreover, I tried the predator-prey case mode you gave me, using the following code: >Easy.Setup("E:/eclipse-workspace/安装程序/sy09") [1] " Using 1 of 4 available cores " > v<-Easy.Run("E:/eclipse-workspace/安装程序/sy09","NewInfectedNumber",8280,1) As a result, the error appears as follows: log4j:WARN No appenders could be found for logger (hsqldb.db.HSQLDB4AD417742A.ENGINE). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. Error in rJava::.jcall(e, "[S", "GetModelOutput") : java.lang.NullPointerException Hello, I am very sorry, could you please tell me what I need to do through the rjava package when I run the model in R? What should I do with the above errors?What should the model code for running Repast from R look like?
------------------ 原始邮件 ------------------ 发件人: "Antonio Prestes García"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 晚上10:33 收件人: "antonio-pgarcia/RRepast"<RRepast@noreply.github.com>; 抄送: "徐爽"<906667624@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [antonio-pgarcia/RRepast] 使用rrepast从R导入repast模型问题 (#1)
Closed #1.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Please, check whether the directory ‘rrepast-deployment’ has been created on the directory you installed the predator-prey model (it should be something like /usr/models/PredatorPrey/rrepast-deployment). This directory is generated when the function Easy.Setup is called the first time. There are no especial requirements regarding the model code besides the output should be an aggregated data set (please check the reference paper). Check out the Predator-Prey example model for a good reference.
Hello, I call the model on R with the following code, and the result shows that the model is initialized: > library(rrepast) > install.dir<-"E:/installationModel/sy09" > sy09_Model<-Model(modeldir = install.dir,8280,dataset="NewInfectedNumber",TRUE)
2020-04-29 14:35:55 ��Ϣ org.haldane.rrepast.ModelInitializerBroker initialize [ModelInitializerBroker]::initialize Then I used the MCMC algorithm of easyABC package to estimate the parameters of the model, but the following error was shown: Error in old_model(param_with_constants) : 没有"old_model"这个函数
Excuse me, why this error can appear, how should handle
------------------ 原始邮件 ------------------ 发件人: "Antonio Prestes García"<notifications@github.com>; 发送时间: 2020年4月28日(星期二) 下午2:48 收件人: "antonio-pgarcia/RRepast"<RRepast@noreply.github.com>; 抄送: "徐爽"<906667624@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [antonio-pgarcia/RRepast] 使用rrepast从R导入repast模型问题 (#1)
Please, check whether the directory ‘rrepast-deployment’ has been created on the directory you installed the predator-prey model (it should be something like /usr/models/PredatorPrey/rrepast-deployment). This directory is generated when the function Easy.Setup is called the first time. There are no especial requirements regarding the model code besides the output should be an aggregated data set (please check the reference paper). Check out the Predator-Prey example model for a good reference.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
The last error you have reported (old_model(param_with_constants) has been generated by easyABC package not by R/Repast.
Hello, I would like to use the easy-calibration function in the rrepast package. The case I see is as follows: my.cost<- function(params, results) { criteria<- c() Rate<- AoE.RMSD(results$X.Simulated,results$X.Experimental) G<- AoE.RMSD(results$G.T.,52) total<- Rate + G criteria<- cbind(total,Rate,G) return(criteria) } Easy.Setup("/models/BactoSim") v<- Easy.Calibration("/models/BactoSim","ds::Output",360, f,exp.n = 1000, exp.r=1, smax=4, design="mcs", my.cost)
One of aoe.rmsd () is the simulation data set and the other is the experimental data set.The simulated data set is derived from the model's data set output. How to add the experimental data set to the model?How to get???
------------------ 原始邮件 ------------------ 发件人: "Antonio Prestes García"<notifications@github.com>; 发送时间: 2020年4月30日(星期四) 下午2:36 收件人: "antonio-pgarcia/RRepast"<RRepast@noreply.github.com>; 抄送: "徐爽"<906667624@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [antonio-pgarcia/RRepast] 使用rrepast从R导入repast模型问题 (#1)
The last error you have reported (old_model(param_with_constants) has been generated by easyABC package not by R/Repast.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Hello, when I use easy-run (), the parameters are as follows: V<-Easy.Run("E:/installationModel/sy09","NewInfectedNumber",12,1) I have seen that the data set name is correct, but it shows the following error.What is the reason. 2020-05-04 03:03:02 ��Ϣ org.haldane.rrepast.ModelInitializerBroker initialize [ModelInitializerBroker]::initialize | | 0% Error in rJava::.jcall(e, "[S", "GetModelOutput") : java.lang.NullPointerException
------------------ 原始邮件 ------------------ 发件人: "Antonio Prestes García"<notifications@github.com>; 发送时间: 2020年4月30日(星期四) 下午2:36 收件人: "antonio-pgarcia/RRepast"<RRepast@noreply.github.com>; 抄送: "徐爽"<906667624@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [antonio-pgarcia/RRepast] 使用rrepast从R导入repast模型问题 (#1)
The last error you have reported (old_model(param_with_constants) has been generated by easyABC package not by R/Repast.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Hello, I would like to use the easy-calibration function, but there is less information in the package. Is there anything I can refer to?
------------------ 原始邮件 ------------------ 发件人: "Antonio Prestes García"<notifications@github.com>; 发送时间: 2020年4月30日(星期四) 下午2:36 收件人: "antonio-pgarcia/RRepast"<RRepast@noreply.github.com>; 抄送: "徐爽"<906667624@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [antonio-pgarcia/RRepast] 使用rrepast从R导入repast模型问题 (#1)
The last error you have reported (old_model(param_with_constants) has been generated by easyABC package not by R/Repast.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
In order to use the calibration function, you should first define a ‘fitness’ or ‘cost’ function and the calibration process will try to find the best combination of parameters minimizing this function. The cost function is populated with two parameters: (a) ‘parameters’ will hold the parameter set used for producing the model output; (b) ‘results’ contains the output data frame returned by your repast model. Basically we are calculating a deviation between simulated values whatever it is and some of experimental data set.
my.cost<- function(params, results) {
criteria<- c()
deviation<- AoE.RMSD(results$X.Simulated,
Once you have defined the ‘fitness’ function you can invoke the calibration function.
Easy.Setup("/models/yourmodel")
v<- Easy.Calibration("/models/yourmodel","
Please note that the calibration function use a static sampling scheme with 3 possible choices: Latin hypercube sampling, Montecarlo Sampling and Full Factorial Sampling respectively “lhs”, “mcs” and “ffs”. You may also want to have a look at an metaheuristic optimization approach for parameter estimation at: https://arxiv.org/abs/2005.12841
Ok, thank you!
------------------ 原始邮件 ------------------ 发件人: "Antonio Prestes García"<notifications@github.com>; 发送时间: 2020年5月31日(星期天) 凌晨4:30 收件人: "antonio-pgarcia/RRepast"<RRepast@noreply.github.com>; 抄送: "徐爽"<906667624@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [antonio-pgarcia/RRepast] 使用rrepast从R导入repast模型问题 (#1)
In order to use the calibration function, you should first define a ‘fitness’ or ‘cost’ function and the calibration process will try to find the best combination of parameters minimizing this function. The cost function is populated with two parameters: (a) ‘parameters’ will hold the parameter set used for producing the model output; (b) ‘results’ contains the output data frame returned by your repast model. Basically we are calculating a deviation between simulated values whatever it is and some of experimental data set.
my.cost<- function(params, results) { criteria<- c() deviation<- AoE.RMSD(results$X.Simulated,) criteria<- cbind(deviation) return(criteria) }
Once you have defined the ‘fitness’ function you can invoke the calibration function.
Easy.Setup("/models/yourmodel") v<- Easy.Calibration("/models/yourmodel","",360, f, exp.n = 1000,exp.r=1, smax=4,design="mcs", my.cost)
Please note that the calibration function use a static sampling scheme with 3 possible choices: Latin hypercube sampling, Montecarlo Sampling and Full Factorial Sampling respectively “lhs”, “mcs” and “ffs”. You may also want to have a look at an metaheuristic optimization approach for parameter estimation at: https://arxiv.org/abs/2005.12841
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Hello, with regard to the use of easy.calibration (), can you elaborate on that?In the description, it is said that the function has an operational model, first based on the experimental setting that all parameters are defined a priori, and second based on the optimization technique.At present, the only optimization technique supported is particle swarm optimization.I didn't quite understand this introduction to the function.Is optimization techniques embedded in this function?Optimization technique is a sampling method of parameters, right?What is the difference between optimization techniques and the three sampling methods introduced in the Design section of the function?The combination of optimization techniques and parametric sampling is not well understood.
------------------ 原始邮件 ------------------ 发件人: "Antonio Prestes García"<notifications@github.com>; 发送时间: 2020年5月31日(星期天) 凌晨4:30 收件人: "antonio-pgarcia/RRepast"<RRepast@noreply.github.com>; 抄送: "徐爽"<906667624@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [antonio-pgarcia/RRepast] 使用rrepast从R导入repast模型问题 (#1)
In order to use the calibration function, you should first define a ‘fitness’ or ‘cost’ function and the calibration process will try to find the best combination of parameters minimizing this function. The cost function is populated with two parameters: (a) ‘parameters’ will hold the parameter set used for producing the model output; (b) ‘results’ contains the output data frame returned by your repast model. Basically we are calculating a deviation between simulated values whatever it is and some of experimental data set.
my.cost<- function(params, results) { criteria<- c() deviation<- AoE.RMSD(results$X.Simulated,) criteria<- cbind(deviation) return(criteria) }
Once you have defined the ‘fitness’ function you can invoke the calibration function.
Easy.Setup("/models/yourmodel") v<- Easy.Calibration("/models/yourmodel","",360, f, exp.n = 1000,exp.r=1, smax=4,design="mcs", my.cost)
Please note that the calibration function use a static sampling scheme with 3 possible choices: Latin hypercube sampling, Montecarlo Sampling and Full Factorial Sampling respectively “lhs”, “mcs” and “ffs”. You may also want to have a look at an metaheuristic optimization approach for parameter estimation at: https://arxiv.org/abs/2005.12841
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Currently, the ‘Easy.Calibration’ function only supports the first operational model, I mean, using an experimental design for generating the combination of simulation parameters. In a previous version, the function also supported particle swarm optimization (PSO) but I started to add more and more meta-heuristics and I have decided to put all optimization-based methods in a separated package, the EvoPER. The description of this function is not correct, I have forgotten to update the description, Thank you very much for noting!!! I will update Easy.Calibration description on github as soon as I have some time.
The installation path is the actual location where you have installed your model on your device. In order to install a model, you should use the corresponding Repast option to generate a Model Installer file (an executable .jar). You may what to check the following link for some hints about the process https://spatialawareness.blog/2019/06/08/installing-repast-simulation-models-and-how-to-make-your-own-installer/
I recommend you to try out first the Predator-Prey example which come along Repast distribution, to get familiar with R/Repast using a validated model.
Once you have built and installed you model, please execute the following lines (The variable “v” should contain a data frame with the model output which holds the wolf and sheep population census.)
Easy.Setup("/usr/models/PredatorPrey") v<- Easy.Run("/usr/models/PredatorPrey", "Agent Counts", 600,1)
head(v) run tick Sheep.Count Wolf.Count 1 1 1 49 97 2 1 2 52 95 3 1 3 55 94 4 1 4 56 94 5 1 5 55 96 6 1 6 57 96
You may also consider checking out the companion paper https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5192867/
Hi, I have similar problems to those mentioned in these comments. I started with your 2016 paper (Analyzing Repast Symphony models in R with RRepast package) and tried to use repast example models for practice. I installed and loaded package rrepast, downloaded the installer for the PredatorPrey model from the link you gave in your previous answers, installed the model on my device, copied the file rrepast-integration.jar into the lib folder of the installed model, and edited the file scenario.xml in folder PredatorPrey.rs to include integration configuration as instructed in your 2016 paper. Having done all of these, I tried to load the model in R, first using Model() and then using Easy.Setup() and both my attempts failed. Here I copy my RStudio console:
install.dir = "C:/temp/learning009predinstalled/PredatorPrey" obj = Model(install.dir,dataset = " dataset ",TRUE) Error in rJava::.jcall(e, "V", "endAt", v) : method endAt with signature (Z)V not found Easy.Setup(install.dir) Error in Easy.Setup(install.dir) : Error deploying integration libraries! De plus : Warning message: In file.create(to[okay]) : impossible de créer le fichier 'C:/temp/learning009predinstalled/PredatorPrey/PredatorPrey/lib/rrepast-integration.jar', à cause de 'No such file or directory'
I have 2 questions: 1-What did I do wrong when using Model() ? 2-I noted that Easy.Setup() made a peculiar change in the folder name string. As you can see above, it has added an extra '/PredatorPrey' inside the string, which I believe is the reason it cannot find the address. I tested it with other directory names, and it did the same: double-copied the last folder name in the string variable install.dir and created an address that doesn't exist. What did I do wrong when using Easy.Setup() ?
I went over the instructions in the paper and your explanations in this thread of comments, but couldn't figure out how to get rrepast to work. I'll appreciate your help.
Update: I had installed the model by this command in R:
system("java -jar C:/temp/learning008predinstaller/setup-predatorprey.jar")
An installation box appeared and in one of the stages of installation it asked to specify the destination folder. I had specified the folder to be "C:/temp/learning009predinstalled". In a new effort, I tried installing the model again and specified the destination folder to be "C:/temp/learning011predinstalled/PredatorPray" , that is, I defined a new subfolder named "PredatorPray" and asked the model to be installed therein. This resolved the issue of the double-copy. Now rrepast is able to find the model in "C:/temp/learning011predinstalled/PredatorPray/PredatorPray". The function Easy.Setup() gave no errors, and the new folder "/rrepast-deployment/" was created. However, neither Easy.Run() nor Model() work now. Here is a copy of my RStudio console after calling these functions:
Easy.Setup(install.dir) [1] " Using 1 of 16 available cores " v=Easy.Run(install.dir,"Agent Counts",600,1) Error in rJava::.jcall(e, "S", "getId") : java.lang.NullPointerException obj = Model(install.dir,dataset = " dataset ",TRUE) Error in rJava::.jcall(e, "V", "endAt", v) : method endAt with signature (Z)V not found
我先在RStudio中library了rrepast包 library(rrepast) 接着设置我模型的路径 install.dir<-"E:/eclipse-workspace/sy09" 然后,使用下面语句加载入模型 obj<-Model(modeldir = install.dir,dataset = "dataset",TRUE) 出现错误 Error in .jfindClass(as.character(class)) : java.lang.NoClassDefFoundError: repast/simphony/engine/environment/AbstractRunner 想请问,什么会出现该问题,怎么解决????