From: <jom...@us...> - 2016-03-13 11:31:41
|
Revision: 1877 http://sourceforge.net/p/jason/svn/1877 Author: jomifred Date: 2016-03-13 11:31:38 +0000 (Sun, 13 Mar 2016) Log Message: ----------- .relevant_plans can have a var as first arg Modified Paths: -------------- trunk/examples/contract-net-protocol/c.asl trunk/src/jason/stdlib/relevant_plans.java trunk/src/jason/stdlib/remove_plan.java Modified: trunk/examples/contract-net-protocol/c.asl =================================================================== --- trunk/examples/contract-net-protocol/c.asl 2016-03-07 13:22:11 UTC (rev 1876) +++ trunk/examples/contract-net-protocol/c.asl 2016-03-13 11:31:38 UTC (rev 1877) @@ -1,9 +1,9 @@ /* Initial beliefs and rules */ all_proposals_received(CNPId) - :- .count(introduction(participant,_),NP) & // number of participants - .count(propose(CNPId,_), NO) & // number of proposes received - .count(refuse(CNPId), NR) & // number of refusals received + :- .count(introduction(participant,_),NP) & // number of participants + .count(propose(CNPId,_)[source(_)], NO) & // number of proposes received + .count(refuse(CNPId)[source(_)], NR) & // number of refusals received NP = NO + NR. /* Initial goals */ Modified: trunk/src/jason/stdlib/relevant_plans.java =================================================================== --- trunk/src/jason/stdlib/relevant_plans.java 2016-03-07 13:22:11 UTC (rev 1876) +++ trunk/src/jason/stdlib/relevant_plans.java 2016-03-13 11:31:38 UTC (rev 1877) @@ -63,6 +63,8 @@ <li> <code>.relevant_plans({+!go(X,Y)},LP, LL)</code>: same as above but also unifies LL with a list of labels of plans in LP.</li> + <li> <code>.relevant_plans({+!_},_,LL)</code>: gets the labels of all achievement goals.</li> + </ul> @see jason.stdlib.add_plan Modified: trunk/src/jason/stdlib/remove_plan.java =================================================================== --- trunk/src/jason/stdlib/remove_plan.java 2016-03-07 13:22:11 UTC (rev 1876) +++ trunk/src/jason/stdlib/remove_plan.java 2016-03-13 11:31:38 UTC (rev 1877) @@ -89,16 +89,14 @@ if (args.length > 1) { source = (Atom)args[1]; } - if (label.isList()) { // arg[0] is a list - boolean r = true; - ListTerm lt = (ListTerm)args[0]; - for (Term t: lt) { - r = r && ts.getAg().getPL().remove((Atom)t, source); + for (Term t: (ListTerm)args[0]) { + //r = r && ts.getAg().getPL().remove((Atom)t, source); + ts.getAg().getPL().remove((Atom)t, source); } - return r; } else { // args[0] is a plan label - return ts.getAg().getPL().remove((Atom)label, source); + ts.getAg().getPL().remove((Atom)label, source); } + return true; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |