| 2569 | } |
| 2570 | |
| 2571 | void HEkk::initialiseBound(const SimplexAlgorithm algorithm, |
| 2572 | const HighsInt solve_phase, const bool perturb) { |
| 2573 | initialiseLpColBound(); |
| 2574 | initialiseLpRowBound(); |
| 2575 | info_.bounds_shifted = false; |
| 2576 | info_.bounds_perturbed = false; |
| 2577 | // Primal simplex bounds are either from the LP or perturbed |
| 2578 | if (algorithm == SimplexAlgorithm::kPrimal) { |
| 2579 | if (!perturb || info_.primal_simplex_bound_perturbation_multiplier == 0) |
| 2580 | return; |
| 2581 | // Perturb the bounds |
| 2582 | // Determine the smallest and largest finite lower/upper bounds |
| 2583 | HighsInt num_col = lp_.num_col_; |
| 2584 | HighsInt num_row = lp_.num_row_; |
| 2585 | HighsInt num_tot = num_col + num_row; |
| 2586 | double min_abs_lower = kHighsInf; |
| 2587 | double max_abs_lower = -1; |
| 2588 | double min_abs_upper = kHighsInf; |
| 2589 | double max_abs_upper = -1; |
| 2590 | for (HighsInt iVar = 0; iVar < num_tot; iVar++) { |
| 2591 | double abs_lower = fabs(info_.workLower_[iVar]); |
| 2592 | double abs_upper = fabs(info_.workUpper_[iVar]); |
| 2593 | if (abs_lower && abs_lower < kHighsInf) { |
| 2594 | min_abs_lower = min(abs_lower, min_abs_lower); |
| 2595 | max_abs_lower = max(abs_lower, max_abs_lower); |
| 2596 | } |
| 2597 | if (abs_upper && abs_upper < kHighsInf) { |
| 2598 | min_abs_upper = min(abs_upper, min_abs_upper); |
| 2599 | max_abs_upper = max(abs_upper, max_abs_upper); |
| 2600 | } |
| 2601 | } |
| 2602 | // printf( |
| 2603 | // "Nonzero finite lower bounds in [%9.4g, %9.4g]; upper bounds in " |
| 2604 | // "[%9.4g, %9.4g]\n", |
| 2605 | // min_abs_lower, max_abs_lower, min_abs_upper, max_abs_upper); |
| 2606 | |
| 2607 | const double base = |
| 2608 | info_.primal_simplex_bound_perturbation_multiplier * 5e-7; |
| 2609 | for (HighsInt iVar = 0; iVar < num_tot; iVar++) { |
| 2610 | double lower = info_.workLower_[iVar]; |
| 2611 | double upper = info_.workUpper_[iVar]; |
| 2612 | const bool fixed = lower == upper; |
| 2613 | // Don't perturb bounds of nonbasic fixed variables as they stay nonbasic |
| 2614 | if (basis_.nonbasicFlag_[iVar] == kNonbasicFlagTrue && fixed) continue; |
| 2615 | double random_value = info_.numTotRandomValue_[iVar]; |
| 2616 | if (lower > -kHighsInf) { |
| 2617 | if (lower < -1) { |
| 2618 | lower -= random_value * base * (-lower); |
| 2619 | } else if (lower < 1) { |
| 2620 | lower -= random_value * base; |
| 2621 | } else { |
| 2622 | lower -= random_value * base * lower; |
| 2623 | } |
| 2624 | info_.workLower_[iVar] = lower; |
| 2625 | } |
| 2626 | if (upper < kHighsInf) { |
| 2627 | if (upper < -1) { |
| 2628 | upper += random_value * base * (-upper); |
no outgoing calls
no test coverage detected