英文:
The method put <double, double> in the type TreeMap <Double, Double> for the arguments (int, double)
问题
I have the following event2 which contains the following code:
Incidence += 100000*(nIUScTotal+nIUSeTotal+nIUAcTotal+nIUAeTotal+nIRcTotal+nIReTotal+nIPcTotal+nIPeTotal+nIPcRcTotal+nIPcReTotal+nIPeRcTotal+nIPeReTotal)/TotalPopulation;
//if (Incidence<500000)
//{
IncidenceDS.add(time(), Incidence);
incidences1.put(time(), Incidence);
//Incidence_plot = Incidence;
//}
//traceln(Incidence);
//traceln(nIUSeTotal);
//pauseSimulation();
incidences1 is a collection object of the following type as shown in the image.
When running the code for Monte Carlo Bayesian Experiment, the following error shows:
"The method put <double, double> in the type TreeMap <Double, Double> for the arguments (int, double)"
Previously, as mentioned by Mr. Benjamin in the after actions of Monte Carlo Bayesian Calibration Experiment, I put:
root.incidences1.put(getCurrentIteration(), root.Incidence_Plot);
英文:
I have the following event2 which contains the following code
Incidence += 100000*(nIUScTotal+nIUSeTotal+nIUAcTotal+nIUAeTotal+nIRcTotal+nIReTotal+nIPcTotal+nIPeTotal+nIPcRcTotal+nIPcReTotal+nIPeRcTotal+nIPeReTotal)/TotalPopulation;
//if (Incidence<500000)
//{
IncidenceDS.add(time(), Incidence);
incidences1.put(time(), Incidence);
//Incidence_plot = Incidence;
//}
//traceln(Incidence);
//traceln(nIUSeTotal);
//pauseSimulation();
incidences1 is a collection object of the following type as shown in image,
When running the code for Monte Carlo Bayesian Experiment the following error shows,
The method put <double, double> in the type TreeMap <Double, Double> for the arguments (int, double)
Previously as mentioned by Mr. Benjamin in the after actions of Monte Carlo Bayesian Calibration Experiment, I put
root.incidences1.put(getCurrentIteration(), root.Incidence_Plot);
答案1
得分: 1
你所显示的错误表明你可能不太清楚自己在做什么...所以首先深呼吸,仔细思考你想要实现什么...
执行 root.incidences1.put(getCurrentIteration(), root.Incidence_Plot);
并不太合理,而且 getCurrentIteration()
返回一个整数,而你的映射需要一个双精度浮点数作为键...
我觉得你应该在你的蒙特卡洛实验中创建另一个映射... 例如,类型为 Map<Integer, TreeMap>
的 mcIncidences
,然后你可以这样做:mcIncidences.put(getCurrentIteration(), root.incidences1);
这段代码应该在每次迭代之后出现。
类似这样...我不知道你真正想要实现什么,所以把这个作为一个指导。
英文:
The error that you are showing is an indication that you don't really know what you are doing... so first take a deep breath, and think very carefully on what you want to achieve...
doing root.incidences1.put(getCurrentIteration(), root.Incidence_Plot); doesn't make much sense and also getCurrentIteration() returns an integer when your map requires a double as the key...
My feeling is that instead you should create another map in your monte carlo experiment... called for example mcIncidences of type Map<Integer,TreeMap>
then you can do mcIncidences.put(getCurrentIteration(),root.incidences1);
This code should occur after each iteration
Something like that... I don't know what you really want to achieve so use this as a guide
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论