Search in sources :

Example 6 with OnDemandBasicSolutions

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

the class OperationTransformTest method randomParse.

@Test
@LongTest
void randomParse() throws Exception {
    // Initialize
    Randoms randoms = new Randoms();
    MinoFactory minoFactory = new MinoFactory();
    MinoShifter minoShifter = new MinoShifter();
    MinoRotation minoRotation = new MinoRotation();
    // Define size
    int height = 4;
    int basicWidth = 3;
    SizedBit sizedBit = new SizedBit(basicWidth, height);
    SeparableMinos separableMinos = SeparableMinos.createSeparableMinos(minoFactory, minoShifter, sizedBit);
    // Create basic solutions
    TaskResultHelper taskResultHelper = new Field4x10MinoPackingHelper();
    LockedReachableThreadLocal lockedReachableThreadLocal = new LockedReachableThreadLocal(minoFactory, minoShifter, minoRotation, height);
    Predicate<ColumnField> memorizedPredicate = (columnField) -> true;
    OnDemandBasicSolutions basicSolutions = new OnDemandBasicSolutions(separableMinos, sizedBit, memorizedPredicate);
    for (int count = 0; count < 100; count++) {
        // Create field
        int numOfMinos = randoms.nextInt(6, 10);
        Field field = randoms.field(height, numOfMinos);
        // Search
        List<InOutPairField> inOutPairFields = InOutPairField.createInOutPairFields(basicWidth, height, field);
        SolutionFilter solutionFilter = new SRSValidSolutionFilter(field, lockedReachableThreadLocal, sizedBit);
        PerfectPackSearcher searcher = new PerfectPackSearcher(inOutPairFields, basicSolutions, sizedBit, solutionFilter, taskResultHelper);
        Optional<Result> resultOptional = searcher.findAny();
        OperationWithKeyComparator<MinoOperationWithKey> operationWithKeyComparator = new OperationWithKeyComparator<>();
        ListComparator<MinoOperationWithKey> comparator = new ListComparator<>(operationWithKeyComparator);
        BuildUpStream buildUpStream = new BuildUpStream(lockedReachableThreadLocal.get(), height);
        // If found solution
        resultOptional.ifPresent(result -> {
            List<MinoOperationWithKey> list = result.getMemento().getSeparableMinoStream(basicWidth).map(SeparableMino::toMinoOperationWithKey).collect(Collectors.toList());
            Optional<List<MinoOperationWithKey>> validOption = buildUpStream.existsValidBuildPattern(field, list).findAny();
            validOption.ifPresent(operationWithKeys -> {
                Operations operations = OperationTransform.parseToOperations(field, operationWithKeys, height);
                List<MinoOperationWithKey> actual = OperationTransform.parseToOperationWithKeys(field, operations, minoFactory, height);
                assertThat(comparator.compare(operationWithKeys, actual)).as("%s%n%s%n %s", FieldView.toString(field, height), OperationWithKeyInterpreter.parseToString(operationWithKeys), OperationWithKeyInterpreter.parseToString(actual)).isEqualTo(0);
            });
        });
    }
}
Also used : TaskResultHelper(searcher.pack.task.TaskResultHelper) Randoms(lib.Randoms) ListComparator(lib.ListComparator) OperationWithKeyComparator(common.comparator.OperationWithKeyComparator) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ColumnField(core.column_field.ColumnField) MinoOperationWithKey(common.datastore.MinoOperationWithKey) FieldView(core.field.FieldView) SizedBit(searcher.pack.SizedBit) MinoFactory(core.mino.MinoFactory) SeparableMinos(searcher.pack.SeparableMinos) FieldFactory(core.field.FieldFactory) Tag(org.junit.jupiter.api.Tag) MinoRotation(core.srs.MinoRotation) BuildUpStream(common.buildup.BuildUpStream) PerfectPackSearcher(searcher.pack.task.PerfectPackSearcher) Field4x10MinoPackingHelper(searcher.pack.task.Field4x10MinoPackingHelper) MinoShifter(core.mino.MinoShifter) Predicate(java.util.function.Predicate) Result(searcher.pack.task.Result) InOutPairField(searcher.pack.InOutPairField) Collectors(java.util.stream.Collectors) Test(org.junit.jupiter.api.Test) Operations(common.datastore.Operations) SolutionFilter(searcher.pack.memento.SolutionFilter) List(java.util.List) Field(core.field.Field) SeparableMino(searcher.pack.separable_mino.SeparableMino) SRSValidSolutionFilter(searcher.pack.memento.SRSValidSolutionFilter) Optional(java.util.Optional) OnDemandBasicSolutions(searcher.pack.solutions.OnDemandBasicSolutions) LockedReachableThreadLocal(concurrent.LockedReachableThreadLocal) LongTest(module.LongTest) OnDemandBasicSolutions(searcher.pack.solutions.OnDemandBasicSolutions) ListComparator(lib.ListComparator) TaskResultHelper(searcher.pack.task.TaskResultHelper) LockedReachableThreadLocal(concurrent.LockedReachableThreadLocal) Result(searcher.pack.task.Result) ColumnField(core.column_field.ColumnField) InOutPairField(searcher.pack.InOutPairField) Field(core.field.Field) MinoOperationWithKey(common.datastore.MinoOperationWithKey) SeparableMinos(searcher.pack.SeparableMinos) InOutPairField(searcher.pack.InOutPairField) PerfectPackSearcher(searcher.pack.task.PerfectPackSearcher) OperationWithKeyComparator(common.comparator.OperationWithKeyComparator) MinoFactory(core.mino.MinoFactory) List(java.util.List) BuildUpStream(common.buildup.BuildUpStream) Operations(common.datastore.Operations) Field4x10MinoPackingHelper(searcher.pack.task.Field4x10MinoPackingHelper) ColumnField(core.column_field.ColumnField) MinoRotation(core.srs.MinoRotation) Randoms(lib.Randoms) SizedBit(searcher.pack.SizedBit) SRSValidSolutionFilter(searcher.pack.memento.SRSValidSolutionFilter) SolutionFilter(searcher.pack.memento.SolutionFilter) SRSValidSolutionFilter(searcher.pack.memento.SRSValidSolutionFilter) MinoShifter(core.mino.MinoShifter) Test(org.junit.jupiter.api.Test) LongTest(module.LongTest) LongTest(module.LongTest)

