Package org.oristool.math.domain
Class DBMZone
java.lang.Object
org.oristool.math.domain.DBMZone
A DBM zone encoding pairwise constraints between variables.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA subzone resulting from a projection. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddVariables(Collection<Variable> vars) Introduces new variables in this zone.voidaddVariables(Variable... vars) booleancanVariableBeLowerOrEqual(Variable var, Collection<Variable> others) Checks if a variable can be the minimum among a set of variables.booleanChecks if a variable can be the minimum in the zone.cartesianProduct(DBMZone other) Computes the Cartesian product with another zone (with distinct set of variables).voidconstantShift(BigDecimal constant) Applies a constant shift to all variables.voidconstantShift(BigDecimal constant, Collection<Variable> variables) Applies a constant shift to a set of variables.booleancontains(Map<Variable, OmegaBigDecimal> point) Checks if this zone contains the input point.booleanChecks whether this zone fully contains an input one.booleanReturns the upper bound for the differenceleft-rightbetween two variables, which is the constantcof a constraintleft-right <= c.getCoefficient(Variable left, Variable right) Returns the constantcfor the constraintleft-right <= c.Returns the minimum value that any of the input variables can take inside this zone.Finds the variables synchronized with the input one.inthashCode()voidimposeBound(Variable left, Variable right, OmegaBigDecimal coefficient) Imposes an upper bound for the differenceleft-right.voidimposeVarLower(Variable var, Collection<Variable> others) Imposes the boundvar-x <= 0for each x inothers.voidimposeVarLowerAndNormalize(Variable var, Collection<Variable> others) Imposes the boundvar-x <= 0for each x inothers.voidIntersects this zone with the input one.booleanisEmpty()Checks if this zone has unsatisfiable constraints.booleanChecks if this zone is fully-dimensional in its variable space.booleanisSyncronized(Variable x, Variable y) voidNormalizes this zone, so that upper bounds satisfy the triangular inequality.voidDiscards the constraints of the input variable.voidprojectVariables(Collection<Variable> vars) Discards the constraints of a set of variables.voidprojectVariables(Variable... vars) voidsetCoefficient(Variable left, Variable right, OmegaBigDecimal coefficient) Sets the constantcfor the constraintsleft-right.voidDiscards the constraints of the input variable and uses it as the new ground.voidsubstitute(Variable oldVar, Variable newVar) Replaces the name of a variable in all of its constraints.voidsubstitute(Variable oldVar, Variable newVar, BigDecimal coefficient) Replaces the name of a variable and applies a constant shift.Produces a representation of the zone constraints as "and"&&operators.Produces a representation of the zone constraints MathematicaRegionPlot.toString()
-
Constructor Details
-
DBMZone
public DBMZone() -
DBMZone
-
DBMZone
Creates a zone for the given variables, without constraints.- Parameters:
vars- zone variables
-
DBMZone
Creates a copy of a DBM zone.- Parameters:
dbm- input zone
-
-
Method Details
-
getCoefficient
Returns the constantcfor the constraintleft-right <= c.Use
getBoundif the DBM is not normalized.- Parameters:
left- first variableright- second variable- Returns:
- upper bound
-
getBound
Returns the upper bound for the differenceleft-rightbetween two variables, which is the constantcof a constraintleft-right <= c.- Parameters:
left- first variableright- second variable- Returns:
- upper bound
-
getMinLFT
Returns the minimum value that any of the input variables can take inside this zone.- Parameters:
vars- input variables- Returns:
- minimum allowed value for the input variables
-
setCoefficient
Sets the constantcfor the constraintsleft-right.- Parameters:
left- first variableright- second variablecoefficient- upper bound forleft-right- Throws:
IllegalArgumentException- ifleft==rightorcoefficientis negative infinity
-
addVariables
-
addVariables
Introduces new variables in this zone.- Parameters:
vars- input variables
-
getVariables
-
normalize
public void normalize()Normalizes this zone, so that upper bounds satisfy the triangular inequality. -
cartesianProduct
Computes the Cartesian product with another zone (with distinct set of variables).- Parameters:
other- another zone- Returns:
- the Cartesian product with this zone
-
isFullDimensional
public boolean isFullDimensional()Checks if this zone is fully-dimensional in its variable space.- Returns:
- true if the zone is fully dimensional, false otherwise
-
isEmpty
public boolean isEmpty()Checks if this zone has unsatisfiable constraints.- Returns:
- true if the zone is empty, false otherwise
-
imposeBound
Imposes an upper bound for the differenceleft-right. If a stricter constraint already exists, no change is applied.- Parameters:
left- first variableright- second variablecoefficient- upper bound
-
imposeVarLower
Imposes the boundvar-x <= 0for each x inothers.- Parameters:
var- a variableothers- a set of variables
-
imposeVarLowerAndNormalize
Imposes the boundvar-x <= 0for each x inothers. This method may result in a faster computation time if normalization is required.- Parameters:
var- a variableothers- a set of variables
-
canVariableBeLowestOrEqual
Checks if a variable can be the minimum in the zone.- Parameters:
var- a variable- Returns:
- true if the variable can be the minimum
-
canVariableBeLowerOrEqual
Checks if a variable can be the minimum among a set of variables.- Parameters:
var- a variableothers- a set of variables- Returns:
- true if the variable can be the minimum
-
setNewGround
Discards the constraints of the input variable and uses it as the new ground.- Parameters:
v- a variable
-
projectVariable
Discards the constraints of the input variable.- Parameters:
v- a variable
-
projectVariables
-
projectVariables
Discards the constraints of a set of variables.- Parameters:
vars- a set of variables
-
substitute
Replaces the name of a variable in all of its constraints.- Parameters:
oldVar- the old namenewVar- the new name
-
substitute
Replaces the name of a variable and applies a constant shift.- Parameters:
oldVar- the old namenewVar- the new namecoefficient- shift value
-
constantShift
Applies a constant shift to all variables.- Parameters:
constant- shift value
-
constantShift
Applies a constant shift to a set of variables.- Parameters:
constant- shift amountvariables- target variables
-
isSyncronized
-
getNullDelayVariables
Finds the variables synchronized with the input one.- Parameters:
v- input variable- Returns:
- set of synchronized variables
-
equals
-
hashCode
public int hashCode() -
intersect
Intersects this zone with the input one.- Parameters:
other- a zone
-
contains
Checks whether this zone fully contains an input one.- Parameters:
other- a zone- Returns:
- true if the input zone is fully contained
-
contains
Checks if this zone contains the input point.- Parameters:
point- a point- Returns:
- true if this zone contains the point
-
toString
-
toAndString
Produces a representation of the zone constraints as "and"&&operators.- Returns:
- string representation of the zone as and operators
-
toRegionPlotString
Produces a representation of the zone constraints MathematicaRegionPlot.- Returns:
- string representation of the zone as region plots
-
toUnitStepsString
-