From: <jom...@us...> - 2016-04-18 14:41:28
|
Revision: 1905 http://sourceforge.net/p/jason/svn/1905 Author: jomifred Date: 2016-04-18 14:41:25 +0000 (Mon, 18 Apr 2016) Log Message: ----------- do at least one sense cycle Modified Paths: -------------- trunk/src/jason/asSemantics/Agent.java trunk/src/jason/asSemantics/TransitionSystem.java trunk/src/jason/infra/centralised/CentralisedAgArch.java trunk/src/jason/infra/centralised/RunCentralisedMAS.java Modified: trunk/src/jason/asSemantics/Agent.java =================================================================== --- trunk/src/jason/asSemantics/Agent.java 2016-04-13 22:22:03 UTC (rev 1904) +++ trunk/src/jason/asSemantics/Agent.java 2016-04-18 14:41:25 UTC (rev 1905) @@ -561,9 +561,7 @@ try { for (Term t: ASSyntax.parseList("["+sBels+"]")) { Literal b = ((Literal)t).forceFullLiteralImpl(); - if (!b.hasSource()) - b.addAnnot(BeliefBase.TSelf); - getBB().add(b); + addBel(b); } } catch (Exception e) { logger.log(Level.WARNING, "Initial beliefs from project '["+sBels+"]' is not a list of literals."); Modified: trunk/src/jason/asSemantics/TransitionSystem.java =================================================================== --- trunk/src/jason/asSemantics/TransitionSystem.java 2016-04-13 22:22:03 UTC (rev 1904) +++ trunk/src/jason/asSemantics/TransitionSystem.java 2016-04-18 14:41:25 UTC (rev 1905) @@ -1499,9 +1499,8 @@ stepAct = State.ProcAct; do { - if (!getUserAgArch().isRunning()) return; applySemanticRuleAct(); - } while (stepAct != State.StartRC); + } while (stepAct != State.StartRC && getUserAgArch().isRunning()); ActionExec action = C.getAction(); Modified: trunk/src/jason/infra/centralised/CentralisedAgArch.java =================================================================== --- trunk/src/jason/infra/centralised/CentralisedAgArch.java 2016-04-13 22:22:03 UTC (rev 1904) +++ trunk/src/jason/infra/centralised/CentralisedAgArch.java 2016-04-18 14:41:25 UTC (rev 1905) @@ -193,20 +193,23 @@ TransitionSystem ts = getTS(); int i = 0; - while (running && i++ < cyclesSense && !ts.canSleepSense()) { - ts.sense(); - } + do { + ts.sense(); // must run at least once, so that perceive() is called + } while (running && ++i < cyclesSense && !ts.canSleepSense()); } + //int sumDel = 0; int nbDel = 0; protected void deliberate() { TransitionSystem ts = getTS(); - int i = 0; while (running && i++ < cyclesDeliberate && !ts.canSleepDeliberate()) { ts.deliberate(); } + //sumDel += i; nbDel++; + //System.out.println("running del "+(sumDel/nbDel)+"/"+cyclesDeliberate); } + //int sumAct = 0; int nbAct = 0; protected void act() { TransitionSystem ts = getTS(); @@ -218,6 +221,8 @@ while (running && i++ < ca && !ts.canSleepAct()) { ts.act(); } + //sumAct += i; nbAct++; + //System.out.println("running act "+(sumAct/nbAct)+"/"+ca); } protected void reasoningCycle() { @@ -297,6 +302,7 @@ // Default perception assumes Complete and Accurate sensing. @Override public Collection<Literal> perceive() { + super.perceive(); if (infraEnv == null) return null; Collection<Literal> percepts = infraEnv.getUserEnvironment().getPercepts(getAgName()); if (logger.isLoggable(Level.FINE) && percepts != null) logger.fine("percepts: " + percepts); @@ -356,7 +362,8 @@ /** called by the TS to ask the execution of an action in the environment */ @Override public void act(ActionExec action) { - if (logger.isLoggable(Level.FINE)) logger.info("doing: " + action.getActionTerm()); + //if (logger.isLoggable(Level.FINE)) logger.fine("doing: " + action.getActionTerm()); + super.act(action); if (isRunning() && infraEnv != null) infraEnv.act(getAgName(), action); } Modified: trunk/src/jason/infra/centralised/RunCentralisedMAS.java =================================================================== --- trunk/src/jason/infra/centralised/RunCentralisedMAS.java 2016-04-13 22:22:03 UTC (rev 1904) +++ trunk/src/jason/infra/centralised/RunCentralisedMAS.java 2016-04-18 14:41:25 UTC (rev 1905) @@ -841,8 +841,7 @@ if (project.getInfrastructure().getParametersArray().length > 4) { cycles = Integer.parseInt(project.getInfrastructure().getParameter(5)); } else { - cycles = 5; - + cycles = 5; } } else if (project.getInfrastructure().getParametersArray().length > 2) { cycles = Integer.parseInt(project.getInfrastructure().getParameter(2)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |