// private MapCSP(ArrayList variables, Constraint constraints): this(variables, constraints) // { // //super(variables, constraints); // // } public static CSP getMap() { ArrayList variables = new ArrayList(); variables.Add(WA); variables.Add(NT); variables.Add(SA); variables.Add(Q); variables.Add(NSW); variables.Add(V); variables.Add(T); ArrayList colors = new ArrayList(); colors.Add(RED); colors.Add(BLUE); colors.Add(GREEN); Domain domains = new Domain(variables); for (int i = 0; i < variables.Count; i++) { string variable = variables[i].ToString(); domains.addToDomain(variable, colors); } Hashtable neighbors = new Hashtable(); addToNeighbors(neighbors, T); addToNeighbors(neighbors, WA, NT, SA); addToNeighbors(neighbors, NT, WA, SA, Q); addToNeighbors(neighbors, SA, WA, NT, Q, NSW, V); addToNeighbors(neighbors, Q, NT, SA, NSW); addToNeighbors(neighbors, NSW, SA, Q, V); addToNeighbors(neighbors, V, SA, NSW); Constraint mapConstraints = new MapColoringConstraint(neighbors); return new CSP(variables, mapConstraints, domains); }
// private MapCSP(ArrayList variables, Constraint constraints): this(variables, constraints) // { // //super(variables, constraints); // // } public static CSP getMap() { ArrayList variables = new ArrayList(); variables.Add(WA); variables.Add(NT); variables.Add(SA); variables.Add(Q); variables.Add(NSW); variables.Add(V); variables.Add(T); ArrayList colors = new ArrayList(); colors.Add(RED); colors.Add(BLUE); colors.Add(GREEN); Domain domains = new Domain(variables); for (int i = 0; i < variables.Count; i++) { string variable = variables[i].ToString(); domains.addToDomain(variable, colors); } Hashtable neighbors = new Hashtable(); addToNeighbors(neighbors, T); addToNeighbors(neighbors, WA, NT, SA); addToNeighbors(neighbors, NT, WA, SA, Q); addToNeighbors(neighbors, SA, WA, NT, Q, NSW, V); addToNeighbors(neighbors, Q, NT, SA, NSW); addToNeighbors(neighbors, NSW, SA, Q, V); addToNeighbors(neighbors, V, SA, NSW); Constraint mapConstraints = new MapColoringConstraint(neighbors); return(new CSP(variables, mapConstraints, domains)); }