diff options
Diffstat (limited to 'Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/api/strategy/interfaces')
2 files changed, 57 insertions, 0 deletions
diff --git a/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/api/strategy/interfaces/IStrategy.java b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/api/strategy/interfaces/IStrategy.java new file mode 100644 index 00000000..8c164396 --- /dev/null +++ b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/api/strategy/interfaces/IStrategy.java | |||
@@ -0,0 +1,44 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2015, Andras Szabolcs Nagy and Daniel Varro | ||
3 | * This program and the accompanying materials are made available under the | ||
4 | * terms of the Eclipse Public License v. 2.0 which is available at | ||
5 | * http://www.eclipse.org/legal/epl-v20.html. | ||
6 | * | ||
7 | * SPDX-License-Identifier: EPL-2.0 | ||
8 | *******************************************************************************/ | ||
9 | package org.eclipse.viatra.dse.api.strategy.interfaces; | ||
10 | |||
11 | import org.eclipse.viatra.dse.base.ThreadContext; | ||
12 | import org.eclipse.viatra.dse.solutionstore.SolutionStore; | ||
13 | |||
14 | /** | ||
15 | * This high level interface is responsible for defining basic operations of an exploration strategy. | ||
16 | * | ||
17 | * @author Andras Szabolcs Nagy | ||
18 | * | ||
19 | */ | ||
20 | public interface IStrategy { | ||
21 | |||
22 | /** | ||
23 | * Initializes the strategy with a specific {@link ThreadContext}. | ||
24 | * | ||
25 | * @param context | ||
26 | * The context. | ||
27 | */ | ||
28 | void initStrategy(ThreadContext context); | ||
29 | |||
30 | /** | ||
31 | * This method explores the design space as the implementation specifies. It will be called only once, hence the | ||
32 | * exploration loop is run by the implementation. The termination condition is also specified by the implementation | ||
33 | * and when it returns the exploration thread will be disposed. | ||
34 | */ | ||
35 | void explore(); | ||
36 | |||
37 | /** | ||
38 | * The implementation of this interface should be ready to be interrupted. If this method is called, the | ||
39 | * {@link IStrategy#explore()} method should return ASAP. | ||
40 | * | ||
41 | * This method is also called by the {@link SolutionStore} class if enough solutions are found. | ||
42 | */ | ||
43 | void interruptStrategy(); | ||
44 | } | ||
diff --git a/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/api/strategy/interfaces/IStrategyFactory.java b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/api/strategy/interfaces/IStrategyFactory.java new file mode 100644 index 00000000..b3352d13 --- /dev/null +++ b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/api/strategy/interfaces/IStrategyFactory.java | |||
@@ -0,0 +1,13 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2016, Andras Szabolcs Nagy and Daniel Varro | ||
3 | * This program and the accompanying materials are made available under the | ||
4 | * terms of the Eclipse Public License v. 2.0 which is available at | ||
5 | * http://www.eclipse.org/legal/epl-v20.html. | ||
6 | * | ||
7 | * SPDX-License-Identifier: EPL-2.0 | ||
8 | *******************************************************************************/ | ||
9 | package org.eclipse.viatra.dse.api.strategy.interfaces; | ||
10 | |||
11 | public interface IStrategyFactory { | ||
12 | IStrategy createStrategy(); | ||
13 | } | ||