public class ValueFunctionVisualizerGUI
extends javax.swing.JFrame
implements java.awt.event.ItemListener
javax.swing.JFrame.AccessibleJFrame
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
Modifier and Type | Field and Description |
---|---|
protected int |
cHeight
Visualizer canvas height
|
protected int |
cWidth
Visualizer canvas width
|
protected PolicyRenderLayer |
pLayer
The policy renderer
|
protected StaticDomainPainter |
sdp
Painter used to visualize general state-independent domain information
|
protected javax.swing.JCheckBox |
showPolicy
The button to enable the visualization of the policy
|
protected StatePolicyPainter |
spp
Painter used to visualize the policy
|
protected java.util.List<State> |
statesToVisualize |
protected StateValuePainter |
svp
Painter used to visualize the value function
|
protected ValueFunctionRenderLayer |
vfLayer
The value function renderer
|
protected MultiLayerRenderer |
visualizer
The multi-layer render layer canvas
|
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
ValueFunctionVisualizerGUI(java.util.List<State> states,
StateValuePainter svp,
ValueFunction valueFunction)
Initializes the visualizer GUI.
|
Modifier and Type | Method and Description |
---|---|
static ValueFunctionVisualizerGUI |
createGridWorldBasedValueFunctionVisualizerGUI(java.util.List<State> states,
ValueFunction valueFunction,
Policy p,
java.lang.Object xVar,
java.lang.Object yVar,
VariableDomain xRange,
VariableDomain yRange,
double xWidth,
double yWidth,
java.lang.String northActionName,
java.lang.String southActionName,
java.lang.String eastActionName,
java.lang.String westActionName)
A method for creating common 2D arrow glyped value function and policy visualization.
|
MultiLayerRenderer |
getMultiLayerRenderer()
Returns the
MultiLayerRenderer used in this GUI. |
StatePolicyPainter |
getSpp()
Returns the state-wise policy painter
|
StateValuePainter |
getSvp()
Returns the State-wise value function painter
|
void |
initGUI()
Initializes the GUI and presents it to the user.
|
void |
itemStateChanged(java.awt.event.ItemEvent e)
Called when the check back for the policy rendering is checked or unchecked.
|
void |
setBgColor(java.awt.Color col)
Sets the canvas background color
|
void |
setPolicy(Policy p)
Sets the policy to render
|
void |
setSpp(StatePolicyPainter spp)
Sets the state-wise policy painter
|
void |
setSvp(StateValuePainter svp)
Sets the state-wise value function painter
|
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected MultiLayerRenderer visualizer
protected ValueFunctionRenderLayer vfLayer
protected PolicyRenderLayer pLayer
protected StateValuePainter svp
protected StatePolicyPainter spp
protected java.util.List<State> statesToVisualize
protected StaticDomainPainter sdp
protected javax.swing.JCheckBox showPolicy
protected int cWidth
protected int cHeight
public ValueFunctionVisualizerGUI(java.util.List<State> states, StateValuePainter svp, ValueFunction valueFunction)
states
- the states whose value should be rendered.svp
- the value function state visualizer to use.valueFunction
- the valueFunction that can return the state values.public static ValueFunctionVisualizerGUI createGridWorldBasedValueFunctionVisualizerGUI(java.util.List<State> states, ValueFunction valueFunction, Policy p, java.lang.Object xVar, java.lang.Object yVar, VariableDomain xRange, VariableDomain yRange, double xWidth, double yWidth, java.lang.String northActionName, java.lang.String southActionName, java.lang.String eastActionName, java.lang.String westActionName)
ArrowActionGlyph
objects. The GUI will not be launched by default; call the initGUI()
on the returned object to start it.states
- the states whose value should be rendered.valueFunction
- the valueFunction that can return the state values.p
- the policy to renderxVar
- the variable key for the x variableyVar
- the variable key for the y variablexRange
- xRange the range of the x variableyRange
- the range of the y variablexWidth
- the width of each rendered state within the x domainyWidth
- the width of the each rendered state within the y domainnorthActionName
- the name of the north actionsouthActionName
- the name of the south actioneastActionName
- the name of the east actionwestActionName
- the name of the west actionValueFunctionVisualizerGUI
public MultiLayerRenderer getMultiLayerRenderer()
MultiLayerRenderer
used in this GUI.MultiLayerRenderer
used in this GUI.public StateValuePainter getSvp()
public void setSvp(StateValuePainter svp)
svp
- state-wise value function painterpublic StatePolicyPainter getSpp()
public void setSpp(StatePolicyPainter spp)
spp
- the state-wise policy painterpublic void setBgColor(java.awt.Color col)
col
- the canvas background colorpublic void setPolicy(Policy p)
p
- the policy to renderpublic void initGUI()
public void itemStateChanged(java.awt.event.ItemEvent e)
itemStateChanged
in interface java.awt.event.ItemListener