diff options
author | 20001LastOrder <boqi.chen@mail.mcgill.ca> | 2020-11-04 01:16:22 -0500 |
---|---|---|
committer | 20001LastOrder <boqi.chen@mail.mcgill.ca> | 2020-11-04 01:16:22 -0500 |
commit | 93243cb3faf1ccd733081fcf380559ac03c9ad35 (patch) | |
tree | 421f9f174eb77c387b5acaa05f01e64a62cab3a7 /Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/objectives/IGlobalConstraint.java | |
parent | add realistic solver (diff) | |
parent | Optimizing generator with linear objective functions (diff) | |
download | VIATRA-Generator-93243cb3faf1ccd733081fcf380559ac03c9ad35.tar.gz VIATRA-Generator-93243cb3faf1ccd733081fcf380559ac03c9ad35.tar.zst VIATRA-Generator-93243cb3faf1ccd733081fcf380559ac03c9ad35.zip |
merge with current master, comment numerical solver related logging
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.java | 58 |
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 | *******************************************************************************/ | ||
9 | package org.eclipse.viatra.dse.objectives; | ||
10 | |||
11 | import 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 | */ | ||
24 | public 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 | } | ||