public class Hanoi
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
Hanoi.HanoiComponent
Component for displaying the towers.
|
Modifier and Type | Field and Description |
---|---|
static jadex.rules.state.OAVAttributeType |
agent_has_movegoals
Agent has move goals.
|
static jadex.rules.state.OAVAttributeType |
agent_has_tower_a
Agent has tower A.
|
static jadex.rules.state.OAVAttributeType |
agent_has_tower_b
Agent has tower B.
|
static jadex.rules.state.OAVAttributeType |
agent_has_tower_c
Agent has tower C.
|
static jadex.rules.state.OAVObjectType |
agent_type
The agent type.
|
static jadex.rules.state.OAVAttributeType |
disc_has_size
Disc has size.
|
static jadex.rules.state.OAVObjectType |
disc_type
The disc type.
|
static jadex.rules.state.OAVTypeModel |
hanoi_type_model
The type model.
|
static jadex.rules.state.OAVObjectType |
java_oavattribute_type
The java OAV atribute type.
|
static jadex.rules.state.OAVAttributeType |
movegoal_has_from
Move goal has from.
|
static jadex.rules.state.OAVAttributeType |
movegoal_has_number
Move goal has number.
|
static jadex.rules.state.OAVAttributeType |
movegoal_has_postcodition
Move goal has postcondition.
|
static jadex.rules.state.OAVAttributeType |
movegoal_has_precodition
Move goal has precondition.
|
static jadex.rules.state.OAVAttributeType |
movegoal_has_temp
Move goal has temp.
|
static jadex.rules.state.OAVAttributeType |
movegoal_has_to
Move goal has to.
|
static jadex.rules.state.OAVAttributeType |
movegoal_is_executing
Move goal is executing.
|
static jadex.rules.state.OAVObjectType |
movegoal_type
The move goal type.
|
Constructor and Description |
---|
Hanoi() |
Modifier and Type | Method and Description |
---|---|
static void |
benchmark(int maxdiscs)
Main for testing.
|
protected static java.lang.String |
calcOverhead(double benchmark,
double value)
calculates overhead of second value in percent.
|
protected static double |
calcTime(long start,
int times,
int discs)
calculates time per move in nanoseconds.
|
protected static jadex.rules.state.IOAVState |
createState()
Create an OAV state.
|
protected static jadex.rules.rulesystem.RuleSystem |
initializeRete(jadex.rules.state.IOAVState state,
boolean showrete)
Initialize Rete system.
|
protected static java.lang.Object |
initState(int discs,
jadex.rules.state.IOAVState state,
boolean showtowers)
Initialize the state with the given number of discs.
|
static void |
main(java.lang.String[] args)
Main for testing.
|
protected static void |
moveWithoutRete(jadex.rules.state.IOAVState state,
java.lang.Object agent,
jadex.rules.state.OAVAttributeType from,
jadex.rules.state.OAVAttributeType to,
jadex.rules.state.OAVAttributeType temp,
int num)
Solve the Hanoi puzzle using goals in state.
|
protected static void |
moveWithoutState(java.util.List from,
java.util.List to,
java.util.List temp,
int num)
Move some discs.
|
protected static void |
moveWithRete(jadex.rules.state.IOAVState state,
java.lang.Object agent,
jadex.rules.state.OAVAttributeType from,
jadex.rules.state.OAVAttributeType to,
jadex.rules.state.OAVAttributeType temp,
int num,
jadex.rules.rulesystem.RuleSystem rete,
boolean showrete)
Move some discs with Rete algorithm.
|
protected static void |
moveWithState(jadex.rules.state.IOAVState state,
java.lang.Object agent,
jadex.rules.state.OAVAttributeType from,
jadex.rules.state.OAVAttributeType to,
jadex.rules.state.OAVAttributeType temp,
int num)
Move some discs.
|
protected static java.lang.Object[] |
performMoveGoal(jadex.rules.state.IOAVState state,
java.lang.Object agent,
java.lang.Object goal)
Perform a single move goal.
|
protected static void |
performMoveGoalRecursive(jadex.rules.state.IOAVState state,
java.lang.Object agent,
java.lang.Object goal)
Recursively perform ove goals.
|
protected static void |
showFrame(jadex.rules.state.IOAVState state,
java.lang.Object agent)
Open a JFrame displaying the towers.
|
protected static void |
test(int discs,
int impl,
boolean showtowers,
boolean showrete)
Test method.
|
public static final jadex.rules.state.OAVTypeModel hanoi_type_model
public static final jadex.rules.state.OAVObjectType java_oavattribute_type
public static final jadex.rules.state.OAVObjectType agent_type
public static final jadex.rules.state.OAVAttributeType agent_has_tower_a
public static final jadex.rules.state.OAVAttributeType agent_has_tower_b
public static final jadex.rules.state.OAVAttributeType agent_has_tower_c
public static final jadex.rules.state.OAVAttributeType agent_has_movegoals
public static final jadex.rules.state.OAVObjectType disc_type
public static final jadex.rules.state.OAVAttributeType disc_has_size
public static final jadex.rules.state.OAVObjectType movegoal_type
public static final jadex.rules.state.OAVAttributeType movegoal_is_executing
public static final jadex.rules.state.OAVAttributeType movegoal_has_precodition
public static final jadex.rules.state.OAVAttributeType movegoal_has_postcodition
public static final jadex.rules.state.OAVAttributeType movegoal_has_from
public static final jadex.rules.state.OAVAttributeType movegoal_has_to
public static final jadex.rules.state.OAVAttributeType movegoal_has_temp
public static final jadex.rules.state.OAVAttributeType movegoal_has_number
public static void main(java.lang.String[] args)
protected static void test(int discs, int impl, boolean showtowers, boolean showrete)
protected static jadex.rules.state.IOAVState createState()
protected static java.lang.Object initState(int discs, jadex.rules.state.IOAVState state, boolean showtowers)
public static void benchmark(int maxdiscs)
protected static double calcTime(long start, int times, int discs)
protected static java.lang.String calcOverhead(double benchmark, double value)
protected static void moveWithoutRete(jadex.rules.state.IOAVState state, java.lang.Object agent, jadex.rules.state.OAVAttributeType from, jadex.rules.state.OAVAttributeType to, jadex.rules.state.OAVAttributeType temp, int num)
protected static void performMoveGoalRecursive(jadex.rules.state.IOAVState state, java.lang.Object agent, java.lang.Object goal)
protected static java.lang.Object[] performMoveGoal(jadex.rules.state.IOAVState state, java.lang.Object agent, java.lang.Object goal)
protected static void showFrame(jadex.rules.state.IOAVState state, java.lang.Object agent)
protected static void moveWithState(jadex.rules.state.IOAVState state, java.lang.Object agent, jadex.rules.state.OAVAttributeType from, jadex.rules.state.OAVAttributeType to, jadex.rules.state.OAVAttributeType temp, int num)
state
- The state.agent
- The agent.from
- The tower to move from.to
- The tower to move to.temp
- The tower for temporarily holding discs.num
- The number of discs to move.protected static void moveWithoutState(java.util.List from, java.util.List to, java.util.List temp, int num)
from
- The tower to move from.to
- The tower to move to.temp
- The tower for temporarily holding discs.num
- The number of discs to move.protected static jadex.rules.rulesystem.RuleSystem initializeRete(jadex.rules.state.IOAVState state, boolean showrete)
state
- The state.showrete
- Show the rete structure in a JFrame.protected static void moveWithRete(jadex.rules.state.IOAVState state, java.lang.Object agent, jadex.rules.state.OAVAttributeType from, jadex.rules.state.OAVAttributeType to, jadex.rules.state.OAVAttributeType temp, int num, jadex.rules.rulesystem.RuleSystem rete, boolean showrete)
state
- The state.agent
- The agent.from
- The tower to move from.to
- The tower to move to.temp
- The tower for temporarily holding discs.num
- The number of discs to move.