Class CumulativeConstraint
java.lang.Object
com.google.ortools.sat.Constraint
com.google.ortools.sat.CumulativeConstraint
Specialized cumulative constraint.
This constraint allows adding (interval, demand) pairs to the cumulative constraint incrementally.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddDemand
(IntervalVar interval, long demand) Adds a pair (interval, demand) to the constraint.addDemand
(IntervalVar interval, LinearArgument demand) Adds a pair (interval, demand) to the constraint.addDemands
(IntervalVar[] intervals, int[] demands) Adds all pairs (intervals[i], demands[i]) to the constraint.addDemands
(IntervalVar[] intervals, long[] demands) Adds all pairs (intervals[i], demands[i]) to the constraint.addDemands
(IntervalVar[] intervals, LinearArgument[] demands) Adds all pairs (intervals[i], demands[i]) to the constraint.Methods inherited from class com.google.ortools.sat.Constraint
getBuilder, getIndex, onlyEnforceIf, onlyEnforceIf
-
Constructor Details
-
CumulativeConstraint
-
-
Method Details
-
addDemand
Adds a pair (interval, demand) to the constraint. -
addDemand
Adds a pair (interval, demand) to the constraint. -
addDemands
Adds all pairs (intervals[i], demands[i]) to the constraint.- Parameters:
intervals
- an array of interval variablesdemands
- an array of linear expression- Returns:
- itself
- Throws:
CpModel.MismatchedArrayLengths
- if intervals and demands have different length
-
addDemands
Adds all pairs (intervals[i], demands[i]) to the constraint.- Parameters:
intervals
- an array of interval variablesdemands
- an array of long values- Returns:
- itself
- Throws:
CpModel.MismatchedArrayLengths
- if intervals and demands have different length
-
addDemands
Adds all pairs (intervals[i], demands[i]) to the constraint.- Parameters:
intervals
- an array of interval variablesdemands
- an array of integer values- Returns:
- itself
- Throws:
CpModel.MismatchedArrayLengths
- if intervals and demands have different length
-