• Tidak ada hasil yang ditemukan

BAB V KESIMPULAN DAN SARAN

5.2 Saran

Dengan mekanisme delegation forwarding, menitipi pesan ke node yang memiliki DP tinggi membuat waktu pesan sampai di tujuan menjadi sedikit lebih lama. Oleh karena itu diharapkan pada penelitian selanjutanya mekanisme delegation forwarding memperhatikan waktu pesan di jaringan untuk memperbaiki kekurangan dari delegation forwarding

25

DAFTAR PUSTAKA

[1] Lindgen, A., Doria, A. & Schelen, O., “Probabilistic Routing in intermittenly Connected Network”. Mobile Computing and Commun. Review, vol.7, no.3, july 2003.

[2] Z. Zhang, "Routing in Intermittently Connected Mobile Ad Hoc Networks and Delay Toleran Networks: Overview and Challenges," IEEE Communications Surveys & Tutorials, vol. 8, no. 1, pp. 24-37, 2006.

[3] V.erramilli, M. Crovella, A. Chaintreau, and C. Diot, "Delegation forwarding," in Proc. of ACM MOBIHOC 2008.

[4] Orlinski, Matthew, “Encounter traces for the ONE simulator”, [online]

diakses di : http://www.shigs.co.uk/index.php?page=traces.2018. [5] Eagle, Nathan & Pentland, Alex (Sandy). “A Community Resource for

Archiving Wireless Data At Dartmouth” [online] diakses di :

http://crawdad.org/mit/reality/20050701/, The mit/reality dataset (v. 2005- 07-01),2018.

26 LAMPIRAN

1. Prophet Decesion Engine

public class ProphetDecisionEngine implements RoutingDecisionEngine {

protected final static String BETA_SETTING = "beta"; protected final static String GAMMA_SETTING = "gamma"; protected final static String P_INIT_SETTING = "initial_p"; protected final static String SECONDS_IN_UNIT_S = "secondsInTimeUnit";

protected static final double DEFAULT_P_INIT = 0.75; protected static final double DEFAULT_GAMMA = 0.98; protected static final double DEFAULT_BETA = 0.25; protected static final int DEFAULT_UNIT = 1;

protected double beta; protected double gamma; protected double pinit;

protected double lastAgeUpdate; protected int secondsInTimeUnit;

/**

* delivery predictabilities */

private Map<DTNHost, Double> preds;

public ProphetDecisionEngine(Settings s) { if (s.contains(BETA_SETTING)) {

} else { beta = DEFAULT_BETA; } if (s.contains(GAMMA_SETTING)) { gamma = s.getDouble(GAMMA_SETTING); } else { gamma = DEFAULT_GAMMA; } if (s.contains(P_INIT_SETTING)) { pinit = s.getDouble(P_INIT_SETTING); } else { pinit = DEFAULT_P_INIT; } if (s.contains(SECONDS_IN_UNIT_S)) { secondsInTimeUnit = s.getInt(SECONDS_IN_UNIT_S); } else { secondsInTimeUnit = DEFAULT_UNIT; }

preds = new HashMap<DTNHost, Double>(); this.lastAgeUpdate = 0.0;

}

public ProphetDecisionEngine(ProphetDecisionEngine de) { beta = de.beta;

gamma = de.gamma; pinit = de.pinit;

secondsInTimeUnit = de.secondsInTimeUnit; preds = new HashMap<DTNHost, Double>();

this.lastAgeUpdate = de.lastAgeUpdate;

}

public RoutingDecisionEngine replicate() { return new ProphetDecisionEngine(this); }

public void connectionUp(DTNHost thisHost, DTNHost peer) { }

public void connectionDown(DTNHost thisHost, DTNHost peer) { }

public void doExchangeForNewConnection(Connection con, DTNHost peer) {

DTNHost myHost = con.getOtherNode(peer);

ProphetDecisionEngine de = getOtherProphetDecisionEngine(peer); Set<DTNHost> hostSet = new HashSet<DTNHost>(this.preds.size() + de.preds.size());

hostSet.addAll(this.preds.keySet()); hostSet.addAll(de.preds.keySet());

this.agePreds(); de.agePreds();

// Update preds for this connection

double myOldValue = this.getPredFor(peer), peerOldValue = de.getPredFor(myHost),

myPforHost = myOldValue + (1 - myOldValue) * pinit, peerPforMe = peerOldValue + (1 - peerOldValue) * de.pinit;

preds.put(peer, myPforHost); de.preds.put(myHost, peerPforMe);

// Update transistivities for (DTNHost h : hostSet) { myOldValue = 0.0; peerOldValue = 0.0; if (preds.containsKey(h)) { myOldValue = preds.get(h); } if (de.preds.containsKey(h)) { peerOldValue = de.preds.get(h); } if (h != myHost) {

preds.put(h, myOldValue + (1 - myOldValue) * myPforHost * peerOldValue * beta);

}

if (h != peer) {

de.preds.put(h, peerOldValue + (1 - peerOldValue) * peerPforMe * myOldValue * beta);

} } }

