blob: cd911ab548254d06cc936a638aa6a790e085b2e7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
package hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.optimization
import org.eclipse.viatra.dse.base.ThreadContext
abstract class AbstractThreeValuedObjective extends DirectionalThresholdObjective implements IThreeValuedObjective {
protected new(String name, ObjectiveKind kind, ObjectiveThreshold threshold, int level) {
super(name, kind, threshold, level)
}
abstract def double getLowestPossibleFitness(ThreadContext threadContext)
abstract def double getHighestPossibleFitness(ThreadContext threadContext)
override getWorstPossibleFitness(ThreadContext threadContext) {
switch (kind) {
case LOWER_IS_BETTER:
getHighestPossibleFitness(threadContext)
case HIGHER_IS_BETTER:
getLowestPossibleFitness(threadContext)
default:
throw new IllegalStateException("Unknown three valued objective kind: " + kind)
}
}
override getBestPossibleFitness(ThreadContext threadContext) {
switch (kind) {
case LOWER_IS_BETTER:
getLowestPossibleFitness(threadContext)
case HIGHER_IS_BETTER:
getHighestPossibleFitness(threadContext)
default:
throw new IllegalStateException("Unknown three valued objective kind: " + kind)
}
}
}
|