From c2c3126de5fc548db5821081af265bb8cf69cebd Mon Sep 17 00:00:00 2001 From: Bjoern Brandenburg Date: Wed, 8 Aug 2012 08:43:11 +0200 Subject: Add support for tracking total LP generation / solving cost Interestingly, this shows that generating huge LPs is not necessarily any faster than creating and solving many small LPs. Further investigation required. --- native/src/linprog/cplex.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'native/src/linprog/cplex.cpp') diff --git a/native/src/linprog/cplex.cpp b/native/src/linprog/cplex.cpp index b5565d4..9be1e74 100644 --- a/native/src/linprog/cplex.cpp +++ b/native/src/linprog/cplex.cpp @@ -70,6 +70,13 @@ void CPLEXSolution::solve_model(unsigned int max_num_vars, { try { +#if DEBUG_LP_OVERHEADS >= 3 + static DEFINE_CPU_CLOCK(model_costs); + static DEFINE_CPU_CLOCK(solver_costs); + static DEFINE_CPU_CLOCK(extract_costs); + + model_costs.start(); +#endif IloNumVarArray cplex_vars = IloNumVarArray(get_env(), max_num_vars, var_lb, var_ub); @@ -84,11 +91,29 @@ void CPLEXSolution::solve_model(unsigned int max_num_vars, IloCplex cplex = IloCplex(model); +#if DEBUG_LP_OVERHEADS >= 3 + model_costs.stop(); + solver_costs.start(); +#endif + cplex.solve(); +#if DEBUG_LP_OVERHEADS >= 3 + solver_costs.stop(); + extract_costs.start(); +#endif + cplex.getValues(cplex_vars, cplex_values); solved = true; +#if DEBUG_LP_OVERHEADS >= 3 + extract_costs.stop(); + + std::cout << model_costs << std::endl + << solver_costs << std::endl + << extract_costs << std::endl; +#endif + } catch (IloException &ex) { // Improve me: we should export some kind of error info. -- cgit v1.2.2