diff --git a/schedulers/tetrisched/include/tetrisched/CapacityConstraint.hpp b/schedulers/tetrisched/include/tetrisched/CapacityConstraint.hpp index 8fdb5763..5806dede 100644 --- a/schedulers/tetrisched/include/tetrisched/CapacityConstraint.hpp +++ b/schedulers/tetrisched/include/tetrisched/CapacityConstraint.hpp @@ -17,15 +17,21 @@ struct PartitionTimePairHasher { /// for a Partition at a particular time. class CapacityConstraint { private: + /// The name of this CapacityConstraint. + std::string name; + /// The RHS of this constraint i.e., the quantity of this Partition + /// at this time. + uint32_t quantity; /// The SolverModel constraint that enforces the resource usage. ConstraintPtr capacityConstraint; - /// A Map from the ExpressionPtr to the usage of that Expression. - std::unordered_map> usageMap; + /// A vector of the Expression contributing the given usage to Constraint. + std::vector>> usageVector; /// The CapacityConstraintMap is allowed to translate this CapacityConstraint. void translate(SolverModelPtr solverModel); friend class CapacityConstraintMap; + friend class CapacityConstraintMapPurgingOptimizationPass; public: /// Constructs a new CapacityConstraint for the given Partition @@ -35,6 +41,15 @@ class CapacityConstraint { /// Registers the given usage in this CapacityConstraint. void registerUsage(const ExpressionPtr expression, uint32_t usage); void registerUsage(const ExpressionPtr expression, VariablePtr variable); + + /// Retrieves the maximum quantity of this CapacityConstraint. + uint32_t getQuantity() const; + + /// Retrieves the name for this CapacityConstraint. + std::string getName() const; + + /// Deactivates this CapacityConstraint. + void deactivate(); }; using CapacityConstraintPtr = std::shared_ptr; @@ -52,9 +67,7 @@ class CapacityConstraintMap { /// The default granularity for the capacity constraints. Time granularity; - /// The ObjectiveExpression is allowed to translate this map. - void translate(SolverModelPtr solverModel); - friend class ObjectiveExpression; + friend class CapacityConstraintMapPurgingOptimizationPass; public: /// Initialize a CapacityConstraintMap with the given granularity. @@ -96,6 +109,10 @@ class CapacityConstraintMap { Time duration, uint32_t usage, std::optional