Example 7 with OnDemandBasicSolutions

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

the class BuildUpTest method randomShortByPacking.

@Test
void randomShortByPacking() throws ExecutionException, InterruptedException {
    // Initialize
    Randoms randoms = new Randoms();
    MinoFactory minoFactory = new MinoFactory();
    MinoShifter minoShifter = new MinoShifter();
    MinoRotation minoRotation = new MinoRotation();
    // Define size
    int height = 4;
    int basicWidth = 3;
    SizedBit sizedBit = new SizedBit(basicWidth, height);
    SeparableMinos separableMinos = SeparableMinos.createSeparableMinos(minoFactory, minoShifter, sizedBit);
    // Create basic solutions
    TaskResultHelper taskResultHelper = new Field4x10MinoPackingHelper();
    LockedReachableThreadLocal lockedReachableThreadLocal = new LockedReachableThreadLocal(minoFactory, minoShifter, minoRotation, height);
    Predicate<ColumnField> memorizedPredicate = (columnField) -> true;
    OnDemandBasicSolutions basicSolutions = new OnDemandBasicSolutions(separableMinos, sizedBit, memorizedPredicate);
    AtomicInteger counter = new AtomicInteger();
    for (int count = 0; count < 10000; count++) {
        // Create field
        int numOfMinos = randoms.nextInt(1, 7);
        Field field = randoms.field(height, numOfMinos);
        // Search
        List<InOutPairField> inOutPairFields = InOutPairField.createInOutPairFields(basicWidth, height, field);
        SolutionFilter solutionFilter = new AllPassedSolutionFilter();
        PerfectPackSearcher searcher = new PerfectPackSearcher(inOutPairFields, basicSolutions, sizedBit, solutionFilter, taskResultHelper);
        Optional<Result> resultOptional = searcher.findAny();
        // If found solution
        resultOptional.ifPresent(result -> {
            counter.incrementAndGet();
            LinkedList<MinoOperationWithKey> operationWithKeys = result.getMemento().getSeparableMinoStream(basicWidth).map(SeparableMino::toMinoOperationWithKey).collect(Collectors.toCollection(LinkedList::new));
            LockedReachable reachable = lockedReachableThreadLocal.get();
            boolean exists = BuildUp.existsValidBuildPattern(field, operationWithKeys, height, reachable);
            if (exists) {
                // cansBuildでtrueとなるものがあることを確認
                Optional<List<MinoOperationWithKey>> valid = StreamSupport.stream(new PermutationIterable<>(operationWithKeys, operationWithKeys.size()).spliterator(), false).filter(combination -> BuildUp.cansBuild(field, combination, height, lockedReachableThreadLocal.get())).findAny();
                assertThat(valid.isPresent()).as(FieldView.toString(field) + OperationWithKeyInterpreter.parseToString(operationWithKeys)).isTrue();
                // checksKeyは必ずtrueとなる
                assertThat(BuildUp.checksKey(operationWithKeys, 0L, height)).as(FieldView.toString(field) + OperationWithKeyInterpreter.parseToString(operationWithKeys)).isTrue();
                // existsValidByOrderは必ずtrueになる
                assert valid.isPresent();
                List<MinoOperationWithKey> keys = valid.get();
                List<Piece> pieces = keys.stream().map(OperationWithKey::getPiece).collect(Collectors.toList());
                assertThat(BuildUp.existsValidByOrder(field, keys.stream(), pieces, height, reachable)).isTrue();
            } else {
                // cansBuildですべてがfalseとなることを確認
                boolean noneMatch = StreamSupport.stream(new PermutationIterable<>(operationWithKeys, operationWithKeys.size()).spliterator(), false).noneMatch(combination -> BuildUp.cansBuild(field, combination, height, lockedReachableThreadLocal.get()));
                assertThat(noneMatch).as(FieldView.toString(field) + OperationWithKeyInterpreter.parseToString(operationWithKeys)).isTrue();
                // existsValidByOrderは必ずfalseになる
                List<Piece> pieces = operationWithKeys.stream().map(OperationWithKey::getPiece).collect(Collectors.toList());
                assertThat(BuildUp.existsValidByOrder(field, operationWithKeys.stream(), pieces, height, reachable)).isFalse();
            }
        });
    }
    System.out.println(counter);
}
Also used : TaskResultHelper(searcher.pack.task.TaskResultHelper) Randoms(lib.Randoms) java.util(java.util) OperationTransform(common.parser.OperationTransform) common.datastore(common.datastore) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ColumnField(core.column_field.ColumnField) ResultHelper(common.ResultHelper) OperationInterpreter(common.parser.OperationInterpreter) AllPassedSolutionFilter(searcher.pack.memento.AllPassedSolutionFilter) LockedCandidate(core.action.candidate.LockedCandidate) FieldView(core.field.FieldView) Action(common.datastore.action.Action) SizedBit(searcher.pack.SizedBit) MinoFactory(core.mino.MinoFactory) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) PerfectValidator(searcher.common.validator.PerfectValidator) SeparableMinos(searcher.pack.SeparableMinos) Candidate(core.action.candidate.Candidate) StreamSupport(java.util.stream.StreamSupport) FieldFactory(core.field.FieldFactory) Tag(org.junit.jupiter.api.Tag) MinoRotation(core.srs.MinoRotation) LockedReachable(core.action.reachable.LockedReachable) PerfectPackSearcher(searcher.pack.task.PerfectPackSearcher) Field4x10MinoPackingHelper(searcher.pack.task.Field4x10MinoPackingHelper) MinoShifter(core.mino.MinoShifter) Piece(core.mino.Piece) PermutationIterable(common.iterable.PermutationIterable) Predicate(java.util.function.Predicate) Result(searcher.pack.task.Result) InOutPairField(searcher.pack.InOutPairField) Rotate(core.srs.Rotate) CheckerUsingHold(searcher.checker.CheckerUsingHold) Collectors(java.util.stream.Collectors) Test(org.junit.jupiter.api.Test) ExecutionException(java.util.concurrent.ExecutionException) SolutionFilter(searcher.pack.memento.SolutionFilter) Field(core.field.Field) Stream(java.util.stream.Stream) SeparableMino(searcher.pack.separable_mino.SeparableMino) OperationWithKeyInterpreter(common.parser.OperationWithKeyInterpreter) OnDemandBasicSolutions(searcher.pack.solutions.OnDemandBasicSolutions) LockedReachableThreadLocal(concurrent.LockedReachableThreadLocal) LongTest(module.LongTest) OnDemandBasicSolutions(searcher.pack.solutions.OnDemandBasicSolutions) AllPassedSolutionFilter(searcher.pack.memento.AllPassedSolutionFilter) TaskResultHelper(searcher.pack.task.TaskResultHelper) LockedReachableThreadLocal(concurrent.LockedReachableThreadLocal) Result(searcher.pack.task.Result) ColumnField(core.column_field.ColumnField) InOutPairField(searcher.pack.InOutPairField) Field(core.field.Field) SeparableMinos(searcher.pack.SeparableMinos) InOutPairField(searcher.pack.InOutPairField) Piece(core.mino.Piece) PerfectPackSearcher(searcher.pack.task.PerfectPackSearcher) MinoFactory(core.mino.MinoFactory) Field4x10MinoPackingHelper(searcher.pack.task.Field4x10MinoPackingHelper) PermutationIterable(common.iterable.PermutationIterable) ColumnField(core.column_field.ColumnField) MinoRotation(core.srs.MinoRotation) Randoms(lib.Randoms) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) SizedBit(searcher.pack.SizedBit) AllPassedSolutionFilter(searcher.pack.memento.AllPassedSolutionFilter) SolutionFilter(searcher.pack.memento.SolutionFilter) MinoShifter(core.mino.MinoShifter) LockedReachable(core.action.reachable.LockedReachable) Test(org.junit.jupiter.api.Test) LongTest(module.LongTest)

Example 8 with OnDemandBasicSolutions

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

the class BuildUpTest method randomLongByPacking.

@Test
@LongTest
void randomLongByPacking() throws ExecutionException, InterruptedException {
    // Initialize
    Randoms randoms = new Randoms();
    MinoFactory minoFactory = new MinoFactory();
    MinoShifter minoShifter = new MinoShifter();
    MinoRotation minoRotation = new MinoRotation();
    // Define size
    int height = 4;
    int basicWidth = 3;
    SizedBit sizedBit = new SizedBit(basicWidth, height);
    SeparableMinos separableMinos = SeparableMinos.createSeparableMinos(minoFactory, minoShifter, sizedBit);
    // Create basic solutions
    TaskResultHelper taskResultHelper = new Field4x10MinoPackingHelper();
    LockedReachableThreadLocal lockedReachableThreadLocal = new LockedReachableThreadLocal(minoFactory, minoShifter, minoRotation, height);
    Predicate<ColumnField> memorizedPredicate = (columnField) -> true;
    OnDemandBasicSolutions basicSolutions = new OnDemandBasicSolutions(separableMinos, sizedBit, memorizedPredicate);
    AtomicInteger counter = new AtomicInteger();
    for (int count = 0; count < 100; count++) {
        // Create field
        int numOfMinos = randoms.nextIntClosed(7, 10);
        Field field = randoms.field(height, numOfMinos);
        // Search
        List<InOutPairField> inOutPairFields = InOutPairField.createInOutPairFields(basicWidth, height, field);
        SolutionFilter solutionFilter = new AllPassedSolutionFilter();
        PerfectPackSearcher searcher = new PerfectPackSearcher(inOutPairFields, basicSolutions, sizedBit, solutionFilter, taskResultHelper);
        Optional<Result> resultOptional = searcher.findAny();
        // If found solution
        resultOptional.ifPresent(result -> {
            counter.incrementAndGet();
            LinkedList<MinoOperationWithKey> operationWithKeys = result.getMemento().getSeparableMinoStream(basicWidth).map(SeparableMino::toMinoOperationWithKey).collect(Collectors.toCollection(LinkedList::new));
            LockedReachable reachable = lockedReachableThreadLocal.get();
            boolean exists = BuildUp.existsValidBuildPattern(field, operationWithKeys, height, reachable);
            if (exists) {
                // cansBuildでtrueとなるものがあることを確認
                Optional<List<MinoOperationWithKey>> valid = StreamSupport.stream(new PermutationIterable<>(operationWithKeys, operationWithKeys.size()).spliterator(), false).filter(combination -> BuildUp.cansBuild(field, combination, height, lockedReachableThreadLocal.get())).findAny();
                assertThat(valid.isPresent()).as(FieldView.toString(field) + OperationWithKeyInterpreter.parseToString(operationWithKeys)).isTrue();
                // checksKeyは必ずtrueとなる
                assertThat(BuildUp.checksKey(operationWithKeys, 0L, height)).as(FieldView.toString(field) + OperationWithKeyInterpreter.parseToString(operationWithKeys)).isTrue();
                // existsValidByOrderは必ずtrueになる
                assert valid.isPresent();
                List<MinoOperationWithKey> keys = valid.get();
                List<Piece> pieces = keys.stream().map(OperationWithKey::getPiece).collect(Collectors.toList());
                assertThat(BuildUp.existsValidByOrder(field, keys.stream(), pieces, height, reachable)).isTrue();
            } else {
                // cansBuildですべてがfalseとなることを確認
                boolean noneMatch = StreamSupport.stream(new PermutationIterable<>(operationWithKeys, operationWithKeys.size()).spliterator(), false).noneMatch(combination -> BuildUp.cansBuild(field, combination, height, lockedReachableThreadLocal.get()));
                assertThat(noneMatch).as(FieldView.toString(field) + OperationWithKeyInterpreter.parseToString(operationWithKeys)).isTrue();
                // existsValidByOrderは必ずfalseになる
                List<Piece> pieces = operationWithKeys.stream().map(OperationWithKey::getPiece).collect(Collectors.toList());
                assertThat(BuildUp.existsValidByOrder(field, operationWithKeys.stream(), pieces, height, reachable)).isFalse();
            }
        });
    }
    System.out.println(counter);
}
Also used : TaskResultHelper(searcher.pack.task.TaskResultHelper) Randoms(lib.Randoms) java.util(java.util) OperationTransform(common.parser.OperationTransform) common.datastore(common.datastore) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ColumnField(core.column_field.ColumnField) ResultHelper(common.ResultHelper) OperationInterpreter(common.parser.OperationInterpreter) AllPassedSolutionFilter(searcher.pack.memento.AllPassedSolutionFilter) LockedCandidate(core.action.candidate.LockedCandidate) FieldView(core.field.FieldView) Action(common.datastore.action.Action) SizedBit(searcher.pack.SizedBit) MinoFactory(core.mino.MinoFactory) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) PerfectValidator(searcher.common.validator.PerfectValidator) SeparableMinos(searcher.pack.SeparableMinos) Candidate(core.action.candidate.Candidate) StreamSupport(java.util.stream.StreamSupport) FieldFactory(core.field.FieldFactory) Tag(org.junit.jupiter.api.Tag) MinoRotation(core.srs.MinoRotation) LockedReachable(core.action.reachable.LockedReachable) PerfectPackSearcher(searcher.pack.task.PerfectPackSearcher) Field4x10MinoPackingHelper(searcher.pack.task.Field4x10MinoPackingHelper) MinoShifter(core.mino.MinoShifter) Piece(core.mino.Piece) PermutationIterable(common.iterable.PermutationIterable) Predicate(java.util.function.Predicate) Result(searcher.pack.task.Result) InOutPairField(searcher.pack.InOutPairField) Rotate(core.srs.Rotate) CheckerUsingHold(searcher.checker.CheckerUsingHold) Collectors(java.util.stream.Collectors) Test(org.junit.jupiter.api.Test) ExecutionException(java.util.concurrent.ExecutionException) SolutionFilter(searcher.pack.memento.SolutionFilter) Field(core.field.Field) Stream(java.util.stream.Stream) SeparableMino(searcher.pack.separable_mino.SeparableMino) OperationWithKeyInterpreter(common.parser.OperationWithKeyInterpreter) OnDemandBasicSolutions(searcher.pack.solutions.OnDemandBasicSolutions) LockedReachableThreadLocal(concurrent.LockedReachableThreadLocal) LongTest(module.LongTest) OnDemandBasicSolutions(searcher.pack.solutions.OnDemandBasicSolutions) AllPassedSolutionFilter(searcher.pack.memento.AllPassedSolutionFilter) TaskResultHelper(searcher.pack.task.TaskResultHelper) LockedReachableThreadLocal(concurrent.LockedReachableThreadLocal) Result(searcher.pack.task.Result) ColumnField(core.column_field.ColumnField) InOutPairField(searcher.pack.InOutPairField) Field(core.field.Field) SeparableMinos(searcher.pack.SeparableMinos) InOutPairField(searcher.pack.InOutPairField) Piece(core.mino.Piece) PerfectPackSearcher(searcher.pack.task.PerfectPackSearcher) MinoFactory(core.mino.MinoFactory) Field4x10MinoPackingHelper(searcher.pack.task.Field4x10MinoPackingHelper) PermutationIterable(common.iterable.PermutationIterable) ColumnField(core.column_field.ColumnField) MinoRotation(core.srs.MinoRotation) Randoms(lib.Randoms) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) SizedBit(searcher.pack.SizedBit) AllPassedSolutionFilter(searcher.pack.memento.AllPassedSolutionFilter) SolutionFilter(searcher.pack.memento.SolutionFilter) MinoShifter(core.mino.MinoShifter) LockedReachable(core.action.reachable.LockedReachable) Test(org.junit.jupiter.api.Test) LongTest(module.LongTest) LongTest(module.LongTest)

