public MasTaskEnvironment(InputStream input) throws IOException {
		try (Scanner scan = new Scanner(input))
		{
			// read first line
			Scanner currLineScanner = new Scanner(scan.nextLine());
			numberOfAgents = currLineScanner.nextInt();
			numberOfCycles = currLineScanner.nextInt();
			LeftoverPenalty = currLineScanner.nextFloat();
			currLineScanner.close();
			
			// consume empty line
			String dummyLine = scan.nextLine().trim();
			if (dummyLine.length() != 0 )
				throw new IOException("Something went wrong in reading the input file! Was expecting empty line ...");
			
			// consume a line for each agents's input data
			for (int i = 0; i < numberOfAgents; i++) {
				currLineScanner = new Scanner(scan.nextLine());
				int budget = currLineScanner.nextInt();
				
				AgentData newAgent = new AgentData(i);
				newAgent.setBudget(budget);
				
				while (currLineScanner.hasNextInt()) {
					int cap = currLineScanner.nextInt();
					if (!currLineScanner.hasNextInt()) {
						currLineScanner.close();
						throw new IOException("Wrong input Could not find cost for current capability.");
					}
					int cost = currLineScanner.nextInt();
					newAgent.addCapability(new Integer(cap), new Integer(cost));
				}
				
				this.addAgent(newAgent);
				currLineScanner.close();
			}
			
			// consume another empty line
			dummyLine = scan.nextLine().trim();
			if (dummyLine.length() != 0 )
				throw new IOException("Something went wrong in reading the input file! Was expecting empty line ...");
			
			// consume a line for each cycle's input data
			for (int i = 0; i < numberOfCycles; i++) {
				currLineScanner = new Scanner(scan.nextLine());
				
				CycleData newCycle = new CycleData(i);
				while (currLineScanner.hasNextInt()) {
					int cap = currLineScanner.nextInt();
					newCycle.tasks.add(new Task(cap));
				}
				
				this.addCycle(newCycle);
				currLineScanner.close();
			}

		}
	}