org.dbe.eve.simulator
Class SME

java.lang.Object
  extended by uchicago.src.sim.network.DefaultNode
      extended by uchicago.src.sim.network.DefaultDrawableNode
          extended by org.dbe.eve.simulator.SME
All Implemented Interfaces:
uchicago.src.sim.gui.Drawable2DGridNode, uchicago.src.sim.gui.DrawableNonGridNode, uchicago.src.sim.gui.Moveable, uchicago.src.sim.gui.NonGridDrawable, uchicago.src.sim.network.Node

public class SME
extends uchicago.src.sim.network.DefaultDrawableNode

Represents a SME

Author:
Roman

Nested Class Summary
 
Nested classes/interfaces inherited from class uchicago.src.sim.network.DefaultNode
uchicago.src.sim.network.DefaultNode.OrderedHashMap
 
Field Summary
private  double actingProbability
           
private  DemandedAndUsedServicePool demandedAndUsedServicePool
           
private  double fitness
           
(package private)  uchicago.src.sim.gui.RoundRectNetworkItem gUIItem
           
private  LocalServicePool localServicePool
           
(package private) static org.apache.log4j.Logger logger
           
private  int maxServicesOnDemand
           
private  int maxServicesOnOffer
           
private  int minServicesOnDemand
           
private  int minServicesOnOffer
           
private  EvEModel model
           
(package private) static MersenneTwister mt
           
private  java.util.HashMap partnerSMEs
           
private  java.lang.String PicPath
           
private  Prototype prototype
           
private  java.util.Vector<Service> ServicesOnOffer
           
private  java.awt.Color sMEColor
           
private  int sMEGroup
           
private  int sMEiD
           
private  java.awt.Color sMELabelColor
           
private  java.lang.String sMEName
           
 
Fields inherited from class uchicago.src.sim.network.DefaultDrawableNode
item
 
Fields inherited from class uchicago.src.sim.network.DefaultNode
inEdges, inMap, label, outEdges, outMap
 
Constructor Summary
SME(int newSMEiD, int color, int groupid, int x, int y)
           
SME(int newSMEiD, java.lang.String sMEName, int color, int groupid)
           
SME(int newSMEiD, java.lang.String sMEName, int color, int grouid, Prototype p)
           
 
Method Summary
 NetworkEdge addNetworkEdgeToSME(SME targetSME, int distanceSME, float strength)
          create network edge to other SME
 PartnerEdge addPartnerEdgeToSME(SME targetSME, int distanceSME, float strength)
          create partner edge to other SME
 boolean addPartnerSME(SME newPartnerSME, int interaction)
          Adds an new Partner SME to the Hashmap of Partner SMEs and creates edge
 ProducerEdge addProducerEdgeToSME(SME targetSME, int distanceSME, float strength)
          create producer edge to other SME
 void addServiceOnDemand(DemandedService serviceToAdd)
           
 void addServiceOnOffer(Service serviceToAdd)
           
 void addServicesOnOffer(java.util.Vector<Service> servicesToAdd)
           
 void addServicesToServicePool(java.util.Vector<Service> newServices)
           
 void addServiceToServicePool(Service newService)
          Adds an Service to the local Service Pool
 boolean addServiceToUsedServices(Service ServiceToAdd, DemandedService demService)
          Adds an Service to the SMEs UsedService HashMap.
 boolean addServiceToUsedServices(Service ServiceToAdd, DemandedService demService, java.util.Vector migHistory)
          Adds an Service to the SMEs UsedService HashMap.
private  void assignServices()
          creates new LocalServicePool, DemandedAndUsedServicePool and fills all pools with services
private  void calcFitness()
          calculates the Fitness of this SME and set the fitness of this SME to the calculated value.
 org.w3c.dom.Element getAsXmlElement(org.w3c.dom.Document xmldoc)
           
 int getDegreeOfInteraction(SME PartnerSME)
          Returns the number of usefull interactions between this SME and the Partner SME
 DemandedAndUsedServicePool getDemandedAndUsedServicePool()
          Returns the DemandedAndUsedServicePool of this SME
 java.util.Vector getDemandedServices()
          Returns the demanded Services as a Vector
 double getFitness()
          Returns the Fitness of the SME
 int getMaxServicesOnDemand()
           
 int getMaxServicesOnOffer()
           
 int getMinServicesOnDemand()
           
 int getMinServicesOnOffer()
           
 EvEModel getModel()
          returns the model