public boolean newMessage(Message m) { return true;

}

return m.getTo() == aHost; }

public boolean shouldSaveReceivedMessage(Message m, DTNHost thisHost) {

return m.getTo() != thisHost; }

public boolean shouldSendMessageToHost(Message m, DTNHost otherHost) { if (m.getTo() == otherHost) { return true; } ProphetDecisionEngine de = getOtherProphetDecisionEngine(otherHost); if (de.getPredFor(m.getTo()) > this.getPredFor(m.getTo())) return true; return false; }

public boolean shouldDeleteSentMessage(Message m, DTNHost otherHost) {

return false; //true single copy }

public boolean shouldDeleteOldMessage(Message m, DTNHost hostReportingOld) {

}

private ProphetDecisionEngine

getOtherProphetDecisionEngine(DTNHost host) { MessageRouter otherRouter = host.getRouter();

assert otherRouter instanceof DecisionEngineRouter : "This router only works "

+ " with other routers of same type";

return (ProphetDecisionEngine) ((DecisionEngineRouter) otherRouter).getDecisionEngine();

}

private void agePreds() {

double timeDiff = (SimClock.getTime() - this.lastAgeUpdate) / secondsInTimeUnit;

if (timeDiff == 0) { return;

}

double mult = Math.pow(gamma, timeDiff);

for (Map.Entry<DTNHost, Double> e : preds.entrySet()) { e.setValue(e.getValue() * mult);

}

this.lastAgeUpdate = SimClock.getTime(); }

/**

* host doesn't exist. *

* @param host The host to look the P for * @return the current P value

*/

public double getPredFor(DTNHost host) {

agePreds(); // make sure preds are updated before getting if (preds.containsKey(host)) { return preds.get(host); } else { return 0; } } }

2. ProphetDecisionEngine Delegation Forwarding

public class ProphetDecisionEngineDF implements RoutingDecisionEngine {

protected final static String BETA_SETTING = "beta"; protected final static String GAMMA_SETTING = "gamma"; protected final static String P_INIT_SETTING = "initial_p"; protected final static String SECONDS_IN_UNIT_S = "secondsInTimeUnit";

public static final String T_SETTING = "t";

public static final String TMIN_SETTING = "t_min";

protected static final double DEFAULT_P_INIT = 0.75; protected static final double DEFAULT_GAMMA = 0.98; protected static final double DEFAULT_BETA = 0.25;

protected static final int DEFAULT_UNIT = 30;

protected double beta; protected double gamma; protected double pinit;

protected double lastAgeUpdate; protected int secondsInTimeUnit;

/**

* delivery predictabilities */

private Map<DTNHost, Double> preds; private Map<String, DTNHost> saveM; protected Map<String, Double> mUtil;

public ProphetDecisionEngineDF(Settings s) { if (s.contains(BETA_SETTING)) { beta = s.getDouble(BETA_SETTING); } else { beta = DEFAULT_BETA; } if (s.contains(GAMMA_SETTING)) { gamma = s.getDouble(GAMMA_SETTING); } else { gamma = DEFAULT_GAMMA; } if (s.contains(P_INIT_SETTING)) { pinit = s.getDouble(P_INIT_SETTING);

} else { pinit = DEFAULT_P_INIT; } if (s.contains(SECONDS_IN_UNIT_S)) { secondsInTimeUnit = s.getInt(SECONDS_IN_UNIT_S); } else { secondsInTimeUnit = DEFAULT_UNIT; }

preds = new HashMap<DTNHost, Double>(); saveM = new HashMap<String, DTNHost>(); this.lastAgeUpdate = 0.0;

}

public ProphetDecisionEngineDF(ProphetDecisionEngineDF de) { beta = de.beta;

gamma = de.gamma; pinit = de.pinit;

secondsInTimeUnit = de.secondsInTimeUnit; preds = new HashMap<DTNHost, Double>(); saveM = new HashMap<String, DTNHost>(); mUtil = new HashMap<String, Double>(); this.lastAgeUpdate = de.lastAgeUpdate; }

public RoutingDecisionEngine replicate() { return new ProphetDecisionEngineDF(this); }

public void connectionUp(DTNHost thisHost, DTNHost peer) { }

public void connectionDown(DTNHost thisHost, DTNHost peer) { }

public void doExchangeForNewConnection(Connection con, DTNHost peer) {

DTNHost myHost = con.getOtherNode(peer); ProphetDecisionEngineDF de =

getOtherProphetDecisionEngine(peer);

Set<DTNHost> hostSet = new HashSet<DTNHost>(this.preds.size() + de.preds.size());

hostSet.addAll(this.preds.keySet()); hostSet.addAll(de.preds.keySet());

this.agePreds(); de.agePreds();

// Update preds for this connection

double myOldValue = this.getPredFor(peer), peerOldValue = de.getPredFor(myHost),

myPforHost = myOldValue + (1 - myOldValue) * pinit, peerPforMe = peerOldValue + (1 - peerOldValue) * de.pinit; preds.put(peer, myPforHost);

de.preds.put(myHost, peerPforMe);

// Update transistivities for (DTNHost h : hostSet) { myOldValue = 0.0; peerOldValue = 0.0;

myOldValue = preds.get(h); } if (de.preds.containsKey(h)) { peerOldValue = de.preds.get(h); } if (h != myHost) {

preds.put(h, myOldValue + (1 - myOldValue) * myPforHost * peerOldValue * beta);

}

if (h != peer) {

de.preds.put(h, peerOldValue + (1 - peerOldValue) * peerPforMe * myOldValue * beta);

} } }

public boolean newMessage(Message m) { return true;

}

@Override

public boolean isFinalDest(Message m, DTNHost aHost) { return m.getTo() == aHost;

}

@Override

public boolean shouldSaveReceivedMessage(Message m, DTNHost thisHost) {

}

@Override

public boolean shouldSendMessageToHost(Message m, DTNHost otherHost) { if (m.getTo() == otherHost) { return true; } ProphetDecisionEngineDF de = getOtherProphetDecisionEngine(otherHost); if (de.getPredFor(m.getTo()) > this.getPredFor(m.getTo())) { if (!mUtil.containsKey(m.getId())) { mUtil.put(m.getId(), de.getPredFor(m.getTo())); return true; } else { if (de.getPredFor(m.getTo()) > mUtil.get(m.getId())) { mUtil.replace(m.getId(), de.getPredFor(m.getTo())); return true; } else { return false; } } } else { return false; } } @Override

public boolean shouldDeleteSentMessage(Message m, DTNHost otherHost) {

return false; //true single copy }

@Override

public boolean shouldDeleteOldMessage(Message m, DTNHost hostReportingOld) {

return m.getTo() == hostReportingOld; }

private ProphetDecisionEngineDF

getOtherProphetDecisionEngine(DTNHost host) { MessageRouter otherRouter = host.getRouter();

assert otherRouter instanceof DecisionEngineRouter : "This router only works "

+ " with other routers of same type";

return (ProphetDecisionEngineDF) ((DecisionEngineRouter) otherRouter).getDecisionEngine();

}

private void agePreds() {

double timeDiff = (SimClock.getTime() - this.lastAgeUpdate) / secondsInTimeUnit;

if (timeDiff == 0) { return;

}

double mult = Math.pow(gamma, timeDiff);

e.setValue(e.getValue() * mult); //System.out.println(e.setValue(e.getValue() * mult)); } this.lastAgeUpdate = SimClock.getTime(); } /**

* Returns the current prediction (P) value for a host or 0 if entry for the * host doesn't exist.

*

* @param host The host to look the P for * @return the current P value

*/

public double getPredFor(DTNHost host) {

agePreds(); // make sure preds are updated before getting if (preds.containsKey(host)) { return preds.get(host); } else { return 0; } } }

3. Haggle 3 Infocom 5 Report

#Scenario information

Scenario.name Prophet_DF_HAGGLE_TTL_1_HARIi Scenario.simulateConnections = false

Scenario.updateInterval = 1

Scenario.endTime = 274883 #987529 Haggle Cam #274883 Haggle #16981816 Reality Report.warmup = 1 Scenario.nrofHostGroups = 1 #Interfaces informations btInterface.type = SimpleBroadcastInterface btInterface.transmitSpeed = 250k btInterface.transmitRange = 10 btInterface.scanInterval = 120 #Group Information

## Buffer Size : 200 messages of 10 K ~ 2M Group.bufferSize = 20M ##ProphetRouter Group.router = DecisionEngineRouter #DecisionEngineRouter.decisionEngine = decisionengine.ProphetDecisionEngine DecisionEngineRouter.decisionEngine = decisionengine.ProphetDecisionEngineDF DecisionEngineRouter.t = 1 DecisionEngineRouter.t_min = 0.4

## TTL 24 hours=1440, 1 week= 10080, 3 weeks= 30240,1 month = 43800, 12 hour = 720

Group.nrofInterfaces = 1 Group.interface1 = btInterface #Group1 Information Group1.groupID = A Group1.waitTime = 10, 30 Group1.speed = 0.8, 1.4 Group1.nrofHosts = 41 #36 Haggle Cam #41 Haggle #97 Reality Group1.nodeLocation = 10, 10 Group1.movementModel = StationaryMovement #StationaryMovement gerak diam

#How many event generator Events.nrof = 2 ## Trace information Events1.class = ExternalEventsQueue Events1.filePath = Haggle3-Infocom5.txt #Events1.filePath = Haggle4-Cam-Imote.csv #RealityConnectionTraceRevised.txt #Haggle4-Cam-Imote.csv #Haggle3-Infocom5.txt #RealityConnectionTraceFinal.txt

## Message creation parameters

Events2.class = MessageEventGenerator Events2.interval = 58, 62

#Events2.interval = 290, 310 #Events2.interval = 580, 620 Events2.time = 0, 231683 #97, 103 # 25,30 (~120 texts/hour) #290, 310 (~12 texts/hour) # 580, 620 (~ 6 texts/hour) Events2.size = 10k

## range of message source/destination address Events2.hosts = 0,40

# 0, 35 Haggle Cam # 0,40 Haggle # 0,96 Reality Events2.prefix = M

# World's size for Movement Models without implicit size (width, height; meters)

MovementModel.worldSize = 100, 100

# seed for movement models' pseudo random number generator (default = 0)

MovementModel.rngSeed = 2

#ReportsInformations Report.nrofReports = 10

Report.reportDir = reports/Prophet/DF/

Report.report1 = MessageStatsReport Report.report2 = DeliveryCentralityReport Report.report3 = LatencyPerContact Report.report4 = CarriedMessageToDestinationReport Report.report5 = MessageCopyReportperContact Report.report6 = ReceiveMessage Report.report7 = BufferOccupancyReport Report.report8 = BufferOccupancyPerTime Report.report9 = MessageStatsReportperContact Report.report10 = MessageStatsReportperTime

4. Reality MIT Report

#Scenario information Scenario.name = Prophet_BIASA_REALITY_TTL_2_BULAN Scenario.simulateConnections = false Scenario.updateInterval = 1 Scenario.endTime = 16981816 #987529 Haggle Cam #274883 Haggle #16981816 Reality Report.warmup = 1 Scenario.nrofHostGroups = 1 #Interfaces informations btInterface.type = SimpleBroadcastInterface btInterface.transmitSpeed = 250k btInterface.transmitRange = 10 btInterface.scanInterval = 120

#Group Information

## Buffer Size : 200 messages of 10 K ~ 2M Group.bufferSize = 20M ##ProphetRouter Group.router = DecisionEngineRouter DecisionEngineRouter.decisionEngine = decisionengine.ProphetDecisionEngine #DecisionEngineRouter.decisionEngine = decisionengine.ProphetDecisionEngineDF DecisionEngineRouter.beta = 0.25 DecisionEngineRouter.gamma = 0.98 DecisionEngineRouter.initial_p = 0.75 DecisionEngineRouter.secondsInTimeUnit = 1000 DecisionEngineRouter.t = 1 DecisionEngineRouter.t_min = 0.4

## TTL 24 hours=1440, 1 week= 10080, 3 weeks= 30240,1 month = 43800,2 month = 876001, 12 hour = 720 Group.msgTtl = 876001 Group.nrofInterfaces = 1 Group.interface1 = btInterface #Group1 Information Group1.groupID = A Group1.waitTime = 10, 30 Group1.speed = 0.8, 1.4 Group1.nrofHosts = 97 #36 Haggle Cam

#41 Haggle #97 Reality

Group1.nodeLocation = 10, 10

Group1.movementModel = StationaryMovement #StationaryMovement gerak diam

#How many event generator Events.nrof = 2 ## Trace information Events1.class = ExternalEventsQueue Events1.filePath = RealityConnectionTraceFinal.txt #Events1.filePath = Haggle4-Cam-Imote.csv #RealityConnectionTraceRevised.txt #Haggle4-Cam-Imote.csv #Haggle3-Infocom5.txt #RealityConnectionTraceFinal.txt

## Message creation parameters

Events2.class = MessageEventGenerator Events2.interval = 580, 620 #Events2.interval = 290, 310 #Events2.interval = 580, 620 Events2.time = 0, 15167416 #97, 103 # 25,30 (~120 texts/hour) #290, 310 (~12 texts/hour) # 580, 620 (~ 6 texts/hour) Events2.size = 10k

Events2.hosts = 0,96 # 0, 35 Haggle Cam # 0,40 Haggle # 0,96 Reality Events2.prefix = M

# World's size for Movement Models without implicit size (width, height; meters)

#MovementModel.worldSize = 100, 100 MovementModel.worldSize = 100, 100

# seed for movement models' pseudo random number generator (default = 0)

MovementModel.rngSeed = 2

#ReportsInformations Report.nrofReports = 10

Report.reportDir = reports/Prophet/biasa/std pabrik #Report classes to load

Report.report1 = MessageStatsReport Report.report2 = DeliveryCentralityReport Report.report3 = LatencyPerContact Report.report4 = CarriedMessageToDestinationReport Report.report5 = MessageCopyReportperContact Report.report6 = ReceiveMessage Report.report7 = BufferOccupancyReport Report.report8 = LastHopMessageReport Report.report9 = MessageStatsReportperContact Report.report10 = MessageStatsReportperTime

Dokumen terkait