es.ants.felixgm.trmsim_wsn.trm.lftm
Class LFTM_Sensor

java.lang.Object
  extended by es.ants.felixgm.trmsim_wsn.network.Sensor
      extended by es.ants.felixgm.trmsim_wsn.trm.lftm.LFTM_Sensor
All Implemented Interfaces:
java.lang.Runnable

public class LFTM_Sensor
extends Sensor

This class models a Sensor implementing LFTM

Since:
0.4
Version:
0.4
Author:
Félix Gómez Mármol, Gregorio Martínez Pérez

Field Summary
protected static int _numServers
          Number of servers composing the network this sensor belongs to
protected  java.util.HashMap<LFTM_Service,Variable> _servicesGoodness
          Goodness of this sensor related to each provided service
protected  Variable clientConformity
          Client's conformity, used to assess the client satisfaction with a received service
protected  Variable clientGoodness
          Client's goodness, used to assess the level of punishment or reward to apply to a trustworthy or untrustworthy server
protected  double costWeight
          Service's cost weight used when comparing two services
protected  double deliveryWeight
          Service's delivery time weight used when comparing two services
protected  double priceWeight
          Service's price weight used when comparing two services
protected  double qualityWeight
          Service's quality weight used when comparing two services
 
Fields inherited from class es.ants.felixgm.trmsim_wsn.network.Sensor
_maxDistance, activeState, collusion, dynamic, id, idCount, links, numRequests, numRequestsThreshold, numRequestsTimer, outcome, requiredService, runningSimulation, servicesGoodness, sleepTimer, sleepTimerAux, transmittedDistance, trmmodelWSN, xPosition, yPosition
 
Constructor Summary
LFTM_Sensor()
          This constructor creates a new Sensor implementing LFTM
LFTM_Sensor(int id, double x, double y)
          This constructor creates a new Sensor implementing LFTM
 
Method Summary
 void addLink(Sensor node)
          Adds a link to a given sensor
 void addService(Service service, double goodness)
          Adds a new service to the set of offered services of this sensor
 Variable evaluateSatisfaction(Variable servicesComparison)
          This method evaluates the client satisfaction with the received service using both the comparison between the expected service and the actually received one, and the client's conformity
 Variable get_clientGoodness()
          This method returns this client's goodness
 double get_costWeight()
          This method returns the service's cost weight used when comparing two services
 double get_deliveryWeight()
          This method returns the service's delivery time weight used when comparing two services
 double get_goodness(Service service)
          Gets the goodness of a given service
 int get_numServers()
          Returns the number of servers of the network
 double get_priceWeight()
          This method returns the service's price weight used when comparing two services
 double get_qualityWeight()
          This method returns the service's quality weight used when comparing two services
 double getHeuristic(Sensor sensor)
          Gets the heuristic value with a given neighbor
 double getPheromone(Sensor sensor)
          Gets the pheromone trace with a given neighbor
 void removeService(Service service)
          Removes a service from the set of offered services by this sensor
 void reset()
          This method resets a Sensor to its initial state
 Service serve(Service service, java.util.Vector<Sensor> path)
          This method returns a requested service.
 void set_goodness(Service service, double goodness)
          Sets the goodness of a given service
 void set_requiredService(Service requiredService)
          Updates the client required Service.
 void setHeuristic(Sensor sensor, double value)
          Sets the heuristic trace value of the link connecting to a certain neighbor
static void setNumServers(int numServers)
          Sets the number of servers
 void setPheromone(Sensor sensor, double value)
          Sets the pheromone trace value of the link connecting to a certain neighbor
 java.lang.String toString()
          This method returns a String representation of this sensor
 
Methods inherited from class es.ants.felixgm.trmsim_wsn.network.Sensor
addTransmittedDistance, cancelAllTimers, distance, distanceInHops, equals, findSensors, get_numServices, get_outcome, get_requiredService, get_services, get_transmittedDistance, get_TRModel_WSN, getNeighbors, getService, getX, getY, id, isActive, isNeighbor, isRunningSimulation, offersService, offersService, removeAllNeighbors, removeLink, resetId, run, set_TRModel_WSN, setActiveState, setCollusion, setDynamic, setMaxDistance, setRunningSimulation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_numServers

protected static int _numServers
Number of servers composing the network this sensor belongs to


_servicesGoodness

protected java.util.HashMap<LFTM_Service,Variable> _servicesGoodness
Goodness of this sensor related to each provided service


clientConformity

protected Variable clientConformity
Client's conformity, used to assess the client satisfaction with a received service


clientGoodness

protected Variable clientGoodness
Client's goodness, used to assess the level of punishment or reward to apply to a trustworthy or untrustworthy server


priceWeight

protected double priceWeight
Service's price weight used when comparing two services


costWeight

protected double costWeight
Service's cost weight used when comparing two services


deliveryWeight

protected double deliveryWeight
Service's delivery time weight used when comparing two services


qualityWeight

