genopt
Class WinGenOpt

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by genopt.WinGenOpt
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class WinGenOpt
extends javax.swing.JFrame
implements java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.WindowListener

Object for optimizing an objective function computed by a simulation program.

This project was carried out at:

and supported by

Copyright Notice

GenOpt Copyright (c) 1998-2011, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.

If you have questions about your rights to use or distribute this software, please contact Berkeley Lab's Technology Transfer Department at TTD@lbl.gov.

NOTICE. This software was developed under partial funding from the U.S. Department of Energy. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, prepare derivative works, and perform publicly and display publicly. Beginning five (5) years after the date permission to assert copyright is obtained from the U.S. Department of Energy, and subject to any subsequent five (5) year renewals, the U.S. Government is granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, prepare derivative works, distribute copies to the public, perform publicly and display publicly, and to permit others to do so.

License agreement

GenOpt Copyright (c) 1998-2011, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

(1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

(2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

(3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, U.S. Dept. of Energy nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

You are under no obligation whatsoever to provide any bug fixes, patches, or upgrades to the features, functionality or performance of the source code ("Enhancements") to anyone; however, if you choose to make your Enhancements available either publicly, or directly to Lawrence Berkeley National Laboratory, without imposing a separate written license agreement for such Enhancements, then you hereby grant the following license: a non-exclusive, royalty-free perpetual license to install, use, modify, prepare derivative works, incorporate into other computer software, distribute, and sublicense such enhancements or derivative works thereof, in binary and source code form.

Version:
GenOpt(R) 3.1.0 (December 8, 2011)

Author:
Michael Wetter
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  javax.swing.JMenu aboutMenu
          About menu
protected  javax.swing.JButton[] button
          Start button
protected static int BUTTONCHART
           
protected static int BUTTONSPLIT
           
protected static int BUTTONSTART
          Button Constants
protected static int BUTTONSTOP
           
protected  javax.swing.JMenu chartMenu
          Chart menu
protected  javax.swing.JMenuItem chartMenu_Change
          Chart menu -> Change
protected  int[] disOrd
          order in which data series are displayed
protected  javax.swing.JMenu fileMenu
          File menu
protected  javax.swing.JMenuItem fileMenu_Start
          File menu -> Start
protected  javax.swing.JMenuItem fileMenu_Stop
          File menu -> Stop
protected  GenOpt go
          GenOpt Object
protected  LineChart lc
          LineChart
private static java.lang.String LS
          System dependent line separator
protected  int nDisSer
          number of displayed data series
protected  boolean optRuns
          flag whether an optimization is currently in progress
protected  javax.swing.JPanel panel
          Panel
private  Preference pref
          user preference
protected  ResultManager resMan
          reference to ResultManager
protected  javax.swing.JScrollPane scTa
          scroll pane for the text area
protected  DataSerie[] se
          DataSeries
private static java.lang.String SEELOGFILEFORERROR
           
private static long serialVersionUID
          The serial version number
protected  javax.swing.JSplitPane splPan
          Split Pane
protected  boolean splPanHor
          flag whether split pane is horizontal or vertical
protected  FlowTextArea ta
          text area displaying online result (shell piping)
protected  javax.swing.JTabbedPane tabPan
          Tabbed Pane
protected  javax.swing.JViewport taVp
          Viewport of the text area
protected  javax.swing.JToolBar toolBar
          Toolbar
protected  javax.swing.JMenu windowMenu
          Windows menu
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
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
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
WinGenOpt()
          Constructor for WinGenOpt
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          performs the ActionEvent
 void append(java.lang.String text)
          appends text to the text field
private  void buildContainer()
          builds the container
protected  void changeDataSeries()
          sets the order in which the series are displayed
protected  void exitWinGenOpt()
          exits WinGenOpt
 void finalizeOptimization()
          finalizes optimization
protected  java.io.File getIniStartUpFile()
          gets the initialization startup file
 java.lang.String getSeparator()
          gets the separator, as specified in properties.txt
private  void handleThrowable(java.lang.Throwable t)
          handles an exception which was thrown by GenOpt
 void initializeSeries(ResultManager res)
          initializes the DataSerie
 boolean isDebug()
          checks whether we should run in debug mode
 void itemStateChanged(java.awt.event.ItemEvent evt)
          performs the ItemEvent if the item state changed
static void main(java.lang.String[] args)
          The main routine
 void printError(java.lang.String text)
          prints an error message to the output device
private  void resetDiagramProperties()
          reset the diagram properties
 void setNewTrial()
          sets a new optimization trial
private  void setupGeneralSplitPane()
          sets up the general setting of the split pane
private  void setupHorizontalSplitPane()
          sets up the horizontal split pane
private  void setupLineChart()
          sets up the line chart
private  void setupMenuBar()
          sets up the menu bar
private  void setupProperties()
          sets up the properties
private  void setupTextArea()
          sets up the text area
private  void setupToolBar()
          sets up the tool bar
private  void setupVerticalSplitPane()
          sets up the vertical split pane
private  void setupWindow()
          sets up the window
protected  void showAboutGenOpt()
          displays the about window
protected  void startGenOpt()
          Starts GenOpt.
protected  void startGenOpt(java.io.File iniFil)
          Starts GenOpt
protected  int stopOptimization()
          displays a message box to stop GenOpt, and if the user selects OK, tells GenOpt to stop the optimization
protected  void updateChart()
          updates the online chart
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class javax.swing.JFrame
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
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
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, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
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, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, 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, isOpaque, 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, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

serialVersionUID

private static final long serialVersionUID
The serial version number

See Also:
Constant Field Values

LS

private static final java.lang.String LS
System dependent line separator


SEELOGFILEFORERROR

private static final java.lang.String SEELOGFILEFORERROR

BUTTONSTART

protected static final int BUTTONSTART
Button Constants

See Also:
Constant Field Values

BUTTONSTOP

protected static final int BUTTONSTOP
See Also:
Constant Field Values

BUTTONCHART

protected static final int BUTTONCHART
See Also:
Constant Field Values

BUTTONSPLIT

protected static final int BUTTONSPLIT
See Also:
Constant Field Values

go

protected GenOpt go
GenOpt Object


panel

protected javax.swing.JPanel panel
Panel


scTa

protected javax.swing.JScrollPane scTa
scroll pane for the text area


ta

protected FlowTextArea ta
text area displaying online result (shell piping)


taVp

protected javax.swing.JViewport taVp
Viewport of the text area


fileMenu

protected javax.swing.JMenu fileMenu
File menu


fileMenu_Start

protected javax.swing.JMenuItem fileMenu_Start
File menu -> Start


fileMenu_Stop

protected javax.swing.JMenuItem fileMenu_Stop
File menu -> Stop


toolBar

protected javax.swing.JToolBar toolBar
Toolbar


button

protected javax.swing.JButton[] button
Start button


chartMenu

protected javax.swing.JMenu chartMenu
Chart menu


chartMenu_Change

protected javax.swing.JMenuItem chartMenu_Change
Chart menu -> Change


windowMenu

protected javax.swing.JMenu windowMenu
Windows menu


aboutMenu

protected javax.swing.JMenu aboutMenu
About menu


tabPan

protected javax.swing.JTabbedPane tabPan
Tabbed Pane


splPan

protected javax.swing.JSplitPane splPan
Split Pane


lc

protected LineChart lc
LineChart


se

protected DataSerie[] se
DataSeries


nDisSer

protected int nDisSer
number of displayed data series


disOrd

protected int[] disOrd
order in which data series are displayed


resMan

protected ResultManager resMan
reference to ResultManager


optRuns

protected boolean optRuns
flag whether an optimization is currently in progress


pref

private Preference pref
user preference


splPanHor

protected boolean splPanHor
flag whether split pane is horizontal or vertical

Constructor Detail

WinGenOpt

public WinGenOpt()
Constructor for WinGenOpt

Method Detail

setupProperties

private void setupProperties()
sets up the properties


setupWindow

private void setupWindow()
sets up the window


setupMenuBar

private void setupMenuBar()
sets up the menu bar


setupToolBar

private void setupToolBar()
sets up the tool bar


setupTextArea

private void setupTextArea()
sets up the text area


setupLineChart

private void setupLineChart()
sets up the line chart


setupHorizontalSplitPane

private void setupHorizontalSplitPane()
sets up the horizontal split pane


setupVerticalSplitPane

private void setupVerticalSplitPane()
sets up the vertical split pane


setupGeneralSplitPane

private void setupGeneralSplitPane()
sets up the general setting of the split pane


buildContainer

private void buildContainer()
builds the container


resetDiagramProperties

private void resetDiagramProperties()
reset the diagram properties


changeDataSeries

protected void changeDataSeries()
sets the order in which the series are displayed


initializeSeries

public void initializeSeries(ResultManager res)
initializes the DataSerie

Parameters:
res - reference to the result manager

setNewTrial

public void setNewTrial()
sets a new optimization trial


updateChart

protected void updateChart()
updates the online chart


append

public void append(java.lang.String text)
appends text to the text field

Parameters:
text - the text to be appended

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
performs the ActionEvent

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
evt - the action event

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent evt)
performs the ItemEvent if the item state changed

Specified by:
itemStateChanged in interface java.awt.event.ItemListener
Parameters:
evt - the item event

startGenOpt

protected void startGenOpt()
Starts GenOpt. This method opens an file chooser to let the user select the optimization initialization file. Then, it calls startGenOpt(File) to start the optimization.


startGenOpt

protected void startGenOpt(java.io.File iniFil)
Starts GenOpt

Parameters:
iniFil - optimization initialization file.

handleThrowable

private void handleThrowable(java.lang.Throwable t)
handles an exception which was thrown by GenOpt

Parameters:
t - the thrown exception

exitWinGenOpt

protected void exitWinGenOpt()
exits WinGenOpt


stopOptimization

protected int stopOptimization()
displays a message box to stop GenOpt, and if the user selects OK, tells GenOpt to stop the optimization

Returns:
0 if OK has been selected, 1 otherwise

showAboutGenOpt

protected void showAboutGenOpt()
displays the about window


printError

public void printError(java.lang.String text)
prints an error message to the output device

Parameters:
text - the text to be printed

finalizeOptimization

public void finalizeOptimization()
finalizes optimization


getIniStartUpFile

protected java.io.File getIniStartUpFile()
gets the initialization startup file

Returns:
the initialization file startup file

getSeparator

public java.lang.String getSeparator()
gets the separator, as specified in properties.txt

Returns:
the separator

isDebug

public boolean isDebug()
checks whether we should run in debug mode

Returns:
true if we run in debug mode, false otherwise

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

main

public static void main(java.lang.String[] args)
The main routine