bdi4jade

Graphic Blocks World

4/8/2014 10:17:59 PM

Details

diff --git a/bdi-jade/src/bdi4jade/belief/AbstractBeliefSet.java b/bdi-jade/src/bdi4jade/belief/AbstractBeliefSet.java
index 953ccad..2ebe2ab 100644
--- a/bdi-jade/src/bdi4jade/belief/AbstractBeliefSet.java
+++ b/bdi-jade/src/bdi4jade/belief/AbstractBeliefSet.java
@@ -68,7 +68,8 @@ public abstract class AbstractBeliefSet<T> extends AbstractBelief<Set<T>>
 	public final void addValue(T value) {
 		if (!hasValue(value)) {
 			addSetValue(value);
-			notifyBeliefBases(new BeliefEvent(this, Action.BELIEF_ADDED, value));
+			notifyBeliefBases(new BeliefEvent(this,
+					Action.BELIEF_SET_VALUE_ADDED, value));
 		}
 	}
 
@@ -81,7 +82,8 @@ public abstract class AbstractBeliefSet<T> extends AbstractBelief<Set<T>>
 	public final boolean removeValue(T value) {
 		boolean removed = removeSetValue(value);
 		if (removed) {
-			notifyBeliefBases(new BeliefEvent(this, Action.BELIEF_ADDED, value));
+			notifyBeliefBases(new BeliefEvent(this,
+					Action.BELIEF_SET_VALUE_REMOVED, value));
 		}
 		return removed;
 	}
diff --git a/bdi-jade/src/bdi4jade/event/BeliefEvent.java b/bdi-jade/src/bdi4jade/event/BeliefEvent.java
index f819e6d..c594399 100644
--- a/bdi-jade/src/bdi4jade/event/BeliefEvent.java
+++ b/bdi-jade/src/bdi4jade/event/BeliefEvent.java
@@ -138,4 +138,13 @@ public class BeliefEvent implements AgentAction {
 		this.belief = belief;
 	}
 
+	@Override
+	public String toString() {
+		StringBuffer sb = new StringBuffer();
+		sb.append(getClass().getSimpleName()).append("\n");
+		sb.append("Belief: ").append(belief).append("\n");
+		sb.append("Action: ").append(action).append(" - ").append(args);
+		return sb.toString();
+	}
+
 }
