public static void main(String[] args) {
		if (args.length != 1 || args[0].charAt(0) != '-') {
			usage();
			return;
		}

		try {
			// Create the modeler/solver object
			IloCplex cplex = new IloCplex();

			IloNumVar[][] var = new IloNumVar[1][];
			IloRange[][] rng = new IloRange[1][];

			// Evaluate command line option and call appropriate populate method.
			// The created ranges and variables are returned as element 0 of arrays
			// var and rng.
			switch (args[0].charAt(1)) {
				case 'r':
					populateByRow(cplex, var, rng);
					break;
				case 'c':
					populateByColumn(cplex, var, rng);
					break;
				case 'n':
					populateByNonzero(cplex, var, rng);
					break;
				default:
					usage();
					return;
			}

			// write model to file
			cplex.exportModel("lpex1.lp");

			// solve the model and display the solution if one was found
			if (cplex.solve()) {
				double[] x = cplex.getValues(var[0]);
				double[] dj = cplex.getReducedCosts(var[0]);
				double[] pi = cplex.getDuals(rng[0]);
				double[] slack = cplex.getSlacks(rng[0]);

				cplex.output().println("Solution status = " + cplex.getStatus());
				cplex.output().println("Solution value  = " + cplex.getObjValue());

				int nvars = x.length;
				for (int j = 0; j < nvars; ++j) {
					cplex.output().println("Variable " + j +
							": Value = " + x[j] +
							" Reduced cost = " + dj[j]);
				}

				int ncons = slack.length;
				for (int i = 0; i < ncons; ++i) {
					cplex.output().println("Constraint " + i +
							": Slack = " + slack[i] +
							" Pi = " + pi[i]);
				}
			}
			cplex.end();
		} catch (IloException e) {
			System.err.println("Concert exception '" + e + "' caught");
		}
	}