Package org.btrplace.model.constraint
Class MaxOnline
java.lang.Object
org.btrplace.model.constraint.SimpleConstraint
org.btrplace.model.constraint.MaxOnline
- All Implemented Interfaces:
Constraint
,SatConstraint
@SideConstraint(args={"ns <: nodes","nb : int"}, inv="card({i. i : ns , nodeState(i) = online}) <= nb") public class MaxOnline extends SimpleConstraint
A constraint to force a set of nodes to have a maximum number of nodes to
be online.
In discrete restriction mode, the constraint only ensures that the set of
nodes have at most n
nodes being online at by end of the reconfiguration
process. The set of nodes may have more number than n nodes being online in
the reconfiguration process.
In continuous restriction mode, a boot node action is performed only when the number of online nodes is smaller than n.
- Author:
- Tu Huynh Dang
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description boolean
equals(Object o)
int
getAmount()
Get the maximum number of online nodes.SatConstraintChecker<MaxOnline>
getChecker()
Get the validator used to check if a plan satisfies the constraint.Collection<Node>
getInvolvedNodes()
Get the nodes involved in the constraint.int
hashCode()
String
toString()
Methods inherited from class org.btrplace.model.constraint.SimpleConstraint
isContinuous, setContinuous
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.btrplace.model.constraint.SatConstraint
getInvolvedVMs, isSatisfied, isSatisfied
-
Constructor Details
-
MaxOnline
Make a new constraint specifying restriction explicitly.- Parameters:
nodes
- The set of nodesn
- The maximum number of online nodescontinuous
-true
for continuous restriction
-
MaxOnline
Make a new discrete constraint.- Parameters:
nodes
- the set of nodesn
- the maximum number of online nodes
-
-
Method Details
-
getAmount
public int getAmount()Get the maximum number of online nodes.- Returns:
- a positive integer
-
toString
-
getChecker
Description copied from interface:SatConstraint
Get the validator used to check if a plan satisfies the constraint.- Returns:
- a non-null
SatConstraintChecker
-
getInvolvedNodes
Description copied from interface:SatConstraint
Get the nodes involved in the constraint.- Returns:
- a set of nodes identifiers that may be empty
-
equals
-
hashCode
public int hashCode()
-