diff --git a/bdi-jade-test/APDescription.txt b/bdi-jade-test/APDescription.txt
index f5daa80..398983c 100644
--- a/bdi-jade-test/APDescription.txt
+++ b/bdi-jade-test/APDescription.txt
@@ -1 +1 @@
-( ap-description  :name "143.54.13.160:1099/JADE" :ap-services (set ( ap-service  :name fipa.mts.mtp.http.std :type fipa.mts.mtp.http.std :addresses (sequence http://IngridNunes-PC.inf.ufrgs.br:7778/acc))))
+( ap-description  :name "192.168.0.2:1099/JADE" :ap-services (set ( ap-service  :name fipa.mts.mtp.http.std :type fipa.mts.mtp.http.std :addresses (sequence http://ingrid-asus:7778/acc))))
diff --git a/bdi-jade-test/MTPs-Main-Container.txt b/bdi-jade-test/MTPs-Main-Container.txt
index 08cdd31..6b6c35d 100644
--- a/bdi-jade-test/MTPs-Main-Container.txt
+++ b/bdi-jade-test/MTPs-Main-Container.txt
@@ -1 +1 @@
-http://IngridNunes-PC.inf.ufrgs.br:7778/acc
+http://ingrid-asus:7778/acc
diff --git a/bdi-jade-test/src/bdi4jade/examples/blocksworld/BlocksWorldApp.java b/bdi-jade-test/src/bdi4jade/examples/blocksworld/BlocksWorldApp.java
new file mode 100644
index 0000000..dc0256b
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/blocksworld/BlocksWorldApp.java
@@ -0,0 +1,103 @@
+/*
+ * Created on 8 Apr 2014 18:58:13
+ */
+package bdi4jade.examples.blocksworld;
+
+import jade.BootProfileImpl;
+import jade.core.ProfileImpl;
+import jade.wrapper.AgentContainer;
+import jade.wrapper.AgentController;
+import jade.wrapper.PlatformController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.PropertyConfigurator;
+
+import bdi4jade.event.GoalEvent;
+import bdi4jade.event.GoalListener;
+import bdi4jade.examples.AgentStarter;
+import bdi4jade.examples.blocksworld.domain.On;
+import bdi4jade.examples.blocksworld.domain.Thing;
+import bdi4jade.examples.blocksworld.goal.AchieveBlocksStacked;
+
+/**
+ * @author ingrid
+ * 
+ */
+public class BlocksWorldApp implements GoalListener {
+
+	private static final On[] target = { new On(Thing.BLOCK_5, Thing.TABLE),
+			new On(Thing.BLOCK_4, Thing.BLOCK_5),
+			new On(Thing.BLOCK_3, Thing.BLOCK_4),
+			new On(Thing.BLOCK_2, Thing.BLOCK_3),
+			new On(Thing.BLOCK_1, Thing.BLOCK_2) };
+
+	public static void main(String[] args) {
+		PropertyConfigurator.configure(AgentStarter.class
+				.getResource("log4j.properties"));
+		new BlocksWorldApp();
+	}
+
+	private ProfileImpl bootProfile;
+	private final Log log;
+	private jade.core.Runtime runtime;
+
+	public BlocksWorldApp() {
+		log = LogFactory.getLog(this.getClass());
+
+		List<String> params = new ArrayList<String>();
+		params.add("-gui");
+		params.add("-detect-main:false");
+
+		log.info("Plataform parameters: " + params);
+
+		this.bootProfile = new BootProfileImpl(params.toArray(new String[0]));
+
+		this.runtime = jade.core.Runtime.instance();
+		PlatformController controller = runtime
+				.createMainContainer(bootProfile);
+		try {
+			BlocksWorldAgent agent = new BlocksWorldAgent();
+			BlocksWorldView view = new BlocksWorldView(agent
+					.getRootCapability().getBeliefBase());
+			createAndShowUI(view);
+
+			AgentController ac = ((AgentContainer) controller).acceptNewAgent(
+					agent.getClass().getSimpleName(), agent);
+			ac.start();
+
+			agent.addGoal(new AchieveBlocksStacked(target), this);
+		} catch (Exception e) {
+			log.error(e);
+		}
+	}
+
+	public void createAndShowUI(BlocksWorldView view) {
+		final JFrame frame = new JFrame();
+		frame.setTitle(BlocksWorldApp.class.getSimpleName());
+		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+		frame.setVisible(false);
+		frame.setContentPane(view);
+
+		frame.pack();
+		SwingUtilities.invokeLater(new Runnable() {
+			public void run() {
+				frame.setVisible(true);
+			}
+		});
+	}
+
+	@Override
+	public void goalPerformed(GoalEvent event) {
+		if (event.getGoal() instanceof AchieveBlocksStacked) {
+			log.info("Goal achieved!!");
+		}
+	}
+
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/blocksworld/BlocksWorldView.java b/bdi-jade-test/src/bdi4jade/examples/blocksworld/BlocksWorldView.java
new file mode 100644
index 0000000..d1a9d95
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/blocksworld/BlocksWorldView.java
@@ -0,0 +1,152 @@
+/*
+ * Created on 8 Apr 2014 18:09:19
+ */
+package bdi4jade.examples.blocksworld;
+
+import java.awt.GridLayout;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.BorderFactory;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import bdi4jade.belief.BeliefBase;
+import bdi4jade.belief.BeliefSet;
+import bdi4jade.event.BeliefEvent;
+import bdi4jade.event.BeliefEvent.Action;
+import bdi4jade.event.BeliefListener;
+import bdi4jade.examples.blocksworld.domain.Clear;
+import bdi4jade.examples.blocksworld.domain.On;
+import bdi4jade.examples.blocksworld.domain.Thing;
+
+/**
+ * @author ingrid
+ * 
+ */
+public class BlocksWorldView extends JPanel implements BeliefListener {
+
+	class State {
+		String clear;
+		String onTable;
+		String stack1;
+		String stack2;
+	}
+
+	private static final long serialVersionUID = -754767782463259272L;
+
+	private final BeliefBase beliefBase;
+	private final JTextArea clearTextArea;
+	private final Log log;
+	private final JTextArea onTableTextArea;
+	private final JTextArea stack1TextArea;
+	private final JTextArea stack2TextArea;
+
+	public BlocksWorldView(BeliefBase beliefBase) {
+		super(new GridLayout(1, 4));
+		this.log = LogFactory.getLog(getClass());
+
+		this.beliefBase = beliefBase;
+		beliefBase.addBeliefListener(this);
+		this.stack1TextArea = new JTextArea();
+		stack1TextArea.setBorder(BorderFactory.createTitledBorder("On"));
+		this.stack2TextArea = new JTextArea();
+		stack2TextArea.setBorder(BorderFactory.createTitledBorder("On"));
+		this.clearTextArea = new JTextArea();
+		clearTextArea.setBorder(BorderFactory.createTitledBorder("Clear"));
+		this.onTableTextArea = new JTextArea();
+		onTableTextArea.setBorder(BorderFactory.createTitledBorder("Table"));
+
+		updateText(generateStateText());
+
+		this.add(stack1TextArea);
+		this.add(stack2TextArea);
+		this.add(clearTextArea);
+		this.add(onTableTextArea);
+	}
+
+	private State generateStateText() {
+		State state = new State();
+
+		BeliefSet<On> onBelief = (BeliefSet<On>) beliefBase
+				.getBelief(BlocksWorldAgent.BELIEF_ON);
+		BeliefSet<Clear> clearBelief = (BeliefSet<Clear>) beliefBase
+				.getBelief(BlocksWorldAgent.BELIEF_CLEAR);
+
+		List<Thing> tops = new ArrayList<>(2);
+		for (On on : onBelief.getValue()) {
+			if (clearBelief.hasValue(new Clear(on.getThing1()))
+					&& !on.getThing2().equals(Thing.TABLE)) {
+				tops.add(on.getThing1());
+			}
+		}
+
+		state.stack1 = "Empty";
+		state.stack2 = "Empty";
+		if (!tops.isEmpty()) {
+			state.stack1 = stackText(tops.get(0));
+		}
+		if (tops.size() > 1) {
+			state.stack2 = stackText(tops.get(1));
+		}
+
+		StringBuffer s = new StringBuffer();
+		for (Clear clear : clearBelief.getValue()) {
+			s.append(clear.getThing()).append("\n");
+		}
+		state.clear = s.toString();
+
+		s = new StringBuffer();
+		for (On on : onBelief.getValue()) {
+			if (on.getThing2().equals(Thing.TABLE)) {
+				s.append(on.getThing1()).append("\n");
+			}
+		}
+		state.onTable = s.toString();
+
+		return state;
+	}
+
+	private Thing getNext(Thing thing) {
+		BeliefSet<On> onBelief = (BeliefSet<On>) beliefBase
+				.getBelief(BlocksWorldAgent.BELIEF_ON);
+		for (On on : onBelief.getValue()) {
+			if (on.getThing1().equals(thing))
+				return on.getThing2();
+		}
+		return null;
+	}
+
+	private String stackText(Thing thing) {
+		StringBuffer s = new StringBuffer();
+		while (thing != null) {
+			s.append(thing).append("\n");
+			thing = getNext(thing);
+		}
+		return s.toString();
+	}
+
+	@Override
+	public void update(BeliefEvent beliefEvent) {
+		log.debug(beliefEvent);
+		if (Action.BELIEF_SET_VALUE_REMOVED.equals(beliefEvent.getAction()))
+			return;
+
+		// Ignore inconsistent states
+		updateText(generateStateText());
+		repaint();
+	}
+
+	private void updateText(final State state) {
+		JOptionPane.showMessageDialog(null, "Proceed?");
+		stack1TextArea.setText(state.stack1);
+		stack2TextArea.setText(state.stack2);
+		clearTextArea.setText(state.clear);
+		onTableTextArea.setText(state.onTable);
+	}
+
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/blocksworld/domain/Thing.java b/bdi-jade-test/src/bdi4jade/examples/blocksworld/domain/Thing.java
index ce2ed46..7f89c09 100644
--- a/bdi-jade-test/src/bdi4jade/examples/blocksworld/domain/Thing.java
+++ b/bdi-jade-test/src/bdi4jade/examples/blocksworld/domain/Thing.java
@@ -33,11 +33,7 @@ public interface Thing {
 	public static final Block BLOCK_3 = new Block(3);
 	public static final Block BLOCK_4 = new Block(4);
 	public static final Block BLOCK_5 = new Block(5);
-	public static final Block BLOCK_6 = new Block(6);
-	public static final Block BLOCK_7 = new Block(7);
-	public static final Block BLOCK_8 = new Block(8);
-	public static final Block BLOCK_9 = new Block(9);
 	public static final Thing[] THINGS = { TABLE, BLOCK_1, BLOCK_2, BLOCK_3,
-			BLOCK_4, BLOCK_5, BLOCK_6, BLOCK_7, BLOCK_8, BLOCK_9 };
+			BLOCK_4, BLOCK_5 };
 
 }
diff --git a/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/AchieveOnPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/AchieveOnPlanBody.java
index d1c2a36..4ecef17 100644
--- a/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/AchieveOnPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/AchieveOnPlanBody.java
@@ -22,15 +22,11 @@
 
 package bdi4jade.examples.blocksworld.plan;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import bdi4jade.examples.blocksworld.BlocksWorldCapability;
+import bdi4jade.examples.blocksworld.BlocksWorldAgent;
 import bdi4jade.examples.blocksworld.domain.Clear;
 import bdi4jade.examples.blocksworld.domain.On;
 import bdi4jade.examples.blocksworld.domain.Thing;
 import bdi4jade.examples.blocksworld.goal.PerformMove;
-import bdi4jade.goal.Goal;
 import bdi4jade.util.goal.BeliefSetValueGoal;
 import bdi4jade.util.plan.BeliefGoalPlanBody;
 
@@ -46,46 +42,33 @@ public class AchieveOnPlanBody extends BeliefGoalPlanBody {
 
 	private static final long serialVersionUID = -5919677537834351951L;
 
-	private Log log;
 	private Step step;
 	private Thing thing1;
 	private Thing thing2;
 
-	public AchieveOnPlanBody() {
-		this.log = LogFactory.getLog(this.getClass());
-	}
-
 	@Override
 	public void execute() {
 		switch (step) {
 		case CLEAR_1:
-			Goal goal = new BeliefSetValueGoal<Clear>(
-					BlocksWorldCapability.BELIEF_CLEAR, new Clear(thing1));
-			dispatchSubgoalAndListen(goal);
-			log.debug("Goal dispatched: " + goal);
+			dispatchSubgoalAndListen(new BeliefSetValueGoal<Clear>(
+					BlocksWorldAgent.BELIEF_CLEAR, new Clear(thing1)));
 			step = Step.WAIT_CLEAR_1;
-			break;
 		case WAIT_CLEAR_1:
 			if (getGoalEvent() != null) {
 				step = Step.CLEAR_2;
 			}
 			break;
 		case CLEAR_2:
-			goal = new BeliefSetValueGoal<Clear>(
-					BlocksWorldCapability.BELIEF_CLEAR, new Clear(thing2));
-			dispatchSubgoalAndListen(goal);
-			log.debug("Goal dispatched: " + goal);
+			dispatchSubgoalAndListen(new BeliefSetValueGoal<Clear>(
+					BlocksWorldAgent.BELIEF_CLEAR, new Clear(thing2)));
 			step = Step.WAIT_CLEAR_2;
-			break;
 		case WAIT_CLEAR_2:
 			if (getGoalEvent() != null) {
 				step = Step.PERFORM_MOVE;
 			}
 			break;
 		case PERFORM_MOVE:
-			goal = new PerformMove(thing1, thing2);
-			dispatchSubgoalAndListen(goal);
-			log.debug("Goal dispatched: " + goal);
+			dispatchSubgoalAndListen(new PerformMove(thing1, thing2));
 			step = Step.WAIT_DONE;
 			break;
 		case WAIT_DONE:
diff --git a/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/ClearPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/ClearPlanBody.java
index 2be9df5..03d7204 100644
--- a/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/ClearPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/ClearPlanBody.java
@@ -22,15 +22,11 @@
 
 package bdi4jade.examples.blocksworld.plan;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 import bdi4jade.belief.BeliefSet;
-import bdi4jade.examples.blocksworld.BlocksWorldCapability;
+import bdi4jade.examples.blocksworld.BlocksWorldAgent;
 import bdi4jade.examples.blocksworld.domain.Clear;
 import bdi4jade.examples.blocksworld.domain.On;
 import bdi4jade.examples.blocksworld.domain.Thing;
-import bdi4jade.goal.Goal;
 import bdi4jade.util.goal.BeliefSetValueGoal;
 import bdi4jade.util.plan.BeliefGoalPlanBody;
 
@@ -42,24 +38,17 @@ public class ClearPlanBody extends BeliefGoalPlanBody {
 
 	private static final long serialVersionUID = -5919677537834351951L;
 
-	private Log log;
 	private BeliefSet<On> onSet;
 	private Thing thing;
 
-	public ClearPlanBody() {
-		this.log = LogFactory.getLog(this.getClass());
-	}
-
 	@Override
 	public void execute() {
 		for (int i = 0; i < Thing.THINGS.length; i++) {
 			Thing t = Thing.THINGS[i];
 			On on = new On(t, thing);
 			if (onSet.hasValue(on)) {
-				Goal goal = new BeliefSetValueGoal<On>(
-						BlocksWorldCapability.BELIEF_ON, new On(t, Thing.TABLE));
-				dispatchSubgoalAndListen(goal);
-				log.debug("Goal dispatched: " + goal);
+				dispatchSubgoalAndListen(new BeliefSetValueGoal<On>(
+						BlocksWorldAgent.BELIEF_ON, new On(t, Thing.TABLE)));
 				getGoalEvent();
 				break;
 			}
@@ -71,7 +60,7 @@ public class ClearPlanBody extends BeliefGoalPlanBody {
 	public void onStart() {
 		super.onStart();
 		this.onSet = (BeliefSet<On>) getBeliefBase().getBelief(
-				BlocksWorldCapability.BELIEF_ON);
+				BlocksWorldAgent.BELIEF_ON);
 		BeliefSetValueGoal<Clear> achieveClear = (BeliefSetValueGoal<Clear>) getGoal();
 		this.thing = achieveClear.getValue().getThing();
 	}
diff --git a/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/PerformMovePlanBody.java b/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/PerformMovePlanBody.java
index 78ef183..cbf0f33 100644
--- a/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/PerformMovePlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/PerformMovePlanBody.java
@@ -22,11 +22,8 @@
 
 package bdi4jade.examples.blocksworld.plan;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 import bdi4jade.belief.BeliefSet;
-import bdi4jade.examples.blocksworld.BlocksWorldCapability;
+import bdi4jade.examples.blocksworld.BlocksWorldAgent;
 import bdi4jade.examples.blocksworld.domain.Clear;
 import bdi4jade.examples.blocksworld.domain.On;
 import bdi4jade.examples.blocksworld.domain.Thing;
@@ -43,35 +40,26 @@ public class PerformMovePlanBody extends AbstractPlanBody {
 	private static final long serialVersionUID = -5919677537834351951L;
 
 	private BeliefSet<Clear> clearSet;
-	private Log log;
 	private BeliefSet<On> onSet;
 	private Thing thing1;
 	private Thing thing2;
 
-	public PerformMovePlanBody() {
-		this.log = LogFactory.getLog(this.getClass());
-	}
-
 	@Override
 	public void action() {
-		if (!thing2.equals(Thing.TABLE)) {
-			clearSet.removeValue(new Clear(thing2));
-			log.debug("~" + new Clear(thing2));
-		}
-
 		for (Thing thing : Thing.THINGS) {
 			On on = new On(thing1, thing);
 			if (onSet.hasValue(on)) {
 				onSet.removeValue(on);
 				if (!Thing.TABLE.equals(thing)) {
 					clearSet.addValue(new Clear(thing));
-					log.debug(new Clear(thing));
 				}
 			}
 		}
 
+		if (!thing2.equals(Thing.TABLE)) {
+			clearSet.removeValue(new Clear(thing2));
+		}
 		onSet.addValue(new On(thing1, thing2));
-		log.debug(new On(thing1, thing2));
 
 		setEndState(EndState.SUCCESSFULL);
 	}
@@ -80,9 +68,9 @@ public class PerformMovePlanBody extends AbstractPlanBody {
 	@SuppressWarnings("unchecked")
 	public void onStart() {
 		this.onSet = (BeliefSet<On>) getBeliefBase().getBelief(
-				BlocksWorldCapability.BELIEF_ON);
+				BlocksWorldAgent.BELIEF_ON);
 		this.clearSet = (BeliefSet<Clear>) getBeliefBase().getBelief(
-				BlocksWorldCapability.BELIEF_CLEAR);
+				BlocksWorldAgent.BELIEF_CLEAR);
 		PerformMove goal = (PerformMove) getGoal();
 		this.thing1 = goal.getThing1();
 		this.thing2 = goal.getThing2();
diff --git a/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/TopLevelPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/TopLevelPlanBody.java
index 8cbe5e6..f40d28d 100644
--- a/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/TopLevelPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/blocksworld/plan/TopLevelPlanBody.java
@@ -25,10 +25,9 @@ package bdi4jade.examples.blocksworld.plan;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import bdi4jade.examples.blocksworld.BlocksWorldCapability;
+import bdi4jade.examples.blocksworld.BlocksWorldAgent;
 import bdi4jade.examples.blocksworld.domain.On;
 import bdi4jade.examples.blocksworld.goal.AchieveBlocksStacked;
-import bdi4jade.goal.Goal;
 import bdi4jade.plan.AbstractPlanBody;
 import bdi4jade.plan.Plan.EndState;
 import bdi4jade.util.goal.BeliefSetValueGoal;
@@ -60,10 +59,8 @@ public class TopLevelPlanBody extends AbstractPlanBody {
 		}
 		// Dispatch the next subgoal, if there are subgoals left
 		if (counter != target.length) {
-			Goal goal = new BeliefSetValueGoal<On>(
-					BlocksWorldCapability.BELIEF_ON, target[counter]);
-			dispatchSubgoalAndListen(goal);
-			log.debug("Goal dispatched: " + goal);
+			dispatchSubgoalAndListen(new BeliefSetValueGoal<On>(
+					BlocksWorldAgent.BELIEF_ON, target[counter]));
 		}
 		counter++;
 
diff --git a/bdi-jade-test/src/bdi4jade/examples/compositegoal/CompositeGoalCapability.java b/bdi-jade-test/src/bdi4jade/examples/compositegoal/CompositeGoalCapability.java
index 99d4360..71811a9 100644
--- a/bdi-jade-test/src/bdi4jade/examples/compositegoal/CompositeGoalCapability.java
+++ b/bdi-jade-test/src/bdi4jade/examples/compositegoal/CompositeGoalCapability.java
@@ -30,14 +30,14 @@ import org.apache.commons.logging.LogFactory;
 
 import bdi4jade.annotation.Parameter;
 import bdi4jade.annotation.Parameter.Direction;
-import bdi4jade.core.BeliefBase;
+import bdi4jade.belief.BeliefBase;
 import bdi4jade.core.Capability;
-import bdi4jade.core.PlanLibrary;
 import bdi4jade.event.GoalEvent;
 import bdi4jade.event.GoalFinishedEvent;
 import bdi4jade.event.GoalListener;
 import bdi4jade.goal.Goal;
 import bdi4jade.plan.Plan;
+import bdi4jade.plan.PlanLibrary;
 import bdi4jade.plan.SimplePlan;
 import bdi4jade.util.goal.CompositeGoal;
 import bdi4jade.util.goal.ParallelGoal;
diff --git a/bdi-jade-test/src/bdi4jade/examples/ping/PingPongCapability.java b/bdi-jade-test/src/bdi4jade/examples/ping/PingPongCapability.java
index f132068..9e7960b 100644
--- a/bdi-jade-test/src/bdi4jade/examples/ping/PingPongCapability.java
+++ b/bdi-jade-test/src/bdi4jade/examples/ping/PingPongCapability.java
@@ -27,10 +27,10 @@ import jade.lang.acl.MessageTemplate;
 import java.util.HashSet;
 import java.util.Set;
 
-import bdi4jade.core.BeliefBase;
+import bdi4jade.belief.BeliefBase;
 import bdi4jade.core.Capability;
-import bdi4jade.core.PlanLibrary;
 import bdi4jade.plan.Plan;
+import bdi4jade.plan.PlanLibrary;
 import bdi4jade.plan.SimplePlan;
 
 /**
diff --git a/bdi-jade-test/src/bdi4jade/examples/planfailed/PlanFailedCapability.java b/bdi-jade-test/src/bdi4jade/examples/planfailed/PlanFailedCapability.java
index 6c65c70..b58029f 100644
--- a/bdi-jade-test/src/bdi4jade/examples/planfailed/PlanFailedCapability.java
+++ b/bdi-jade-test/src/bdi4jade/examples/planfailed/PlanFailedCapability.java
@@ -28,14 +28,14 @@ import java.util.Set;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import bdi4jade.core.BeliefBase;
+import bdi4jade.belief.BeliefBase;
 import bdi4jade.core.Capability;
-import bdi4jade.core.PlanLibrary;
 import bdi4jade.event.GoalEvent;
 import bdi4jade.event.GoalFinishedEvent;
 import bdi4jade.event.GoalListener;
 import bdi4jade.goal.Goal;
 import bdi4jade.plan.Plan;
+import bdi4jade.plan.PlanLibrary;
 import bdi4jade.plan.SimplePlan;
 
 /**
diff --git a/bdi-jade-test/src/bdi4jade/examples/subgoal/SubgoalCapability.java b/bdi-jade-test/src/bdi4jade/examples/subgoal/SubgoalCapability.java
index 25bdaf9..8b8b60c 100644
--- a/bdi-jade-test/src/bdi4jade/examples/subgoal/SubgoalCapability.java
+++ b/bdi-jade-test/src/bdi4jade/examples/subgoal/SubgoalCapability.java
@@ -25,10 +25,10 @@ package bdi4jade.examples.subgoal;
 import java.util.HashSet;
 import java.util.Set;
 
-import bdi4jade.core.BeliefBase;
+import bdi4jade.belief.BeliefBase;
 import bdi4jade.core.Capability;
-import bdi4jade.core.PlanLibrary;
 import bdi4jade.plan.Plan;
+import bdi4jade.plan.PlanLibrary;
 import bdi4jade.plan.SimplePlan;
 
 /**