Class LearnInd

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--javax.swing.JApplet
                                |
                                +--LearnInd
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable
Direct Known Subclasses:
LearnIndAA

public class LearnInd
extends javax.swing.JApplet
implements java.awt.event.ActionListener

LearnInd.java
A java Applet-Application for simulating industries composed of NWFirms, GenFirms,XCSFirms and NNGenFirms.
NWFirms use a fixed R&D rule as in Nelson & Winter (1982).
GenFirms use a Genetic Algorithm to adjust their RD/Profit ratio to industry conditions.
XCSFirms use a XCS for learning.
NNGenFirms use a genetic algorithm where the fittness of each rule is the expected profit provided by an artificial neural network (ANN): NNeco.
When used as an application, LearnInd can save data on files xxx.*
where xxx is the radical fixed in the initialisation panel.


Permission to use, copy, modify, and distribute this
software and its documentation for NON-COMMERCIAL purposes
and without fee is hereby granted provided that this
copyright notice appears in all copies.
Last change: MY August 24, 2001
(c) Murat Yildizoglu, 2001

Version:
3.2 August 2001
Author:
Murat Yildizoglu
See Also:
Firm, NWFirm, GenFirm, XCSFirm, NNGenFirm, Serialized Form

Inner classes inherited from class javax.swing.JApplet
javax.swing.JApplet.AccessibleJApplet
 
Inner classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
 boolean autoFlush
           
 Cadre learnindCadre
          The user interface
 int LearnRate
          Learning rate of GenFirms
 ResultsWindow results
          The output Window
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LearnInd()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          The main part of the application.
 void close_file(java.io.PrintWriter s)
          An utility to close opened files.
 void closeAllFiles()
           
 void closeSimFiles()
           
 void computeEnv()
          Computes the Environment string to pass to XCSFirms' R&D rates.
 java.io.PrintWriter create_file(java.lang.String s)
          A utility to create new files for recording.
 void DataGen(int i0)
          Computes the shares of each type of firm in Total Capital and in Total
cumulated profits and other relative or average performance measures.
 double demand(double s)
          Computes the market price for the short term equilibrium.
 void IndProd()
          Computes the average and maximal productivities in the industry.
 double IndSupply()
          Computes the total supply of the industry and the shares of each type of firms in this supply
 void init()
          Initializes the interface.
 void InitDataGen()
          Initializes the variables that will be used to record
the performance of the industry and the firms.
 void initEnv()
          Initializes the ENV table for computing
the global environment that will be used by the XCSFirms
 void isChampion(int i0)
          Determines the champion of the industry (imax)
 void LearnInd()
           
 void printLog()
          Prints the log file that contains the description of the parameter values and the output files
 void report()
          Saves all the output of the model in the corresponding panels and files
(if fileoutput is chosen) and generates the data for the ResultsWindow.
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

learnindCadre

public Cadre learnindCadre
The user interface

results

public ResultsWindow results
The output Window

LearnRate

public int LearnRate
Learning rate of GenFirms

autoFlush

public boolean autoFlush
Constructor Detail

LearnInd

public LearnInd()
Method Detail

LearnInd

public void LearnInd()

init

public void init()
Initializes the interface.
Overrides:
init in class java.applet.Applet

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
The main part of the application.
Following the push of the Compute Button it reads the provided values
of the parameters and starts the simulation.
If the button Stop is pushed, it closes all open streams and closes
the application.
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - Determines the button used in Cadre
See Also:
Cadre

initEnv

public void initEnv()
Initializes the ENV table for computing
the global environment that will be used by the XCSFirms

computeEnv

public void computeEnv()
Computes the Environment string to pass to XCSFirms' R&D rates.

IndSupply

public double IndSupply()
Computes the total supply of the industry and the shares of each type of firms in this supply

IndProd

public void IndProd()
Computes the average and maximal productivities in the industry.
The average productivity is used in the measure of the tecnological
performance of industries.
The maximal productivity conditions the imitation of firms
See Also:
Firm

InitDataGen

public void InitDataGen()
Initializes the variables that will be used to record
the performance of the industry and the firms.

DataGen

public void DataGen(int i0)
Computes the shares of each type of firm in Total Capital and in Total
cumulated profits and other relative or average performance measures.
Parameters:
i0 - The index of the firm under scrunity

isChampion

public void isChampion(int i0)
Determines the champion of the industry (imax)
Parameters:
i0 - The index of the firm to test

demand

public double demand(double s)
Computes the market price for the short term equilibrium. This price results from the confrontation of total supply and demand. Demand function is a constant elasticity function.
Parameters:
s - Total supply
Returns:
Prix : The market price

report

public void report()
Saves all the output of the model in the corresponding panels and files
(if fileoutput is chosen) and generates the data for the ResultsWindow.
See Also:
ResultsWindow

printLog

public void printLog()
Prints the log file that contains the description of the parameter values and the output files

closeAllFiles

public void closeAllFiles()

closeSimFiles

public void closeSimFiles()

close_file

public void close_file(java.io.PrintWriter s)
An utility to close opened files.
Parameters:
s - The file to close

create_file

public java.io.PrintWriter create_file(java.lang.String s)
A utility to create new files for recording.
Parameters:
s - The name of the file to create