Package com.google.ortools.sat
Class CumulativeConstraint
- java.lang.Object
-
- com.google.ortools.sat.Constraint
-
- com.google.ortools.sat.CumulativeConstraint
-
public class CumulativeConstraint extends Constraint
Specialized cumulative constraint.This constraint allows adding (interval, demand) pairs to the cumulative constraint incrementally.
-
-
Constructor Summary
Constructors Constructor Description CumulativeConstraint(CpModel model)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CumulativeConstraintaddDemand(IntervalVar interval, long demand)CumulativeConstraintaddDemand(IntervalVar interval, LinearArgument demand)CumulativeConstraintaddDemands(IntervalVar[] intervals, int[] demands)Adds all pairs (intervals[i], demands[i]) to the constraint.CumulativeConstraintaddDemands(IntervalVar[] intervals, long[] demands)Adds all pairs (intervals[i], demands[i]) to the constraint.CumulativeConstraintaddDemands(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 Detail
-
CumulativeConstraint
public CumulativeConstraint(CpModel model)
-
-
Method Detail
-
addDemand
public CumulativeConstraint addDemand(IntervalVar interval, LinearArgument demand)
-
addDemand
public CumulativeConstraint addDemand(IntervalVar interval, long demand)
-
addDemands
public CumulativeConstraint addDemands(IntervalVar[] intervals, LinearArgument[] demands)
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
public CumulativeConstraint addDemands(IntervalVar[] intervals, long[] demands)
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
public CumulativeConstraint addDemands(IntervalVar[] intervals, int[] demands)
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
-
-