public void simulate() {
		
		long _time = 1000000L;
		
		if (this._labyrinthType.equals("g")) { // This behavior is applied for
												// graph based labyrinths.

			// Load the labyrinth from the .xml file
			this._labyrinthFactory.setFilename(this._filename);
			de.unihannover.sim.labysim.model.graph.Labyrinth _labyrinth = this._labyrinthFactory
					.getGraphLabyrinth();

			// Load the agents from the .xml file and provide them with the
			// engine and the labyrinth.
			this._agentFactory.setFilename(this._filename);
			this._agentFactory.setGraphLabyrinth(_labyrinth);
			this._agentFactory.setSimEngine(this._engine);
			LinkedList<GraphAgent> _agents = this._agentFactory
					.getGraphAgents();

			// Run the simulation.
			this._engine.simulate(_time);

			// Save results to .xml file
			OutputWriter _outputWriter = new OutputWriter(_filename);
			_outputWriter.setGraphAgents(_agents);
			_outputWriter.write();


		} else if (this._labyrinthType.equals("b")) { // This behavior is
														// applied for bitmap
														// based labyrinths.
			// Load the labyrinth from the .xml file
			this._labyrinthFactory.setFilename(this._filename);
			de.unihannover.sim.labysim.model.bmp.Labyrinth _labyrinth = this._labyrinthFactory
					.getBMPLabyrinth();

			// Load the agents from the .xml file and provide them with the
			// engine and the labyrinth.
			this._agentFactory.setFilename(this._filename);
			this._agentFactory.setBMPLabyrinth(_labyrinth);
			this._agentFactory.setSimEngine(this._engine);
			LinkedList<BMPAgent> _agents = this._agentFactory
					.getBMPAgents();

			// Run the simulation.
			this._engine.simulate(_time);

			// Save results to .xml file
			OutputWriter _outputWriter = new OutputWriter(_filename);
			_outputWriter.setBMPAgents(_agents);
			_outputWriter.write();

		} else {
			printUsage();
		}
	}