public class LunarLanderDomain extends java.lang.Object implements DomainGenerator
The agent object class is made up of 5 attributes, x-y position, x-y velocity, and the angle or orientation (in radians from the default vertical orientation). Two other object classes are defined for landing pads and obstacles. Both are objects are defined as a rectangular region with a left, right, bottom, and top attribute defining the space. Typically, the goal is for the agent to land on the land pad while avoiding the obstacles.
The domain generator allows the client to specify the physics and action definitions for the lunar lander. In particular the client can add as many thrust actions (each with their own thrust force) as desired, the force of gravity can be changed, the size of the domain (that is, the x space and y space in which the agent can fly before hitting a "wall") can be changed, the maximum lander rotation can be set, and the rotate increment size that results from applying a clockwise/counterclockwise rotate action can also be set. There is also a method to set the domain to a standard set of physics and actions.
If the domain generator physics parameters are changed after a domain has been generated, the previously generated domain will remain unaffected, allowing you to reuse the same domain generator to produce different versions of the domain without conflict.
Modifier and Type | Class and Description |
---|---|
static class |
LunarLanderDomain.LLPhysicsParams
A class for holding the physics parameters
|
class |
LunarLanderDomain.OnPadPF
A propositional function that evaluates to true if the agent has landed on the top surface of a landing pad.
|
static class |
LunarLanderDomain.ThrustType |
class |
LunarLanderDomain.TouchGroundPF
A propositional function that evaluates to true if the agent is touching the ground.
|
class |
LunarLanderDomain.TouchPadPF
A propositional function that evaluates to true if the agent is touching any part of the landing pad, including its
side boundaries.
|
class |
LunarLanderDomain.TouchSurfacePF
A propositional function that evaluates to true if the agent is touching any part of an obstacle, including its
side boundaries.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ACTION_IDLE
Constant for the name of the idle action which causes the agent to do nothing by drift for a time step
|
static java.lang.String |
ACTION_THRUST
Constant for the base name of thrust actions.
|
static java.lang.String |
ACTION_TURN_LEFT
Constant for the name of the turn/rotate left/counterclockwise action
|
static java.lang.String |
ACTION_TURN_RIGHT
Constant for the name of the turn/rotate right/clockwise action
|
static java.lang.String |
CLASS_AGENT
Constant for the name of the agent OO-MDP class
|
static java.lang.String |
CLASS_OBSTACLE
Constant for the name of the obstacle OO-MDP class
|
static java.lang.String |
CLASS_PAD
Constant for the name of the goal landing pad OO-MDP class
|
static java.lang.String |
PF_ON_GROUND
Constant for the name of the propositional function that indicates whether the agent/lander is on the ground
|
static java.lang.String |
PF_ON_PAD
Constant for the name of the propositional function that indicates whether the agent/lander is on a landing pad
|
static java.lang.String |
PF_TOUCH_SURFACE
Constant for the name of the propositional function that indicates whether the agent/lander is touching
an obstacle surface.
|
static java.lang.String |
PF_TOUTCH_PAD
Constant for the name of the propositional function that indicates whether the agent/lander is *touching* a landing pad.
|
protected LunarLanderDomain.LLPhysicsParams |
physParams
An object for holding the physics parameters of this domain.
|
protected RewardFunction |
rf |
protected TerminalFunction |
tf |
protected java.util.List<java.lang.Double> |
thrustValues
List of the thrust forces for each thrust action
|
static java.lang.String |
VAR_ANGLE
Constant for the name of the angle of orientation attribute.
|
static java.lang.String |
VAR_BOTTOM
Constant for the name of the bottom boundary attribute for rectangular obstacles and landing pads
|
static java.lang.String |
VAR_LEFT
Constant for the name of the left boundary attribute for rectangular obstacles and landing pads
|
static java.lang.String |
VAR_RIGHT
Constant for the name of the right boundary attribute for rectangular obstacles and landing pads
|
static java.lang.String |
VAR_TOP
Constant for the name of the top boundary attribute for rectangular obstacles and landing pads
|
static java.lang.String |
VAR_VX
Constant for the name of the x velocity attribute.
|
static java.lang.String |
VAR_VY
Constant for the name of the y velocity attribute.
|
static java.lang.String |
VAR_X
Constant for the name of the x position attribute.
|
static java.lang.String |
VAR_Y
Constant for the name of the y position attribute.
|
Constructor and Description |
---|
LunarLanderDomain()
Initializes with no thrust actions set.
|
Modifier and Type | Method and Description |
---|---|
void |
addStandardThrustActions()
Adds two standard thrust actions.
|
void |
addThrustActionWithThrust(double t)
Adds a thrust action with thrust force t
|
OOSADomain |
generateDomain()
Returns a newly instanced Domain object
|
java.util.List<PropositionalFunction> |
generatePfs() |
double |
getAnginc()
Returns how many radians the agent will rotate from its current orientation when a turn/rotate action is applied
|
double |
getAngmax()
Returns the maximum rotate angle (in radians) that the lander can be rotated from the vertical orientation in either
clockwise or counterclockwise direction.
|
LunarLanderDomain.LLPhysicsParams |
getPhysParams() |
RewardFunction |
getRf() |
TerminalFunction |
getTf() |
double |
getVmax()
Returns the maximum velocity of the agent (the agent cannot move faster than this value).
|
double |
getXmax()
Returns the maximum x position of the lander (the agent cannot cross this boundary)
|
double |
getXmin()
Returns the minimum x position of the lander (the agent cannot cross this boundary)
|
double |
getYmax()
Returns the maximum y position of the lander (the agent cannot cross this boundary)
|
double |
getYmin()
Returns the minimum y position of the lander (the agent cannot cross this boundary)
|
static void |
main(java.lang.String[] args)
This method will launch a visual explorer for the lunar lander domain.
|
void |
setAnginc(double anginc)
Sets how many radians the agent will rotate from its current orientation when a turn/rotate action is applied
|
void |
setAngmax(double angmax)
Sets the maximum rotate angle (in radians) that the lander can be rotated from the vertical orientation in either
clockwise or counterclockwise direction.
|
void |
setGravity(double g)
Sets the gravity of the domain
|
void |
setPhysParams(LunarLanderDomain.LLPhysicsParams physParams) |
void |
setRf(RewardFunction rf) |
void |
setTf(TerminalFunction tf) |
void |
setToStandardLunarLander()
Sets the domain to use a standard set of physics and with a standard set of two thrust actions.
|
void |
setVmax(double vmax)
Sets the maximum velocity of the agent (the agent cannot move faster than this value).
|
void |
setXmax(double xmax)
Sets the maximum x position of the lander (the agent cannot cross this boundary)
|
void |
setXmin(double xmin)
Sets the minimum x position of the lander (the agent cannot cross this boundary)
|
void |
setYmax(double ymax)
Sets the maximum y position of the lander (the agent cannot cross this boundary)
|
void |
setYmin(double ymin)
Sets the minimum y position of the lander (the agent cannot cross this boundary)
|
public static final java.lang.String VAR_X
public static final java.lang.String VAR_Y
public static final java.lang.String VAR_VX
public static final java.lang.String VAR_VY
public static final java.lang.String VAR_ANGLE
public static final java.lang.String VAR_LEFT
public static final java.lang.String VAR_RIGHT
public static final java.lang.String VAR_BOTTOM
public static final java.lang.String VAR_TOP
public static final java.lang.String CLASS_AGENT
public static final java.lang.String CLASS_OBSTACLE
public static final java.lang.String CLASS_PAD
public static final java.lang.String ACTION_TURN_LEFT
public static final java.lang.String ACTION_TURN_RIGHT
public static final java.lang.String ACTION_THRUST
public static final java.lang.String ACTION_IDLE
public static final java.lang.String PF_ON_PAD
public static final java.lang.String PF_TOUTCH_PAD
public static final java.lang.String PF_TOUCH_SURFACE
public static final java.lang.String PF_ON_GROUND
protected java.util.List<java.lang.Double> thrustValues
protected LunarLanderDomain.LLPhysicsParams physParams
protected RewardFunction rf
protected TerminalFunction tf
public LunarLanderDomain()
public void addThrustActionWithThrust(double t)
t
- the thrust of the thrust force to addpublic LunarLanderDomain.LLPhysicsParams getPhysParams()
public void setPhysParams(LunarLanderDomain.LLPhysicsParams physParams)
public void setGravity(double g)
g
- the force of gravitypublic double getXmin()
public void setXmin(double xmin)
xmin
- the minimum x position of the lander (the agent cannot cross this boundary)public double getXmax()
public void setXmax(double xmax)
xmax
- the maximum x position of the lander (the agent cannot cross this boundary)public double getYmin()
public void setYmin(double ymin)
ymin
- the minimum y position of the lander (the agent cannot cross this boundary)public double getYmax()
public void setYmax(double ymax)
ymax
- the maximum y position of the lander (the agent cannot cross this boundary)public double getVmax()
public void setVmax(double vmax)
vmax
- the maximum velocity of the agent (the agent cannot move faster than this value).public double getAngmax()
public void setAngmax(double angmax)
angmax
- the maximum rotate angle (in radians) that the lander can be rotatedpublic double getAnginc()
public void setAnginc(double anginc)
anginc
- how many radians the agent will rotate from its current orientation when a turn/rotate action is appliedpublic TerminalFunction getTf()
public void setTf(TerminalFunction tf)
public RewardFunction getRf()
public void setRf(RewardFunction rf)
public void setToStandardLunarLander()
gravity = -0.2
xmin = 0
xmax = 100
ymin = 0
ymax = 50
max velocity component speed = 4
maximum angle of rotation = pi/4
change in angle from turning = pi/20
thrust1 force = 0.32
thrust2 force = 0.2 (opposite gravity)
public void addStandardThrustActions()
thrust1 force = 0.32
thrust2 force = 0.2 (opposite gravity)
public java.util.List<PropositionalFunction> generatePfs()
public OOSADomain generateDomain()
DomainGenerator
generateDomain
in interface DomainGenerator
public static void main(java.lang.String[] args)
w: heavy thrust
s: weak thrust
a: turn/rotate counterclockwise
d: turn/rotate clockwise
x: idle (drift for one time step)
If you pass the main method "t" as an argument, a terminal explorer will be used instead of a visual explorer.
args
- optionally pass "t" asn argument to use a terminal explorer instead of a visual explorer.