Skip to main content
FRAMES NO FRAMES

IlcPack

public IlcConstraint IlcPack(IlcIntVarArray load, IlcIntVarArray where, IlcIntArray weight)
Definition file: ilcp/cpext.h
Include file: <ilcp/cpext.h>
Returns a packing constraint.

The IlcPack function returns a constraint which maintains the load of a set of containers, given a set of weighted items and an assignment of items to containers. Consider that we have n items and m containers. Each item i has an integer weight w[i] and a constrained integer variable p[i] associated with it indicating in which container (numbered contiguously from 0) item i is to be placed. No item can be split up, and so can go in only one container. Also associated with each container j is an integer variable l[j] representing the load in that container; that is, the sum of the weights of the items which have been assigned to that container. A capacity can be set for each container placing an upper bound on this load variable. The constraint also ensures that the total sum of the loads of the containers is equal to the sum of the weights of the items being placed.

Parameters:

load
The load of each container. The upper bounds of these variables determines the capacity of each container.
where
The container where each object is placed.
weight
The (non-negative) weights of the items. This array must be equal in side to the where array.

Returns:

The packing constraint.

IlcPack

public IlcConstraint IlcPack(IlcIntVarArray load, IlcIntVarArray where, IlcIntArray weight, IlcIntVar used)
Definition file: ilcp/cpext.h
Include file: <ilcp/cpext.h>
Returns a packing constraint.

The IlcPack function returns a constraint which maintains the load of a set of containers, given a set of weighted items and an assignment of items to containers. Consider that we have n items and m containers. Each item i has an integer weight w[i] and a constrained integer variable p[i] associated with it indicating in which container (numbered contiguously from 0) item i is to be placed. No item can be split up, and so can go in only one container. Also associated with each container j is an integer variable l[j] representing the load in that container; that is, the sum of the weights of the items which have been assigned to that container. A capacity can be set for each container placing an upper bound on this load variable. The constraint also ensures that the total sum of the loads of the containers is equal to the sum of the weights of the items being placed. The number of containers which are used is also maintained, the definition of usage being that at least one item is placed in the container.

Parameters:

load
The load of each container. The upper bounds of these variables determines the capacity of each container.
where
The container where each object is placed.
weight
The (non-negative) weights of the items. This array must be equal in side to the where array.
used
The number of containers used. A container is used if at least one item is placed in it.

Returns:

The packing constraint.