Skip to content

Implemented algorithms for both requests and reports processing in PropositionNodes and RuleNodes #192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
17cd675
initial revision for deduce method
ylkhayat Mar 28, 2019
be5d8de
migrate deduce method to class PropositionNode
ylkhayat Mar 29, 2019
ca15865
initialized two matching classes and declared some functions to adapt…
ylkhayat Apr 5, 2019
db76d23
handling different cases for RuleNode processSingleRequestsChannel
ylkhayat Apr 7, 2019
51ae7a4
migrate alreadyWorking to NodeSet
ylkhayat Apr 13, 2019
3815172
checkpoint before feedback modifications over Requests handling and p…
ylkhayat Apr 18, 2019
0229584
fixing processSingleRequestsChannel in RuleNode
ylkhayat Apr 24, 2019
7bd3260
defined new Class VariableNodeStats for easier logic and changed the …
ylkhayat Apr 25, 2019
95e165d
changed OrNode support type to Hashtable, fixed isWhQuestion to use c…
ylkhayat Apr 26, 2019
ce2f443
combined last two cases for RuleNode processRequests before deletion
ylkhayat Apr 26, 2019
24a649e
applied modifications for latest cases in processRequestsChannel
ylkhayat Apr 26, 2019
c067af3
finalized handling requests before May's feedback
ylkhayat May 2, 2019
9ca83b1
implemented rule node reports processing
ylkhayat May 8, 2019
a281555
latest checkpoint on 12/5, report support changed to propset, modifie…
ylkhayat May 11, 2019
8ab7e61
finalized reports handling for a proposition node and modified multip…
ylkhayat May 19, 2019
2174961
minor modifications to Channel and Match classes
ylkhayat May 20, 2019
4d9d260
renamed ReportInstances to KnownInstances and finalized report proces…
ylkhayat May 23, 2019
20ed4ee
added switch substitutions for the ChannelIdentifier class
ylkhayat May 23, 2019
b2bb841
added another match method and initiated test methods
ylkhayat May 27, 2019
ffce72c
added helpful prints and some tests in snip/Test
ylkhayat Jun 2, 2019
dd85045
fixed incorrect algorithm for computing VariableNodeStats in LinearSu…
ylkhayat Jun 5, 2019
699b5cc
added toString methods for data structures for visual content during …
ylkhayat Jun 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,070 changes: 1,507 additions & 1,563 deletions src/sneps/gui/FXController.java

Large diffs are not rendered by default.

463 changes: 209 additions & 254 deletions src/sneps/network/Network.java

Large diffs are not rendered by default.

62 changes: 27 additions & 35 deletions src/sneps/network/Node.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
package sneps.network;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import sneps.network.cables.DownCableSet;
import sneps.network.cables.UpCable;
import sneps.network.cables.UpCableSet;
import sneps.network.classes.Semantic;
import sneps.network.classes.term.Molecular;
import sneps.network.classes.term.Open;
import sneps.network.classes.term.Term;
import sneps.network.classes.term.Variable;
import sneps.network.classes.setClasses.NodeSet;
import sneps.network.classes.setClasses.VariableSet;
import sneps.snebr.Context;
import sneps.snebr.Controller;
import sneps.snip.Pair;
import sneps.snip.Runner;
import sneps.snip.channels.AntecedentToRuleChannel;
import sneps.snip.channels.Channel;
import sneps.snip.channels.ChannelTypes;
import sneps.snip.channels.MatchChannel;
import sneps.snip.channels.RuleToConsequentChannel;
import sneps.snip.classes.VariableNodeStats;
import sneps.snip.matching.LinearSubstitutions;
import sneps.snip.matching.Substitutions;

public class Node implements Serializable {
Expand All @@ -25,7 +41,7 @@ public Node() {
public Node(Term trm) {
term = trm;
id = count++;
if(this.getTerm() instanceof Molecular) {
if (this.getTerm() instanceof Molecular) {
this.updateUpCables();
}
}
Expand All @@ -39,7 +55,7 @@ public Node(Semantic sem, Term trm) {
semanticType = sem;
term = trm;
id = count++;
if(this.getTerm() instanceof Molecular) {
if (this.getTerm() instanceof Molecular) {
this.updateUpCables();
}
}
Expand Down Expand Up @@ -104,6 +120,7 @@ public String getIdentifier() {
public UpCableSet getUpCableSet() {
return this.term.getUpCableSet();
}


/**
*
Expand All @@ -127,8 +144,7 @@ public String toString() {
* This method overrides the default equals method inherited from the Object
* class.
*
* @param obj
* an Object that is to be compared to the current node to check
* @param obj an Object that is to be compared to the current node to check
* whether they are equal.
*
* @return true if the given object is an instance of the Node class and has the
Expand All @@ -144,8 +160,11 @@ public boolean equals(Object obj) {
}

public void receiveRequest(Channel newChannel) {
// TODO Auto-generated method stub
Runner.addToLowQueue(this);
}

public void receiveReport(Channel newChannel) {
Runner.addToHighQueue(this);
}

public void processReports() {
Expand Down Expand Up @@ -187,41 +206,14 @@ public NodeSet getDominatingRules() {
return ret;
}

public boolean isWhQuestion(Substitutions sub) {
/*
* if (!this.getIdentifier().equalsIgnoreCase("patternnode")) return false;
*
* PatternNode node = (PatternNode) this; LinkedList<VariableNode> variables =
* node.getFreeVariables();
*
* for (int i = 0; i < variables.size(); i++) { Node termNode =
* sub.term(variables.get(i)); if (termNode == null ||
* (!termNode.getIdentifier().equalsIgnoreCase("basenode"))) return true;
*
* }
*/
return false;
}




Context fake() {
return null;
}

public void deduce(Node node) {
/*
* Runner.initiate(); NodeSet dominatingRules = getDominatingRules();
* sendRequests(dominatingRules, channel.getFilter().getSubstitution(),
* channel.getContextID(), ChannelTypes.RuleCons); //
* System.out.println("#$#$#$#$# 1"); try { List<Object[]> matchesReturned =
* Matcher.Match(this); if(matchesReturned != null) { ArrayList<Pair> matches =
* new ArrayList<Pair>(); for(Object[] match : matchesReturned) { Pair newPair =
* new Pair((Substitutions)match[1], (Substitutions)match[2], (Node)match[0]);
* matches.add(newPair); } sendRequests(matches, channel.getContextID(),
* ChannelTypes.MATCHED); } } catch (Exception e) { e.printStackTrace(); }
* Runner.run(); // what to return here ?
*/
}

public void setTerm(Term term) {
this.term = term;
}
Expand Down
Loading