Skip to content
Merged
184 changes: 98 additions & 86 deletions Makefile.dep

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ INTHDR0 = \
unary/man-prop.hpp unary/opt-prop.hpp unary/post.hpp \
cumulative.hh cumulative/man-prop.hpp cumulative/opt-prop.hpp \
cumulative/task-view.hpp cumulative/overload.hpp \
cumulative/knapsack-overload.hpp \
cumulative/time-tabling.hpp cumulative/task.hpp \
cumulative/edge-finding.hpp cumulative/post.hpp \
cumulative/tree.hpp cumulative/limits.hpp \
Expand Down
11 changes: 11 additions & 0 deletions changelog.in
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ Date: unreleased
This is the development changelog for the next Gecode release.

[ENTRY]

Module: int
What: performance
Rank: major
[DESCRIPTION]
Advanced cumulative propagation uses bounded knapsack-augmented overload
checking for fixed-processing tasks to detect conflicts missed by ordinary
overload checking. The algorithm is described in:
S. Cloutier, C.-G. Quimper, Augmenting the Cumulative Overload Check
with Integral Resource Usage Reasoning, CP 2026.

Module: search
What: new
Rank: major
Expand Down
64 changes: 56 additions & 8 deletions gecode/int.hh
Original file line number Diff line number Diff line change
Expand Up @@ -3843,11 +3843,18 @@ namespace Gecode {
* propagation level \a ipl as follows:
* - If \a IPL_BASIC is set, the propagator performs overload checking
* and time-tabling propagation.
* - If \a IPL_ADVANCED is set, the propagator performs overload checking
* and edge finding.
* - If \a IPL_ADVANCED is set, the propagator performs overload checking,
* edge finding, and bounded knapsack-augmented overload checking for
* fixed-processing tasks.
* - If both flags are combined, all the above listed propagation is
* performed.
*
* The knapsack check runs for 4 to 64 participating tasks when the
* current capacity upper bound is between 2 and 127. Each task must have
* a fixed processing time. Each demand must be positive and at most that
* bound, with at least one demand above 1.
* Outside these limits, only the knapsack check is skipped.
*
* The propagator uses algorithms taken from:
*
* Petr Vilím, Max Energy Filtering Algorithm for Discrete Cumulative
Expand All @@ -3860,6 +3867,11 @@ namespace Gecode {
* resources in O(kn log n). In I. P. Gent, editor, CP, volume 5732 of LNCS,
* pages 802-816. Springer, 2009.
*
* and
*
* Samuel Cloutier and Claude-Guy Quimper, Augmenting the Cumulative
* Overload Check with Integral Resource Usage Reasoning, CP, 2026.
*
* - Throws an exception of type Int::ArgumentSizeMismatch, if \a t, \a s
* \a p, or \a u are of different size.
* - Throws an exception of type Int::OutOfLimits, if \a p, \a u, or \a c
Expand Down Expand Up @@ -3902,11 +3914,18 @@ namespace Gecode {
* propagation level \a ipl as follows:
* - If \a IPL_BASIC is set, the propagator performs overload checking
* and time-tabling propagation.
* - If \a IPL_ADVANCED is set, the propagator performs overload checking
* and edge finding.
* - If \a IPL_ADVANCED is set, the propagator performs overload checking,
* edge finding, and bounded knapsack-augmented overload checking for
* fixed-processing tasks.
* - If both flags are combined, all the above listed propagation is
* performed.
*
* The knapsack check considers only currently mandatory tasks. It runs
* for 4 to 64 such tasks when the current capacity upper bound is between
* 2 and 127. Each task must have a fixed processing time. Each demand must
* be positive and at most that bound, with at least one demand above 1.
* Outside these limits, only the knapsack check is skipped.
*
* The propagator uses algorithms taken from:
*
* Petr Vilím, Max Energy Filtering Algorithm for Discrete Cumulative
Expand All @@ -3919,6 +3938,11 @@ namespace Gecode {
* resources in O(kn log n). In I. P. Gent, editor, CP, volume 5732 of LNCS,
* pages 802-816. Springer, 2009.
*
* and
*
* Samuel Cloutier and Claude-Guy Quimper, Augmenting the Cumulative
* Overload Check with Integral Resource Usage Reasoning, CP, 2026.
*
* - Throws an exception of type Int::ArgumentSizeMismatch, if \a t, \a s
* \a p, or \a u are of different size.
* - Throws an exception of type Int::OutOfLimits, if \a p, \a u, or \a c
Expand Down Expand Up @@ -3947,11 +3971,18 @@ namespace Gecode {
* propagation level \a ipl as follows:
* - If \a IPL_BASIC is set, the propagator performs overload checking
* and time-tabling propagation.
* - If \a IPL_ADVANCED is set, the propagator performs overload checking
* and edge finding.
* - If \a IPL_ADVANCED is set, the propagator performs overload checking,
* edge finding, and bounded knapsack-augmented overload checking for
* fixed-processing tasks.
* - If both flags are combined, all the above listed propagation is
* performed.
*
* The knapsack check runs for 4 to 64 participating tasks when the
* current capacity upper bound is between 2 and 127. Each task must have
* a fixed processing time. Each demand must be positive and at most that
* bound, with at least one demand above 1.
* Outside these limits, only the knapsack check is skipped.
*
* The propagator uses algorithms taken from:
*
* Petr Vilím, Max Energy Filtering Algorithm for Discrete Cumulative
Expand All @@ -3964,6 +3995,11 @@ namespace Gecode {
* resources in O(kn log n). In I. P. Gent, editor, CP, volume 5732 of LNCS,
* pages 802-816. Springer, 2009.
*
* and
*
* Samuel Cloutier and Claude-Guy Quimper, Augmenting the Cumulative
* Overload Check with Integral Resource Usage Reasoning, CP, 2026.
*
* - Throws an exception of type Int::ArgumentSizeMismatch, if \a s
* \a p, or \a u are of different size.
* - Throws an exception of type Int::OutOfLimits, if \a p, \a u, or \a c
Expand Down Expand Up @@ -3992,11 +4028,18 @@ namespace Gecode {
* propagation level \a ipl as follows:
* - If \a IPL_BASIC is set, the propagator performs overload checking
* and time-tabling propagation.
* - If \a IPL_ADVANCED is set, the propagator performs overload checking
* and edge finding.
* - If \a IPL_ADVANCED is set, the propagator performs overload checking,
* edge finding, and bounded knapsack-augmented overload checking for
* fixed-processing tasks.
* - If both flags are combined, all the above listed propagation is
* performed.
*
* The knapsack check considers only currently mandatory tasks. It runs
* for 4 to 64 such tasks when the current capacity upper bound is between
* 2 and 127. Each task must have a fixed processing time. Each demand must
* be positive and at most that bound, with at least one demand above 1.
* Outside these limits, only the knapsack check is skipped.
*
* The propagator uses algorithms taken from:
*
* Petr Vilím, Max Energy Filtering Algorithm for Discrete Cumulative
Expand All @@ -4009,6 +4052,11 @@ namespace Gecode {
* resources in O(kn log n). In I. P. Gent, editor, CP, volume 5732 of LNCS,
* pages 802-816. Springer, 2009.
*
* and
*
* Samuel Cloutier and Claude-Guy Quimper, Augmenting the Cumulative
* Overload Check with Integral Resource Usage Reasoning, CP, 2026.
*
* - Throws an exception of type Int::ArgumentSizeMismatch, if \a s,
* \a p, \a u, or \a m are of different size.
* - Throws an exception of type Int::OutOfLimits, if \a p, \a u, or \a c
Expand Down
39 changes: 39 additions & 0 deletions gecode/int/cumulative.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
* Cumulative Resources, CP-AI-OR, 2009.
* Petr Vilím, Edge Finding Filtering Algorithm for Discrete
* Cumulative Resources in O(kn log n), CP, 2009.
* Samuel Cloutier and Claude-Guy Quimper, Augmenting the Cumulative
* Overload Check with Integral Resource Usage Reasoning, CP, 2026.
*
* \brief %Scheduling for cumulative resources
*/
Expand Down Expand Up @@ -683,6 +685,36 @@ namespace Gecode { namespace Int { namespace Cumulative {
template<class ManTask>
ExecStatus overload(Space& home, int c, TaskArray<ManTask>& t);

/// Perform knapsack-augmented overload checking
template<class Task>
forceinline ExecStatus
knapsack_overload(Space&, int, TaskArray<Task>&) {
return ES_OK;
}
template<class Task> struct SupportsKnapsackOverload {
static const bool value = false;
};
template<> struct SupportsKnapsackOverload<ManFixPTask> {
static const bool value = true;
};
template<> struct SupportsKnapsackOverload<ManFixPSETask> {
static const bool value = true;
};
template<> struct SupportsKnapsackOverload<OptFixPTask> {
static const bool value = true;
};
template<> struct SupportsKnapsackOverload<OptFixPSETask> {
static const bool value = true;
};
ExecStatus knapsack_overload(Space& home, int c,
TaskArray<ManFixPTask>& t);
ExecStatus knapsack_overload(Space& home, int c,
TaskArray<ManFixPSETask>& t);
ExecStatus knapsack_overload(Space& home, int c,
TaskArray<OptFixPTask>& t);
ExecStatus knapsack_overload(Space& home, int c,
TaskArray<OptFixPSETask>& t);

/// Perform time-tabling propagation
template<class Task, class Cap>
ExecStatus timetabling(Space& home, Propagator& p, Cap c,
Expand All @@ -709,6 +741,9 @@ namespace Gecode { namespace Int { namespace Cumulative {
/// Constructor for cloning \a p
ManProp(Space& home, ManProp& p);
public:
/// Return propagation cost
virtual PropCost cost(const Space& home,
const ModEventDelta& med) const;
/// Perform copying during cloning
virtual Actor* copy(Space& home);
/// Perform propagation
Expand Down Expand Up @@ -736,6 +771,9 @@ namespace Gecode { namespace Int { namespace Cumulative {
/// Constructor for cloning \a p
OptProp(Space& home, OptProp& p);
public:
/// Return propagation cost
virtual PropCost cost(const Space& home,
const ModEventDelta& med) const;
/// Perform copying during cloning
virtual Actor* copy(Space& home);
/// Perform propagation
Expand All @@ -761,6 +799,7 @@ namespace Gecode { namespace Int { namespace Cumulative {
#include <gecode/int/cumulative/time-tabling.hpp>
#include <gecode/int/cumulative/subsumption.hpp>
#include <gecode/int/cumulative/overload.hpp>
#include <gecode/int/cumulative/knapsack-overload.hpp>
#include <gecode/int/cumulative/edge-finding.hpp>
#include <gecode/int/cumulative/man-prop.hpp>
#include <gecode/int/cumulative/opt-prop.hpp>
Expand Down
Loading
Loading