AMLSim icon indicating copy to clipboard operation
AMLSim copied to clipboard

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7 during run_AMLSim.sh conf.json

Open florisviss opened this issue 6 years ago • 2 comments

Thanks for making the changes, the first part of sh scripts/run_AMLSim.sh conf.json works I suppose. However I get another exception error:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7 at amlsim.AMLSim.loadAccountFile(AMLSim.java:214) at amlsim.AMLSim.initSimulation(AMLSim.java:99) at paysim.PaySim.start(PaySim.java:115) at amlsim.AMLSim.executeSimulation(AMLSim.java:403) at amlsim.AMLSim.runSimulation(AMLSim.java:84) at amlsim.AMLSim.main(AMLSim.java:496) The full command prompt is:

Microsoft Windows [Version 10.0.17763.864] (c) 2018 Microsoft Corporation. All rights reserved.

C:\Path\To\AMLSim-master>

C:\Path\To\AMLSim-master> python scripts/transaction_graph_generator.py conf.json Random seed: 0 Simulation name: sample Generated 10000 accounts. Add 99900 base transactions Exported 10000 accounts to tmp\sample\accounts.csv Exported 100632 transactions to tmp\sample\transactions.csv Output alert member list to: tmp\sample\alert_members.csv Exported 792 members for 100 AML typologies to tmp\sample\alert_members.csv

C:\Path\To\AMLSim-master> sh scripts/build_AMLSim.sh

C:\Path\To\AMLSim-master>sh scripts/run_AMLSim.sh conf.json General transaction interval: 7 Base transaction amount: Normal = 100.000000, Suspicious= 1000.000000 Random seed: 0 Simulation name: sample Working directory: tmp\sample
dec 05, 2019 12:53:12 PM amlsim.AMLSim parseArgs INFO: PaySim Properties File: paramFiles/paysim.properties dec 05, 2019 12:53:12 PM amlsim.AMLSim parseArgs INFO: PaySim Properties File: paramFiles/paysim.properties dec 05, 2019 12:53:12 PM amlsim.AMLSim parseArgs INFO: Simulation Steps: 720 dec 05, 2019 12:53:12 PM amlsim.AMLSim parseArgs INFO: Simulation Steps: 720 Norm: 100 Case: 50 dec 05, 2019 12:53:12 PM amlsim.AMLSim initSimulatorName INFO: Simulator Name: sample dec 05, 2019 12:53:12 PM amlsim.AMLSim initSimulatorName INFO: Simulator Name: sample dec 05, 2019 12:53:12 PM amlsim.AMLSim initSimulatorName WARNING: Output log directory already exists: tmp\sample
dec 05, 2019 12:53:12 PM amlsim.AMLSim initSimulatorName WARNING: Output log directory already exists: tmp\sample
dec 05, 2019 12:53:12 PM amlsim.AMLSim executeSimulation INFO: Transaction log file: tmp\sample\tx_log.csv dec 05, 2019 12:53:12 PM amlsim.AMLSim executeSimulation INFO: Transaction log file: tmp\sample\tx_log.csv PAYSIM: Financial Simulator v1.0

dec 05, 2019 12:53:12 PM amlsim.AMLSim loadAccountFile INFO: Account CSV header: ACCOUNT_ID,CUSTOMER_ID,INIT_BALANCE,START_DATE,END_DATE,COUNTRY,ACCOUNT_TYPE,IS_SAR,TX_BEHAVIOR_ID,BANK_ID dec 05, 2019 12:53:12 PM amlsim.AMLSim loadAccountFile INFO: Account CSV header: ACCOUNT_ID,CUSTOMER_ID,INIT_BALANCE,START_DATE,END_DATE,COUNTRY,ACCOUNT_TYPE,IS_SAR,TX_BEHAVIOR_ID,BANK_ID Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7 at amlsim.AMLSim.loadAccountFile(AMLSim.java:214) at amlsim.AMLSim.initSimulation(AMLSim.java:99) at paysim.PaySim.start(PaySim.java:115) at amlsim.AMLSim.executeSimulation(AMLSim.java:403) at amlsim.AMLSim.runSimulation(AMLSim.java:84) at amlsim.AMLSim.main(AMLSim.java:496)

C:\Path\To\AMLSim-master>

florisviss avatar Dec 06 '19 08:12 florisviss

Sorry for the late response. Related to issue #30, we re-arranged parameters in the configuration JSON files. It should work with the same commands and parameter files.

hkanezashi avatar Feb 25 '20 07:02 hkanezashi

I modified the loadAccountsFile method

			private void loadAccountFile(String accountFile) throws IOException{
	BufferedReader reader = new BufferedReader(new FileReader(accountFile));
	String line = reader.readLine();
	logger.info("Account CSV header: " + line);
	Map<String, Integer> columnIndex = getColumnIndices(line);
	while((line = reader.readLine()) != null){

		if(line.equals("")) continue;

		String[] elements = line.split(",");
		String accountID = elements[columnIndex.get("ACCOUNT_ID")];
		boolean isSAR = elements[columnIndex.get("IS_SAR")].toLowerCase().equals("true");
		int modelID = Integer.parseInt(elements[columnIndex.get("TX_BEHAVIOR_ID")]);
		float initBalance = Float.parseFloat(elements[columnIndex.get("INIT_BALANCE")]);
		int start = Integer.parseInt(elements[columnIndex.get("START_DATE")]);
		int end = Integer.parseInt(elements[columnIndex.get("END_DATE")]);
		String bankID = elements[columnIndex.get("BANK_ID")];


		Account account;
		if (isSAR) {
			account = new SARAccount(accountID, modelID, normalTxInterval, initBalance, start, end, bankID,
					getRandom());
		} else {
			account = new Account(accountID, modelID, normalTxInterval, initBalance, start, end, bankID,
					getRandom());
		}

		int index = this.getClients().size();
		account.setBranch(this.branches.get(index % this.numBranches));
		this.getClients().add(account);
		this.idMap.put(accountID, index);
		this.schedule.scheduleRepeating(account);
	}
	int numAccounts = idMap.size();
	logger.info("Number of total accounts: " + numAccounts);
	diameter = new Diameter(numAccounts);

	reader.close();
}

FredWrecked avatar Dec 17 '21 10:12 FredWrecked