-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetConfigSourceAgentBehavior.java
More file actions
45 lines (40 loc) · 1.47 KB
/
SetConfigSourceAgentBehavior.java
File metadata and controls
45 lines (40 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.masim.emissionAgents;
import com.masim.core.CooperationStrategy;
import com.masim.gameTheory.PrisonnerDelimmaUtl;
import com.masim.gameTheory.VoteStrategyUtl;
import com.masim.ui.Console;
import com.masim.utils.Environment;
import com.masim.utils.SimulationFramework;
import jade.core.Agent;
import jade.core.behaviours.OneShotBehaviour;
/**
*
* @author sabri ghazi
*
*/
public class SetConfigSourceAgentBehavior extends OneShotBehaviour {
EmissionUnit _agent;
public SetConfigSourceAgentBehavior(Agent pagnt){
_agent=(EmissionUnit)pagnt;
}
@Override
public void action() {
SourceConfigInfo obj=(SourceConfigInfo)_agent.getO2AObject();
_agent.emisionRate=obj.emisionRate;
_agent.production= obj.production;
_agent.geoLocation= obj.geoLocation;
_agent.isLocatedOnCbox= obj.isLocatedOnCbox;
//_agent.p=obj.p;
Console.frmLogMSG("Current Strategy is "+SimulationFramework.currentStrategy);
if(SimulationFramework.currentStrategy==CooperationStrategy.NAIVE)
_agent.addBehaviour( new ModeratePollutionNAIVE(_agent, 60));
else if(SimulationFramework.currentStrategy==CooperationStrategy.NEGOTIATION){
PrisonnerDelimmaUtl.getInstance().putInGame(_agent);
_agent.addBehaviour(new ModeratePollutionGameTheoryPD(_agent,60));
}
else if(SimulationFramework.currentStrategy==CooperationStrategy.Voting){
VoteStrategyUtl.putInGame(_agent);
_agent.addBehaviour(new ModeratePollutionVoting(_agent,60));
}
}
}