private  DemandedService getNextRequest()
          Identifies the next request for the GA
 java.util.Vector getOfferedServices()
          Returns an Vector with the services on offer
 java.util.HashMap getPartnerSMEs()
          Returns the Hashmap of Partner SMEs
 Prototype getPrototype()
           
 LocalServicePool getServicePool()
          Returns the Service-Pool of this SME
 int getSMEGroup()
          Returns the group number to which this service belongs to.
 int getSMEID()
          Returns the ID of the SME
 java.lang.String getSMEName()
          Returns the name of the SME
 java.util.Vector getUsedServices()
          Returns a Vector which include all Services which are currently in use
 void increaseDegreeOfInteraction(SME PartnerSME)
          If the Partner SME is already in the HashMap the Degree of interaction will be increased by one.
 void initWorld()
          draw the SMES as ovals
 void initWorld(int x, int y)
          draw SME at a certain position
 void instanciateService(DemandedService request, Individuum toInstantiate)
           
 void newGA()
          start GA for SME Note that OptimisationSupervisor now calls the UMDA implementation
 void onDisplayClick(java.awt.event.MouseEvent evt)
          onClick auf den simulationsframe GUI
 boolean removeServiceFromServicePool(Service serviceToRemove)
          Removes an Service from the ServicePool
 boolean removeServiceFromUsedServices(Service ServiceToRemove)
          This Methode removes an Service from the UsedService HashMap.
 void selectService(DemandedService request, java.util.ArrayList results)
           
private  void setAttitudeDemanding()
          maps Attitude Demanding to the SME
private  void setAttitudeOffering()
          maps Attitude Offering to the SME
private  void setBusinessStrategy()
          maps BusinessStrategy to the SME no influence to the simulation at the moment
private  void setDimension()
          maps Dimension to the SME no influence to the simulation at the moment
private  void setFitness(double fitness)
          Sets the Fitness of the SME
private  void setICTUsage()
          maps ICTUsage to the SME
private  void setInnovation()
          maps Innovation to the SME no influence to the simulation at the moment cross relation to ICT usage and effect on attitude in the DBE
private  void setParameters(int newSMEiD, java.lang.String smeName, int color, int groupid)
          Is a help method for the constructors to set parameters
 void setPrototype(Prototype prototype)
           
private  void setSMEColor(int color)
          Sets the color of each SME
 void setSMEGroup(int group)
           
 void setSMEName(java.lang.String newSMEName)
          Sets an new name for the SME
private  void setSocialCapital()
          maps SocialCapital to the SME
private  void setTypology()
          maps the typology to the SME
 boolean shrinkServicePool(float percentageToShrink)
          This method shrinks the service pool by deleting the worst (less fit) Service, stored in the local ServicePool.
 boolean shrinkServicePoolByAge(float maxPercentageOfDemandedServices)
          This method shrinks the service pool by deleting the oldest ServicePool Services, stored in the local ServicePool.
 boolean shrinkServicePoolByUseage(float percentageOfServicePoolServices)
          This method shrinks the service pool by deleting the oldest as well as the most often used ServicePool Services, stored in the local ServicePool.
 java.lang.String toString()
           
 
Methods inherited from class uchicago.src.sim.network.DefaultDrawableNode
allowResizing, calcSize, contains, draw, getBorderColor, getBorderWidth, getColor, getFont, getHeight, getLabelColor, getNode, getWidth, getX, getY, setBorderColor, setBorderWidth, setColor, setDrawable, setDrawableNoCopy, setFont, setHeight, setLabelColor, setNodeLabel, setWidth, setX, setX, setY, setY
 
Methods inherited from class uchicago.src.sim.network.DefaultNode
addInEdge, addInEdges, addOutEdge, addOutEdges, clearInEdges, clearOutEdges, getEdgesFrom, getEdgesTo, getFromNodes, getId, getInDegree, getInEdges, getInNodes, getNodeLabel, getNumInEdges, getNumOutEdges, getOutDegree, getOutEdges, getOutNodes, getRandomFromNode, getRandomNodeIn, getRandomNodeOut, getRandomToNode, getToNodes, hasEdgeFrom, hasEdgeTo, hasEdgeToOrFrom, makeRandomInEdge, makeRandomOutEdge, removeEdgesFrom, removeEdgesTo, removeInEdge, removeOutEdge
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface uchicago.src.sim.gui.DrawableNonGridNode
getOutEdges
 
Methods inherited from interface uchicago.src.sim.gui.Drawable2DGridNode
getOutEdges
 

Field Detail

mt

static final MersenneTwister mt

sMEColor

private java.awt.Color sMEColor

sMELabelColor

private java.awt.Color sMELabelColor

ServicesOnOffer

private java.util.Vector<Service> ServicesOnOffer

localServicePool

private LocalServicePool localServicePool

partnerSMEs

private java.util.HashMap partnerSMEs

fitness

private double fitness

sMEName

private java.lang.String sMEName

PicPath

private java.lang.String PicPath

sMEiD

private int sMEiD

demandedAndUsedServicePool

