|
13 | 13 | namespace ipx { |
14 | 14 |
|
15 | 15 | Int LpSolver::LoadModel(Int num_var, const double offset, |
16 | | - const double* obj, const double* lb, |
| 16 | + const double* obj, const double* lb, |
17 | 17 | const double* ub, Int num_constr, const Int* Ap, |
18 | 18 | const Int* Ai, const double* Ax, const double* rhs, |
19 | 19 | const char* constr_type) { |
@@ -57,24 +57,24 @@ Int LpSolver::Solve() { |
57 | 57 | control_.hLog("IPX version 1.0\n"); |
58 | 58 | try { |
59 | 59 | InteriorPointSolve(); |
60 | | - const bool run_crossover_on = control_.run_crossover() == 1; |
61 | | - const bool run_crossover_choose = control_.run_crossover() == -1; |
62 | | - const bool run_crossover_not_off = run_crossover_choose || run_crossover_on; |
63 | | - const bool run_crossover = |
64 | | - (info_.status_ipm == IPX_STATUS_optimal && run_crossover_on) || |
65 | | - (info_.status_ipm == IPX_STATUS_imprecise && run_crossover_not_off); |
66 | | - // if ((info_.status_ipm == IPX_STATUS_optimal || |
67 | | - // info_.status_ipm == IPX_STATUS_imprecise) && run_crossover_on) { |
68 | | - if (run_crossover) { |
69 | | - if (run_crossover_on) { |
70 | | - control_.hLog("Running crossover as requested\n"); |
71 | | - } else if (run_crossover_choose) { |
72 | | - assert(info_.status_ipm == IPX_STATUS_imprecise); |
73 | | - control_.hLog("Running crossover since IPX is imprecise\n"); |
74 | | - } else { |
75 | | - assert(run_crossover_on || run_crossover_choose); |
76 | | - } |
77 | | - BuildCrossoverStartingPoint(); |
| 60 | + const bool run_crossover_on = control_.run_crossover() == 1; |
| 61 | + const bool run_crossover_choose = control_.run_crossover() == -1; |
| 62 | + const bool run_crossover_not_off = run_crossover_choose || run_crossover_on; |
| 63 | + const bool run_crossover = |
| 64 | + (info_.status_ipm == IPX_STATUS_optimal && run_crossover_on) || |
| 65 | + (info_.status_ipm == IPX_STATUS_imprecise && run_crossover_not_off); |
| 66 | + // if ((info_.status_ipm == IPX_STATUS_optimal || |
| 67 | + // info_.status_ipm == IPX_STATUS_imprecise) && run_crossover_on) { |
| 68 | + if (run_crossover) { |
| 69 | + if (run_crossover_on) { |
| 70 | + control_.hLog("Running crossover as requested\n"); |
| 71 | + } else if (run_crossover_choose) { |
| 72 | + assert(info_.status_ipm == IPX_STATUS_imprecise); |
| 73 | + control_.hLog("Running crossover since IPX is imprecise\n"); |
| 74 | + } else { |
| 75 | + assert(run_crossover_on || run_crossover_choose); |
| 76 | + } |
| 77 | + BuildCrossoverStartingPoint(); |
78 | 78 | RunCrossover(); |
79 | 79 | } |
80 | 80 | if (basis_) { |
@@ -381,12 +381,10 @@ void LpSolver::InteriorPointSolve() { |
381 | 381 | info_.rel_dresidual > control_.ipm_feasibility_tol()) |
382 | 382 | info_.status_ipm = IPX_STATUS_imprecise; |
383 | 383 | } |
384 | | - if (info_.centring_tried) { |
385 | | - // Assess the success of analytic centre calculation |
| 384 | + // Assess the success of analytic centre calculation |
| 385 | + if (info_.centring_tried) |
386 | 386 | info_.status_ipm = info_.centring_success ? IPX_STATUS_optimal : IPX_STATUS_imprecise; |
387 | | - //assert(info_.status_ipm == IPX_STATUS_optimal); |
388 | | - } |
389 | | -} |
| 387 | + } |
390 | 388 |
|
391 | 389 | void LpSolver::RunIPM() { |
392 | 390 | IPM ipm(control_); |
@@ -527,7 +525,7 @@ void LpSolver::BuildStartingBasis() { |
527 | 525 | StartingBasis(iterate_.get(), basis_.get(), &info_); |
528 | 526 | if (info_.errflag == IPX_ERROR_user_interrupt) { |
529 | 527 | info_.errflag = 0; |
530 | | - info_.status_ipm = IPX_STATUS_user_interrupt; |
| 528 | + info_.status_ipm = IPX_STATUS_user_interrupt; |
531 | 529 | return; |
532 | 530 | } else if (info_.errflag == IPX_ERROR_time_interrupt) { |
533 | 531 | info_.errflag = 0; |
|
0 commit comments