Only used for debugging
| 804 | |
| 805 | // Only used for debugging |
| 806 | void undoUntil(const HighsOptions& options, HighsSolution& solution, |
| 807 | HighsBasis& basis, size_t numReductions) { |
| 808 | reductionValues.resetPosition(); |
| 809 | |
| 810 | // Do these returns ever happen? How is it known that undo has not |
| 811 | // been performed? |
| 812 | assert(solution.col_value.size() == origColIndex.size()); |
| 813 | assert(solution.row_value.size() == origRowIndex.size()); |
| 814 | // This should be a better measure of whether undo can be |
| 815 | // performed |
| 816 | assert(solution.value_valid); |
| 817 | if (solution.col_value.size() != origColIndex.size()) return; |
| 818 | if (solution.row_value.size() != origRowIndex.size()) return; |
| 819 | |
| 820 | bool perform_dual_postsolve = solution.dual_valid; |
| 821 | assert((solution.col_dual.size() == solution.col_value.size()) == |
| 822 | perform_dual_postsolve); |
| 823 | bool perform_basis_postsolve = basis.valid; |
| 824 | |
| 825 | // expand solution to original index space |
| 826 | undoIterateBackwards(solution.col_value, origColIndex, origNumCol); |
| 827 | |
| 828 | undoIterateBackwards(solution.row_value, origRowIndex, origNumRow); |
| 829 | |
| 830 | if (perform_dual_postsolve) { |
| 831 | // if dual solution is given, expand dual solution and basis to original |
| 832 | // index space |
| 833 | undoIterateBackwards(solution.col_dual, origColIndex, origNumCol); |
| 834 | |
| 835 | undoIterateBackwards(solution.row_dual, origRowIndex, origNumRow); |
| 836 | } |
| 837 | |
| 838 | if (perform_basis_postsolve) { |
| 839 | // if basis is given, expand basis status values to original index space |
| 840 | undoIterateBackwards(basis.col_status, origColIndex, origNumCol); |
| 841 | |
| 842 | undoIterateBackwards(basis.row_status, origRowIndex, origNumRow); |
| 843 | } |
| 844 | |
| 845 | // now undo the changes |
| 846 | for (size_t i = reductions.size(); i > numReductions; --i) { |
| 847 | switch (reductions[i - 1].first) { |
| 848 | case ReductionType::kLinearTransform: { |
| 849 | LinearTransform reduction; |
| 850 | reductionValues.pop(reduction); |
| 851 | reduction.undo(options, solution); |
| 852 | break; |
| 853 | } |
| 854 | case ReductionType::kFreeColSubstitution: { |
| 855 | FreeColSubstitution reduction; |
| 856 | reductionValues.pop(colValues); |
| 857 | reductionValues.pop(rowValues); |
| 858 | reductionValues.pop(reduction); |
| 859 | reduction.undo(options, rowValues, colValues, solution, basis); |
| 860 | break; |
| 861 | } |
| 862 | case ReductionType::kDoubletonEquation: { |
| 863 | DoubletonEquation reduction; |
no test coverage detected