public static void main(String[] args) { if (args.length < 1) { usage(); return; } try { IloCplex cplex = new IloCplex(); String fixedfile = null; String tunedfile = null; int tunemeasure = 0; boolean mset = false; Vector<String> filenames = new Vector<String>(); for (int i = 0; i < args.length; ++i) { if (args[i].charAt(0) != '-') { filenames.add(args[i]); continue; } switch (args[i].charAt(1)) { case 'a': tunemeasure = 1; mset = true; break; case 'm': tunemeasure = 2; mset = true; break; case 'f': fixedfile = args[++i]; break; case 'o': tunedfile = args[++i]; break; } } System.out.println("Problem set:"); for (String name : filenames) { System.out.println(" " + name); } if (mset) cplex.setParam(IloCplex.Param.Tune.Measure, tunemeasure); IloCplex.ParameterSet paramset = null; if (fixedfile != null) { cplex.readParam(fixedfile); paramset = cplex.getParameterSet(); cplex.setDefaults(); } int tunestat = cplex.tuneParam(filenames.toArray(new String[0]), paramset); if (tunestat == IloCplex.TuningStatus.Complete) System.out.println("Tuning complete."); else if (tunestat == IloCplex.TuningStatus.Abort) System.out.println("Tuning abort."); else if (tunestat == IloCplex.TuningStatus.TimeLim) System.out.println("Tuning time limit."); else System.out.println("Tuning status unknown."); if (tunedfile != null) { cplex.writeParam(tunedfile); System.out.println("Tuned parameters written to file '" + tunedfile + "'"); } cplex.end(); } catch (IloException e) { System.err.println("Concert exception caught: " + e); } }