aboutsummaryrefslogtreecommitdiffstats
path: root/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/objectives/IGlobalConstraint.java
diff options
context:
space:
mode:
Diffstat (limited to 'Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/objectives/IGlobalConstraint.java')
-rw-r--r--Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/objectives/IGlobalConstraint.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/objectives/IGlobalConstraint.java b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/objectives/IGlobalConstraint.java
new file mode 100644
index 00000000..2f7f0347
--- /dev/null
+++ b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/objectives/IGlobalConstraint.java
@@ -0,0 +1,58 @@
1/*******************************************************************************
2 * Copyright (c) 2010-2014, Miklos Foldenyi, Andras Szabolcs Nagy, Abel Hegedus, Akos Horvath, Zoltan Ujhelyi 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 *******************************************************************************/
9package org.eclipse.viatra.dse.objectives;
10
11import org.eclipse.viatra.dse.base.ThreadContext;
12
13/**
14 *
15 * Implementation of this interface represents a global constraint of the DSE problem, which can halt an exploration
16 * continuing from a state which dissatisfies the global constraint.
17 * <p>
18 * Certain global constraints can have inner state for the validation. In this case a new instance is necessary for
19 * every new thread, and the {@code createNew} method should not return the same instance more than once.
20 *
21 * @author Andras Szabolcs Nagy
22 *
23 */
24public interface IGlobalConstraint {
25
26 /**
27 * Returns the name of the global constraint.
28 *
29 * @return The name of the global constraint.
30 */
31 String getName();
32
33 /**
34 * Checks whether the current state satisfies the global constraint.
35 *
36 * @param context
37 * The {@link ThreadContext} which contains the necessary information.
38 * @return True if the state is valid and exploration can be continued from the actual state.
39 */
40 boolean checkGlobalConstraint(ThreadContext context);
41
42 /**
43 * Initializes the global constraint. It is called exactly once for every thread starts.
44 *
45 * @param context
46 * The {@link ThreadContext}.
47 */
48 void init(ThreadContext context);
49
50 /**
51 * Returns an instance of the {@link IGlobalConstraint}. If it returns the same instance, all the methods has to be
52 * thread save as they are called concurrently.
53 *
54 * @return An instance of the global constraint.
55 */
56 IGlobalConstraint createNew();
57
58}