Skip to content
Snippets Groups Projects
Commit 691ebc9c authored by Philipp Spohr's avatar Philipp Spohr
Browse files

Basic CyRest support for core algorithm

parent 8fea1b05
Branches
Tags
No related merge requests found
...@@ -117,7 +117,7 @@ public class CyActivator extends AbstractCyActivator { ...@@ -117,7 +117,7 @@ public class CyActivator extends AbstractCyActivator {
Properties props = new Properties(); Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "yoshiko"); props.setProperty(COMMAND_NAMESPACE, "yoshiko");
props.setProperty(COMMAND, YoshikoCommand.PERFORM_ALGORITHM.toString()); props.setProperty(COMMAND, YoshikoCommand.PERFORM_ALGORITHM.toString());
props.setProperty(COMMAND_DESCRIPTION,"TEST PERFORM ALGORITHM"); props.setProperty(COMMAND_DESCRIPTION,"Cluster a network with the Yoshiko algorithm");
registerService(context, commandTaskFactory, TaskFactory.class, props); registerService(context, commandTaskFactory, TaskFactory.class, props);
//Initialize and register main panel //Initialize and register main panel
......
...@@ -8,21 +8,40 @@ public class ParameterSet { ...@@ -8,21 +8,40 @@ public class ParameterSet {
@Tunable(description="Time Limit for the ILP mode", context="nogui") @Tunable(description="Time Limit for the ILP mode", context="nogui")
public int timeLimit = -1; public int timeLimit = -1;
@Tunable(description="A column in the edge table containing weights", context="nogui") @Tunable(description="A column in the edge table containing weights", context="nogui")
public CyColumn weightColumn; public CyColumn weightColumn;
@Tunable(description="A column containing boolean entries for edges that are to be treated as permanent",context="nogui")
public CyColumn permanentColumn; public CyColumn permanentColumn;
@Tunable(description="A column containing boolean entries for edges that are to be treated as forbidden",context="nogui")
public CyColumn forbiddenColumn; public CyColumn forbiddenColumn;
public double defaultInsertionCost;
public double defaultDeletionCost; @Tunable(description="The default insertion cost that is to be used for non-existing edges",context="nogui")
public String reductionRulesBitMask; public double defaultInsertionCost = -1;
public double snrMultFactor; @Tunable(description="The default deletion cost that is to be used for edges without an associated weight",context="nogui")
public boolean useTriangleCuts; public double defaultDeletionCost = 1;
public boolean usePartitionCuts;
public boolean useHeuristic; @Tunable(description="A bitmask representing which reduction rules should be used",context="nogui") //TODO: Filter bad bitmasks
public int solCount; public String reductionRulesBitMask = "000000";
@Tunable(description="A value controlling the resolution of the SNR reduction rule. Higher values mean a longer running time but possibly better reduction.",context="nogui")
public double snrMultFactor = 1.0;
@Tunable(description="Alternative Callback for CPLEX, might be faster on certain instances",context="nogui")
public boolean useTriangleCuts = false;
@Tunable(description="Alternative Callback for CPLEX, might be faster on large instances",context="nogui")
public boolean usePartitionCuts = false;
@Tunable(description="Uses a heuristic instead of ILP to solve WCE, significantly faster",context="nogui")
public boolean useHeuristic = true;
@Tunable(description="The maximum number of (optimal) solutions that is to be calculated",context="nogui")
public int solCount = 1;
@Tunable(description="Disable multithreading to keep the system responsive",context="nogui")
public boolean disableMultiThreading; public boolean disableMultiThreading;
@Tunable(description="Automatically choose an appopriate set of reduction rules (overrides a given bitmask)",context="nogui")
/**Describes whether auto configuration of the reduction rules is to be used. Overrides the bit mask.**/ /**Describes whether auto configuration of the reduction rules is to be used. Overrides the bit mask.**/
public boolean suggestReduction; public boolean suggestReduction = true;
} }
...@@ -6,14 +6,14 @@ import org.cytoscape.model.CyColumn; ...@@ -6,14 +6,14 @@ import org.cytoscape.model.CyColumn;
import org.cytoscape.model.CyEdge; import org.cytoscape.model.CyEdge;
import org.cytoscape.model.CyNetwork; import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyRow; import org.cytoscape.model.CyRow;
import org.slf4j.Logger; //import org.slf4j.Logger;
import de.hhu.ba.yoshikoWrapper.logging.YoshikoLogger; //import de.hhu.ba.yoshikoWrapper.logging.YoshikoLogger;
public class GraphAnalyzer { public class GraphAnalyzer {
private static Logger logger = YoshikoLogger.getInstance().getLogger(); //private static Logger logger = YoshikoLogger.getInstance().getLogger();
public static boolean isMultiGraph(CyNetwork net) { public static boolean isMultiGraph(CyNetwork net) {
//TODO: Better algorithm? //TODO: Better algorithm?
...@@ -38,6 +38,13 @@ public class GraphAnalyzer { ...@@ -38,6 +38,13 @@ public class GraphAnalyzer {
return false; return false;
} }
/**
* Checks whether two edges connect the same pair of nodes
* This function is symmetric
* @param e1 An arbitrary CyEdge
* @param e2 An arbitrary CyEdge
* @return true if the edges connect the same pair of nodes, false otherwise
*/
private static boolean connectSameNodes(CyEdge e1, CyEdge e2) { private static boolean connectSameNodes(CyEdge e1, CyEdge e2) {
if (//Treating all edges as undirected here if (//Treating all edges as undirected here
(e1.getSource() == e2.getTarget() && e1.getTarget() == e2.getSource()) || (e1.getSource() == e2.getTarget() && e1.getTarget() == e2.getSource()) ||
...@@ -61,7 +68,7 @@ public class GraphAnalyzer { ...@@ -61,7 +68,7 @@ public class GraphAnalyzer {
* Generates a fitting bitmask by choosing the reduction rules that appear to be the best choice based on current research * Generates a fitting bitmask by choosing the reduction rules that appear to be the best choice based on current research
* @param containsRealValues * @param containsRealValues
* @param heuristic * @param heuristic
* @return * @return The bitmask as a String
*/ */
public static String suggestReductionRules(boolean containsRealValues, boolean heuristic) { public static String suggestReductionRules(boolean containsRealValues, boolean heuristic) {
......
...@@ -18,6 +18,9 @@ public enum YoshikoCommand { ...@@ -18,6 +18,9 @@ public enum YoshikoCommand {
if (this==PERFORM_ALGORITHM) { if (this==PERFORM_ALGORITHM) {
return "cluster"; //TODO: Dynamic return "cluster"; //TODO: Dynamic
} }
else if (this==CREATE_CLUSTER_VIEW) {
return "createcvs";
}
return "null"; return "null";
} }
} }
......
...@@ -76,7 +76,7 @@ public class AlgorithmTask extends AbstractTask implements ObservableTask { ...@@ -76,7 +76,7 @@ public class AlgorithmTask extends AbstractTask implements ObservableTask {
public ParameterSet parameterSet = null; public ParameterSet parameterSet = null;
@Tunable(description="Network to analyze for clusters", context="nogui") @Tunable(description="Network to analyze for clusters", context="nogui")
public CyNetwork net; public CyNetwork net = CyCore.cy.getCurrentNetwork();
//Temps, pointing to and need to be freed in C++ //Temps, pointing to and need to be freed in C++
private LibraryInput c_input; private LibraryInput c_input;
...@@ -289,7 +289,7 @@ public class AlgorithmTask extends AbstractTask implements ObservableTask { ...@@ -289,7 +289,7 @@ public class AlgorithmTask extends AbstractTask implements ObservableTask {
@Override @Override
public <R> R getResults(Class<? extends R> type) { public <R> R getResults(Class<? extends R> type) {
//TODO: //TODO: Return Result in some format that is suitable for console applications
if (type.equals(YoshikoResult.class)) { if (type.equals(YoshikoResult.class)) {
return (R) (result!=null ? result : null); return (R) (result!=null ? result : null);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment