diff --git a/pom.xml b/pom.xml index ec47bc35de5d5a267273002c94541d0e6c9874c5..9c858d656abc1e935ecbf9b68c689258d6c2314f 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,7 @@ <groupId>de.hhu.ba</groupId> <artifactId>yoshikoWrapper</artifactId> - <version>0.1.0</version> + <version>0.1.1</version> <name>YoshikoWrapper</name> diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshikoLoader.java b/src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshikoLoader.java index bb7a8be983ba50477c289a2a2bb98afa0fce0d7f..d3906b4b7a3e573eaf091f01c4317c92090dceac 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshikoLoader.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshikoLoader.java @@ -32,7 +32,7 @@ import de.hhu.ba.yoshikoWrapper.swig.LibraryInterface; public class YoshikoLoader { - public static final String REQUIRED_VERSION = "2.1"; + public static final String REQUIRED_VERSION = "2.1.1"; private static boolean isLoaded; @@ -52,11 +52,8 @@ public class YoshikoLoader { logger.info("Attempting to load library @: "+libPath); if (!libPath.substring(0,libPath.lastIndexOf(".")).endsWith(REQUIRED_VERSION)) { throw new Exception(LocalizationManager.get("libFail")+" "+REQUIRED_VERSION); - //TODO: Error output! } System.load(libPath); - //update cfg - CyCore.cm.getProperties().setProperty("pathToYoshiko", libPath); } catch(Exception e) { logger.error(e.getMessage()); @@ -64,6 +61,8 @@ public class YoshikoLoader { return; } LibraryInterface.setVerbosity(3); + //update cfg + CyCore.cm.getProperties().setProperty("pathToYoshiko", libPath); isLoaded = true; } 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 d8ca6b3480f17f78f152ba932a33280599946bb2..10744f7c6dc6ec23408e90eb9e0169dd6df0482c 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,12 @@ 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_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 SolutionFlags_reducedInstances_set(long jarg1, SolutionFlags jarg1_, int jarg2); + public final static native int SolutionFlags_reducedInstances_get(long jarg1, SolutionFlags jarg1_); + public final static native void SolutionFlags_solvedInstances_set(long jarg1, SolutionFlags jarg1_, int jarg2); + public final static native int SolutionFlags_solvedInstances_get(long jarg1, SolutionFlags jarg1_); + public final static native void SolutionFlags_lastGap_set(long jarg1, SolutionFlags jarg1_, double jarg2); + public final static native double SolutionFlags_lastGap_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); 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 d363c1e67c00315fdb543448aa1fd8cd74214939..cff40e0f4503b1a95f04f3283073d82bb8482a02 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/SolutionFlags.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/SolutionFlags.java @@ -71,13 +71,28 @@ public class SolutionFlags { return LibraryInterfaceJNI.SolutionFlags_optimal_get(swigCPtr, this); } - public void setInstances(DoubleVector value) { - LibraryInterfaceJNI.SolutionFlags_instances_set(swigCPtr, this, DoubleVector.getCPtr(value), value); + public void setReducedInstances(int value) { + LibraryInterfaceJNI.SolutionFlags_reducedInstances_set(swigCPtr, this, value); } - public DoubleVector getInstances() { - long cPtr = LibraryInterfaceJNI.SolutionFlags_instances_get(swigCPtr, this); - return (cPtr == 0) ? null : new DoubleVector(cPtr, false); + public int getReducedInstances() { + return LibraryInterfaceJNI.SolutionFlags_reducedInstances_get(swigCPtr, this); + } + + public void setSolvedInstances(int value) { + LibraryInterfaceJNI.SolutionFlags_solvedInstances_set(swigCPtr, this, value); + } + + public int getSolvedInstances() { + return LibraryInterfaceJNI.SolutionFlags_solvedInstances_get(swigCPtr, this); + } + + public void setLastGap(double value) { + LibraryInterfaceJNI.SolutionFlags_lastGap_set(swigCPtr, this, value); + } + + public double getLastGap() { + return LibraryInterfaceJNI.SolutionFlags_lastGap_get(swigCPtr, this); } } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/HelpButton.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/HelpButton.java index 645952713a3a4f102228c0b55cf516b6c84ad866..f4bdbc1e279534261b418b8352705f3d61b88eb1 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/HelpButton.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/HelpButton.java @@ -10,6 +10,7 @@ import java.net.URI; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; +import javax.swing.JOptionPane; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; import de.hhu.ba.yoshikoWrapper.help.HelpLinks; @@ -45,6 +46,7 @@ public class HelpButton extends JButton{ try { java.awt.Desktop.getDesktop().browse(uri); } catch (IOException ex) { + JOptionPane.showMessageDialog(null, "DEBUG: Thesis is currently not online! Works only on my pc!"); ex.printStackTrace(); } } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/LanguageRenderer.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/LanguageRenderer.java index 2b2ca9ff53fc4178092b6acfa50df4e49cbe5e1d..cfb92b880df5dd10282832d85466b9c4b0d403e9 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/LanguageRenderer.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/LanguageRenderer.java @@ -13,8 +13,8 @@ import de.hhu.ba.yoshikoWrapper.swing.GraphicsLoader; @SuppressWarnings("serial") class LanguageRenderer extends JPanel implements ListCellRenderer<Locale>{ - private static final int FLAG_SIZE_X = 48; - private static final int FLAG_SIZE_Y = 24; + private static final int FLAG_SIZE_X = 36; + private static final int FLAG_SIZE_Y = 18; private final JLabel label; diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/ResultPanel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/ResultPanel.java index e94793180fa55b5a4c774cfc52d9d97958d1e45a..689695db6d437282216734c7ad08d6b4944d93bb 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/ResultPanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/ResultPanel.java @@ -1,16 +1,16 @@ /******************************************************************************* * 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 @@ -51,18 +51,18 @@ import de.hhu.ba.yoshikoWrapper.swing.SwingUtil; */ @SuppressWarnings("serial")//Will never be serialized public class ResultPanel extends JPanel implements CytoPanelComponent{ - + private final JTabbedPane solutionTabs; private final JButton destroyButton; - + private BasicCollapsiblePanel marker; - + private final YoshikoResult result; - + public ResultPanel(YoshikoResult result) { - + this.result = result; - + //Init subcomponents solutionTabs = new JTabbedPane(); for (YoshikoSolution s : result.solutions) { @@ -85,13 +85,8 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{ optimalLabel = new JLabel(LocalizationManager.get("notOptimal")); optimalLabel.setForeground(Color.RED); marker.add(optimalLabel); - for (int i = 0; i < result.flags.getInstances().size();i++) { - marker.add(new JLabel( - LocalizationManager.get("instance")+" "+i+" "+ - LocalizationManager.get("gap")+": "+ - ((int)(100*result.flags.getInstances().get(i)))+"%") - ); - } + marker.add(new JLabel(result.flags.getSolvedInstances()+"/"+result.flags.getReducedInstances()+" "+LocalizationManager.get("redSolved"))); + marker.add(new JLabel(LocalizationManager.get("lastInstanceGap")+" "+(int)(100*result.flags.getLastGap())+"%")); } JLabel costLabel = new JLabel(LocalizationManager.get("cost")+" "+result.flags.getTotalCost()); marker.add(costLabel); @@ -101,7 +96,7 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{ marker.setCollapsed(false); this.add(marker); } - + destroyButton = new JButton(LocalizationManager.get("discardSolution")); destroyButton.addActionListener(new ActionListener() { @@ -109,24 +104,24 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{ public void actionPerformed(ActionEvent e) { deleteSolution(); } - + }); - + SwingUtil.addAll(this,solutionTabs,destroyButton); - + //Layout GroupLayout layout = new GroupLayout(this); - + layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); - + if (result.flags.getIlpGenerated()) { layout.setVerticalGroup(layout.createSequentialGroup() .addComponent(marker) .addComponent(solutionTabs) .addComponent(destroyButton) ); - + layout.setHorizontalGroup(layout.createParallelGroup() .addComponent(marker) .addComponent(solutionTabs) @@ -138,7 +133,7 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{ .addComponent(solutionTabs) .addComponent(destroyButton) ); - + layout.setHorizontalGroup(layout.createParallelGroup() .addComponent(solutionTabs) .addComponent(destroyButton) @@ -147,7 +142,7 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{ this.setLayout(layout); } - + public void deleteSolution() { int dialogResult = JOptionPane.showConfirmDialog ( null, @@ -158,12 +153,12 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{ if (dialogResult != JOptionPane.YES_OPTION) { return; } - + CyCore.registrar.unregisterService(this,CytoPanelComponent.class); removeAll(); super.setVisible(false); } - + private void addSolutionTab(YoshikoSolution s) { SolutionTab tab = new SolutionTab(s); solutionTabs.add( diff --git a/src/main/resources/YoshikoStrings.properties b/src/main/resources/YoshikoStrings.properties index 13324bf87ad96c512c927168ced2abe7ad11642d..df0759a254c55beb3d0d6c9bb6b05011f809bd32 100644 --- a/src/main/resources/YoshikoStrings.properties +++ b/src/main/resources/YoshikoStrings.properties @@ -26,7 +26,7 @@ cluster = Cluster clusterFound = Clusters found: clusterSize = Cluster Size: continueTimeout = The ILP has exceeded the given time limit. Do you want to continue? (This may take a long time) -cost = Cost: +cost = Editing Cost: createMetaGraph = Create Meta-Graph currentGap = [ILP] Current Instance Gap defaultDeletion = Default deletion cost: @@ -42,6 +42,7 @@ icTooltip = This value is used to determine what the algorithm pays when inserti ilpMarker = ILP Properties incompleteResult = This run yielded no usable result! instance = Instance +lastInstanceGap = Gap (Current Instance): libFail = Failed to load library! Make sure you got the right file. The required version for this version of the wrapper is: libraryPanel = Library metaGraph = Meta Graph @@ -51,12 +52,13 @@ noLibMessage = There is no Yoshiko Library currently loaded! You might have to s noLibTitle = Library not loaded! noMappingHint = You haven't mapped the cost value to a column in your edge table.\nYoshiko runs significantly faster and generates better solutions if you map values. nodes = Nodes -notOptimal = Non-Optimal Solution +notOptimal = Optimality not guaranteed nrSolutions = Number of Solutions: operationMode = Operation Mode optimal = Optimal Solution paidCost = Paid a total modification cost of: redRuleChooserTitle = Reduction Rules +redSolved = reduced instances solved resolveLibPath = Resolve Yoshiko Library Path restartNeeded = Changes only take effect after restart! resultsPanelTitle = Yoshiko Results diff --git a/src/main/resources/graphics/YoshikoLogo.png b/src/main/resources/graphics/YoshikoLogo.png index f71daaa2bec19e27195c3d5d229a50e607761bf0..3b843d9d9dc0ce8e69788e6ba67c4a84267e6acd 100644 Binary files a/src/main/resources/graphics/YoshikoLogo.png and b/src/main/resources/graphics/YoshikoLogo.png differ diff --git a/src/main/resources/graphics/YoshikoSolved.png b/src/main/resources/graphics/YoshikoSolved.png index f1631b52749f39c677cc1db46262a9f1227a8090..0fa39b3e0183dcda97a4172fd3d94272daed9c4e 100644 Binary files a/src/main/resources/graphics/YoshikoSolved.png and b/src/main/resources/graphics/YoshikoSolved.png differ diff --git a/thesis/tex/Multigraph.pdf b/thesis/tex/Multigraph.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d632aeec216d1a3fa56cc600762033f1f9a108dd Binary files /dev/null and b/thesis/tex/Multigraph.pdf differ diff --git a/thesis/tex/Multigraph.tex b/thesis/tex/Multigraph.tex new file mode 100644 index 0000000000000000000000000000000000000000..d77cdc000710cc0a57c802480aadd56619f8c03b --- /dev/null +++ b/thesis/tex/Multigraph.tex @@ -0,0 +1,12 @@ +\documentclass[10pt,a4paper]{article} +\usepackage[utf8]{inputenc} +\usepackage[english]{babel} +\usepackage{amsmath} +\usepackage{amsfonts} +\usepackage{amssymb} +\author{Philipp Spohr} +\title{Rough Analysis of Cluster Editing Reduction Rules in Multi-Graphs} +\begin{document} +\maketitle +\section{•} +\end{document} \ No newline at end of file