jadex.gpmn.runtime.plan.GoalHierarchyExecutionPlan Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-kernel-gpmn Show documentation
Show all versions of jadex-kernel-gpmn Show documentation
The Jadex GPMN (goal oriented process modeling
notation) kernel provides a goal-oriented workflow
kernel. The idea is that a workflow is specified as
declarative goal hierarchy, which describes what has
to be achieved to fulfill the workflow. At runtime
goals are pursued by executing plans represented by
standard BPMN workflows. The execution of goal-based
workflows is achieved by conversion to BDI agents.
package jadex.gpmn.runtime.plan;
import jadex.bdi.runtime.IGoal;
import jadex.bdi.runtime.Plan;
import jadex.commons.SUtil;
/**
* Create subgoals according to the goal hierarchy specified in plan parameters.
* The 'subgoals' parameter set denotes the names of goals to create.
* The 'mode' parameter specifies the execution mode ('sequential' or 'parallel').
*/
public class GoalHierarchyExecutionPlan extends Plan
{
/**
* Plan body.
*/
public void body()
{
String[] subgoals = (String[]) getParameterSet("subgoals").getValues();
String mode = (String) getParameter("mode").getValue();
System.out.println("Goal decomposition: "+mode+SUtil.arrayToString(subgoals));
if("parallel".equals(mode))
{
IGoal[] goals = new IGoal[subgoals.length];
for(int i=0; i