Ejemplo n.º 1
0
        public TheoricalSituation(DynamicManager2D dynamicManager, Structure2D structure, List <IDecidable> decisionMakers, List <Particle2D> particles, float executionTime)
        {
            this.dynamicManager = dynamicManager;
            this.structure      = structure;
            this.decisionMakers = decisionMakers;
            this.particles      = particles;
            this.executionTime  = executionTime;

            setup();
        }
Ejemplo n.º 2
0
        public static void Main(String[] args)
        {
            ///Experimental

            //Random random = new Random();
            ////RandomManhattanLattice2D manhattanLattice = new RandomManhattanLattice2D(1, 200, 200, random);
            //RegularManhattanLattice2D manhattanLattice = new RegularManhattanLattice2D(1, 20, 20, 0, 0);
            //DrunkMind decisionMaker = new DrunkMind(random);
            //Position initialPosition = new Position() { x = 0, y = 0 };

            //List<IDecidable> decisionMakers = new List<IDecidable>();
            //List<Position> particlesInitialPositions = new List<Position>();
            //List<float> dts = new List<float>();

            //decisionMakers.Add(decisionMaker);
            //particlesInitialPositions.Add(initialPosition);
            //dts.Add(1);

            //IParticleFactory particlesFactory = new WalkerFactory(particlesInitialPositions, dts);
            //SimpleDynamicSituationFactory sdsFactory = new SimpleDynamicSituationFactory(manhattanLattice, particlesFactory, decisionMakers, 20);

            //List<ID> monitoredElement = new List<ID>();
            //monitoredElement.Add(new ID { type = ElementType.Particle, number = 0 });
            //StatFinalPosition statModul = new StatFinalPosition(monitoredElement, "RegularML");

            //Sequencer experiment = new Sequencer(statModul, sdsFactory);

            //experiment.Run(100000);

            /// Theorie

            Random                    random           = new Random();
            DynamicManager2D          dynamicManager   = new DynamicManager2D();
            RegularManhattanLattice2D manhattanLattice = new RegularManhattanLattice2D(dynamicManager.GetNewStructureID(), 20, 20, 0, 0);
            DrunkMind                 decisionMaker    = new DrunkMind(random);
            Position                  position         = new Position()
            {
                x = 0, y = 0
            };
            TheoricalParticle2D theoricalParticle = new TheoricalWalker(dynamicManager, dynamicManager.GetNewParticleID(), manhattanLattice, decisionMaker, 1, position, 1);

            List <IDecidable> decisionMakers = new List <IDecidable>();
            List <Particle2D> particles      = new List <Particle2D>();

            decisionMakers.Add(decisionMaker);
            particles.Add(theoricalParticle);

            TheoricalSituation theoricalSituation = new TheoricalSituation(dynamicManager, manhattanLattice, decisionMakers, particles, 20);

            StatTool theorieManager = new TheoricalProbability(theoricalSituation, "TheoricalRML");

            theorieManager.setup();
            theoricalSituation.Play();
            theorieManager.computeResult();
        }
Ejemplo n.º 3
0
        public DynamicSituation CreateSituation()
        {
            DynamicManager2D dynamicManager = new DynamicManager2D();

            List <IDecidable> duplicateDecisionMakers = new List <IDecidable>();

            foreach (IDecidable decisionMaker in decisionMakers)
            {
                duplicateDecisionMakers.Add(decisionMaker.Duplicate());
            }

            List <Particle2D> particles = particlesFactory.CreateParticles(structure, duplicateDecisionMakers);

            return(new SimpleDynamicSituation(dynamicManager, structure.Duplicate(), particles, duplicateDecisionMakers, executionTime));
        }
        public TheoricalWalker(DynamicManager2D dynamicManager, int elementIDNumber, Structure2D structure, IDecidable decisionMaker, double probability, Position position = new Position(), float dt = 1)
        {
            elementID = new ID {
                type = ElementType.Particle, number = elementIDNumber
            };

            this.dynamicManager = dynamicManager;
            this.structure      = structure;
            this.decisionMaker  = decisionMaker;

            this.probability = probability;

            this.position = position;

            this.dt = dt;
        }