aboutsummaryrefslogtreecommitdiffstats
path: root/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/objectives/Comparators.java
diff options
context:
space:
mode:
authorLibravatar 20001LastOrder <boqi.chen@mail.mcgill.ca>2020-11-04 01:16:22 -0500
committerLibravatar 20001LastOrder <boqi.chen@mail.mcgill.ca>2020-11-04 01:16:22 -0500
commit93243cb3faf1ccd733081fcf380559ac03c9ad35 (patch)
tree421f9f174eb77c387b5acaa05f01e64a62cab3a7 /Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/objectives/Comparators.java
parentadd realistic solver (diff)
parentOptimizing generator with linear objective functions (diff)
downloadVIATRA-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/Comparators.java')
-rw-r--r--Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/objectives/Comparators.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/objectives/Comparators.java b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/objectives/Comparators.java
new file mode 100644
index 00000000..b1bd9349
--- /dev/null
+++ b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/src/org/eclipse/viatra/dse/objectives/Comparators.java
@@ -0,0 +1,31 @@
1/*******************************************************************************
2 * Copyright (c) 2010-2015, 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 java.util.Comparator;
12
13/**
14 * This helper class holds comparators for objective implementations.
15 *
16 * @author Andras Szabolcs Nagy
17 *
18 */
19public class Comparators {
20
21 private Comparators() { /*Utility class constructor*/ }
22
23 public static final Comparator<Double> HIGHER_IS_BETTER = (o1, o2) -> o1.compareTo(o2);
24
25 public static final Comparator<Double> LOWER_IS_BETTER = (o1, o2) -> o2.compareTo(o1);
26
27 private static final Double ZERO = Double.valueOf(0);
28
29 public static final Comparator<Double> DIFFERENCE_TO_ZERO_IS_BETTER = (o1, o2) -> ZERO.compareTo(Math.abs(o1)-Math.abs(o2));
30
31}