com.exigen.ie.constrainer.impl.GoalArcConsistency_1 Maven / Gradle / Ivy
package com.exigen.ie.constrainer.impl;
import com.exigen.ie.constrainer.Failure;
import com.exigen.ie.constrainer.Goal;
import com.exigen.ie.constrainer.GoalImpl;
import com.exigen.ie.constrainer.IntExpArray;
///////////////////////////////////////////////////////////////////////////////
/*
* Copyright Exigen Group 1998, 1999, 2000
* 320 Amboy Ave., Metuchen, NJ, 08840, USA, www.exigengroup.com
*
* The copyright to the computer program(s) herein
* is the property of Exigen Group, USA. All rights reserved.
* The program(s) may be used and/or copied only with
* the written permission of Exigen Group
* or in accordance with the terms and conditions
* stipulated in the agreement/contract under which
* the program(s) have been supplied.
*/
///////////////////////////////////////////////////////////////////////////////
/**
* An implementation of the goal that executes the arc consistency algorithm.
*/
public class GoalArcConsistency_1 extends GoalImpl
{
private IntExpArray _vars;
private ArcConsistency _ac = new ArcConsistency_1();
public GoalArcConsistency_1(IntExpArray vars)
{
super(vars.constrainer(),"");//"AC-1");
_vars = vars;
}
public Goal execute() throws Failure
{
if(_vars.domainsProductCard() >= Math.pow(2,_vars.size()))
_ac.arcConsistency(_vars);
return null;
}
} // ~GoalArcConsistency_1