net.sf.gluebooster.java.booster.basic.math.planning.Planning Maven / Gradle / Ivy
package net.sf.gluebooster.java.booster.basic.math.planning;
import java.awt.Frame;
import java.util.Collection;
import java.util.Hashtable;
import net.sf.gluebooster.java.booster.basic.container.BoostedNode;
import net.sf.gluebooster.java.booster.basic.container.BoostedNodeUtils;
import net.sf.gluebooster.java.booster.basic.math.Operation;
import net.sf.gluebooster.java.booster.basic.math.graph.BoostedNodeGraph;
import net.sf.gluebooster.java.booster.basic.math.graph.GraphDisplayConfiguration;
import net.sf.gluebooster.java.booster.essentials.eventsCommands.Callable;
import net.sf.gluebooster.java.booster.essentials.math.Condition;
import net.sf.gluebooster.java.booster.essentials.meta.HasName;
import net.sf.gluebooster.java.booster.essentials.objects.BoostedObject;
/**
* Configuration of (one step of) the planning.
*
*/
public class Planning extends BoostedObject {
/**
* The generated plan.
*/
private Plan plan;
/**
* The environment of the planning.
*/
private PlannerEnv env;
public Planning() {
}
public Planning(Plan plan, PlannerEnv env) {
this.plan = plan;
this.env = env;
}
/**
* Create a planning with a plan with one node
*
* @param planWithOnlyOneOperation
* the operation of the node
* @param world
* the world of the planning
*/
public Planning(
Operation planWithOnlyOneOperation,
World world) throws Exception {
plan = new Plan();
plan.initialize(world, planWithOnlyOneOperation);
setEnv(new PlannerEnv());
}
public Plan getPlan() {
return plan;
}
public void setPlan(Plan plan) {
this.plan = plan;
}
public PlannerEnv getEnv() {
return env;
}
public void setEnv(PlannerEnv env) {
this.env = env;
}
/**
* Log some information at info level
*
* @param objectsToLog
* the information
*/
public void info(Object... objectsToLog) {
getEnv().getPlanningLog().info(objectsToLog);
}
/**
* Log some information at debug level
*
* @param objectsToLog
* the information
*/
public void debug(Object... objectsToLog) {
getEnv().getPlanningLog().info(objectsToLog);
}
/**
* Log some information at warn level
*
* @param objectsToLog
* the information
*/
public void warn(Object... objectsToLog) {
getEnv().getPlanningLog().info(objectsToLog);
}
/**
* Log some information at error level
*
* @param objectsToLog
* the information
*/
public void error(Object... objectsToLog) {
getEnv().getPlanningLog().info(objectsToLog);
}
/**
* Transforms an unsolved node of the plan into a subgraph and replaces the node by the subgraph.
*
* @param unsolvedNodeOfPlan
* the node to be transformed
* @param transformer
* the transformer of the node
* @return true if something has been done
*/
public boolean transformNode(BoostedNode unsolvedNodeOfPlan,
Callable