public void testAgentActionNumber1()
        {
            VacuumEnvironment tve = new VacuumEnvironment(
                    VacuumEnvironment.LocationState.Dirty,
                    VacuumEnvironment.LocationState.Dirty);
            tve.addAgent(agent, VacuumEnvironment.LOCATION_A);

            Assert.AreEqual(VacuumEnvironment.LOCATION_A,
                    tve.getAgentLocation(agent));
            Assert.AreEqual(1, tve.GetAgents().Size());
            tve.Step(); // cleans location A
            Assert.AreEqual(VacuumEnvironment.LOCATION_A,
                    tve.getAgentLocation(agent));
            Assert.AreEqual(VacuumEnvironment.LocationState.Clean,
                    tve.getLocationState(VacuumEnvironment.LOCATION_A));
            tve.Step(); // moves to lcation B
            Assert.AreEqual(VacuumEnvironment.LOCATION_B,
                    tve.getAgentLocation(agent));
            Assert.AreEqual(VacuumEnvironment.LocationState.Dirty,
                    tve.getLocationState(VacuumEnvironment.LOCATION_B));
            tve.Step(); // cleans location B
            Assert.AreEqual(VacuumEnvironment.LOCATION_B,
                    tve.getAgentLocation(agent));
            Assert.AreEqual(VacuumEnvironment.LocationState.Clean,
                    tve.getLocationState(VacuumEnvironment.LOCATION_B));
            tve.Step(); // NOOP
            Assert.AreEqual(VacuumEnvironment.LOCATION_B,
                    tve.getAgentLocation(agent));
            Assert.AreEqual(19, tve.GetPerformanceMeasure(agent), 0.001);
        }
예제 #2
0
	public void setUp() {
		tve = new VacuumEnvironment(VacuumEnvironment.LocationState.Dirty,
				VacuumEnvironment.LocationState.Dirty);
		tve2 = new VacuumEnvironment(VacuumEnvironment.LocationState.Clean,
				VacuumEnvironment.LocationState.Clean);
		tve3 = new VacuumEnvironment(VacuumEnvironment.LocationState.Clean,
				VacuumEnvironment.LocationState.Dirty);
		tve4 = new VacuumEnvironment(VacuumEnvironment.LocationState.Dirty,
				VacuumEnvironment.LocationState.Clean);
		a = new ModelBasedReflexVacuumAgent();
	}
예제 #3
0
 public void setUp()
 {
     tve = new VacuumEnvironment(VacuumEnvironment.LocationState.Dirty,
                                 VacuumEnvironment.LocationState.Dirty);
     tve2 = new VacuumEnvironment(VacuumEnvironment.LocationState.Clean,
                                  VacuumEnvironment.LocationState.Clean);
     tve3 = new VacuumEnvironment(VacuumEnvironment.LocationState.Clean,
                                  VacuumEnvironment.LocationState.Dirty);
     tve4 = new VacuumEnvironment(VacuumEnvironment.LocationState.Dirty,
                                  VacuumEnvironment.LocationState.Clean);
     a = new ModelBasedReflexVacuumAgent <object>();
 }
	public void testCleanClean() {
		VacuumEnvironment tve = new VacuumEnvironment(
				VacuumEnvironment.LocationState.Clean,
				VacuumEnvironment.LocationState.Clean);
		tve.addAgent(agent, VacuumEnvironment.LOCATION_A);

		tve.addEnvironmentView(new EnvironmentViewActionTracker(envChanges));

		tve.stepUntilDone();

		Assert.assertEquals("Action[name==Right]Action[name==NoOp]", envChanges
				.ToString());
	}
예제 #5
0
        static void Main(params string[] args)
        {
            // create environment with random state of cleaning.
            IEnvironment     env  = new VacuumEnvironment();
            IEnvironmentView view = new SimpleEnvironmentView();

            env.AddEnvironmentView(view);

            IAgent a = new ReflexVacuumAgent();

            env.AddAgent(a);
            env.Step(16);
            env.NotifyViews("Performance=" + env.GetPerformanceMeasure(a));
        }
        public void testCleanClean()
        {
            VacuumEnvironment tve = new VacuumEnvironment(
                    VacuumEnvironment.LocationState.Clean,
                    VacuumEnvironment.LocationState.Clean);
            tve.addAgent(agent, VacuumEnvironment.LOCATION_A);

            tve.AddEnvironmentView(new VacuumEnvironmentViewActionTracker(envChanges));

            tve.StepUntilDone();

            Assert.AreEqual("Action[name==Right]Action[name==NoOp]",
                    envChanges.ToString());
        }
예제 #7
0
	public void testDirtyDirty() {
		VacuumEnvironment tve = new VacuumEnvironment(
				VacuumEnvironment.LocationState.Dirty,
				VacuumEnvironment.LocationState.Dirty);
		tve.addAgent(agent, VacuumEnvironment.LOCATION_A);

		tve.addEnvironmentView(new EnvironmentViewActionTracker(envChanges));

		tve.step(8);

		Assert
				.assertEquals(
						"Action[name==Suck]Action[name==Right]Action[name==Suck]Action[name==Left]Action[name==Right]Action[name==Left]Action[name==Right]Action[name==Left]",
						envChanges.ToString());
	}
예제 #8
0
        public void testDirtyDirty()
        {
            VacuumEnvironment tve = new VacuumEnvironment(
                VacuumEnvironment.LocationState.Dirty,
                VacuumEnvironment.LocationState.Dirty);

            tve.addAgent(agent, VacuumEnvironment.LOCATION_A);

            tve.AddEnvironmentView(new VacuumEnvironmentViewActionTracker(envChanges));

            tve.Step(8);

            Assert.AreEqual(
                "Action[name==Suck]Action[name==Right]Action[name==Suck]Action[name==Left]Action[name==Right]Action[name==Left]Action[name==Right]Action[name==Left]",
                envChanges.ToString());
        }
	public void testAgentActionNumber1() {
		VacuumEnvironment tve = new VacuumEnvironment(
				VacuumEnvironment.LocationState.Dirty,
				VacuumEnvironment.LocationState.Dirty);
		tve.addAgent(agent, VacuumEnvironment.LOCATION_A);

		Assert.assertEquals(VacuumEnvironment.LOCATION_A, tve
				.getAgentLocation(agent));
		Assert.assertEquals(1, tve.getAgents().size());
		tve.step(); // cleans location A
		Assert.assertEquals(VacuumEnvironment.LOCATION_A, tve
				.getAgentLocation(agent));
		Assert.assertEquals(VacuumEnvironment.LocationState.Clean, tve
				.getLocationState(VacuumEnvironment.LOCATION_A));
		tve.step(); // moves to lcation B
		Assert.assertEquals(VacuumEnvironment.LOCATION_B, tve
				.getAgentLocation(agent));
		Assert.assertEquals(VacuumEnvironment.LocationState.Dirty, tve
				.getLocationState(VacuumEnvironment.LOCATION_B));
		tve.step(); // cleans location B
		Assert.assertEquals(VacuumEnvironment.LOCATION_B, tve
				.getAgentLocation(agent));
		Assert.assertEquals(VacuumEnvironment.LocationState.Clean, tve
				.getLocationState(VacuumEnvironment.LOCATION_B));
		tve.step(); // NOOP
		Assert.assertEquals(VacuumEnvironment.LOCATION_B, tve
				.getAgentLocation(agent));
		Assert.assertEquals(19, tve.getPerformanceMeasure(agent), 0.001);
	}