|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opencyc.constraintsolver.ValueDomains
ValueDomains object to model the attributes and behavior of value domains of variables during forward checking search for one or more solutions to the ConstraintProblem.
Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.
THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
UnitTest#testConstraintProblem
Field Summary | |
protected ConstraintProblem |
constraintProblem
Reference to the parent ConstraintProblem object. |
protected java.util.HashMap |
domains
Dictionary of dictionaries of objects used to mark domain values during search. |
protected java.util.HashMap |
varsDictionary
Dictionary of variable --> domain value ArrayList. |
protected int |
verbosity
Sets verbosity of the constraint solver output. |
Constructor Summary | |
ValueDomains(ConstraintProblem constraintProblem)
Constructs a new ValueDomains object. |
Method Summary | |
void |
addDomainValue(CycVariable cycVariable,
java.lang.Object value)
Adds an Object value to the domain for a variable. |
void |
complementDomainValues(CycVariable cycVariable,
java.lang.Integer newLevel,
Binding selectedBinding)
Iterates over the domain values for the given variable, changing any entries marked true to Integer level. |
void |
displayVariablesAndDomains()
Displays the variables and their value domains. |
boolean |
domainHasValue(CycVariable cycVariable,
java.lang.Object value)
Returns true if the variable has value in its domain. |
java.util.ArrayList |
getDomainValues(CycVariable cycVariable)
Returns the ArrayList of domain values for a variable. |
int |
getUnmarkedDomainSize(CycVariable cycVariable)
Returns the number of unmarked (eligible for the solution) domain values for the given variable. |
java.util.ArrayList |
getUnmarkedDomainValues(CycVariable cycVariable)
Returns the ArrayList of unmarked (eligible for the solution) domain values for the given variable. |
void |
initializeDomainValueMarking()
Initializes the domain value marking structure. |
boolean |
isDomainMarked(CycVariable cycVariable,
java.lang.Object value)
Returns true iff the variable / value combination is marked with any level number. |
boolean |
isDomainMarkedAtLevel(CycVariable cycVariable,
java.lang.Object value,
java.lang.Integer level)
Returns true iff the variable / value combination is marked with a given level number. |
boolean |
isDomainWipedOut(CycVariable cycVariable)
Returns true iff all the domain values of the variable have been marked and thus eliminated from consideration as a solution. |
void |
markDomain(CycVariable cycVariable,
java.lang.Object value,
java.lang.Object level)
Marks the entry for the variable / domain value with an Integer level number, or a Boolean True, or null. |
void |
removeFromValue(CycVariable cycVariable,
java.lang.Object value)
Removes the given value from the given variable's value domain. |
void |
setDomainValues(CycVariable cycVariable,
java.util.ArrayList domainValues)
Sets the ArrayList of domain values for a variable. |
void |
setVerbosity(int verbosity)
Sets verbosity of the constraint solver output. |
void |
unmarkDomain(CycVariable cycVariable,
java.lang.Object value)
Resets the entry for the variable / domain value marking. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int verbosity
protected java.util.HashMap varsDictionary
protected java.util.HashMap domains
protected ConstraintProblem constraintProblem
Constructor Detail |
public ValueDomains(ConstraintProblem constraintProblem)
constraintProblem
- the parent constraint problemMethod Detail |
public void displayVariablesAndDomains()
public void initializeDomainValueMarking()
public java.util.ArrayList getDomainValues(CycVariable cycVariable)
cycVariable
- the variable for domain values are soughtpublic void setDomainValues(CycVariable cycVariable, java.util.ArrayList domainValues)
cycVariable
- the variabledomainValues
- the ArrayList of domain values for the variablepublic void addDomainValue(CycVariable cycVariable, java.lang.Object value)
cycVariable
- the variablevalue
- the Object value which is added to the domain for the variablepublic boolean domainHasValue(CycVariable cycVariable, java.lang.Object value)
cycVariable
- the variable under considerationvalue
- the value for comparison with the variable's value domain.public void removeFromValue(CycVariable cycVariable, java.lang.Object value)
cycVariable
- the variable under considerationvalue
- the Object to be removed from the variable's value domainpublic void unmarkDomain(CycVariable cycVariable, java.lang.Object value)
public void markDomain(CycVariable cycVariable, java.lang.Object value, java.lang.Object level)
public int getUnmarkedDomainSize(CycVariable cycVariable)
public java.util.ArrayList getUnmarkedDomainValues(CycVariable cycVariable)
public void complementDomainValues(CycVariable cycVariable, java.lang.Integer newLevel, Binding selectedBinding)
cycVariable
- the variable for domain value complementationnewLevel
- the new search level for the variable's domainselectedBinding
- a variable binding for optional diagnostic displaypublic boolean isDomainWipedOut(CycVariable cycVariable)
public boolean isDomainMarked(CycVariable cycVariable, java.lang.Object value)
public boolean isDomainMarkedAtLevel(CycVariable cycVariable, java.lang.Object value, java.lang.Integer level)
public void setVerbosity(int verbosity)
verbosity
- 0 --> quiet ... 9 -> maximum diagnostic input
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |