|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opencyc.constraintsolver.VariableDomainPopulator
VariableDomainPopulator object to contain information about variables and applicable rules, and which determines the best rule to populate each variable. For high cardinality variables, which are those variables having a domain size exceeding a high cardinality threshold, the domain population is typically postponed until the forward checking search has instantiated enough other variables so that the high cardinality variable's domain is more efficiently obtained from the KB.
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 java.util.ArrayList |
candidateVariablePopulators
List of VariablePopulation objects used to determine the best domain population rule for each variable. |
protected ConstraintProblem |
constraintProblem
Reference to the parent ConstraintProblem object. |
protected java.util.ArrayList |
constraintRules
Reference to the parent list of constraint rules. |
static int |
DEFAULT_DOMAIN_SIZE_THRESHOLD
The default value of the variable value domain size beyond which the initial values are not all fetched from the KB. |
protected java.util.ArrayList |
domainPopulationRules
Reference to the parent list of domain populating constraint rules. |
protected int |
domainSizeThreshold
The value of the variable value domain size beyond which the initial values are not all fetched from the KB. |
protected ValueDomains |
valueDomains
Reference to the parent ValueDomains object. |
protected java.util.HashMap |
variableDomainPopulators
variable --> VariableDomainPopulator |
protected int |
verbosity
Sets verbosity of the constraint solver output. |
Constructor Summary | |
VariableDomainPopulator(ConstraintProblem constraintProblem)
Constructs a new VariableDomainPopulator object. |
Method Summary | |
void |
add(VariablePopulationItem variablePopulationItem)
Adds the given VariablePopulationItem object to the list of variable populator items. |
int |
getDomainSize(CycVariable cycVariable)
Gets the domain size of the high cardinality variable. |
ConstraintRule |
getPopulatingRule(CycVariable cycVariable)
Gets the domain-populating ConstraintRule of the high cardinality variable. |
void |
initializeDomain(VariablePopulationItem variablePopulationItem)
Initializes the value domain for each variable. |
boolean |
isPopulatingRule(ConstraintRule rule,
CycVariable cycVariable)
Returns true iff the given ConstraintRule was used to populate the domain of the given high cardinality variable. |
boolean |
isPostponedHighCardinalityDomain(CycVariable cycVariable)
Returns true iff this variable's domain is too large for efficient processing. |
void |
populateDomains()
Determines the best domain population rule to populate each constraint problem variable, and populates those which do not exceed the domain size threshold. |
protected void |
populateDomainViaQuery(ConstraintRule rule,
CycVariable cycVariable)
Populates the domain by asking a query. |
protected void |
populatePostponedDomain(CycVariable variable)
Populates the domain of an postponed high cardinality variable, using the previously determined best value domain population rule. |
void |
setDomainSizeThreshold(int domainSizeThreshold)
Sets the domain size threshold, beyond which the population of a variable's domain is typically postponed until the forward checking search. |
void |
setPopulatingRule(CycVariable cycVariable,
ConstraintRule rule)
Sets the domain-populating ConstraintRule of the high cardinality variable. |
void |
setVerbosity(int verbosity)
Sets verbosity of the constraint solver output. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected ConstraintProblem constraintProblem
protected ValueDomains valueDomains
protected java.util.ArrayList domainPopulationRules
protected java.util.ArrayList constraintRules
protected java.util.ArrayList candidateVariablePopulators
public static final int DEFAULT_DOMAIN_SIZE_THRESHOLD
protected int domainSizeThreshold
protected java.util.HashMap variableDomainPopulators
protected int verbosity
Constructor Detail |
public VariableDomainPopulator(ConstraintProblem constraintProblem)
Method Detail |
public void add(VariablePopulationItem variablePopulationItem)
public void populateDomains() throws java.io.IOException, CycApiException
public boolean isPostponedHighCardinalityDomain(CycVariable cycVariable)
cycVariable
- the variable under considerationpublic void setVerbosity(int verbosity)
verbosity
- 0 --> quiet ... 9 -> maximum diagnostic inputpublic boolean isPopulatingRule(ConstraintRule rule, CycVariable cycVariable)
rule
- the rule under considerationcycVariable
- the variable under considerationpublic void setDomainSizeThreshold(int domainSizeThreshold)
domainSizeThreshold
- domain size thresholdpublic int getDomainSize(CycVariable cycVariable)
cycVariable
- the variable under considerationpublic void setPopulatingRule(CycVariable cycVariable, ConstraintRule rule)
cycVariable
- the high-cardinality variable under considerationpublic ConstraintRule getPopulatingRule(CycVariable cycVariable)
cycVariable
- the variable under considerationprotected void populateDomainViaQuery(ConstraintRule rule, CycVariable cycVariable) throws java.io.IOException, CycApiException
rule
- the query to asked in the KBcycVariable
- the variable whose value domain is to be populated by the results of the querypublic void initializeDomain(VariablePopulationItem variablePopulationItem) throws java.io.IOException, CycApiException
variablePopulationItem
- the VariablePopulationItem object which contains the variable
and its domain populating ruleprotected void populatePostponedDomain(CycVariable variable) throws java.io.IOException, CycApiException
variable
- the variable whose value domain is to be populated
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |