diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000000000000000000000000000000000..abdea9ac032d4655898933f93050f48bf9581d14 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding/<project>=UTF-8 diff --git a/pom.xml b/pom.xml index d697b89ea11087fc6c36cf3e3833165187229263..34a0ed52a57a7f8ea3ec7f7c251eafcd820b1d68 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ <properties> <bundle.symbolicName>de.hhu.ba.yoshikoWrapper</bundle.symbolicName> <bundle.namespace>de.hhu.ba.yoshikoWrapper</bundle.namespace> - <cytoscape.api.version>3.0.1</cytoscape.api.version> + <cytoscape.api.version>3.5.0</cytoscape.api.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven-bundle-plugin.version>2.3.4</maven-bundle-plugin.version> <osgi.api.version>4.2.0</osgi.api.version> 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 8c182bf5d3f8c34c8f82d890efd75136b5872ddf..1db8a878597551cfd6dd11e4b717d1fe75519752 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/core/AlgorithmTask.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/core/AlgorithmTask.java @@ -21,8 +21,12 @@ ******************************************************************************/ package de.hhu.ba.yoshikoWrapper.core; +import java.awt.Window; import java.util.Properties; +import javax.swing.JDialog; +import javax.swing.JOptionPane; + import org.cytoscape.application.swing.CytoPanel; import org.cytoscape.application.swing.CytoPanelComponent; import org.cytoscape.application.swing.CytoPanelName; @@ -41,6 +45,7 @@ import de.hhu.ba.yoshikoWrapper.gui.ResultPanel; import de.hhu.ba.yoshikoWrapper.logging.YoshikoLogger; import de.hhu.ba.yoshikoWrapper.swig.ClusterEditingSolutions; import de.hhu.ba.yoshikoWrapper.swig.CoreAlgorithm; +import de.hhu.ba.yoshikoWrapper.swig.CplexInformer; import de.hhu.ba.yoshikoWrapper.swig.IntVector; import de.hhu.ba.yoshikoWrapper.swig.LibraryInput; import de.hhu.ba.yoshikoWrapper.swig.LibraryInterface; @@ -51,6 +56,7 @@ public class AlgorithmTask extends AbstractTask { //Symbolic links private static Logger logger = YoshikoLogger.getInstance().getLogger(); + private Window statusWindow; //Parameters private final double insertionCostDefault; @@ -70,11 +76,12 @@ public class AlgorithmTask extends AbstractTask { //Temps, need to be freed in C++ private LibraryInput input; private ClusterEditingSolutions result; - private CoreAlgorithm ca; - private CallbackHandler ch; + + private ResultPanel resultPanel; - public AlgorithmTask( + public AlgorithmTask(// <<< Too many variables here, some should be grouped later TODO: + Window statusWindow, CyNetwork net, int timeLimit, CyColumn weightColumn, @@ -90,6 +97,7 @@ public class AlgorithmTask extends AbstractTask { int numberOfSolutions ) { + this.statusWindow = statusWindow; this.net = net; this.timeLimit = timeLimit; this.weightColumn = weightColumn; @@ -147,6 +155,31 @@ public class AlgorithmTask extends AbstractTask { separateTriangles, useHeuristic ); + class CallbackHandler extends CplexInformer{ + + public boolean continueOnTimeout() { + try { + int result = JOptionPane.showConfirmDialog( + statusWindow, + LocalizationManager.get("continueTimeout"), + LocalizationManager.get("timeoutTitle"), + JOptionPane.YES_NO_OPTION, + JOptionPane.INFORMATION_MESSAGE + ); + if (result == JOptionPane.YES_OPTION) { + return true; + } + return false; + } + catch(Exception e) { + e.printStackTrace(); + return false; + } + } + } + + ca.registerCplexInformer(new CallbackHandler()); + result = ca.run(); taskMonitor.setProgress(0.9); @@ -155,8 +188,9 @@ public class AlgorithmTask extends AbstractTask { taskMonitor.setStatusMessage("Found: "+numberOfSolutions+" solutions!"); //TODO localize YoshikoResult yoshikoResult = new YoshikoResult(); + yoshikoResult.flags = result.getFlags(); - yoshikoResult.editingCost = result.getTotalCost(); + System.out.print("ILP FLAG: "+yoshikoResult.flags.getIlpGenerated()); //Loop over (multiple) solutions for (long i=0;i<numberOfSolutions;i++) { @@ -190,30 +224,26 @@ public class AlgorithmTask extends AbstractTask { net.getRow(node).set(columnName, ""+(k+1)); //Add Cluster ID in table (Remove in final version?) } + cluster.getSubNetwork(); solution.cluster.add(cluster); } yoshikoResult.solutions.add(solution); } - - - //Provide some useful info - if (result.isTimedOut()) { - throw new Exception(LocalizationManager.get("timedOutMessage")); - } + taskMonitor.setProgress(0.99); //At this point the C++ objects can be freed, in case that the algorithm terminates beforehand they need to be cleaned-up elsewhere ca.delete(); input.delete(); result.delete(); //Generate solutionsPanel - ResultPanel solutionsPanel = new ResultPanel(yoshikoResult); + resultPanel = new ResultPanel(yoshikoResult); //Show solution panel - CyCore.registrar.registerService(solutionsPanel,CytoPanelComponent.class, new Properties()); + CyCore.registrar.registerService(resultPanel,CytoPanelComponent.class, new Properties()); //Focus solution panel CytoPanel eastPanel = CyCore.swing.getCytoPanel(CytoPanelName.EAST); - eastPanel.setSelectedIndex(eastPanel.indexOfComponent(solutionsPanel)); + eastPanel.setSelectedIndex(eastPanel.indexOfComponent(resultPanel)); //Show (might be invisible) eastPanel.setState(CytoPanelState.DOCK); @@ -233,6 +263,10 @@ public class AlgorithmTask extends AbstractTask { if (result != null) { result.delete(); } + //Delete (incomplete) result panel + if (resultPanel != null) { + resultPanel.deleteSolution(); + } super.cancel(); } } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/core/CallbackHandler.java b/src/main/java/de/hhu/ba/yoshikoWrapper/core/CallbackHandler.java deleted file mode 100644 index bda1ea02ffc9e70dffeb711899cff84e76b856c8..0000000000000000000000000000000000000000 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/core/CallbackHandler.java +++ /dev/null @@ -1,7 +0,0 @@ -package de.hhu.ba.yoshikoWrapper.core; - -import de.hhu.ba.yoshikoWrapper.swig.CplexInformer; - -public abstract class CallbackHandler extends CplexInformer { - public abstract void callback(); -} diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/graphModel/YoshikoCluster.java b/src/main/java/de/hhu/ba/yoshikoWrapper/graphModel/YoshikoCluster.java index 3e240754b69d6c18a46f8aa882f202effecb7f65..40b3878452055c7a7b5131e3d62aa3464cc510e8 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/graphModel/YoshikoCluster.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/graphModel/YoshikoCluster.java @@ -42,9 +42,11 @@ import org.cytoscape.view.vizmap.VisualStyle; import org.cytoscape.work.Task; import org.cytoscape.work.TaskIterator; import org.cytoscape.work.TaskMonitor; +import org.slf4j.Logger; import de.hhu.ba.yoshikoWrapper.core.CyCore; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; +import de.hhu.ba.yoshikoWrapper.logging.YoshikoLogger; import static org.cytoscape.view.presentation.property.BasicVisualLexicon.NETWORK_HEIGHT; import static org.cytoscape.view.presentation.property.BasicVisualLexicon.NETWORK_WIDTH; @@ -59,7 +61,7 @@ public class YoshikoCluster { //SYMBOLIC LINKS private final CyNetwork originalGraph; - + private Logger logger = YoshikoLogger.getInstance().getLogger(); public YoshikoCluster(long id, CyNetwork originalGraph) { @@ -70,34 +72,41 @@ public class YoshikoCluster { private void createSubNetwork() { - CyRootNetwork originalGraphAsRoot = CyCore.rootNetworkManager.getRootNetwork(originalGraph); - - //Create nested graph and cluster subnet - ArrayList<CyEdge> inducedEdges = new ArrayList<CyEdge>(); - for (CyNode n: nodes) { - //Sadly Cytoscape doesnt provide a comfort function here - List<CyEdge> adjacentEdges = originalGraph.getAdjacentEdgeList(n, CyEdge.Type.ANY); - for (CyEdge e: adjacentEdges) { - if (nodes.contains(e.getSource()) && nodes.contains(e.getTarget())) { - inducedEdges.add(e); + if (net == null) { + CyRootNetwork originalGraphAsRoot = CyCore.rootNetworkManager.getRootNetwork(originalGraph); + + //Create nested graph and cluster subnet + ArrayList<CyEdge> inducedEdges = new ArrayList<CyEdge>(); + for (CyNode n: nodes) { + //Sadly Cytoscape doesnt provide a comfort function here + List<CyEdge> adjacentEdges = originalGraph.getAdjacentEdgeList(n, CyEdge.Type.ANY); + for (CyEdge e: adjacentEdges) { + if (nodes.contains(e.getSource()) && nodes.contains(e.getTarget())) { + inducedEdges.add(e); + } } } - } - CySubNetwork subnet = originalGraphAsRoot.addSubNetwork(nodes ,inducedEdges); + CySubNetwork subnet = originalGraphAsRoot.addSubNetwork(nodes ,inducedEdges); - subnet.getRow(subnet).set(CyNetwork.NAME, LocalizationManager.get("cluster")+" "+(id+1)); - - net = subnet; //Save for further reference + subnet.getRow(subnet).set(CyNetwork.NAME, LocalizationManager.get("cluster")+" "+(id+1)); + + net = subnet; //Save for further reference + } } public void select() { - List<CyRow> allRows = originalGraph.getDefaultNodeTable().getAllRows(); - for (CyRow r: allRows) { - r.set("selected", false); + if (originalGraph.getDefaultNodeTable() != null) { + List<CyRow> allRows = originalGraph.getDefaultNodeTable().getAllRows(); + for (CyRow r: allRows) { + r.set("selected", false); + } + //Select nodes corresponding to the cluster + for (CyNode n : nodes) { + originalGraph.getRow(n).set("selected", true); + } } - //Select nodes corresponding to the cluster - for (CyNode n : nodes) { - originalGraph.getRow(n).set("selected", true); + else { + logger.warn("The graph doesn't exist anymore, can't highlight nodes!"); } } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/graphModel/YoshikoResult.java b/src/main/java/de/hhu/ba/yoshikoWrapper/graphModel/YoshikoResult.java index e641e9f9e3576a634a5276d6143ad739b72fe7c2..cc8b34ed012ee8099a8fff84f54338d5922772a0 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/graphModel/YoshikoResult.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/graphModel/YoshikoResult.java @@ -23,6 +23,8 @@ package de.hhu.ba.yoshikoWrapper.graphModel; import java.util.ArrayList; +import de.hhu.ba.yoshikoWrapper.swig.SolutionFlags; + /**Basic data class that represents a CES instance internally. By using this class the C++ resources can be freed upon retrieval. * @@ -31,7 +33,8 @@ import java.util.ArrayList; public class YoshikoResult { public ArrayList<YoshikoSolution> solutions; - public double editingCost; + + public SolutionFlags flags; public YoshikoResult() { 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 806fccd28353892d7f086b266df5598482bcef24..35b57beeadd16b45e44d2a3e2fc7d82220fa1660 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java @@ -25,8 +25,18 @@ import static javax.swing.GroupLayout.DEFAULT_SIZE; import static javax.swing.GroupLayout.PREFERRED_SIZE; import java.awt.Component; +import java.awt.Dialog.ModalExclusionType; +import java.awt.Dialog.ModalityType; +import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowFocusListener; +import java.awt.event.WindowListener; import java.util.ArrayList; import java.util.Arrays; @@ -36,8 +46,10 @@ import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComponent; +import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.JPanel; +import javax.swing.SwingUtilities; import org.cytoscape.application.swing.CytoPanelComponent; import org.cytoscape.application.swing.CytoPanelName; @@ -56,8 +68,10 @@ import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader; @SuppressWarnings("serial") public class MainPanel extends JPanel implements CytoPanelComponent { - //SWING COMPONENTS + private MainPanel self = this; + //SWING COMPONENTS + private final YoshikoHeader header; private final JCheckBox showAdvancedOptions; @@ -73,11 +87,8 @@ public class MainPanel extends JPanel implements CytoPanelComponent { * Main constructor, creates a new Panel and initializes subcomponents */ public MainPanel() { - - //SWING INIT - - //Initialize Swing components + //Initialize Swing components header = new YoshikoHeader(); showAdvancedOptions = new JCheckBox(LocalizationManager.get("showAdvanced")); @@ -131,7 +142,7 @@ public class MainPanel extends JPanel implements CytoPanelComponent { layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING,true) - .addGap(30) + .addGap(50,50,50) .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) @@ -154,8 +165,7 @@ public class MainPanel extends JPanel implements CytoPanelComponent { ); this.setLayout(layout); - - + } private ActionListener toggleAdvancedOptionsListener = new ActionListener() { @@ -184,8 +194,21 @@ public class MainPanel extends JPanel implements CytoPanelComponent { private final TaskIterator iterator = new TaskIterator(); @Override public void actionPerformed(ActionEvent e) { + + //SWING BLACK MAGIC + Window noWindow = null; + JDialog statusWindow = new JDialog(noWindow); + JDialog popupLevel = new JDialog(statusWindow); + popupLevel.setAlwaysOnTop(true); + popupLevel.setModalityType(ModalityType.APPLICATION_MODAL); + popupLevel.setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE); + statusWindow.setModalityType(ModalityType.MODELESS); + statusWindow.setAlwaysOnTop(false); + //SWING BLACK MAGIC + if (YoshikoLoader.isLibraryLoaded()){ AbstractTask yoshiko = new AlgorithmTask( + popupLevel, CyCore.cy.getCurrentNetwork(), opModePanel.getTimeLimit(), ecPanel.getWeightColumn(), @@ -205,7 +228,10 @@ public class MainPanel extends JPanel implements CytoPanelComponent { */ if (!iterator.hasNext()) { iterator.append(yoshiko); + + CyCore.dialogTaskManager.setExecutionContext(statusWindow); CyCore.dialogTaskManager.execute(iterator); + } } else { 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 de3ab6f801977bdd1378d80bbfc10a1484f13308..64ade8d7488eb95190f1c67f6b51f0bd667cac6b 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ResultPanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ResultPanel.java @@ -21,10 +21,12 @@ ******************************************************************************/ package de.hhu.ba.yoshikoWrapper.gui; +import java.awt.Color; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import javax.swing.BoxLayout; import javax.swing.GroupLayout; import javax.swing.Icon; import javax.swing.JButton; @@ -35,6 +37,7 @@ import javax.swing.JTabbedPane; import org.cytoscape.application.swing.CytoPanelComponent; import org.cytoscape.application.swing.CytoPanelName; +import org.cytoscape.util.swing.BasicCollapsiblePanel; import de.hhu.ba.yoshikoWrapper.core.CyCore; import de.hhu.ba.yoshikoWrapper.core.GraphicsLoader; @@ -49,9 +52,9 @@ import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoSolution; public class ResultPanel extends JPanel implements CytoPanelComponent{ private final JTabbedPane solutionTabs; - private final JLabel costLabel; private final JButton destroyButton; - private final JLabel optimalLabel; + + private BasicCollapsiblePanel marker; private final YoshikoResult result; @@ -65,13 +68,32 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{ addSolutionTab(s); } - - //TODO - optimalLabel = new JLabel("Optimal"); - optimalLabel.setForeground(GraphicsLoader.yoshikoGreen); - - costLabel = new JLabel(); - setCost(result.editingCost); + if (result.flags.getIlpGenerated()) { + System.out.println("Setting up ILP Info Marker"); + //Optional Markers + marker = new BasicCollapsiblePanel(LocalizationManager.get("ilpMarker")); + marker.setLayout(new BoxLayout(marker,BoxLayout.Y_AXIS)); + if(result.flags.getOptimal()) { + JLabel optimalLabel; + optimalLabel = new JLabel(LocalizationManager.get("optimal")); + optimalLabel.setForeground(GraphicsLoader.yoshikoGreen); + marker.add(optimalLabel); + } + else { + JLabel optimalLabel; + 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())+"%")); + } + JLabel costLabel = new JLabel(LocalizationManager.get("cost")+" "+result.flags.getTotalCost()); + marker.add(costLabel); + if (result.flags.getTimedOut()) { + marker.add(new JLabel(LocalizationManager.get("timeoutMarker"))); + } + marker.setCollapsed(false); + this.add(marker); + } destroyButton = new JButton(LocalizationManager.get("discardSolution")); destroyButton.addActionListener(new ActionListener() { @@ -83,7 +105,7 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{ }); - SwingUtil.addAll(this,optimalLabel,costLabel,solutionTabs,destroyButton); + SwingUtil.addAll(this,solutionTabs,destroyButton); //Layout GroupLayout layout = new GroupLayout(this); @@ -91,24 +113,31 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{ layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); - layout.setVerticalGroup(layout.createSequentialGroup() - .addComponent(costLabel) - .addComponent(optimalLabel) - .addComponent(solutionTabs) - .addComponent(destroyButton) - ); - - + if (result.flags.getIlpGenerated()) { + layout.setVerticalGroup(layout.createSequentialGroup() + .addComponent(marker) + .addComponent(solutionTabs) + .addComponent(destroyButton) + ); + + layout.setHorizontalGroup(layout.createParallelGroup() + .addComponent(marker) + .addComponent(solutionTabs) + .addComponent(destroyButton) + ); + } + else { + layout.setVerticalGroup(layout.createSequentialGroup() + .addComponent(solutionTabs) + .addComponent(destroyButton) + ); + + layout.setHorizontalGroup(layout.createParallelGroup() + .addComponent(solutionTabs) + .addComponent(destroyButton) + ); + } - - layout.setHorizontalGroup(layout.createParallelGroup() - .addComponent(costLabel) - .addComponent(optimalLabel) - .addComponent(solutionTabs) - .addComponent(destroyButton) - ); - - this.setLayout(layout); } @@ -136,12 +165,6 @@ public class ResultPanel extends JPanel implements CytoPanelComponent{ ); } - public void setCost(double modificationCost) { - costLabel.setText(LocalizationManager.get("cost")+" "+modificationCost); - revalidate(); - repaint(); - } - @Override public Component getComponent() { return this; diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/ClusterEditingSolutions.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/ClusterEditingSolutions.java index d68381a64522debb0e654ab76b10310c57459906..10eab6276ae28f1834ada45e49b549979c532555 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/ClusterEditingSolutions.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/ClusterEditingSolutions.java @@ -35,10 +35,6 @@ public class ClusterEditingSolutions { } } - public ClusterEditingSolutions() { - this(LibraryInterfaceJNI.new_ClusterEditingSolutions(), true); - } - public long getNumberOfClusters(long i) { return LibraryInterfaceJNI.ClusterEditingSolutions_getNumberOfClusters(swigCPtr, this, i); } @@ -55,12 +51,16 @@ public class ClusterEditingSolutions { return LibraryInterfaceJNI.ClusterEditingSolutions_getNumberOfSolutions(swigCPtr, this); } - public double getTotalCost() { - return LibraryInterfaceJNI.ClusterEditingSolutions_getTotalCost(swigCPtr, this); + public SolutionFlags getFlags() { + return new SolutionFlags(LibraryInterfaceJNI.ClusterEditingSolutions_getFlags(swigCPtr, this), true); } - public boolean isTimedOut() { - return LibraryInterfaceJNI.ClusterEditingSolutions_isTimedOut(swigCPtr, this); + public void setFlags(SolutionFlags f) { + LibraryInterfaceJNI.ClusterEditingSolutions_setFlags(swigCPtr, this, SolutionFlags.getCPtr(f), f); + } + + public ClusterEditingSolutions() { + this(LibraryInterfaceJNI.new_ClusterEditingSolutions(), true); } } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/CplexInformer.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/CplexInformer.java index 7bff664892adc7b4b12e268e38bc222f93baa625..7ea4abbff6f3d4eef914a9a0506549af954059f8 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/CplexInformer.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/CplexInformer.java @@ -54,6 +54,10 @@ public class CplexInformer { if (getClass() == CplexInformer.class) LibraryInterfaceJNI.CplexInformer_callback(swigCPtr, this, gap); else LibraryInterfaceJNI.CplexInformer_callbackSwigExplicitCplexInformer(swigCPtr, this, gap); } + public boolean continueOnTimeout() { + return (getClass() == CplexInformer.class) ? LibraryInterfaceJNI.CplexInformer_continueOnTimeout(swigCPtr, this) : LibraryInterfaceJNI.CplexInformer_continueOnTimeoutSwigExplicitCplexInformer(swigCPtr, this); + } + public CplexInformer() { this(LibraryInterfaceJNI.new_CplexInformer(), true); LibraryInterfaceJNI.CplexInformer_director_connect(this, swigCPtr, swigCMemOwn, 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 999ecd2d18e329e38f1083c1fbef37b815a8d2b3..ebcafd999b8e41ca24626a10522633b5be9a692b 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/LibraryInterfaceJNI.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/LibraryInterfaceJNI.java @@ -9,6 +9,18 @@ package de.hhu.ba.yoshikoWrapper.swig; public class LibraryInterfaceJNI { + public final static native long new_SolutionFlags(); + public final static native void SolutionFlags_totalCost_set(long jarg1, SolutionFlags jarg1_, double jarg2); + public final static native double SolutionFlags_totalCost_get(long jarg1, SolutionFlags jarg1_); + public final static native void SolutionFlags_timedOut_set(long jarg1, SolutionFlags jarg1_, boolean jarg2); + public final static native boolean SolutionFlags_timedOut_get(long jarg1, SolutionFlags jarg1_); + public final static native void SolutionFlags_ilpGenerated_set(long jarg1, SolutionFlags jarg1_, boolean jarg2); + 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 delete_SolutionFlags(long jarg1); public final static native long new_IntVector__SWIG_0(); public final static native long new_IntVector__SWIG_1(long jarg1); public final static native long IntVector_size(long jarg1, IntVector jarg1_); @@ -20,13 +32,13 @@ 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_ClusterEditingSolutions(); 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); public final static native long ClusterEditingSolutions_getNumberOfSolutions(long jarg1, ClusterEditingSolutions jarg1_); - public final static native double ClusterEditingSolutions_getTotalCost(long jarg1, ClusterEditingSolutions jarg1_); - public final static native boolean ClusterEditingSolutions_isTimedOut(long jarg1, ClusterEditingSolutions jarg1_); + public final static native long ClusterEditingSolutions_getFlags(long jarg1, ClusterEditingSolutions jarg1_); + public final static native void ClusterEditingSolutions_setFlags(long jarg1, ClusterEditingSolutions jarg1_, long jarg2, SolutionFlags jarg2_); + public final static native long new_ClusterEditingSolutions(); public final static native void delete_ClusterEditingSolutions(long jarg1); public final static native long new_LibraryInput(); public final static native void delete_LibraryInput(long jarg1); @@ -36,6 +48,8 @@ public class LibraryInterfaceJNI { public final static native void LibraryInput_setDefaultInsertionCost(long jarg1, LibraryInput jarg1_, double jarg2); public final static native void CplexInformer_callback(long jarg1, CplexInformer jarg1_, double jarg2); public final static native void CplexInformer_callbackSwigExplicitCplexInformer(long jarg1, CplexInformer jarg1_, double jarg2); + public final static native boolean CplexInformer_continueOnTimeout(long jarg1, CplexInformer jarg1_); + public final static native boolean CplexInformer_continueOnTimeoutSwigExplicitCplexInformer(long jarg1, CplexInformer jarg1_); public final static native void delete_CplexInformer(long jarg1); public final static native long new_CplexInformer(); public final static native void CplexInformer_director_connect(CplexInformer obj, long cptr, boolean mem_own, boolean weak_global); @@ -52,6 +66,9 @@ public class LibraryInterfaceJNI { public static void SwigDirector_CplexInformer_callback(CplexInformer jself, double gap) { jself.callback(gap); } + public static boolean SwigDirector_CplexInformer_continueOnTimeout(CplexInformer jself) { + return jself.continueOnTimeout(); + } private final static native void swig_module_init(); static { diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/SolutionFlags.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/SolutionFlags.java new file mode 100644 index 0000000000000000000000000000000000000000..18e7ca6691713da118203382ecc4b0c0e2a47a85 --- /dev/null +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/SolutionFlags.java @@ -0,0 +1,82 @@ +/* ---------------------------------------------------------------------------- + * 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 SolutionFlags { + private transient long swigCPtr; + protected transient boolean swigCMemOwn; + + protected SolutionFlags(long cPtr, boolean cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = cPtr; + } + + protected static long getCPtr(SolutionFlags obj) { + return (obj == null) ? 0 : obj.swigCPtr; + } + + protected void finalize() { + delete(); + } + + public synchronized void delete() { + if (swigCPtr != 0) { + if (swigCMemOwn) { + swigCMemOwn = false; + LibraryInterfaceJNI.delete_SolutionFlags(swigCPtr); + } + swigCPtr = 0; + } + } + + public SolutionFlags() { + this(LibraryInterfaceJNI.new_SolutionFlags(), true); + } + + public void setTotalCost(double value) { + LibraryInterfaceJNI.SolutionFlags_totalCost_set(swigCPtr, this, value); + } + + public double getTotalCost() { + return LibraryInterfaceJNI.SolutionFlags_totalCost_get(swigCPtr, this); + } + + public void setTimedOut(boolean value) { + LibraryInterfaceJNI.SolutionFlags_timedOut_set(swigCPtr, this, value); + } + + public boolean getTimedOut() { + return LibraryInterfaceJNI.SolutionFlags_timedOut_get(swigCPtr, this); + } + + public void setIlpGenerated(boolean value) { + LibraryInterfaceJNI.SolutionFlags_ilpGenerated_set(swigCPtr, this, value); + } + + public boolean getIlpGenerated() { + return LibraryInterfaceJNI.SolutionFlags_ilpGenerated_get(swigCPtr, this); + } + + public void setOptimal(boolean value) { + LibraryInterfaceJNI.SolutionFlags_optimal_set(swigCPtr, this, value); + } + + public boolean getOptimal() { + return LibraryInterfaceJNI.SolutionFlags_optimal_get(swigCPtr, this); + } + + public void setGapSize(double value) { + LibraryInterfaceJNI.SolutionFlags_gapSize_set(swigCPtr, this, value); + } + + public double getGapSize() { + return LibraryInterfaceJNI.SolutionFlags_gapSize_get(swigCPtr, this); + } + +} diff --git a/src/main/resources/YoshikoStrings.properties b/src/main/resources/YoshikoStrings.properties index d7ed53dc4cc4d0c848491d2a1cba8fb2eea96272..124cb05dab86a475c35c82cb742a487b3d61b398 100644 --- a/src/main/resources/YoshikoStrings.properties +++ b/src/main/resources/YoshikoStrings.properties @@ -53,3 +53,11 @@ icTooltip = This value is used to determine what the algorithm pays when inserti operationMode = Operation Mode run = Perform Algorithm nodes = Nodes +continueTimeout = The ILP has exceeded the given time limit. Do you want to continue? (This may take a long time) +timeoutTitle = Timeout +incompleteResult = This run yielded no usable result! +optimal = Optimal Solution +notOptimal = Not Optimal Solution +ilpMarker = ILP Properties +timeoutMarker = Timed Out +gap = Gap