Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
florisviss opened this issue Dec 6, 2019 · 2 comments

Comments

@florisviss
Copy link

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>

hkanezashi added a commit that referenced this issue Feb 3, 2020
hkanezashi added a commit that referenced this issue Feb 4, 2020
@hkanezashi hkanezashi added this to Issues: AMLSim transactions in Progress of documentations Feb 25, 2020
@hkanezashi hkanezashi removed this from Issues: AMLSim transactions in Progress of documentations Feb 25, 2020
@hkanezashi
Copy link
Collaborator

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.

@FredWrecked
Copy link

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();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants