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

java.lang.Object
  extended by es.ants.felixgm.trmsim_wsn.trm.TRModel_WSN
      extended by es.ants.felixgm.trmsim_wsn.trm.lftm.LFTM

public class LFTM
extends TRModel_WSN

This class models LFTM (Linguistic Fuzzy Trust Model) algorithm used by a client in a P2P, Ad-hoc or Wireless Sensor Network, in order to find the most trustworthy server offering a desired service.

It needs some parameters to be passed as a LFTM_Parameters object. To do this, a file can be given following the next structure:

    ####################################
    # LFTM parameters file
    ####################################
    phi=0.01
    rho=0.87
    q0=0.45
    numAnts=0.35
    numIterations=0.59
    alpha=1.0
    beta=1.0
    initialPheromone=0.85
    pathLengthFactor=0.71
    transitionThreshold=0.66
    punishmentThreshold=0.48
    U_MIN=0.0
    U_MAX=1.0
    VH_A=0.7
    VH_B=0.9
    VH_C=1.0
    VH_D=1.0
    H_A=0.55
    H_B=0.7
    H_C=0.8
    H_D=0.9
    M_A=0.3
    M_B=0.45
    M_C=0.55
    M_D=0.7
    L_A=0.1
    L_B=0.2
    L_C=0.3
    L_D=0.45
    VL_A=0.0
    VL_B=0.0
    VL_C=0.1
    VL_D=0.3
 
This file can be downloaded here. But if any of the parameters can not be successfully extracted from the file, they are set to a default value.

For more information regarding LFTM algorithm, please check the following reference:

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

Field Summary
 
Fields inherited from class es.ants.felixgm.trmsim_wsn.trm.TRModel_WSN
trmParameters
 
Constructor Summary
LFTM(LFTM_Parameters lftm_parameters)
          Class LFTM constructor
 
Method Summary
 GatheredInformation gatherInformation(Sensor client, Service service)
          This method collects or gathers the required information from the network needed to evaluate each sensor offering a given service in order to determine whether to have a transaction with it or not
 Network generateRandomNetwork(int numSensors, double probClients, double rangeFactor, java.util.Collection<java.lang.Double> probServices, java.util.Collection<java.lang.Double> probGoodness, java.util.Collection<Service> services)
          This method generates a new random network specific for this trust and reputation model
static java.lang.String get_name()
          Returns the name of this model, i.e., "LFTM"
 Network loadCurrentNetwork(java.lang.String fileName)
          This method loads a network from a XML file and creates the specific network corresponding to this trust and reputation model
 Outcome performTransaction(java.util.Vector<Sensor> path, Service service)
          This method actually requests a desired service to a specified server and evaluates the satisfaction of the client with the actually received service
 Outcome punish(java.util.Vector<Sensor> path, Outcome outcome)
          This method punishes a server if the client is not satisfied with the received service, according to that precise dissatisfaction
 Outcome reward(java.util.Vector<Sensor> path, Outcome outcome)
          This method rewards a server if the client is satisfied with the received service, according to that precise satisfaction
 java.util.Vector<Sensor> scoreAndRanking(Sensor client, GatheredInformation gi)
          This method computes a trust and/or reputation value for each reachable server from the specified client and returns either a sorted list of all the reachable servers or a path leading directly to the most trustworthy and/or reputable one
 
Methods inherited from class es.ants.felixgm.trmsim_wsn.trm.TRModel_WSN
get_TRMParameters, set_TRMParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LFTM

public LFTM(LFTM_Parameters lftm_parameters)
Class LFTM constructor

Parameters:
lftm_parameters - Parameters needed for the algorithm, as described before
Method Detail

get_name

public static java.lang.String get_name()
Returns the name of this model, i.e., "LFTM"

Returns:
The name of this model, i.e., "LFTM"

gatherInformation

public GatheredInformation gatherInformation(Sensor client,
                                             Service service)
