diff --git a/.classpath b/.classpath
old mode 100755
new mode 100644
index ace8266..0ca1374
--- a/.classpath
+++ b/.classpath
@@ -15,9 +15,16 @@
+
+
+
+
+
+
+
@@ -27,9 +34,21 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
index ca97329..6b7ce95 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,8 @@
-*.class
+.settings
+.project
+.classpath
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
+*.class
# Package Files #
*.jar
@@ -15,4 +16,4 @@ hs_err_pid*
/output
/log
*.csv
-*.log
+*.log
\ No newline at end of file
diff --git a/.project b/.project
old mode 100755
new mode 100644
index 412a914..5249f33
--- a/.project
+++ b/.project
@@ -10,11 +10,6 @@
-
- de.walware.statet.r.builders.RSupport
-
-
-
org.eclipse.m2e.core.maven2Builder
@@ -24,7 +19,5 @@
org.eclipse.jdt.core.javanature
org.eclipse.m2e.core.maven2Nature
- de.walware.statet.base.StatetNature
- de.walware.statet.r.RNature
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index 714351a..5592a0a 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -2,4 +2,6 @@ eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.processAnnotations=disabled
+org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
diff --git a/CHANGES.LOG b/CHANGES.LOG
index df4fbff..34ece0c 100755
--- a/CHANGES.LOG
+++ b/CHANGES.LOG
@@ -1,6 +1,10 @@
Changes
=======
+09/07/2018
+----------
+1. (New Feature) Log the number of General and Specific Investigations conducted and requested
+
08/05/2017
----------
1. (New Feature) Created the GLODERSRandomBatch that allows the execution of a set of
diff --git a/pom.xml b/pom.xml
index 0951196..a370a08 100755
--- a/pom.xml
+++ b/pom.xml
@@ -1,5 +1,5 @@
-
+
4.0.0
gloderss
@@ -9,14 +9,14 @@
UTF-8
- 3.2
- 1.3.2
- 2.6
+ 3.8.0
+ 3.1.0
+ 1.6.0
1.8
0.1
- 4.11
- 1.7.7
- 1.1.2
+ 4.12
+ 1.7.25
+ 1.2.3
1.2.0
0.9.4
3.12.1.GA
@@ -130,7 +130,8 @@
java
- -Xmx1024m -javaagent:target/${project.artifactId}-${project.version}.jar -classpath %classpath gloderss.GLODERSSimulator ${exec.args}
+
+ -Xmx1024m -classpath %classpath gloderss.GLODERSSimulator ${exec.args}
diff --git a/script/runBatch.sh b/script/runBatch.sh
index 4744a77..c258b9d 100755
--- a/script/runBatch.sh
+++ b/script/runBatch.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-XMLpath=src/main/resources/conf/sampleBatch.xml
+XMLpath=src/main/resources/conf/batch/batch.xml
XSDpath=src/main/resources/conf/batch.xsd
if [ $# -gt 0 ]
diff --git a/script/runRandomBatch.sh b/script/runRandomBatch.sh
index 8375589..c6ab952 100755
--- a/script/runRandomBatch.sh
+++ b/script/runRandomBatch.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-XMLpath=src/main/resources/conf/randomBatch.xml
+XMLpath=src/main/resources/conf/sensitivity-analysis/randomBatch.xml
XSDpath=src/main/resources/conf/randomBatch.xsd
if [ $# -gt 0 ]
@@ -9,7 +9,7 @@ then
then
XMLpath=$1
else
- echo "./runBatch.sh [Batch XML path]"
+ echo "./runRandomBatch.sh [Batch XML path]"
exit 1
fi
fi
diff --git a/script/runSim.sh b/script/runSim.sh
index 3627ed0..10c6bd8 100755
--- a/script/runSim.sh
+++ b/script/runSim.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-XMLpath=src/test/resources/conf/sampleScenario.xml
+XMLpath=src/test/resources/conf/scenario.xml
XSDpath=src/main/resources/conf/scenario.xsd
if [ $# -gt 0 ]
@@ -15,4 +15,4 @@ then
fi
cd ..
-/usr/bin/mvn exec:exec -Pexec -Dexec.args="$XMLpath $XSDpath"
\ No newline at end of file
+/usr/bin/mvn exec:exec -Pexec -Dexec.args="$XMLpath $XSDpath"
diff --git a/src/main/java/gloderss/Constants.java b/src/main/java/gloderss/Constants.java
index b7f0f90..08958d7 100755
--- a/src/main/java/gloderss/Constants.java
+++ b/src/main/java/gloderss/Constants.java
@@ -1,377 +1,381 @@
package gloderss;
public final class Constants {
-
+
/**
* General
*/
-
+
public static final String ENCONDING = "UTF-8";
-
+
/**
* Parameters
*/
public static final String PARAM_XML_FILENAME = "xmlFilename";
-
+
public static final String PARAM_XSD_FILENAME = "xsdFilename";
-
+
/**
* Simulation tags
*/
public static final String TAG_NAMESPACE = "palermo.conf";
-
+
public static final String TAG_SCENARIO = "scenario";
-
+
/**
* General tags
*/
public static final String TAG_GENERAL = "general";
-
+
public static final String TAG_NUMBER_REPLICATIONS = "numberReplications";
-
+
public static final String TAG_NUMBER_CYCLES = "numberCycles";
-
+
public static final String TAG_NETWORK_TOPOLOGY = "networkTopology";
-
+
public static final String TAG_CITIZENS_DISTRIBUTION = "citizensDistribution";
-
+
/**
* Seed tags
*/
public static final String TAG_SEEDS = "seeds";
-
+
public static final String TAG_SEED = "seed";
-
+
/**
* Output tags
*/
public static final String TAG_OUTPUT = "output";
-
+
public static final String TAG_OUTPUT_DIRECTORY = "directory";
-
+
public static final String TAG_OUTPUT_APPEND = "append";
-
+
public static final String TAG_OUTPUT_SEPARATOR = "separator";
-
+
public static final String TAG_OUTPUT_TIME_TO_WRITE = "timeToWrite";
-
+
/**
* Filename tags
*/
public static final String TAG_FILENAME = "filename";
-
+
public static final String TAG_FILENAME_EXTORTION = "extortion";
-
+
public static final String TAG_FILENAME_COMPENSATION = "compensation";
-
+
public static final String TAG_FILENAME_PURCHASE = "purchase";
-
+
public static final String TAG_FILENAME_NORMATIVE = "normative";
-
+
public static final String TAG_FILENAME_ENTREPRENEUR = "entrepreneur";
-
+
public static final String TAG_FILENAME_CONSUMER = "consumer";
-
+
public static final String TAG_FILENAME_MAFIA = "mafia";
-
+
public static final String TAG_FILENAME_MAFIOSI = "mafiosi";
-
+
public static final String TAG_FILENAME_STATE = "state";
-
+
+ public static final String TAG_FILENAME_INVESTIGATION = "investigation";
+
public static final String TAG_FILENAME_INTERMEDIARY_ORGANIZATION = "intermediaryOrganization";
-
+
/**
* Visibility tags
*/
public static final String TAG_COMMUNICATION = "communication";
-
+
public static final String TAG_COMMUNICATION_TYPES = "types";
-
+
public static final String TAG_COMMUNICATION_TYPE = "type";
-
+
public static final String TAG_COMMUNICATION_TYPE_NAME = "name";
-
+
public static final String TAG_COMMUNICATION_ACTIONS = "actions";
-
+
public static final String TAG_COMMUNICATION_ACTION = "action";
-
+
public static final String TAG_COMMUNICATION_ACTION_NAME = "name";
-
+
/**
* Consumers tags
*/
public static final String TAG_CONSUMERS = "consumers";
-
+
public static final String TAG_CONSUMER = "consumer";
-
+
public static final String TAG_CONSUMER_NUMBER_CONSUMERS = "numberConsumers";
-
+
public static final String TAG_CONSUMER_LOGGING_TIME_UNIT = "loggingTimeUnit";
-
+
public static final String TAG_CONSUMER_CLUSTERED = "clustered";
-
+
public static final String TAG_CONSUMER_BUY_PDF = "buyPDF";
-
+
public static final String TAG_CONSUMER_NUMBER_ENTREPRENEURS_SEARCH = "numberEntrepreneursSearch";
-
+
public static final String TAG_CONSUMER_REPUTATION = "reputation";
-
+
public static final String TAG_CONSUMER_REPUTATION_ENTREPRENEUR = "entrepreneur";
-
+
public static final String TAG_CONSUMER_REPUTATION_ENTREPRENEUR_THRESHOLD = "entrepreneurThreshold";
-
+
public static final String TAG_CONSUMER_SANCTION = "sanction";
-
+
public static final String TAG_CONSUMER_SANCTION_THRESHOLD = "threshold";
-
+
public static final String TAG_CONSUMER_SANCTION_DISCERNABILITY = "discernability";
-
+
/**
* Entrepreneurs tags
*/
public static final String TAG_ENTREPRENEURS = "entrepreneurs";
-
+
public static final String TAG_ENTREPRENEUR = "entrepreneur";
-
+
public static final String TAG_ENTREPRENEUR_NUMBER_ENTREPRENEURS = "numberEntrepreneurs";
-
+
public static final String TAG_ENTREPRENEUR_LOGGING_TIME_UNIT = "loggingTimeUnit";
-
+
public static final String TAG_ENTREPRENEUR_CLUSTERED = "clustered";
-
+
public static final String TAG_ENTREPRENEUR_WEALTH = "wealth";
-
+
public static final String TAG_ENTREPRENEUR_PERIODICITY_WAGE_PDF = "periodicityWagePDF";
-
+
public static final String TAG_ENTREPRENEUR_MINIMUM_WAGE = "minimumWage";
-
+
public static final String TAG_ENTREPRENEUR_MAXIMUM_WAGE = "maximumWage";
-
+
public static final String TAG_ENTREPRENEUR_VARIATION_WAGE = "variationWage";
-
+
public static final String TAG_ENTREPRENEUR_MINIMUM_PRICE = "minimumPrice";
-
+
public static final String TAG_ENTREPRENEUR_MAXIMUM_PRICE = "maximumPrice";
-
+
public static final String TAG_ENTREPRENEUR_VARIATION_PRICE = "variationPrice";
-
+
public static final String TAG_ENTREPRENEUR_DENOUNCE_ALPHA = "denounceAlpha";
-
+
public static final String TAG_ENTREPRENEUR_COLLABORATION_PROBABILITY = "collaborationProbability";
-
+
public static final String TAG_ENTREPRENEUR_AFFILIATE_THRESHOLD = "affiliateThreshold";
-
+
public static final String TAG_ENTREPRENEUR_AFFILIATED = "affiliated";
-
+
public static final String TAG_ENTREPRENEUR_REPUTATION = "reputation";
-
+
public static final String TAG_ENTREPRENEUR_REPUTATION_STATE_PROTECTOR = "stateProtector";
-
+
public static final String TAG_ENTREPRENEUR_REPUTATION_STATE_PUNISHER = "statePunisher";
-
+
public static final String TAG_ENTREPRENEUR_REPUTATION_MAFIA_PUNISHER = "mafiaPunisher";
-
+
/**
* Normative tags
*/
public static final String TAG_NORMATIVE_XML = "normativeXML";
-
+
public static final String TAG_NORMATIVE_XSD = "normativeXSD";
-
+
public static final String TAG_NORMATIVE_INDIVIDUAL_WEIGHT = "individualWeight";
-
+
public static final String TAG_NORMATIVE_NORMATIVE_WEIGHT = "normativeWeight";
-
+
public static final String TAG_NORMATIVE_NORMS_SALIENCE = "normsSalience";
-
+
public static final String TAG_NORMATIVE_NORM_SALIENCE = "normSalience";
-
+
public static final String TAG_NORMATIVE_NORM_ID = "id";
-
+
public static final String TAG_NORMATIVE_NORM_ACTIVE = "active";
-
+
public static final String TAG_NORMATIVE_NORM_INITIAL_COMPLIANCE = "compliance";
-
+
public static final String TAG_NORMATIVE_NORM_INITIAL_VIOLATION = "violation";
-
+
public static final String TAG_NORMATIVE_NORM_INITIAL_OBS_COMPLIANCE = "obsCompliance";
-
+
public static final String TAG_NORMATIVE_NORM_INITIAL_OBS_VIOLATION = "obsViolation";
-
+
public static final String TAG_NORMATIVE_NORM_INITIAL_PUNISHMENT = "punishment";
-
+
public static final String TAG_NORMATIVE_NORM_INITIAL_SANCTION = "sanction";
-
+
public static final String TAG_NORMATIVE_NORM_INITIAL_INVOCATION_COMPLIANCE = "invocationCompliance";
-
+
public static final String TAG_NORMATIVE_NORM_INITIAL_INVOCATION_VIOLATION = "invocationViolation";
-
+
/**
* State tags
*/
public static final String TAG_STATE = "state";
-
+
public static final String TAG_STATE_NUMBER_POLICE_OFFICERS = "numberPoliceOfficers";
-
+
+ public static final String TAG_STATE_LOGGING_TIME_UNIT = "loggingTimeUnit";
+
public static final String TAG_STATE_GENERAL_INVESTIGATION_DURATION_PDF = "generalInvestigationDurationPDF";
-
+
public static final String TAG_STATE_BUREAUCRATIC_ACTIVITY_DURATION_PDF = "bureaucraticActivityDurationPDF";
-
+
public static final String TAG_STATE_SPECIFIC_INVESTIGATION_DURATION_PDF = "specificInvestigationDurationPDF";
-
+
public static final String TAG_STATE_SPECIFIC_INVESTIGATION_PROBABILITY = "specificInvestigationProbability";
-
+
public static final String TAG_STATE_CAPTURE_PROBABILITY = "captureProbability";
-
+
public static final String TAG_STATE_EVIDENCE_PROBABILITY = "evidenceProbability";
-
+
public static final String TAG_STATE_CUSTODY_DURATION_PDF = "custodyDurationPDF";
-
+
public static final String TAG_STATE_CONVICTION_PROBABILITY = "convictionProbability";
-
+
public static final String TAG_STATE_COLLABORATION_CONVICTION_FUNCTION = "collaborationConvictionFunction";
-
+
public static final String TAG_STATE_IMPRISONMENT_DURATION_PDF = "imprisonmentDurationPDF";
-
+
public static final String TAG_STATE_TIME_TO_COMPENSATION_PDF = "timeToCompensationPDF";
-
+
public static final String TAG_STATE_NO_COLLABORATION_PUNISHMENT_PROBABILITY = "noCollaborationPunishmentProbability";
-
+
public static final String TAG_STATE_NO_COLLABORATION_PUNISHMENT = "noCollaborationPunishment";
-
+
public static final String TAG_STATE_RESOURCE_FONDO = "resourceFondo";
-
+
public static final String TAG_STATE_PERIODICITY_FONDO_PDF = "periodicityFondoPDF";
-
+
public static final String TAG_STATE_PROPORTION_TRANSFER_FONDO = "proportionTransferFondo";
-
+
public static final String TAG_STATE_SPREAD_INFO_FUNCTION = "spreadInfoFunction";
-
+
public static final String TAG_STATE_PROPORTION_CONSUMERS = "proportionConsumers";
-
+
public static final String TAG_STATE_PROPORTION_ENTREPRENEURS = "proportionEntrepreneurs";
-
+
/**
* Mafia tags
*/
public static final String TAG_MAFIA = "mafia";
-
+
public static final String TAG_MAFIA_NUMBER_MAFIOSI = "numberMafiosi";
-
+
public static final String TAG_MAFIA_LOGGING_TIME_UNIT = "loggingTimeUnit";
-
+
public static final String TAG_MAFIA_WEALTH = "wealth";
-
+
public static final String TAG_MAFIA_DEMAND_PDF = "demandPDF";
-
+
public static final String TAG_MAFIA_DEMAND_AFFILIATED_PROBABILITY = "demandAffiliatedProbability";
-
+
public static final String TAG_MAFIA_EXTORTION_LEVEL = "extortionLevel";
-
+
public static final String TAG_MAFIA_PUNISHMENT_SEVERITY = "punishmentSeverity";
-
+
public static final String TAG_MAFIA_COLLECTION_PDF = "collectionPDF";
-
+
public static final String TAG_MAFIA_PUNISHMENT_PROBABILITY = "punishmentProbability";
-
+
public static final String TAG_MAFIA_MINIMUM_BENEFIT = "minimumBenefit";
-
+
public static final String TAG_MAFIA_MAXIMUM_BENEFIT = "maximumBenefit";
-
+
public static final String TAG_MAFIA_PENTITI_PROBABILITY = "pentitiProbability";
-
+
public static final String TAG_MAFIA_RECRUITING_THRESHOLD = "recruitingThreshold";
-
+
public static final String TAG_MAFIA_RECRUITING_PROBABILITY = "recruitingProbability";
-
+
/**
* Intermediary organization tags
*/
public static final String TAG_INTERMEDIARY_ORG = "intermediaryOrg";
-
+
public static final String TAG_INTERMEDIARY_ORG_TIME_TO_AFFILIATE_PDF = "timeToAffiliatePDF";
-
+
public static final String TAG_INTERMEDIARY_ORG_SPREAD_INFO_FUNCTION = "spreadInfoFunction";
-
+
public static final String TAG_INTERMEDIARY_ORG_PROPORTION_CONSUMERS = "proportionConsumers";
-
+
public static final String TAG_INTERMEDIARY_ORG_PROPORTION_ENTREPRENEURS = "proportionEntrepreneurs";
-
+
/**
* Change tags
*/
public static final String TAG_CHANGES = "changes";
-
+
public static final String TAG_CHANGE = "change";
-
+
public static final String TAG_CHANGE_TIME = "time";
-
+
public static final String TAG_CHANGE_PARAMETER = "parameter";
-
+
public static final String TAG_CHANGE_VALUE = "value";
-
+
/**
* Batch tags
*/
public static final String TAG_BATCH = "batch";
-
+
public static final String TAG_BATCH_BASE = "base";
-
+
public static final String TAG_BATCH_OUTPUT = "output";
-
+
public static final String TAG_BATCH_REPLICA = "replica";
-
+
public static final String TAG_BATCH_XML_SCENARIO = "xmlScenario";
-
+
public static final String TAG_BATCH_XSD_SCENARIO = "xsdScenario";
-
+
public static final String TAG_BATCH_HEADER = "header";
-
+
public static final String TAG_BATCH_GENERAL = "general";
-
+
public static final String TAG_BATCH_COMMUNICATION = "communication";
-
+
public static final String TAG_BATCH_CITIZENS = "citizens";
-
+
public static final String TAG_BATCH_STATES = "states";
-
+
public static final String TAG_BATCH_MAFIAS = "mafias";
-
+
public static final String TAG_BATCH_IOS = "ios";
-
+
public static final String TAG_BATCH_TAIL = "tail";
-
+
public static final String TAG_BATCH_CODE = "code";
-
+
public static final String TAG_BATCH_CONTENT = "content";
-
+
/**
* Batch tags
*/
public static final String TAG_RANDOM_BATCH = "randomBatch";
-
+
public static final String TAG_RANDOM_BATCH_OUTPUT_DIR = "outputDir";
-
+
public static final String TAG_RANDOM_BATCH_OUTPUT_FILE = "outputFile";
-
+
public static final String TAG_RANDOM_BATCH_REPLICA = "replica";
-
+
public static final String TAG_RANDOM_BATCH_XML_SCENARIO = "xmlScenario";
-
+
public static final String TAG_RANDOM_BATCH_XSD_SCENARIO = "xsdScenario";
-
+
public static final String TAG_RANDOM_BATCH_CHANGES = "changes";
-
+
public static final String TAG_RANDOM_BATCH_CHANGE = "change";
-
+
public static final String TAG_RANDOM_BATCH_NAME = "name";
-
+
public static final String TAG_RANDOM_BATCH_PARAMETER = "parameter";
-
+
public static final String TAG_RANDOM_BATCH_TYPE = "type";
-
+
public static final String TAG_RANDOM_BATCH_VALUE = "value";
-
+
/**
* Actions
*/
@@ -413,7 +417,7 @@ public static enum Actions {
REPUTATION_INFO,
CRITICAL_CONSUMER_INFO;
}
-
+
/**
* Norms
*/
@@ -425,7 +429,7 @@ public static enum Norms {
BUY_FROM_NOT_PAYING_ENTREPRENEURS,
BUY_FROM_PAYING_ENTREPRENEURS;
}
-
+
/**
* Sanctions
*/
@@ -433,7 +437,7 @@ public static enum Sanctions {
REPUTATION_ENTREPRENEUR,
NORM_SANCTION;
}
-
+
/**
* Citizens distribution
*/
@@ -441,7 +445,7 @@ public static enum CitizensDistribution {
CLUSTERED,
RANDOM;
}
-
+
/**
* Network topology
*/
@@ -449,75 +453,77 @@ public static enum NetworkTopolgy {
MESH,
SCALEFREE;
}
-
+
/**
* Information request
*/
public static final String REQUEST_AFFILIATION = "affiliated";
-
+
public static final String REQUEST_COLLECT_PAYERS = "requestCollectPayers";
-
+
public static final String REQUEST_CRITICAL_CONSUMERS = "criticalConsumers";
-
+
public static final String REQUEST_ID = "id";
-
+
public static final String REQUEST_DEFAULT_WAGE = "defaultWage";
-
+
public static final String REQUEST_DURATION = "duration";
-
+
public static final String REQUEST_ENTREPRENEUR_ID = "entrepreneurId";
-
+
public static final String REQUEST_PRODUCT_PRICE = "productPrice";
-
+
public static final String REQUEST_TARGET_ID = "targetId";
-
+
public static final String REQUEST_WEALTH = "wealth";
-
+
/**
* Information set
*/
public static final String PARAMETER_STATE_ID = "stateId";
-
+
public static final String PARAMETER_STATE_PUNISHMENT = "statePunishment";
-
+
public static final String PARAMETER_ADD_MAFIOSO = "addMafioso";
-
+
public static final String PARAMETER_REMOVE_MAFIOSO = "removeMafioso";
-
+
public static final String PARAMETER_WEALTH = "wealth";
-
+
/**
* Events
*/
public static final String EVENT_AFFILIATE_PROCESSING = "eventAffiliateProcessing";
-
+
public static final String EVENT_ASSIST_ENTREPRENEUR = "eventAssistEntrepreneur";
-
+
public static final String EVENT_BUROCRATIC_ACTIVITY = "eventBurocraticActivity";
-
+
public static final String EVENT_BUY_PRODUCT = "eventBuyProduct";
-
+
public static final String EVENT_COLLECT_EXTORTION = "eventCollectExtortion";
-
+
public static final String EVENT_DEMAND_EXTORTION = "eventDemandExtortion";
-
+
public static final String EVENT_GENERAL_INVESTIGATION = "eventGeneralInvestigation";
-
+
public static final String EVENT_LOGGING_CONSUMERS = "eventLoggingConsumers";
-
+
public static final String EVENT_LOGGING_ENTREPRENEURS = "eventLoggingEntrepreneurs";
-
+
public static final String EVENT_LOGGING_MAFIOSI = "eventLoggingMafiosi";
-
+
+ public static final String EVENT_LOGGING_INVESTIGATION = "eventLoggingInvestigations";
+
public static final String EVENT_RECEIVE_WAGE = "eventReceiveWage";
-
+
public static final String EVENT_RELEASE_PRISON = "eventReleasePrison";
-
+
public static final String EVENT_RELEASE_CUSTODY = "eventReleaseCustody";
-
+
public static final String EVENT_RESOURCE_FONDO = "eventResourceFondo";
-
+
public static final String EVENT_SPREAD_INFORMATION = "eventSpreadInformation";
-
+
public static final String EVENT_WRITE_DATA = "eventWriteData";
}
\ No newline at end of file
diff --git a/src/main/java/gloderss/agents/entrepreneur/EntrepreneurAgent.java b/src/main/java/gloderss/agents/entrepreneur/EntrepreneurAgent.java
index 5221138..f1f3bff 100755
--- a/src/main/java/gloderss/agents/entrepreneur/EntrepreneurAgent.java
+++ b/src/main/java/gloderss/agents/entrepreneur/EntrepreneurAgent.java
@@ -1363,6 +1363,8 @@ public synchronized void handleMessage( Message msg ) {
// Normative process
this.normative.input( msg );
+ this.normative.update();
+
// Reputation
this.mafiaPunisherRep
.updateReputation( (MafiaPunishmentAction) content );
@@ -1470,9 +1472,7 @@ public synchronized void handleMessage( Message msg ) {
msg.getReceiver(), pay );
this.normative.input( newMsg );
}
-
}
-
}
}
}
@@ -1502,20 +1502,20 @@ public Object handleInfo( InfoAbstract info ) {
return infoRequested;
} else if ( info.getType().equals( InfoAbstract.Type.SET ) ) {
- Object infoResult = new Boolean( false );
+ Object infoResult = Boolean.FALSE;
InfoSet set = (InfoSet) info;
switch ( set.getParameter() ) {
case Constants.PARAMETER_STATE_ID:
if ( set.getValue() instanceof Integer ) {
this.stateId = (Integer) set.getValue();
- infoResult = new Boolean( true );
+ infoResult = Boolean.TRUE;
}
break;
case Constants.PARAMETER_STATE_PUNISHMENT:
if ( set.getValue() instanceof Double ) {
this.statePunishment = ((Double) set.getValue() * this.defaultWage);
- infoResult = new Boolean( true );
+ infoResult = Boolean.TRUE;
}
break;
}
diff --git a/src/main/java/gloderss/agents/intermediaryOrg/IntermediaryOrg.java b/src/main/java/gloderss/agents/intermediaryOrg/IntermediaryOrg.java
index 0c832e4..9be89e5 100755
--- a/src/main/java/gloderss/agents/intermediaryOrg/IntermediaryOrg.java
+++ b/src/main/java/gloderss/agents/intermediaryOrg/IntermediaryOrg.java
@@ -189,7 +189,7 @@ public void spreadNormativeInformation() {
this.spreadInfoFunction.clearVariables();
this.spreadInfoFunction.putVariable( NUMBER_ACTIONS,
- (new Integer( this.numActions )).toString() );
+ Integer.valueOf( this.numActions ).toString() );
double probSpreadInfo = 0.0;
try {
diff --git a/src/main/java/gloderss/agents/state/IStateOrg.java b/src/main/java/gloderss/agents/state/IStateOrg.java
index 4fe7b97..033af33 100755
--- a/src/main/java/gloderss/agents/state/IStateOrg.java
+++ b/src/main/java/gloderss/agents/state/IStateOrg.java
@@ -11,47 +11,47 @@
import gloderss.actions.ReleaseInvestigationAction;
public interface IStateOrg {
-
+
public void initializeSim();
-
-
+
+
public void decideInvestigateExtortion( DenounceExtortionAction action );
-
-
+
+
public void decideInvestigateExtortionAffiliated(
DenounceExtortionAffiliatedAction action );
-
-
+
+
public void decideInvestigatePunishment( DenouncePunishmentAction action );
-
-
+
+
public void decideInvestigatePunishmentAffiliated(
DenouncePunishmentAffiliatedAction action );
-
-
+
+
public void releaseInvestigation( ReleaseInvestigationAction action );
-
-
+
+
public void decideCustody( CaptureMafiosoAction action );
-
-
+
+
public void decideConviction( CaptureMafiosoAction action );
-
-
+
+
public void receivePentito( PentitoAction action );
-
-
+
+
public void receiveCollaboration( CollaborateAction action );
-
-
+
+
public void decideStatePunishment( NotCollaborateAction action );
-
-
+
+
public void decideStateCompensation();
-
-
+
+
public void spreadNormativeInformation();
-
-
+
+
public void finalizeSim();
}
\ No newline at end of file
diff --git a/src/main/java/gloderss/agents/state/PoliceOfficerAgent.java b/src/main/java/gloderss/agents/state/PoliceOfficerAgent.java
index d6bf04e..ee44161 100755
--- a/src/main/java/gloderss/agents/state/PoliceOfficerAgent.java
+++ b/src/main/java/gloderss/agents/state/PoliceOfficerAgent.java
@@ -22,264 +22,282 @@
public class PoliceOfficerAgent extends AbstractAgent
implements IPoliceOfficer {
-
+
private int stateId;
-
+
private String generalInvestigationDuration;
-
+
private PDFAbstract generalInvestigationDurationPDF;
-
+
private String bureaucraticActivityDuration;
-
+
private PDFAbstract bureaucraticActivityDurationPDF;
-
+
private String specificInvestigationDuration;
-
+
private PDFAbstract specificInvestigationDurationPDF;
-
+
private double captureProbability;
-
+
private int observed;
-
+
private List mafiosi;
-
+
private Event event;
-
+
private int extortionId;
-
+
private boolean specificInvestigation;
-
-
+
+ private int numGeneralInv;
+
+
/**
* Police constructor
- *
+ *
* @param id
- * Police officer agent identification
+ * Police officer agent identification
* @param simulator
- * Event simulator
+ * Event simulator
* @param conf
- * Police officer configuration
+ * Police officer configuration
* @return none
*/
public PoliceOfficerAgent( Integer id, EventSimulator simulator, StateConf conf, int stateId ) {
super( id, simulator );
-
+
this.stateId = stateId;
-
+
this.generalInvestigationDuration = conf
.getGeneralInvestigationDurationPDF();
-
+
this.generalInvestigationDurationPDF = PDFAbstract
.getInstance( this.generalInvestigationDuration );
-
+
this.bureaucraticActivityDuration = conf
.getBureaucraticActivityDurationPDF();
-
+
this.bureaucraticActivityDurationPDF = PDFAbstract
.getInstance( this.bureaucraticActivityDuration );
-
+
this.specificInvestigationDuration = conf
.getSpecificInvestigationDurationPDF();
-
+
this.specificInvestigationDurationPDF = PDFAbstract
.getInstance( this.specificInvestigationDuration );
-
+
this.captureProbability = conf.getCaptureProbability();
-
+
this.observed = -1;
-
+
this.mafiosi = new ArrayList();
-
+
this.event = null;
-
+
this.specificInvestigation = false;
this.extortionId = -1;
+
+ this.numGeneralInv = 0;
}
-
-
+
+
/*******************************
- *
+ *
* Getters and Setters
- *
+ *
*******************************/
-
+
public String getGeneralInvestigationDuration() {
return this.generalInvestigationDuration;
}
-
-
+
+
public void
setGeneralInvestigationDuration( String generalInvestigationDuration ) {
this.generalInvestigationDuration = generalInvestigationDuration;
-
+
this.generalInvestigationDurationPDF = PDFAbstract
.getInstance( this.generalInvestigationDuration );
}
-
-
+
+
public String getBureaucraticActivityDuration() {
return this.bureaucraticActivityDuration;
}
-
-
+
+
public void
setBureaucraticActivityDuration( String bureaucraticActivityDuration ) {
this.bureaucraticActivityDuration = bureaucraticActivityDuration;
-
+
this.bureaucraticActivityDurationPDF = PDFAbstract
.getInstance( this.bureaucraticActivityDuration );
}
-
-
+
+
public String getSpecificInvestigationDuration() {
return this.specificInvestigationDuration;
}
-
-
+
+
public void
setSpecificInvestigationDuration( String specificInvestigationDuration ) {
this.specificInvestigationDuration = specificInvestigationDuration;
-
+
this.specificInvestigationDurationPDF = PDFAbstract
.getInstance( this.specificInvestigationDuration );
}
-
-
+
+
public double getCaptureProbability() {
return this.captureProbability;
}
-
-
+
+
public void setCaptureProbability( double captureProbability ) {
this.captureProbability = captureProbability;
}
-
-
+
+
public int getObserved() {
return this.observed;
}
-
-
+
+
public void setObserved( int observed ) {
this.observed = observed;
}
-
-
+
+
public List getMafiosi() {
return this.mafiosi;
}
-
-
+
+
public void setMafiosi( List mafiosi ) {
this.mafiosi = mafiosi;
}
-
-
+
+
public void addMafioso( int mafioso ) {
if ( !this.mafiosi.contains( mafioso ) ) {
this.mafiosi.add( mafioso );
}
}
-
-
+
+
public void removeMafioso( int mafioso ) {
if ( this.mafiosi.contains( mafioso ) ) {
this.mafiosi.remove( mafioso );
}
}
-
-
+
+
+ public int getNumGeneralInv() {
+ return this.numGeneralInv;
+ }
+
+
+ public void setNumGeneralInv( int numGeneralInv ) {
+ this.numGeneralInv = numGeneralInv;
+ }
+
+
/*******************************
- *
+ *
* Decision Processes
- *
+ *
*******************************/
-
+
@Override
public void initializeSim() {
this.specificInvestigation = false;
-
+
+ this.numGeneralInv = 0;
+
this.event = new Event( this.simulator.now() + 1, this,
Constants.EVENT_GENERAL_INVESTIGATION );
this.simulator.insert( this.event );
}
-
-
+
+
@Override
public void generalInvestigation() {
-
+
// Release specific investigation
if ( this.specificInvestigation ) {
ReleaseInvestigationAction action = new ReleaseInvestigationAction(
this.id, this.observed );
-
+
Message msg = new Message( this.simulator.now(), this.id, this.stateId,
action );
this.sendMsg( msg );
-
+
this.specificInvestigation = false;
this.extortionId = -1;
}
-
+
if ( (this.observed != -1) ) {
this.removeObservation( this.id, this.observed );
this.observed = -1;
}
-
+
// Get one target with the Mafia Organization
InfoRequest entrepreneurRequest = new InfoRequest( this.id, this.stateId,
Constants.REQUEST_ENTREPRENEUR_ID );
this.observed = (int) this.sendInfo( entrepreneurRequest );
-
+
this.addObservation( this.id, this.observed );
-
+
+ this.numGeneralInv += 1;
+
this.event = new Event(
this.simulator.now() + this.bureaucraticActivityDurationPDF.nextValue(),
this, Constants.EVENT_BUROCRATIC_ACTIVITY );
this.simulator.insert( this.event );
}
-
-
+
+
@Override
public void specificInvestigation( SpecificInvestigationAction action ) {
-
+
if ( this.event != null ) {
this.simulator.cancel( this.event );
}
-
+
if ( (this.observed != -1) ) {
this.removeObservation( this.id, this.observed );
}
-
+
this.extortionId = (int) action
.getParam( SpecificInvestigationAction.Param.EXTORTION_ID );
-
+
this.observed = (int) action
.getParam( SpecificInvestigationAction.Param.ENTREPRENEUR_ID );
-
+
this.addObservation( this.id, this.observed );
-
+
this.event = new Event(
this.simulator.now()
+ this.specificInvestigationDurationPDF.nextValue(),
this, Constants.EVENT_GENERAL_INVESTIGATION );
this.simulator.insert( this.event );
-
+
this.specificInvestigation = true;
}
-
-
+
+
/**
* Decides to capture observed Mafioso
- *
+ *
* @param mafiosoId
- * Mafioso identification
+ * Mafioso identification
* @return none
*/
private void captureMafioso( int mafiosoId ) {
-
+
if ( RandomUtil.nextDouble() < this.captureProbability ) {
-
+
CaptureMafiosoAction action;
if ( this.specificInvestigation ) {
action = new CaptureMafiosoAction( this.extortionId, this.id, mafiosoId,
@@ -287,17 +305,17 @@ private void captureMafioso( int mafiosoId ) {
} else {
action = new CaptureMafiosoAction( -1, this.id, mafiosoId, false );
}
-
+
Message msg = new Message( this.simulator.now(), this.id, this.stateId,
action );
this.sendMsg( msg );
}
}
-
-
+
+
/**
* Waits a period of time before initiating a new general investigation
- *
+ *
* @param none
* @return none
*/
@@ -306,52 +324,52 @@ private void burocraticActivity() {
this.simulator.now() + this.generalInvestigationDurationPDF.nextValue(),
this, Constants.EVENT_GENERAL_INVESTIGATION );
this.simulator.insert( this.event );
-
+
}
-
-
+
+
@Override
public void finalizeSim() {
}
-
-
+
+
/*******************************
- *
+ *
* Handle communication requests
- *
+ *
*******************************/
-
+
@Override
public synchronized void handleMessage( Message msg ) {
-
+
Object content = msg.getContent();
-
+
if ( (msg.getSender() != this.id)
&& (msg.getReceiver().contains( this.id )) ) {
-
+
if ( content instanceof SpecificInvestigationAction ) {
this.specificInvestigation( (SpecificInvestigationAction) content );
-
+
}
}
}
-
-
+
+
@Override
public Object handleInfo( InfoAbstract info ) {
Object infoRequested = null;
-
+
if ( info.getType().equals( InfoAbstract.Type.REQUEST ) ) {
-
+
InfoRequest request = (InfoRequest) info;
switch ( request.getInfoRequest() ) {
case Constants.REQUEST_ID:
infoRequested = this.getId();
break;
}
-
+
} else if ( info.getType().equals( InfoAbstract.Type.SET ) ) {
-
+
InfoSet set = (InfoSet) info;
int mafioso;
switch ( set.getParameter() ) {
@@ -365,53 +383,53 @@ public Object handleInfo( InfoAbstract info ) {
break;
}
}
-
+
return infoRequested;
}
-
-
+
+
@Override
public void handleObservation( Message msg ) {
-
+
Object content = msg.getContent();
-
+
if ( (msg.getSender() != this.id)
&& (!msg.getReceiver().contains( this.id )) ) {
-
+
// Collect
if ( content instanceof CollectAction ) {
CollectAction action = (CollectAction) content;
int mafiosoId = (int) action.getParam( CollectAction.Param.MAFIOSO_ID );
this.captureMafioso( mafiosoId );
-
- // Exortion
+
+ // Extortion
} else if ( content instanceof ExtortionAction ) {
ExtortionAction action = (ExtortionAction) content;
int mafiosoId = (int) action
.getParam( ExtortionAction.Param.MAFIOSO_ID );
this.captureMafioso( mafiosoId );
-
+
// Mafia Punishment
} else if ( content instanceof MafiaPunishmentAction ) {
MafiaPunishmentAction action = (MafiaPunishmentAction) content;
int mafiosoId = (int) action
.getParam( MafiaPunishmentAction.Param.MAFIOSO_ID );
this.captureMafioso( mafiosoId );
-
+
}
}
}
-
-
+
+
/*******************************
- *
+ *
* Handle simulation events
- *
+ *
*******************************/
-
+
@Override
public void handleEvent( Event event ) {
-
+
switch ( (String) event.getCommand() ) {
case Constants.EVENT_GENERAL_INVESTIGATION:
this.generalInvestigation();
diff --git a/src/main/java/gloderss/agents/state/StateOrg.java b/src/main/java/gloderss/agents/state/StateOrg.java
index 0255390..da33be1 100755
--- a/src/main/java/gloderss/agents/state/StateOrg.java
+++ b/src/main/java/gloderss/agents/state/StateOrg.java
@@ -43,6 +43,7 @@
import gloderss.output.AbstractEntity.EntityType;
import gloderss.output.CompensationOutputEntity;
import gloderss.output.ExtortionOutputEntity;
+import gloderss.output.InvestigationOutputEntity;
import gloderss.output.NormativeOutputEntity;
import gloderss.output.OutputController;
import gloderss.output.StateOutputEntity;
@@ -52,153 +53,161 @@
import net.sourceforge.jeval.Evaluator;
public class StateOrg extends AbstractAgent implements IStateOrg {
-
+
private final static Logger logger = LoggerFactory
.getLogger( StateOrg.class );
-
+
private static final String COLLABORATION = "COLLABORATION";
-
+
+ private int loggingTimeUnit;
+
private int ioId;
-
+
private List changesConf;
-
+
private double specificInvestigationProbability;
-
+
private double evidenceProbability;
-
+
private double convictionProbability;
-
+
private double noCollaborationPunishmentProbability;
-
+
private double noCollaborationPunishment;
-
+
private double resourceFondo;
-
+
private double proportionTransferFondo;
-
+
private PDFAbstract custodyDurationPDF;
-
+
private PDFAbstract imprisonmentDurationPDF;
-
+
private PDFAbstract timeToCompensationPDF;
-
+
private PDFAbstract periodicityFondoPDF;
-
+
private String collaborationConvictionFunction;
-
+
private String spreadInfoFunctionStr;
-
+
private Evaluator spreadInfoFunction;
-
+
private String proportionConsumersStr;
-
+
private Evaluator proportionConsumers;
-
+
private String proportionEntrepreneursStr;
-
+
private Evaluator proportionEntrepreneurs;
-
+
private double fondoSolidarieta;
-
+
private Map policeOfficers;
-
+
private Map consumers;
-
+
private Map entrepreneurs;
-
+
private List mafiosiBlackList;
-
+
private List investigateEntrepreneurs;
-
+
private List allocatedPoliceOfficers;
-
+
private Queue custodyQueue;
-
+
private Queue prisonQueue;
-
+
private Queue