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
Modifier and TypeClassDescriptionstatic final class
A subzone resulting from a projection. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addVariables
(Collection<Variable> vars) Introduces new variables in this zone.void
addVariables
(Variable... vars) boolean
canVariableBeLowerOrEqual
(Variable var, Collection<Variable> others) Checks if a variable can be the minimum among a set of variables.boolean
Checks 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).void
constantShift
(BigDecimal constant) Applies a constant shift to all variables.void
constantShift
(BigDecimal constant, Collection<Variable> variables) Applies a constant shift to a set of variables.boolean
contains
(Map<Variable, OmegaBigDecimal> point) Checks if this zone contains the input point.boolean
Checks whether this zone fully contains an input one.boolean
Returns the upper bound for the differenceleft-right
between two variables, which is the constantc
of a constraintleft-right <= c
.getCoefficient
(Variable left, Variable right) Returns the constantc
for 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.int
hashCode()
void
imposeBound
(Variable left, Variable right, OmegaBigDecimal coefficient) Imposes an upper bound for the differenceleft-right
.void
imposeVarLower
(Variable var, Collection<Variable> others) Imposes the boundvar-x <= 0
for each x inothers
.void
imposeVarLowerAndNormalize
(Variable var, Collection<Variable> others) Imposes the boundvar-x <= 0
for each x inothers
.void
Intersects this zone with the input one.boolean
isEmpty()
Checks if this zone has unsatisfiable constraints.boolean
Checks if this zone is fully-dimensional in its variable space.boolean
isSyncronized
(Variable x, Variable y) void
Normalizes this zone, so that upper bounds satisfy the triangular inequality.void
Discards the constraints of the input variable.void
projectVariables
(Collection<Variable> vars) Discards the constraints of a set of variables.void
projectVariables
(Variable... vars) void
setCoefficient
(Variable left, Variable right, OmegaBigDecimal coefficient) Sets the constantc
for the constraintsleft-right
.void
Discards the constraints of the input variable and uses it as the new ground.void
substitute
(Variable oldVar, Variable newVar) Replaces the name of a variable in all of its constraints.void
substitute
(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 constantc
for the constraintleft-right <= c
.Use
getBound
if the DBM is not normalized.- Parameters:
left
- first variableright
- second variable- Returns:
- upper bound
-
getBound
Returns the upper bound for the differenceleft-right
between two variables, which is the constantc
of 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 constantc
for the constraintsleft-right
.- Parameters:
left
- first variableright
- second variablecoefficient
- upper bound forleft-right
- Throws:
IllegalArgumentException
- ifleft==right
orcoefficient
is 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 <= 0
for each x inothers
.- Parameters:
var
- a variableothers
- a set of variables
-
imposeVarLowerAndNormalize
Imposes the boundvar-x <= 0
for 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
-