private DemandedAndUsedServicePool demandedAndUsedServicePool

model

private EvEModel model

sMEGroup

private int sMEGroup

minServicesOnOffer

private int minServicesOnOffer

maxServicesOnOffer

private int maxServicesOnOffer

minServicesOnDemand

private int minServicesOnDemand

maxServicesOnDemand

private int maxServicesOnDemand

gUIItem

uchicago.src.sim.gui.RoundRectNetworkItem gUIItem

actingProbability

private double actingProbability

logger

static org.apache.log4j.Logger logger

prototype

private Prototype prototype
Constructor Detail

SME

public SME(int newSMEiD,
           java.lang.String sMEName,
           int color,
           int groupid)

SME

public SME(int newSMEiD,
           java.lang.String sMEName,
           int color,
           int grouid,
           Prototype p)

SME

public SME(int newSMEiD,
           int color,
           int groupid,
           int x,
           int y)
Method Detail

setParameters

private void setParameters(int newSMEiD,
                           java.lang.String smeName,
                           int color,
                           int groupid)
Is a help method for the constructors to set parameters


assignServices

private void assignServices()
creates new LocalServicePool, DemandedAndUsedServicePool and fills all pools with services


initWorld

public void initWorld()
draw the SMES as ovals


initWorld

public void initWorld(int x,
                      int y)
draw SME at a certain position

Parameters:
x -
y -

shrinkServicePool

public boolean shrinkServicePool(float percentageToShrink)
This method shrinks the service pool by deleting the worst (less fit) Service, stored in the local ServicePool.

Parameters:
percentageToShrink - is the percentage of to drop ServicePool services
Returns:
true if the shrinking process was successful

shrinkServicePoolByUseage

public boolean shrinkServicePoolByUseage(float percentageOfServicePoolServices)
This method shrinks the service pool by deleting the oldest as well as the most often used ServicePool Services, stored in the local ServicePool.

Parameters:
percentageOfServicePoolServices - is the percentage of to drop ServicePool services
Returns:
true if the shrinking process was successful

shrinkServicePoolByAge

public boolean shrinkServicePoolByAge(float maxPercentageOfDemandedServices)
This method shrinks the service pool by deleting the oldest ServicePool Services, stored in the local ServicePool.

Parameters:
percentageOfServicePoolServices - is the percentage of to drop ServicePool services
Returns:
true if the shrinking process was successful

getOfferedServices

public java.util.Vector getOfferedServices()
Returns an Vector with the services on offer

Returns:
Vector of Services on offer

getDemandedServices

public java.util.Vector getDemandedServices()
Returns the demanded Services as a Vector

Returns:
Vector the demanded Services

getUsedServices

public java.util.Vector getUsedServices()
Returns a Vector which include all Services which are currently in use

Returns:
Used service vector

getFitness

public double getFitness()
Returns the Fitness of the SME

Returns:
Fitness value as double

setFitness

private void setFitness(double fitness)
Sets the Fitness of the SME


calcFitness

private void calcFitness()
calculates the Fitness of this SME and set the fitness of this SME to the calculated value.


getSMEID

public int getSMEID()
Returns the ID of the SME

Returns:
ID of the SME

getPartnerSMEs

public java.util.HashMap getPartnerSMEs()
Returns the Hashmap of Partner SMEs

Returns:
hashmap of Partner SMEs

getSMEName

public java.lang.String getSMEName()
Returns the name of the SME

Returns:
name of SME

setSMEName

public void setSMEName(java.lang.String newSMEName)
Sets an new name for the SME

Parameters:
newSMEName - is the new name for the SME

setSMEColor

private void setSMEColor(int color)
Sets the color of each SME

Parameters:
void -

removeServiceFromServicePool

public boolean removeServiceFromServicePool(Service serviceToRemove)
Removes an Service from the ServicePool

Parameters:
serviceToRemove - is the Service which should be removed form the ServicePool
Returns:
true if the Service was successfully removed from the ServicePool Vector

getServicePool

public LocalServicePool getServicePool()
Returns the Service-Pool of this SME

Returns:
ServicePool

getDemandedAndUsedServicePool

public DemandedAndUsedServicePool getDemandedAndUsedServicePool()
Returns the DemandedAndUsedServicePool of this SME

Returns:
DemandedAndUsedServicePool

addServiceToUsedServices

public boolean addServiceToUsedServices(Service ServiceToAdd,
                                        DemandedService demService)
Adds an Service to the SMEs UsedService HashMap. Starting at Position 0!

Parameters:
ServiceToAdd - (the Service which should be added)
demService - (the Service which was demanded)

addServiceToUsedServices

public boolean addServiceToUsedServices(Service ServiceToAdd,
                                        DemandedService demService,
                                        java.util.Vector migHistory)
