Commit 691ebc9c authored by Philipp Spohr's avatar Philipp Spohr
Browse files

Basic CyRest support for core algorithm

parent 8fea1b05
......@@ -117,7 +117,7 @@ public class CyActivator extends AbstractCyActivator {
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "yoshiko");
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);
//Initialize and register main panel
......
......@@ -8,21 +8,40 @@ public class ParameterSet {
@Tunable(description="Time Limit for the ILP mode", context="nogui")
public int timeLimit = -1;
@Tunable(description="A column in the edge table containing weights", context="nogui")
public CyColumn weightColumn;
@Tunable(description="A column containing boolean entries for edges that are to be treated as permanent",context="nogui")
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 double defaultInsertionCost;
public double defaultDeletionCost;
public String reductionRulesBitMask;
public double snrMultFactor;
public boolean useTriangleCuts;
public boolean usePartitionCuts;
public boolean useHeuristic;
public int solCount;
@Tunable(description="The default insertion cost that is to be used for non-existing edges",context="nogui")
public double defaultInsertionCost = -1;
@Tunable(description="The default deletion cost that is to be used for edges without an associated weight",context="nogui")
public double defaultDeletionCost = 1;
@Tunable(description="A bitmask representing which reduction rules should be used",context="nogui") //TODO: Filter bad bitmasks
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;
@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.**/
public boolean suggestReduction;
public boolean suggestReduction = true;
}
......@@ -6,14 +6,14 @@ import org.cytoscape.model.CyColumn;
import org.cytoscape.model.CyEdge;
import org.cytoscape.model.CyNetwork;
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 {
private static Logger logger = YoshikoLogger.getInstance().getLogger();
//private static Logger logger = YoshikoLogger.getInstance().getLogger();
public static boolean isMultiGraph(CyNetwork net) {
//TODO: Better algorithm?
......@@ -38,6 +38,13 @@ public class GraphAnalyzer {
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) {
if (//Treating all edges as undirected here
(e1.getSource() == e2.getTarget() && e1.getTarget() == e2.getSource()) ||
......@@ -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
* @param containsRealValues
* @param heuristic
* @return
* @return The bitmask as a String
*/
public static String suggestReductionRules(boolean containsRealValues, boolean heuristic) {
......
......@@ -18,6 +18,9 @@ public enum YoshikoCommand {
if (this==PERFORM_ALGORITHM) {
return "cluster"; //TODO: Dynamic
}
else if (this==CREATE_CLUSTER_VIEW) {
return "createcvs";
}
return "null";
}
}
......
......@@ -76,7 +76,7 @@ public class AlgorithmTask extends AbstractTask implements ObservableTask {
public ParameterSet parameterSet = null;
@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++
private LibraryInput c_input;
......@@ -289,7 +289,7 @@ public class AlgorithmTask extends AbstractTask implements ObservableTask {
@Override
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)) {
return (R) (result!=null ? result : null);
}
......
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