Example 9 with OnDemandBasicSolutions

use of searcher.pack.solutions.OnDemandBasicSolutions 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)

Example 10 with OnDemandBasicSolutions

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

the class PackSearcherTest method createOnDemandBasicSolutions.

private BasicSolutions createOnDemandBasicSolutions(SizedBit sizedBit) {
    SeparableMinos separableMinos = SeparableMinos.createSeparableMinos(minoFactory, minoShifter, sizedBit);
    Predicate<ColumnField> memorizedPredicate = BasicSolutions.createBitCountPredicate(1);
    return new OnDemandBasicSolutions(separableMinos, sizedBit, memorizedPredicate);
}
Also used : FilterOnDemandBasicSolutions(searcher.pack.solutions.FilterOnDemandBasicSolutions) OnDemandBasicSolutions(searcher.pack.solutions.OnDemandBasicSolutions) SeparableMinos(searcher.pack.SeparableMinos) ColumnField(core.column_field.ColumnField)

Aggregations

ColumnField (core.column_field.ColumnField)10 SeparableMinos (searcher.pack.SeparableMinos)10 OnDemandBasicSolutions (searcher.pack.solutions.OnDemandBasicSolutions)10 Field (core.field.Field)8 InOutPairField (searcher.pack.InOutPairField)8 SizedBit (searcher.pack.SizedBit)8 SolutionFilter (searcher.pack.memento.SolutionFilter)8 MinoFactory (core.mino.MinoFactory)7 MinoShifter (core.mino.MinoShifter)7 SeparableMino (searcher.pack.separable_mino.SeparableMino)7 Result (searcher.pack.task.Result)7 TaskResultHelper (searcher.pack.task.TaskResultHelper)7 LockedReachableThreadLocal (concurrent.LockedReachableThreadLocal)6 Piece (core.mino.Piece)6 MinoRotation (core.srs.MinoRotation)6 Predicate (java.util.function.Predicate)6 Collectors (java.util.stream.Collectors)6 Randoms (lib.Randoms)6 LongTest (module.LongTest)6 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)6