diff options
| author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-08-08 02:43:11 -0400 |
|---|---|---|
| committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2013-02-12 06:49:40 -0500 |
| commit | c2c3126de5fc548db5821081af265bb8cf69cebd (patch) | |
| tree | d43e82928b0f85f79e58bed4030b10426d70c098 /native/src/linprog/cplex.cpp | |
| parent | 95cf0a86519981386d22604bab27502fa096df50 (diff) | |
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.
Diffstat (limited to 'native/src/linprog/cplex.cpp')
| -rw-r--r-- | native/src/linprog/cplex.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
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, | |||
| 70 | { | 70 | { |
| 71 | try | 71 | try |
| 72 | { | 72 | { |
| 73 | #if DEBUG_LP_OVERHEADS >= 3 | ||
| 74 | static DEFINE_CPU_CLOCK(model_costs); | ||
| 75 | static DEFINE_CPU_CLOCK(solver_costs); | ||
| 76 | static DEFINE_CPU_CLOCK(extract_costs); | ||
| 77 | |||
| 78 | model_costs.start(); | ||
| 79 | #endif | ||
| 73 | IloNumVarArray cplex_vars = IloNumVarArray(get_env(), max_num_vars, | 80 | IloNumVarArray cplex_vars = IloNumVarArray(get_env(), max_num_vars, |
| 74 | var_lb, var_ub); | 81 | var_lb, var_ub); |
| 75 | 82 | ||
| @@ -84,11 +91,29 @@ void CPLEXSolution::solve_model(unsigned int max_num_vars, | |||
| 84 | 91 | ||
| 85 | IloCplex cplex = IloCplex(model); | 92 | IloCplex cplex = IloCplex(model); |
| 86 | 93 | ||
| 94 | #if DEBUG_LP_OVERHEADS >= 3 | ||
| 95 | model_costs.stop(); | ||
| 96 | solver_costs.start(); | ||
| 97 | #endif | ||
| 98 | |||
| 87 | cplex.solve(); | 99 | cplex.solve(); |
| 88 | 100 | ||
| 101 | #if DEBUG_LP_OVERHEADS >= 3 | ||
| 102 | solver_costs.stop(); | ||
| 103 | extract_costs.start(); | ||
| 104 | #endif | ||
| 105 | |||
| 89 | cplex.getValues(cplex_vars, cplex_values); | 106 | cplex.getValues(cplex_vars, cplex_values); |
| 90 | solved = true; | 107 | solved = true; |
| 91 | 108 | ||
| 109 | #if DEBUG_LP_OVERHEADS >= 3 | ||
| 110 | extract_costs.stop(); | ||
| 111 | |||
| 112 | std::cout << model_costs << std::endl | ||
| 113 | << solver_costs << std::endl | ||
| 114 | << extract_costs << std::endl; | ||
| 115 | #endif | ||
| 116 | |||
| 92 | } catch (IloException &ex) | 117 | } catch (IloException &ex) |
| 93 | { | 118 | { |
| 94 | // Improve me: we should export some kind of error info. | 119 | // Improve me: we should export some kind of error info. |