Description copied from class: TRModel_WSN
This method collects or gathers the required information from the network needed to evaluate each sensor offering a given service in order to determine whether to have a transaction with it or not

Specified by:
gatherInformation in class TRModel_WSN
Parameters:
client - The client applying this trust and reputation model in order to find the most trustworthy and reputable server offering a given service
service - The service requested by the given client
Returns:
The required information from the network needed to evaluate each sensor offering a given service in order to determine whether to have a transaction with it or not

scoreAndRanking

public java.util.Vector<Sensor> scoreAndRanking(Sensor client,
                                                GatheredInformation gi)
Description copied from class: TRModel_WSN
This method computes a trust and/or reputation value for each reachable server from the specified client and returns either a sorted list of all the reachable servers or a path leading directly to the most trustworthy and/or reputable one

Specified by:
scoreAndRanking in class TRModel_WSN
Parameters:
client - The client applying this trust and reputation model in order to find the most trustworthy and reputable server offering a given service
gi - The gathered information fro the network needed in order to compute the trust and/or reputation value for each reachable server
Returns:
Either a path leading to the most trustworthy server found, or a sorted list of all the reachable servers

performTransaction

public Outcome performTransaction(java.util.Vector<Sensor> path,
                                  Service service)
Description copied from class: TRModel_WSN
This method actually requests a desired service to a specified server and evaluates the satisfaction of the client with the actually received service

Specified by:
performTransaction in class TRModel_WSN
Parameters:
path - Path of sensors leading to the most trustworthy and reputable server or sorted list of all the reachable servers
service - Service requested by the client running this trust and reputation model
Returns:
Outcome with the satisfaction of the client with the received service

reward

public Outcome reward(java.util.Vector<Sensor> path,
                      Outcome outcome)
Description copied from class: TRModel_WSN
This method rewards a server if the client is satisfied with the received service, according to that precise satisfaction

Specified by:
reward in class TRModel_WSN
Parameters:
path - Path of sensors leading to the requesting server
outcome - Client's satisfaction with the received service
Returns:
Outcome with the updated transmitted distance of the messages sent

punish

public Outcome punish(java.util.Vector<Sensor> path,
                      Outcome outcome)
Description copied from class: TRModel_WSN
This method punishes a server if the client is not satisfied with the received service, according to that precise dissatisfaction

Specified by:
punish in class TRModel_WSN
Parameters:
path - Path of sensors leading to the requesting server
outcome - Client's dissatisfaction with the received service
Returns:
Outcome with the updated transmitted distance of the messages sent

generateRandomNetwork

public Network generateRandomNetwork(int numSensors,
                                     double probClients,
                                     double rangeFactor,
                                     java.util.Collection<java.lang.Double> probServices,
                                     java.util.Collection<java.lang.Double> probGoodness,
                                     java.util.Collection<Service> services)
Description copied from class: TRModel_WSN
This method generates a new random network specific for this trust and reputation model

Specified by:
generateRandomNetwork in class TRModel_WSN
Parameters:
numSensors - Number of sensors composing the network
probClients - Probability of a sensor to act as a client requesting services
rangeFactor - Maximum wireless range of every sensor. It determines the neighborhood of every sensor
probServices - A collection of probabilities of offering a certain service, one per service
probGoodness - A collection of goodnesses about offering a certain service, one per service
services - All the services offered by the generated Network
Returns:
A new random network specific for this trust and reputation model

loadCurrentNetwork

public Network loadCurrentNetwork(java.lang.String fileName)
                           throws java.lang.Exception
Description copied from class: TRModel_WSN
This method loads a network from a XML file and creates the specific network corresponding to this trust and reputation model

Specified by:
loadCurrentNetwork in class TRModel_WSN
Parameters:
fileName - Path of the XML to load the network from
Returns:
The loaded and generated specific network for this trust and reputation model
Throws:
java.lang.Exception - If the XML file given does not have the appropriate structure, or if a sensor links to an undefined sensor, or if a sensor links to itself