40#ifndef GECODE_INT_BIN_PACKING_HH
41#define GECODE_INT_BIN_PACKING_HH
105 int card(
void)
const;
107 int total(
void)
const;
125 int card(
void)
const;
127 int total(
void)
const;
173 template<
class SizeSet>
174 bool nosum(
const SizeSet& s,
int a,
int b,
int& ap,
int& bp);
176 template<
class SizeSet>
196 int* weights_base_reduction,
197 int& capacity_base_reduction,
198 int* delta_reductions);
200 static int f_ccm1(
int w,
int l,
int c);
201 static int f_mt(
int w,
int l,
int c);
202 static int f_bj1(
int w,
int l,
int c);
204 static int f_vb2(
int w,
int l,
int c);
205 static int f_fs1(
int w,
int l,
int c);
207 static int f_rad2(
int w,
int l,
int c);
216 int n_weights,
int max_weight);
218 template<
int f(
int,
int,
int)>
222 template<
int f(
int,
int,
int), LambdaRange l(
int)>
224 int capacity,
int n_not_zero_weights,
225 int max_weight,
bool sanitize =
false);
239 int nodes(
void)
const;
255 bool in(
int i)
const;
327 void incl(
int i,
unsigned int w);
329 void excl(
int i,
unsigned int w);
359 void edge(
int i,
int j,
bool add=
true);
Home class for posting propagators
Passing integer variables.
Clique(Region &r, int m)
Constructor for m nodes.
void excl(int i, unsigned int w)
Exclude node i with weight w.
NodeSet n
Nodes in the clique.
void incl(int i, unsigned int w)
Include node i with weight w.
unsigned int c
Cardinality of clique.
unsigned int w
Weight of clique.
void empty(int n)
Clear the whole node set for n nodes.
void incl(int i)
Include node i.
NodeSet(void)
Keep uninitialized.
static bool iwn(NodeSet &iwa, const NodeSet &a, NodeSet &iwb, const NodeSet &b, const NodeSet &c, int n)
void init(Region &r, int n)
Initialize node set for n nodes.
bool in(int i) const
Test whether node i is included.
void allocate(Region &r, int n)
Allocate node set for n nodes.
void copy(int n, const NodeSet &ns)
Copy elements from node set ns with n nodes.
void excl(int i)
Exclude node i.
unsigned int w
Weight (initialized with degree before graph is reduced).
Node(void)
Default constructor.
void operator++(void)
Move iterator to next node (if possible).
Nodes(const NodeSet &ns)
Initialize for nodes in ns.
int operator()(void) const
Return current node.
Clique cur
Current clique.
ExecStatus clique(void)
Report the current clique.
int nodes(void) const
Return number of nodes.
ExecStatus post(void)
Post additional constraints.
ConflictGraph(Home &home, Region &r, const IntVarArgs &b, int m)
Initialize graph.
int pivot(const NodeSet &a, const NodeSet &b) const
Find a pivot node with maximal degree from a or b.
~ConflictGraph(void)
Destructor.
bool adjacent(int i, int j) const
Test whether nodes i and j are adjacent.
Node * node
The nodes in the graph.
ExecStatus bk(NodeSet &p, NodeSet &x)
Run Bosch-Kerbron algorithm for finding max cliques.
unsigned int bins
Number of bins.
void edge(int i, int j, bool add=true)
Add or remove an edge between nodes i and j (i must be less than j).
const IntVarArgs & b
Bin variables.
Clique max
Largest clique so far.
IntSet maxclique(void) const
Return maximal clique found.
Item combining bin and size information.
IntView bin(void) const
Return bin of item.
void update(Space &home, Item &i)
Update item during cloning.
Item(void)
Default constructor.
int size(void) const
Return size of item.
static LambdaRange l_rad2(int c)
static int f_bj1(int w, int l, int c)
ViewArray< OffsetView > l
Views for load of bins.
static int calc_dff_lower_bound(const int *weights, int n_weights, int capacity, int n_not_zero_weights, int max_weight, bool sanitize=false)
IntPropLevel ipl
Propagation level.
static LambdaRange sanitize_lambda_range(LambdaRange lambda, int n_weights, int max_weight)
static int f_mt(int w, int l, int c)
ViewArray< Item > bs
Items with bin and size.
virtual void reschedule(Space &home)
Schedule function.
int t
Total size of all items.
static void calc_reductions(const ViewArray< Item > &bs, const ViewArray< OffsetView > &l, int *weights_base_reduction, int &capacity_base_reduction, int *delta_reductions)
static int f_rad2(int w, int l, int c)
static int calc_dff_lower_bound_single_lambda(const int *weights, int n_weights, int capacity, int lambda)
Lower bound.
static int const n_lambda_samples
static int const n_reductions
Reductions.
static LambdaRange l_ccm1(int c)
static int f_ccm1(int w, int l, int c)
Dual Feasible Functions.
static LambdaRange l_bj1(int c)
static ExecStatus post(Home home, ViewArray< OffsetView > &l, ViewArray< Item > &bs, IntPropLevel ipl=IPL_DEF)
Post propagator for loads l and items bs.
bool nosum(const SizeSet &s, int a, int b, int &ap, int &bp)
Detect non-existence of sums in a .. b.
static int f_vb2(int w, int l, int c)
static LambdaRange l_mt(int c)
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static int f_vb2_base(int w, int l, int c)
static LambdaRange l_vb2(int c)
Pack(Home home, ViewArray< OffsetView > &l, ViewArray< Item > &bs, IntPropLevel ipl)
Constructor for posting.
static int f_rad2_base(int w, int l, int c)
static LambdaRange l_fs1(int c)
static int f_fs1(int w, int l, int c)
virtual size_t dispose(Space &home)
Destructor.
int operator[](int i) const
Return size of item i.
void minus(int s)
Discard size s.
SizeSetMinusOne(void)
Default constructor.
int p
Position of discarded item.
int total(void) const
Return total size.
int card(void) const
Return cardinality of set (number of entries).
int t
Total size of the set.
SizeSet(void)
Default constructor.
void add(int s)
Add new size s.
int total(void) const
Return total size.
int operator[](int i) const
Return size of item i.
int n
Number of size entries in the set.
int * s
Array of sizes (will have more elements).
int card(void) const
Return cardinality of set (number of entries).
Integer view for integer variables.
ModEventDelta med
A set of modification events (used during propagation).
Propagator(Home home)
Constructor for posting.
Basic bitset support (without stored size information).
#define GECODE_INT_EXPORT
int ModEventDelta
Modification event deltas.
IntPropLevel
Propagation levels for integer propagators.
@ IPL_DEF
Simple propagation levels.
void weights(Home home, IntSharedArray elements, IntSharedArray weights, SetVar x, IntVar y)
Post propagator for .
bool operator<(const Item &i, const Item &j)
Order, also for sorting according to size.
bool operator!=(const Item &i, const Item &j)
Whether two items are not the same.
bool operator==(const Item &i, const Item &j)
Whether two items are the same.
Gecode toplevel namespace
const int capacity[n_warehouses]
Capacity of a single warehouse.