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

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

Go to download

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

The 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;


/**
 *  Walk to the least visited positions.
 *  Uses a relative measure to go to seldom seen positions.
 */
public class LeastSeenWalkPlan extends Plan
{
	//-------- constructors --------

	/**
	 *  Create a new plan.
	 */
	public LeastSeenWalkPlan()
	{
//		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_seen").execute();
		MapPoint mp = (MapPoint)mps.get(0);
		IVector1 dist = env.getDistance(mypos, mp.getLocation());
		int cnt	= 1;
		
		for( ; cnt




© 2015 - 2025 Weber Informatics LLC | Privacy Policy