Commit 1322c5aa authored by Philipp Spohr's avatar Philipp Spohr
Browse files

Basic passing of solution quality

Crashfix for loops
parent dbe6caf2
......@@ -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+"%");
}
}
......
......@@ -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
);
);
}
}
......
......@@ -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)
......
......@@ -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);
......
......@@ -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()
......
......@@ -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);
......
/*******************************************************************************
* 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);
}
}
/*******************************************************************************
* 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
}
}
/* ----------------------------------------------------------------------------
* 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);
}
}
......@@ -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);
......
......@@ -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);
}
}
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment