/*******************************************************************************
* Copyright (c) 2010-2016, Andras Szabolcs Nagy, Zoltan Ujhelyi and Daniel Varro
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-v20.html.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.viatra.dse.api.strategy.impl;
import java.util.Collection;
import java.util.Iterator;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.log4j.Logger;
import org.eclipse.viatra.dse.api.strategy.interfaces.IStrategy;
import org.eclipse.viatra.dse.base.GlobalContext;
import org.eclipse.viatra.dse.base.ThreadContext;
import org.eclipse.viatra.dse.objectives.Fitness;
import org.eclipse.viatra.dse.solutionstore.SolutionStore;
/**
* A breadth-first search algorithm implementation, that
*
*
can work with multiple threads,
*
indeterministic,
*
saves all states (trajectories) as solutions that fulfill all the hard objectives,
*
can have a depth limit,
*
will backtrack when a model satisfies the hard objectives (after saving it as a solution) and will not explore
* beyond that state.
*
*
* @author Andras Szabolcs Nagy
*
*/
public class BreadthFirstStrategy implements IStrategy {
private static final class BfsSharedObject {
private final ConcurrentLinkedQueue