Search in sources :

Example 1 with ColumnField

use of core.column_field.ColumnField in project solution-finder by knewjade.

the class FilterOnDemandBasicSolutions method addColumnSmallField.

private RecursiveMinoFields addColumnSmallField(ColumnField basicField) {
    Field wallField = createWallField(basicField);
    ColumnSmallField initOuterField = ColumnFieldFactory.createField();
    RecursiveMinoFields recursiveMinoFields = calculate(basicField, initOuterField, wallField);
    return new FilteredRecursiveMinoFields(recursiveMinoFields, solutionFilter);
}
Also used : ColumnField(core.column_field.ColumnField) SmallField(core.field.SmallField) Field(core.field.Field) ColumnSmallField(core.column_field.ColumnSmallField) ColumnSmallField(core.column_field.ColumnSmallField)

Example 2 with ColumnField

use of core.column_field.ColumnField in project solution-finder by knewjade.

the class MinoPackingTaskWidthForWidth2 method createTask.

private PackingTask createTask(PackSearcher searcher, long innerFieldBoard, MinoFieldMemento memento, int index) {
    long fillBoard = searcher.getSizedBit().getFillBoard();
    ColumnSmallField over = ColumnFieldFactory.createField(innerFieldBoard & ~fillBoard);
    ColumnField outerField = searcher.getInOutPairFields().get(index).getOuterField();
    if (over.canMerge(outerField)) {
        over.merge(outerField);
        ColumnSmallField innerField = ColumnFieldFactory.createField(innerFieldBoard & fillBoard);
        return new MinoPackingTaskWidthForWidth2(searcher, innerField, over, memento, index);
    }
    return EMPTY_TASK;
}
Also used : ColumnSmallField(core.column_field.ColumnSmallField) ColumnField(core.column_field.ColumnField)

Example 3 with ColumnField

use of core.column_field.ColumnField in project solution-finder by knewjade.

the class MinoPackingTaskWidthForWidth2 method split.

private PackingTask split(MinoField minoField) {
    ColumnField minoOuterField = minoField.getOuterField();
    // 注目範囲外outerで重なりがないか確認
    if (outerField.canMerge(minoOuterField)) {
        // 有効なおきかた
        SizedBit sizedBit = searcher.getSizedBit();
        ColumnField mergedOuterField = outerField.freeze(sizedBit.getHeight());
        mergedOuterField.merge(minoOuterField);
        long innerFieldBoard = mergedOuterField.getBoard(0) >> sizedBit.getMaxBitDigit();
        MinoFieldMemento nextMemento = memento.concat(minoField);
        return checkAndCreateTask(innerFieldBoard, nextMemento, index + 1);
    }
    return EMPTY_TASK;
}
Also used : SizedBit(searcher.pack.SizedBit) ColumnField(core.column_field.ColumnField) MinoFieldMemento(searcher.pack.memento.MinoFieldMemento)

Example 4 with ColumnField

use of core.column_field.ColumnField in project solution-finder by knewjade.

the class MinoPackingTaskWidthForWidth2 method splitAndFixResult.

private Stream<Result> splitAndFixResult(MinoField minoField) {
    ColumnField minoOuterField = minoField.getOuterField();
    // 注目範囲外outerで重なりがないか確認
    if (outerField.canMerge(minoOuterField)) {
        // 有効なおきかた
        SizedBit sizedBit = searcher.getSizedBit();
        ColumnField mergedOuterField = outerField.freeze(searcher.getSizedBit().getHeight());
        mergedOuterField.merge(minoOuterField);
        long innerFieldBoard = mergedOuterField.getBoard(0) >> sizedBit.getMaxBitDigit();
        MinoFieldMemento nextMemento = memento.concat(minoField);
        return searcher.getTaskResultHelper().fixResult(searcher, innerFieldBoard, nextMemento);
    }
    return Stream.empty();
}
Also used : SizedBit(searcher.pack.SizedBit) ColumnField(core.column_field.ColumnField) MinoFieldMemento(searcher.pack.memento.MinoFieldMemento)

Example 5 with ColumnField

use of core.column_field.ColumnField in project solution-finder by knewjade.

the class MinoPackingTaskWidthForWidth3 method split.

private PackingTask split(MinoField minoField) {
    ColumnField outerField = searcher.getInOutPairFields().get(index).getOuterField();
    ColumnField minoOuterField = minoField.getOuterField();
    // 注目範囲外outerで重なりがないか確認
    if (outerField.canMerge(minoOuterField)) {
        // 有効なおきかた
        SizedBit sizedBit = searcher.getSizedBit();
        ColumnField mergedOuterField = outerField.freeze(sizedBit.getHeight());
        mergedOuterField.merge(minoOuterField);
        ColumnSmallField nextInnerField = ColumnFieldFactory.createField(mergedOuterField.getBoard(0) >> sizedBit.getMaxBitDigit());
        MinoFieldMemento nextMemento = memento.concat(minoField);
        return checkAndCreateTask(nextInnerField, nextMemento, index + 1);
    }
    return EMPTY_TASK;
}
Also used : ColumnSmallField(core.column_field.ColumnSmallField) SizedBit(searcher.pack.SizedBit) ColumnField(core.column_field.ColumnField) MinoFieldMemento(searcher.pack.memento.MinoFieldMemento)

Aggregations

ColumnField (core.column_field.ColumnField)62 SeparableMinos (searcher.pack.SeparableMinos)33 SizedBit (searcher.pack.SizedBit)26 Field (core.field.Field)19 Test (org.junit.jupiter.api.Test)19 MinoFieldMemento (searcher.pack.memento.MinoFieldMemento)17 MinoFactory (core.mino.MinoFactory)14 MinoShifter (core.mino.MinoShifter)14 ForkJoinPool (java.util.concurrent.ForkJoinPool)12 Predicate (java.util.function.Predicate)12 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)12 RecursiveMinoFields (searcher.pack.mino_fields.RecursiveMinoFields)12 SeparableMino (searcher.pack.separable_mino.SeparableMino)12 Stream (java.util.stream.Stream)11 ColumnSmallField (core.column_field.ColumnSmallField)10 InOutPairField (searcher.pack.InOutPairField)10 OnDemandBasicSolutions (searcher.pack.solutions.OnDemandBasicSolutions)10 BasicSolutions (searcher.pack.calculator.BasicSolutions)9 SolutionFilter (searcher.pack.memento.SolutionFilter)9 Piece (core.mino.Piece)7