Package org.jacop.satwrapper.translation
Class SatCPBridge
java.lang.Object
org.jacop.satwrapper.translation.SatCPBridge
- All Implemented Interfaces:
WrapperComponent
- Direct Known Subclasses:
LazyCpVarDomain,SimpleCpVarDomain
interface representing the domain of a CP variable as a range. It is used
to provide literals to represent assertions like 'X = v' or 'X<= v' where X
is the CP variable and v a value from its domain
- Version:
- 4.10
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanfinal IntDomainintintfinal IntVarprotected SatWrapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract intboolVarToCpValue(int literal) return the value corresponding to given literal (variable)abstract intcpValueToBoolVar(int value, boolean isEquality) return the literal that represents the assertion 'var = value'.final intthe left limit of the rangefinal intthe right limit of the rangeabstract voidinitialize(SatWrapper wrapper) connect the component to the wrapperabstract booleanisEqualityBoolVar(int literal) checks if the literal stands for a 'x=d' proposition, or a 'x<=d' propositionfinal booleanisInThisRange(int literal) checks if the literal represents a proposition about the variable this object managesabstract booleanpredicate for whether this variable should be handled by the DomainClausesDatabase or notabstract voidpropagate(int literal) does all propagation required, in a way specific to this range.voidsetDomain(int minValue, int maxValue) set the domain to be between minValue and maxValue.toString()
-
Field Details
-
wrapper
-
variable
-
initialDomain
-
min
public int min -
max
public int max -
hasSetDomain
protected boolean hasSetDomain
-
-
Constructor Details
-
SatCPBridge
simple constructor with a variable- Parameters:
variable- the variable of which this is the range
-
-
Method Details
-
getLeftLimit
public final int getLeftLimit()the left limit of the range- Returns:
- the *value* of the current left limit of the range
-
getRightLimit
public final int getRightLimit()the right limit of the range- Returns:
- the *value* of the current right limit of the range
-
setDomain
public void setDomain(int minValue, int maxValue) set the domain to be between minValue and maxValue. It only does something on the first call.- Parameters:
minValue- minimum value of the rangemaxValue- maximum value of the range
-
cpValueToBoolVar
public abstract int cpValueToBoolVar(int value, boolean isEquality) return the literal that represents the assertion 'var = value'. For the proposition 'var<= value', set the isEquality flag to false- Parameters:
value- the value for the variable this range representsisEquality- true if we want the literal for 'x=d' kind of propositions, false for 'x<=d'- Returns:
- the literal corresponding to 'var = this value'. If the value is out of the domain of the variable, returns 0.
-
boolVarToCpValue
public abstract int boolVarToCpValue(int literal) return the value corresponding to given literal (variable)- Parameters:
literal- the literal standing for 'var = value'- Returns:
- the value such that 'var = value' (or 'var<= value')
-
isEqualityBoolVar
public abstract boolean isEqualityBoolVar(int literal) checks if the literal stands for a 'x=d' proposition, or a 'x<=d' proposition- Parameters:
literal- the literal (among literals from this range)- Returns:
- true if the literal stands for 'x=d', false otherwise
-
isInThisRange
public final boolean isInThisRange(int literal) checks if the literal represents a proposition about the variable this object manages- Parameters:
literal- a literal- Returns:
- true if there is a 'd' such that literal stands for 'x=d' or 'x<=d'
-
propagate
public abstract void propagate(int literal) does all propagation required, in a way specific to this range. This part may not be used, if the variable is not bound to a DomainClausesDatabase. This will be called only ifthis.isTranslated()is false.- Parameters:
literal- the literal that has been asserted
-
isTranslated
public abstract boolean isTranslated()predicate for whether this variable should be handled by the DomainClausesDatabase or not- Returns:
- true if the variable should be handled by the DomainClausesDatabase
-
toString
-
initialize
Description copied from interface:WrapperComponentconnect the component to the wrapper- Specified by:
initializein interfaceWrapperComponent- Parameters:
wrapper- the wrapper
-