public void launchSimplification(Type type) {
		int i = 1;
		switch (type) {
		case FUNCTION:
			for (String function : functions) {
				if (function.length() == 1) {
					this.s += Tools.writeSolution(function, i);
					i++;
					continue;
				}
				TruthTable truthTable = new TruthTable(function);
				if (truthTable.getError() != null) {
					this.s += Tools.writeError(i, truthTable.getError()
							.getMessage());
					i++;
					continue;
				}
				nombreVars = truthTable.getVars().length();
				ordrVar = truthTable.getVars();
				kmap = new KarnaughTable(truthTable.TruthTable, nombreVars);
				solve();
				truthTable = new TruthTable(function);
				nombreVars = truthTable.getVars().length();
				ordrVar = truthTable.getVars();
				kmap = new KarnaughTable(truthTable.TruthTable, nombreVars);

				this.s += Tools.writeSolution(minimisedExpression, i);
				if (detailledSolution && nombreVars != 1)
					this.s += Tools.writeKarnaughMap(kmap, nombreVars);
				if (functions.length == 1 && detailledSolution
						&& nombreVars != 1)
					this.s += Tools.writeTruthTable(truthTable, nombreVars,
							ordrVar);
				i++;
			}
			break;
		case TRUTH_TABLE:
			String function[] = new String[1];
			function[0] = getFunctionFromTruthTable(truthTable.TruthTable,
					nombreVars);
			controller.program.getMainPanel().getTextField()
					.setText(function[0]);
			s += Tools.writeIntroducedFunctions(function);
			kmap = new KarnaughTable(truthTable.TruthTable, nombreVars);
			solve();
			String ordreVars = ordrVar;
			ordrVar = ordreVars;
			kmap = new KarnaughTable(truthTable.TruthTable, nombreVars);
			s += Tools.writeSolution(minimisedExpression, 1);
			s += Tools.writeKarnaughMap(kmap, nombreVars);
			s += Tools.writeTruthTable(truthTable, nombreVars, ordrVar);
			break;

		case KARNAUGH_MAP:
			String func[] = new String[1];
			func[0] = functionFromKmap(nombreVars);
			controller.program.getMainPanel().getTextField().setText(func[0]);
			s += Tools.writeIntroducedFunctions(func);
			solve();
			int nbVar = nombreVars;
			String varOrder = ordrVar;
			KarnaughTable kt = kmap;
			kmap = kt;
			nombreVars = nbVar;
			ordrVar = varOrder;
			s += Tools.writeSolution(minimisedExpression, 1);
			s += Tools.writeKarnaughMap(kmap, nombreVars);
			break;
		}
		writeSolution();
	}