Stay organized with collections Save and categorize content based on your preferences.

C++ Reference: class SchedulingDemandHelper

Note: This documentation is automatically generated.

Helper class for cumulative constraint to wrap demands and expose concept like energy.

In a cumulative constraint, an interval always has a size and a demand, but it can also have a set of "selector" literals each associated with a fixed size / fixed demands. This allows more precise energy estimation.

TODO(user): Cache energy min and reason for the non O(1) cases.
Method
AddDemandMinReason

Return type: void

Arguments: int t

AddEnergyMinInWindowReason

Return type: void

Arguments: int t, IntegerValue window_start, IntegerValue window_end

AddEnergyMinReason

Return type: void

Arguments: int t

CacheAllEnergyValues

Return type: void

The "energy" is usually size * demand, but in some non-conventional usage it might have a more complex formula. In all case, the energy is assumed to be only consumed during the interval duration. IMPORTANT: One must call CacheAllEnergyValues() for the values to be updated. TODO(user): this is error prone, maybe we should revisit. But if there is many alternatives, we don't want to rescan the list more than a linear number of time per propagation. TODO(user): Add more complex EnergyMinBefore(time) once we also support expressing the interval as a set of alternatives.

DecreaseEnergyMax

Return type: ABSL_MUST_USE_RESULT bool

Arguments: int t, IntegerValue value

Important: This might not do anything depending on the representation of the energy we have.

DemandIsFixed

Return type: bool

Arguments: int t

DemandMax

Return type: IntegerValue

Arguments: int t

DemandMin

Return type: IntegerValue

Arguments: int t

When defined, the interval will consume this much demand during its whole duration. Some propagator only relies on the "energy" and thus never uses this.

Demands

Return type: const std::vector<AffineExpression>&

EnergyIsQuadratic

Return type: bool

Arguments: int t

EnergyMax

Return type: IntegerValue

Arguments: int t

EnergyMin

Return type: IntegerValue

Arguments: int t

EnergyMinInWindow

Return type: IntegerValue

Arguments: int t, IntegerValue window_start, IntegerValue window_end

Returns the energy min in [start, end]. Note(user): These functions are not in O(1) if the decomposition is used, so we have to be careful in not calling them too often.

OverrideDecomposedEnergies

Return type: void

Arguments: const std::vector<std::vector<LiteralValueValue>>& energies

OverrideLinearizedEnergies

Return type: void

Arguments: const std::vector<LinearExpression>& energies

Visible for testing.

SchedulingDemandHelper

Arguments: std::vector<AffineExpression> demands, SchedulingConstraintHelper* helper, Model* model

Hack: this can be called with and empty demand vector as long as OverrideEnergies() is called to define the energies.