The method put <double, double> in the type TreeMap <Double, Double> for the arguments (int, double)

huangapple go评论53阅读模式
英文:

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&lt;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&lt;500000)
//{
IncidenceDS.add(time(), Incidence);
incidences1.put(time(), Incidence);
//Incidence_plot = Incidence;
//}
//traceln(Incidence);
//traceln(nIUSeTotal);
//pauseSimulation();

The method put <double, double> in the type TreeMap <Double, Double> for the arguments (int, double)

incidences1 is a collection object of the following type as shown in image,

The method put <double, double> in the type TreeMap <Double, Double> for the arguments (int, double)

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

huangapple
  • 本文由 发表于 2023年6月12日 21:35:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/76457208.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定