All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jadex.bdi.examples.cleanerworld.cleaner.ExploreMapPlan Maven / Gradle / Ivy

Go to download

The Jadex BDI applications package contain several example applications, benchmarks and testcases using BDI agents.

There is a newer version: 2.4
Show newest version
package jadex.bdi.examples.cleanerworld.cleaner;

import jadex.bdi.runtime.IGoal;
import jadex.bdi.runtime.Plan;
import jadex.extension.envsupport.environment.space2d.Space2D;
import jadex.extension.envsupport.math.IVector1;
import jadex.extension.envsupport.math.IVector2;

import java.util.List;


/**
 *  Plan to explore the map by going to the seldom visited positions.
 *  Uses the absolute quantity to go to positions that are not yet
 *  explored.
 */
public class ExploreMapPlan extends Plan
{
	//-------- constructors --------

	/**
	 *  Create a new plan.
	 */
	public ExploreMapPlan()
	{
//		getLogger().info("Created: "+this+" for goal "+getRootGoal());
	}

	//-------- methods --------

	/**
	 *  The plan body.
	 */
	public void body()
	{
		// Use shortest not seen point
		Space2D env = (Space2D)getBeliefbase().getBelief("environment").getFact();
		IVector2 mypos = (IVector2)getBeliefbase().getBelief("my_location").getFact();

		List	mps = (List)getExpression("query_min_quantity").execute();
		MapPoint mp = (MapPoint)mps.get(0);
		IVector1 dist = env.getDistance(mypos, mp.getLocation());
		int cnt	= 1;
		
		for( ; cnt




© 2015 - 2024 Weber Informatics LLC | Privacy Policy