Search in sources :

Example 1 with FilterWrappedBasicSolutions

use of searcher.pack.solutions.FilterWrappedBasicSolutions in project solution-finder by knewjade.

the class PackSearcherComparingParityBasedOnDemandTest method compareCount.

private void compareCount(int width, int height, List<TestData> testDataList) throws InterruptedException, ExecutionException {
    SizedBit sizedBit = new SizedBit(width, height);
    SeparableMinos separableMinos = createSeparableMinos(sizedBit);
    Predicate<ColumnField> bitCountPredicate = BasicSolutions.createBitCountPredicate(1);
    OnDemandBasicSolutions onDemandBasicSolutions = new OnDemandBasicSolutions(separableMinos, sizedBit, bitCountPredicate);
    for (TestData data : testDataList) {
        // 準備
        List<Piece> usingPieces = data.getPieces();
        int popCount = usingPieces.size();
        Field initField = createSquareEmptyField(height, popCount);
        // packで探索
        Set<PieceCounter> pieceCounters = Collections.singleton(new PieceCounter(usingPieces));
        SolutionFilter solutionFilter = createUsingBlockAndValidKeyMementoFilter(initField, sizedBit, pieceCounters);
        BasicSolutions basicSolutions = new FilterWrappedBasicSolutions(onDemandBasicSolutions, solutionFilter);
        long packCounter = calculateSRSValidCount(sizedBit, basicSolutions, initField, solutionFilter);
        System.out.println(usingPieces);
        assertThat(packCounter).isEqualTo(data.getCount());
    }
}
Also used : OnDemandBasicSolutions(searcher.pack.solutions.OnDemandBasicSolutions) PieceCounter(common.datastore.PieceCounter) ColumnField(core.column_field.ColumnField) FilterWrappedBasicSolutions(searcher.pack.solutions.FilterWrappedBasicSolutions) BasicSolutions(searcher.pack.calculator.BasicSolutions) OnDemandBasicSolutions(searcher.pack.solutions.OnDemandBasicSolutions) ColumnField(core.column_field.ColumnField) InOutPairField(searcher.pack.InOutPairField) Field(core.field.Field) SeparableMinos(searcher.pack.SeparableMinos) SizedBit(searcher.pack.SizedBit) Piece(core.mino.Piece) UsingBlockAndValidKeySolutionFilter(searcher.pack.memento.UsingBlockAndValidKeySolutionFilter) SolutionFilter(searcher.pack.memento.SolutionFilter) FilterWrappedBasicSolutions(searcher.pack.solutions.FilterWrappedBasicSolutions)

Aggregations

PieceCounter (common.datastore.PieceCounter)1 ColumnField (core.column_field.ColumnField)1 Field (core.field.Field)1 Piece (core.mino.Piece)1 InOutPairField (searcher.pack.InOutPairField)1 SeparableMinos (searcher.pack.SeparableMinos)1 SizedBit (searcher.pack.SizedBit)1 BasicSolutions (searcher.pack.calculator.BasicSolutions)1 SolutionFilter (searcher.pack.memento.SolutionFilter)1 UsingBlockAndValidKeySolutionFilter (searcher.pack.memento.UsingBlockAndValidKeySolutionFilter)1 FilterWrappedBasicSolutions (searcher.pack.solutions.FilterWrappedBasicSolutions)1 OnDemandBasicSolutions (searcher.pack.solutions.OnDemandBasicSolutions)1