protected double qualityWeight
Service's quality weight used when comparing two services

Constructor Detail

LFTM_Sensor

public LFTM_Sensor()
This constructor creates a new Sensor implementing LFTM


LFTM_Sensor

public LFTM_Sensor(int id,
                   double x,
                   double y)
This constructor creates a new Sensor implementing LFTM

Parameters:
id - Identifier of the new sensor
x - X coordinate of the new sensor
y - Y coordinate of the new sensor
Method Detail

evaluateSatisfaction

public Variable evaluateSatisfaction(Variable servicesComparison)
This method evaluates the client satisfaction with the received service using both the comparison between the expected service and the actually received one, and the client's conformity

Parameters:
servicesComparison - Comparison between the expected and the actually received service
Returns:
Client's satisfaction with the received service (as a fuzzy set)

serve

public Service serve(Service service,
                     java.util.Vector<Sensor> path)
This method returns a requested service. The similarity between the actually offered service and the actually delivered service depends on the goodness of this sensor about this service. If it has a high goodness both services will be very similar (or equal), otherwise it will deliver a very different service than the one requested

Overrides:
serve in class Sensor
Parameters:
service - Requested service
path - Path leading from the client requesting the service to the server providing it
Returns:
A service more or less similar to the requested one, depending on the goodness of this sensor delivering that certain service

addService

public void addService(Service service,
                       double goodness)
Description copied from class: Sensor
Adds a new service to the set of offered services of this sensor

Overrides:
addService in class Sensor
Parameters:
service - The new service to be added
goodness - The goodness when offering that new service

removeService

public void removeService(Service service)
Description copied from class: Sensor
Removes a service from the set of offered services by this sensor

Overrides:
removeService in class Sensor
Parameters:
service - Service to be removed from the set of offered services by this sensor

get_goodness

public double get_goodness(Service service)
                    throws java.lang.Exception
Description copied from class: Sensor
Gets the goodness of a given service

Overrides:
get_goodness in class Sensor
Parameters:
service - The service to get its goodness
Returns:
The goodness of the given service
Throws:
java.lang.Exception - If this sensor does not offer the given service

set_goodness

public void set_goodness(Service service,
                         double goodness)
                  throws java.lang.Exception
Description copied from class: Sensor
Sets the goodness of a given service

Overrides:
set_goodness in class Sensor
Parameters:
service - The service to set its goodness
goodness - The goodness to be set
Throws:
java.lang.Exception - If this sensor does not offer the given service

set_requiredService

public void set_requiredService(Service requiredService)
Description copied from class: Sensor
Updates the client required Service.

Overrides:
set_requiredService in class Sensor
Parameters:
requiredService - New service.

addLink

public void addLink(Sensor node)
Description copied from class: Sensor
Adds a link to a given sensor

Overrides:
addLink in class Sensor
Parameters:
node - Sensor to link to

get_numServers

public int get_numServers()
Returns the number of servers of the network

Returns:
Number of servers

setNumServers

public static void setNumServers(int numServers)
Sets the number of servers

Parameters:
numServers - Number of servers

getPheromone

public double getPheromone(Sensor sensor)
Gets the pheromone trace with a given neighbor

Parameters:
sensor - One of this sensor's neighbors
Returns:
The pheromone trace with the given neighbor sensor

getHeuristic

public double getHeuristic(Sensor sensor)
Gets the heuristic value with a given neighbor

Parameters:
sensor - One of this sensor's neighbors
Returns:
The heuristic value with the given neighbor sensor

setPheromone

public void setPheromone(Sensor sensor,
                         double value)
Sets the pheromone trace value of the link connecting to a certain neighbor

Parameters:
sensor - Neighbor whose pheromone trace is to be modified
value - New pheromone value

setHeuristic

public void setHeuristic(Sensor sensor,
                         double value)
Sets the heuristic trace value of the link connecting to a certain neighbor

Parameters:
sensor - Neighbor whose heuristic trace is to be modified
value - New heuristic value

get_clientGoodness

public Variable get_clientGoodness()
This method returns this client's goodness

Returns:
This client's goodness

get_priceWeight

public double get_priceWeight()
This method returns the service's price weight used when comparing two services

Returns:
The service's price weight used when comparing two services

get_costWeight

public double get_costWeight()
This method returns the service's cost weight used when comparing two services

Returns:
The service's cost weight used when comparing two services

get_deliveryWeight

public double get_deliveryWeight()
This method returns the service's delivery time weight used when comparing two services

Returns:
The service's delivery time weight used when comparing two services

get_qualityWeight

public double get_qualityWeight()
This method returns the service's quality weight used when comparing two services

Returns:
The service's quality weight used when comparing two services

reset

public void reset()
Description copied from class: Sensor
This method resets a Sensor to its initial state

Specified by:
reset in class Sensor

toString

public java.lang.String toString()
Description copied from class: Sensor
This method returns a String representation of this sensor

Overrides:
toString in class Sensor
Returns:
A String representation of this sensor