多重并行蒙特卡罗因密钥错误而失败(在数据库名称上)

时间:2016-04-15 20:40:01

标签: brightway

我正在尝试使用Brightway的 var point1 = new google.maps.LatLng(marker.getPosition().lat(), marker.getPosition().lng()); var point2 = new google.maps.LatLng(satelite.getPosition().lat(), satelite.getPosition().lng()); var distance = google.maps.geometry.spherical.computeDistanceBetween(point1, point2); alert('distance is '+distance+'m'); ParallelMonteCarlo类,但遇到了KeyError。我在带有LCI数据库的Brightway项目中:

MultiMonteCarlo

选择活动和方法:

In  [1] bw.databases
Out [1] Brightway2 databases metadata with 2 objects:
           biosphere3
           ecoinvent 3_2 CutOff

我的代码如下:

In [2]  db = bw.Database('ecoinvent 3_2 CutOff')
        act = db.random()
        method = ('CML 2001', 'climate change', 'GWP 100a')

In [3]  ParallelMC_LCA = bw.ParallelMonteCarlo({act:1}, 
                                              method = myMethod,
                                              iterations=1000,
                                              cpus=mp.cpu_count())
        results = np.array(ParallelMC_LCA.calculate())

两者都给了我一个In [4] act1 = db.random() act2 = db.random() multiMC_LCA = bw.MultiMonteCarlo(demands = [{act1:1}, {act2:1}], method = myMethod, iterations = 10) results = np.array(ParallelMC_LCA.calculate())

我的问题是:为什么?

1 个答案:

答案 0 :(得分:0)

这是known issue due to differences in how multiprocessing works on Windows and Unix。具体来说,在Windows上,项目设置不正确,导致KeyError。因此,它不是Stack Overflow问题。