Adds an Service to the SMEs UsedService HashMap. Starting at Position 0!

Parameters:
ServiceToAdd - (the Service which should be added)
demService - (the Service which was demanded)
migHistory - (migration History of the service to add

addServiceOnOffer

public void addServiceOnOffer(Service serviceToAdd)

addServicesOnOffer

public void addServicesOnOffer(java.util.Vector<Service> servicesToAdd)

addServiceOnDemand

public void addServiceOnDemand(DemandedService serviceToAdd)

removeServiceFromUsedServices

public boolean removeServiceFromUsedServices(Service ServiceToRemove)
This Methode removes an Service from the UsedService HashMap.

Parameters:
ServiceToRemove - is the Service which should be removed from the UsedServices
Returns:
true if Service was found and therefore was removed

getDegreeOfInteraction

public int getDegreeOfInteraction(SME PartnerSME)
Returns the number of usefull interactions between this SME and the Partner SME

Parameters:
PartnerSME - is the Partner SME which is searched
Returns:
an int value greater 0 if the SME is an Partner SME otherwise zero

addPartnerSME

public boolean addPartnerSME(SME newPartnerSME,
                             int interaction)
Adds an new Partner SME to the Hashmap of Partner SMEs and creates edge

Parameters:
newPartnerSME - is the new Partner SME
lineColor - the color of the edge
Returns:
true if the SME isn't already in the Hashmap

increaseDegreeOfInteraction

public void increaseDegreeOfInteraction(SME PartnerSME)
If the Partner SME is already in the HashMap the Degree of interaction will be increased by one. Otherwise the PartnerSME will added to the HashMap of Partner SMEs and the Degree of interaction will be setted to one. Also a edge to the partner sme is created

Parameters:
PartnerSME - is the Partner SME

addServiceToServicePool

public void addServiceToServicePool(Service newService)
Adds an Service to the local Service Pool

Parameters:
newService - is the Service which should be added

addServicesToServicePool

public void addServicesToServicePool(java.util.Vector<Service> newServices)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

newGA

public void newGA()
start GA for SME Note that OptimisationSupervisor now calls the UMDA implementation


getNextRequest

private DemandedService getNextRequest()
Identifies the next request for the GA

Returns:

onDisplayClick

public void onDisplayClick(java.awt.event.MouseEvent evt)
onClick auf den simulationsframe GUI


addPartnerEdgeToSME

public PartnerEdge addPartnerEdgeToSME(SME targetSME,
                                       int distanceSME,
                                       float strength)
create partner edge to other SME


addProducerEdgeToSME

public ProducerEdge addProducerEdgeToSME(SME targetSME,
                                         int distanceSME,
                                         float strength)
create producer edge to other SME


addNetworkEdgeToSME

public NetworkEdge addNetworkEdgeToSME(SME targetSME,
                                       int distanceSME,
                                       float strength)
create network edge to other SME


getAsXmlElement

public org.w3c.dom.Element getAsXmlElement(org.w3c.dom.Document xmldoc)

selectService

public void selectService(DemandedService request,
                          java.util.ArrayList results)
Parameters:
request -
results - Gets a ranked list of services from OptimisationSupervisor and selects the service to instanciate

instanciateService

public void instanciateService(DemandedService request,
                               Individuum toInstantiate)
Parameters:
request -
toInstantiate - The service is added to the used service pool.

getModel

public EvEModel getModel()
returns the model


getSMEGroup

public int getSMEGroup()
Returns the group number to which this service belongs to.

Returns:
int the group number

setSMEGroup

public void setSMEGroup(int group)

getPrototype

public Prototype getPrototype()

setPrototype

public void setPrototype(Prototype prototype)

setTypology

private void setTypology()
maps the typology to the SME


setICTUsage

private void setICTUsage()
maps ICTUsage to the SME


setDimension

private void setDimension()
maps Dimension to the SME no influence to the simulation at the moment


setInnovation

private void setInnovation()
maps Innovation to the SME no influence to the simulation at the moment cross relation to ICT usage and effect on attitude in the DBE


setSocialCapital

private void setSocialCapital()
maps SocialCapital to the SME


setBusinessStrategy

private void setBusinessStrategy()
maps BusinessStrategy to the SME no influence to the simulation at the moment


setAttitudeOffering

private void setAttitudeOffering()
maps Attitude Offering to the SME


setAttitudeDemanding

private void setAttitudeDemanding()
maps Attitude Demanding to the SME


getMaxServicesOnDemand

public int getMaxServicesOnDemand()

getMaxServicesOnOffer

public int getMaxServicesOnOffer()

getMinServicesOnDemand

public int getMinServicesOnDemand()

getMinServicesOnOffer

public int getMinServicesOnOffer()