diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/core/AlgorithmTask.java b/src/main/java/de/hhu/ba/yoshikoWrapper/core/AlgorithmTask.java index b6a9f90b004fb89dc7ae7c67a278253916c50fdd..e8104501a6ccd712cb1862fb9aa28634664bf329 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/core/AlgorithmTask.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/core/AlgorithmTask.java @@ -152,7 +152,7 @@ public class AlgorithmTask extends AbstractTask { @Override public void updateGap(double gap) { - taskMonitor.setStatusMessage(LocalizationManager.get("currentGap")+": "+gap); + taskMonitor.setStatusMessage(LocalizationManager.get("currentGap")+": "+gap*100+"%"); } } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/core/NetworkParser.java b/src/main/java/de/hhu/ba/yoshikoWrapper/core/NetworkParser.java index 551394143c76000e4e13832623316c9d31d5f589..dabb092023bbaa136dde5934b475ac1777dbedc0 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/core/NetworkParser.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/core/NetworkParser.java @@ -71,7 +71,7 @@ public class NetworkParser { //It is possible, that there are missing entries if (edgeEntry.get(weightColumn.getName(), weightColumn.getType()) != null){ if (weightColumn.getType() == Integer.class) { - weight = edgeEntry.get(weightColumn.getName(), Integer.class); + weight = 1.0*edgeEntry.get(weightColumn.getName(), Integer.class); } else if (weightColumn.getType() == Double.class) { weight = edgeEntry.get(weightColumn.getName(), Double.class); @@ -82,6 +82,7 @@ public class NetworkParser { //Parse Forbidden/Permanent markers boolean forbidden = false; boolean permanent = false; + if (permanentColumn != null) { //Additional check as it is not required to have a value in every row if (edgeEntry.get(permanentColumn.getName(), Boolean.class) != null) { @@ -103,7 +104,7 @@ public class NetworkParser { weight, permanent, forbidden - ); + ); } } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ColumnMapper.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ColumnMapper.java index f3b34924ee808e9430572a8dc7919cf3a33bb4d9..84b9f9bd0714e9274a0ed21bd6175d2e25685e33 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ColumnMapper.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ColumnMapper.java @@ -80,22 +80,21 @@ public class ColumnMapper extends JPanel{ //Layout GroupLayout layout = new GroupLayout(this); - layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING,true) - .addGroup(layout.createSequentialGroup() - .addComponent(useMappingCost) - .addComponent(editingCostMapper) - ) - .addGroup(layout.createSequentialGroup() - .addComponent(useMappingPerm) - .addComponent(permanentMapper) - ) - .addGroup(layout.createSequentialGroup() - .addComponent(useMappingForb) - .addComponent(forbiddenMapper) - ) + layout.setHorizontalGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(useMappingCost) + .addComponent(useMappingPerm) + .addComponent(useMappingForb) + ) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(editingCostMapper) + .addComponent(permanentMapper) + .addComponent(forbiddenMapper) + ) + ); - layout.setVerticalGroup(layout.createSequentialGroup() + layout.setVerticalGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup() .addComponent(useMappingCost) .addComponent(editingCostMapper) diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/EditCostPanel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/EditCostPanel.java index 54303384a5f177144cc07cb13800e495f4505234..660df5c4129bfd52046eb0bc75acfb6a3461bed1 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/EditCostPanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/EditCostPanel.java @@ -43,9 +43,6 @@ public class EditCostPanel extends JPanel { private final JLabel icLabel; private final JLabel dcLabel; - private final JPanel groupIC; - private final JPanel groupDC; - public EditCostPanel() { //Initialize components @@ -61,28 +58,40 @@ public class EditCostPanel extends JPanel { icLabel = new JLabel(LocalizationManager.get("defaultInsertion")); dcLabel = new JLabel(LocalizationManager.get("defaultDeletion")); //Group the labels with their text fields - groupIC = new JPanel(); - groupDC = new JPanel(); - SwingUtil.addAll(groupIC,icLabel,icField); - SwingUtil.addAll(groupDC,dcLabel,dcField); + SwingUtil.addAll(this,icLabel,icField); + SwingUtil.addAll(this,dcLabel,dcField); - SwingUtil.addAll(this,columnMapper,groupIC,groupDC); + SwingUtil.addAll(this,columnMapper); //Layout GroupLayout layout = new GroupLayout(this); - layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING,true) + layout.setHorizontalGroup(layout.createParallelGroup() .addComponent(columnMapper) - .addComponent(groupIC) - .addComponent(groupDC) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(icLabel) + .addComponent(dcLabel) + ) + .addGroup(layout.createParallelGroup(Alignment.LEADING) + .addComponent(icField) + .addComponent(dcField) + ) + ) ); layout.setVerticalGroup(layout.createSequentialGroup() .addComponent(columnMapper) - .addComponent(groupIC) - .addComponent(groupDC) + .addGroup(layout.createParallelGroup() + .addComponent(icLabel) + .addComponent(icField) + ) + .addGroup(layout.createParallelGroup() + .addComponent(dcLabel) + .addComponent(dcField) + ) ); this.setLayout(layout); diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java index 6b8f7f48d542d1d6cfa934a468aac8b51e4c8261..350150c5355ce605ad9e2d5c6e54824b350d668a 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java @@ -148,14 +148,14 @@ public class MainPanel extends JPanel implements CytoPanelComponent { layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING,true) - .addComponent(header,DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(showAdvancedOptions,DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(langPanel,DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(libraryPanel,PREFERRED_SIZE, PREFERRED_SIZE, Short.MAX_VALUE) - .addComponent(ecPanelWrapper,DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(reductionWrapper,DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(opWrapper,DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(runButton,DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(header,DEFAULT_SIZE, PREFERRED_SIZE,PREFERRED_SIZE) + .addComponent(showAdvancedOptions,DEFAULT_SIZE, PREFERRED_SIZE,PREFERRED_SIZE) + .addComponent(langPanel,DEFAULT_SIZE, PREFERRED_SIZE,PREFERRED_SIZE) + .addComponent(libraryPanel,DEFAULT_SIZE, PREFERRED_SIZE,PREFERRED_SIZE) + .addComponent(ecPanelWrapper,DEFAULT_SIZE, PREFERRED_SIZE,PREFERRED_SIZE) + .addComponent(reductionWrapper,DEFAULT_SIZE, PREFERRED_SIZE,PREFERRED_SIZE) + .addComponent(opWrapper,DEFAULT_SIZE, PREFERRED_SIZE,PREFERRED_SIZE) + .addComponent(runButton,DEFAULT_SIZE, PREFERRED_SIZE,PREFERRED_SIZE) ); layout.setVerticalGroup(layout.createSequentialGroup() diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ResultPanel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ResultPanel.java index 64ade8d7488eb95190f1c67f6b51f0bd667cac6b..2148ddeb54104d545a6518b5417854f646be22c8 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ResultPanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ResultPanel.java @@ -84,7 +84,13 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{ optimalLabel = new JLabel(LocalizationManager.get("notOptimal")); optimalLabel.setForeground(Color.RED); marker.add(optimalLabel); - marker.add(new JLabel(LocalizationManager.get("gap")+" "+(int)(100*result.flags.getGapSize())+"%")); + for (int i = 0; i < result.flags.getInstances().size();i++) { + marker.add(new JLabel( + LocalizationManager.get("instance")+" "+i+" "+ + LocalizationManager.get("gap")+": "+ + (100*result.flags.getInstances().get(i))+"%") + ); + } } JLabel costLabel = new JLabel(LocalizationManager.get("cost")+" "+result.flags.getTotalCost()); marker.add(costLabel); diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/YoshikoHelpDialog.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/YoshikoHelpDialog.java deleted file mode 100644 index 71ae6ea6e7d1a4d0f36b4743f6a5a8c5b698811f..0000000000000000000000000000000000000000 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/YoshikoHelpDialog.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2017 Philipp Spohr - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; - -import javax.swing.JDialog; -import javax.swing.JTree; - -@SuppressWarnings("serial") -public class YoshikoHelpDialog extends JDialog { - private JTree navigationTree; - - public YoshikoHelpDialog() { - navigationTree = new JTree(); - this.add(navigationTree); - } -} diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/YoshikoHelpModel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/YoshikoHelpModel.java deleted file mode 100644 index 907a23e6d65d3db0fe85cc02af60efc701dd494a..0000000000000000000000000000000000000000 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/YoshikoHelpModel.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2017 Philipp Spohr - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - ******************************************************************************/ -package de.hhu.ba.yoshikoWrapper.gui; - -import javax.swing.event.TreeModelListener; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; - -public class YoshikoHelpModel implements TreeModel { - - @Override - public Object getRoot() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Object getChild(Object parent, int index) { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getChildCount(Object parent) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public boolean isLeaf(Object node) { - // TODO Auto-generated method stub - return false; - } - - @Override - public void valueForPathChanged(TreePath path, Object newValue) { - // TODO Auto-generated method stub - - } - - @Override - public int getIndexOfChild(Object parent, Object child) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public void addTreeModelListener(TreeModelListener l) { - // TODO Auto-generated method stub - - } - - @Override - public void removeTreeModelListener(TreeModelListener l) { - // TODO Auto-generated method stub - - } - -} diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/DoubleVector.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/DoubleVector.java new file mode 100644 index 0000000000000000000000000000000000000000..3cc3bde8320fbc88eeef394849f194df8c56b101 --- /dev/null +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/DoubleVector.java @@ -0,0 +1,78 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 3.0.8 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +package de.hhu.ba.yoshikoWrapper.swig; + +public class DoubleVector { + private transient long swigCPtr; + protected transient boolean swigCMemOwn; + + protected DoubleVector(long cPtr, boolean cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = cPtr; + } + + protected static long getCPtr(DoubleVector obj) { + return (obj == null) ? 0 : obj.swigCPtr; + } + + protected void finalize() { + delete(); + } + + public synchronized void delete() { + if (swigCPtr != 0) { + if (swigCMemOwn) { + swigCMemOwn = false; + LibraryInterfaceJNI.delete_DoubleVector(swigCPtr); + } + swigCPtr = 0; + } + } + + public DoubleVector() { + this(LibraryInterfaceJNI.new_DoubleVector__SWIG_0(), true); + } + + public DoubleVector(long n) { + this(LibraryInterfaceJNI.new_DoubleVector__SWIG_1(n), true); + } + + public long size() { + return LibraryInterfaceJNI.DoubleVector_size(swigCPtr, this); + } + + public long capacity() { + return LibraryInterfaceJNI.DoubleVector_capacity(swigCPtr, this); + } + + public void reserve(long n) { + LibraryInterfaceJNI.DoubleVector_reserve(swigCPtr, this, n); + } + + public boolean isEmpty() { + return LibraryInterfaceJNI.DoubleVector_isEmpty(swigCPtr, this); + } + + public void clear() { + LibraryInterfaceJNI.DoubleVector_clear(swigCPtr, this); + } + + public void add(double x) { + LibraryInterfaceJNI.DoubleVector_add(swigCPtr, this, x); + } + + public double get(int i) { + return LibraryInterfaceJNI.DoubleVector_get(swigCPtr, this, i); + } + + public void set(int i, double val) { + LibraryInterfaceJNI.DoubleVector_set(swigCPtr, this, i, val); + } + +} diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/LibraryInterfaceJNI.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/LibraryInterfaceJNI.java index dcaa7e51d5d82f3307b3064d709bbd4d113170eb..48f3c2538da2bf3bb1b3ad844ca5dc2a6657048f 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/LibraryInterfaceJNI.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/LibraryInterfaceJNI.java @@ -18,8 +18,8 @@ public class LibraryInterfaceJNI { public final static native boolean SolutionFlags_ilpGenerated_get(long jarg1, SolutionFlags jarg1_); public final static native void SolutionFlags_optimal_set(long jarg1, SolutionFlags jarg1_, boolean jarg2); public final static native boolean SolutionFlags_optimal_get(long jarg1, SolutionFlags jarg1_); - public final static native void SolutionFlags_gapSize_set(long jarg1, SolutionFlags jarg1_, double jarg2); - public final static native double SolutionFlags_gapSize_get(long jarg1, SolutionFlags jarg1_); + public final static native void SolutionFlags_instances_set(long jarg1, SolutionFlags jarg1_, long jarg2, DoubleVector jarg2_); + public final static native long SolutionFlags_instances_get(long jarg1, SolutionFlags jarg1_); public final static native void delete_SolutionFlags(long jarg1); public final static native long new_IntVector__SWIG_0(); public final static native long new_IntVector__SWIG_1(long jarg1); @@ -32,6 +32,17 @@ public class LibraryInterfaceJNI { public final static native int IntVector_get(long jarg1, IntVector jarg1_, int jarg2); public final static native void IntVector_set(long jarg1, IntVector jarg1_, int jarg2, int jarg3); public final static native void delete_IntVector(long jarg1); + public final static native long new_DoubleVector__SWIG_0(); + public final static native long new_DoubleVector__SWIG_1(long jarg1); + public final static native long DoubleVector_size(long jarg1, DoubleVector jarg1_); + public final static native long DoubleVector_capacity(long jarg1, DoubleVector jarg1_); + public final static native void DoubleVector_reserve(long jarg1, DoubleVector jarg1_, long jarg2); + public final static native boolean DoubleVector_isEmpty(long jarg1, DoubleVector jarg1_); + public final static native void DoubleVector_clear(long jarg1, DoubleVector jarg1_); + public final static native void DoubleVector_add(long jarg1, DoubleVector jarg1_, double jarg2); + public final static native double DoubleVector_get(long jarg1, DoubleVector jarg1_, int jarg2); + public final static native void DoubleVector_set(long jarg1, DoubleVector jarg1_, int jarg2, double jarg3); + public final static native void delete_DoubleVector(long jarg1); public final static native long ClusterEditingSolutions_getNumberOfClusters(long jarg1, ClusterEditingSolutions jarg1_, long jarg2); public final static native long ClusterEditingSolutions_getCluster(long jarg1, ClusterEditingSolutions jarg1_, long jarg2, long jarg3); public final static native long ClusterEditingSolutions_getSolution(long jarg1, ClusterEditingSolutions jarg1_, long jarg2); diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/SolutionFlags.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/SolutionFlags.java index 18e7ca6691713da118203382ecc4b0c0e2a47a85..d363c1e67c00315fdb543448aa1fd8cd74214939 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/SolutionFlags.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/SolutionFlags.java @@ -71,12 +71,13 @@ public class SolutionFlags { return LibraryInterfaceJNI.SolutionFlags_optimal_get(swigCPtr, this); } - public void setGapSize(double value) { - LibraryInterfaceJNI.SolutionFlags_gapSize_set(swigCPtr, this, value); + public void setInstances(DoubleVector value) { + LibraryInterfaceJNI.SolutionFlags_instances_set(swigCPtr, this, DoubleVector.getCPtr(value), value); } - public double getGapSize() { - return LibraryInterfaceJNI.SolutionFlags_gapSize_get(swigCPtr, this); + public DoubleVector getInstances() { + long cPtr = LibraryInterfaceJNI.SolutionFlags_instances_get(swigCPtr, this); + return (cPtr == 0) ? null : new DoubleVector(cPtr, false); } } diff --git a/src/main/resources/YoshikoStrings.properties b/src/main/resources/YoshikoStrings.properties index 16b9988d9b851d4db6d0a416dc424b39b96608e6..8c05e37ac593283ac71e8636c0509cf244ab7263 100644 --- a/src/main/resources/YoshikoStrings.properties +++ b/src/main/resources/YoshikoStrings.properties @@ -49,7 +49,7 @@ libraryPanel = Library defaultInsertion = Default insertion cost: defaultDeletion = Default deletion cost: switchLanguage = Plugin language -icTooltip = This value is used to determine what the algorithm pays when inserting an edge. Existing mappings overwrite this value. A higher value means that the algorithm is less likely to insert edges in order to generate a cluster. +icTooltip = This value is used to determine what the algorithm pays when inserting an edge.\nExisting mappings overwrite this value.\nA higher value means that the algorithm is less likely to insert edges in order to generate a cluster. operationMode = Operation Mode run = Perform Algorithm nodes = Nodes @@ -60,8 +60,9 @@ optimal = Optimal Solution notOptimal = Not Optimal Solution ilpMarker = ILP Properties timeoutMarker = Timed Out +instance = Instance gap = Gap -currentGap = [ILP] Current Instance Gap: +currentGap = [ILP] Current Instance Gap disableMultiThreading = Disable Multithreading yoshikoHint = Yoshiko Hint getYoshiko = Get Yoshiko Library