GithubHelp home page GithubHelp logo

montecarlodemo's Introduction

README.MD


模块说明

code
|.....\__init__.py
|....../ut代码目录
|..........\__init__.py
|..........cls.py----------程序中的类模块
|..........main.py-------主模块
|..........monte.py-----蒙特卡鲁算法模块
|..........out.py---------辅助输出模块
|..........utl.py----------传播模型模块
|.........../SequenceDiagram感染时序图输出目录
|.........../MonteCarloOutInfo蒙特卡洛算法溯源结果报告输出目录

程序说明

传播模型选取最简单的SI模型,S代表感染者,I未感染者,程序先通过设定感染源坐标(X,Y),进行N轮感染,每一轮感染结束后会实时的刷新地图并保存至指定目录,红色表示已经被感染的人,黄色表示未被感染的人。当N轮的传播完成后即可使用蒙特卡洛算法进行K次溯源。每一次模拟都会对于每一个可能的节点给与一个评分,评分越高,该节点是源头的概率也就越大。当K次模拟完成时,会结合之前的数据,选取没轮评分最高的节点作为源头进行误差分析。


使用说明

使用前请先看传播模型参数! windows下cmd进入到ut目录,输入python main.py回车根据提示输入参数即可。 前2个参数为坐标,第三个参数为进行N次传播,建议N>3 第3个参数为进行几轮感染 输入完成回车就会进入传播模拟,完成后可在/SequenceDiagram目录下看时序图 之后按照提示进入蒙克卡罗溯源阶段,你可以指定溯源的次数K 完成后会生成误差图,关于每次溯源的详细信息会保存在/MonteCarloOutInfo目录下

关于传播模型的参数详解

PMAX = 88          #表示地图上的最大人数,这个参数不要大于10000,否则影响性能                               
WMAX = 200         #地图宽度              
HMAX = 200         #地图长度         
POINTSIZE = 2      #点的大小,看不清地图上的点可适当调节            
U=33               #健康节点被感染的概率U% (1-100之间)                     
N=5                #一个感染节点在一轮感染中最多能传给附近的N个节点            
MAX_INF=50         #任意两个节点能相互感染的最大距离,这距离使用的是曼哈顿距离。即|dx|+|dy|来表示

montecarlodemo's People

Contributors

dqy1650857726 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.