Package aima.test.core.unit.search.csp

Source Code of aima.test.core.unit.search.csp.MapCSPTest

package aima.test.core.unit.search.csp;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import aima.core.search.csp.Assignment;
import aima.core.search.csp.BacktrackingStrategy;
import aima.core.search.csp.CSP;
import aima.core.search.csp.MapCSP;
import aima.core.search.csp.MinConflictsStrategy;

/**
* @author Ravi Mohan
*
*/
public class MapCSPTest {
  private CSP csp;

  @Before
  public void setUp() {
    csp = new MapCSP();
  }

  @Test
  public void testBackTrackingSearch() {
    Assignment results = new BacktrackingStrategy().solve(csp);
    Assert.assertNotNull(results);
    Assert.assertEquals(MapCSP.GREEN, results.getAssignment(MapCSP.WA));
    Assert.assertEquals(MapCSP.RED, results.getAssignment(MapCSP.NT));
    Assert.assertEquals(MapCSP.BLUE, results.getAssignment(MapCSP.SA));
    Assert.assertEquals(MapCSP.GREEN, results.getAssignment(MapCSP.Q));
    Assert.assertEquals(MapCSP.RED, results.getAssignment(MapCSP.NSW));
    Assert.assertEquals(MapCSP.GREEN, results.getAssignment(MapCSP.V));
    Assert.assertEquals(MapCSP.RED, results.getAssignment(MapCSP.T));
  }

  @Test
  public void testMCSearch() {
    new MinConflictsStrategy(100).solve(csp);
  }
}
TOP

Related Classes of aima.test.core.unit.search.csp.MapCSPTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.