Search in sources :

Example 1 with VectorPacking

use of org.btrplace.scheduler.choco.extensions.pack.VectorPacking in project scheduler by btrplace.

the class VectorPackingTest method modelPack.

public void modelPack(int[][] capa, int[][] height) {
    int nRes = capa.length;
    assert nRes == height.length;
    int nBins = capa[0].length;
    int nItems = height[0].length;
    s = new Model();
    loads = new IntVar[nRes][nBins];
    bins = new IntVar[nItems];
    String[] name = new String[nRes];
    for (int d = 0; d < nRes; d++) {
        name[d] = "d" + d;
        for (int i = 0; i < nBins; i++) {
            loads[d][i] = s.intVar("l" + d + "." + i, 0, capa[d][i], true);
        }
    }
    sizes = height;
    bins = s.intVarArray("b", nItems, 0, nBins, false);
    Constraint cPack = new VectorPacking(name, loads, sizes, bins);
    s.post(cPack);
}
Also used : VectorPacking(org.btrplace.scheduler.choco.extensions.pack.VectorPacking) Constraint(org.chocosolver.solver.constraints.Constraint) Model(org.chocosolver.solver.Model) Constraint(org.chocosolver.solver.constraints.Constraint)

Aggregations

VectorPacking (org.btrplace.scheduler.choco.extensions.pack.VectorPacking)1 Model (org.chocosolver.solver.Model)1 Constraint (org.chocosolver.solver.constraints.Constraint)1