MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / computeDual

Method computeDual

highs/simplex/HEkk.cpp:2954–3000  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2952}
2953
2954void HEkk::computeDual() {
2955 analysis_.simplexTimerStart(ComputeDualClock);
2956 // Create a local buffer for the pi vector
2957 HVector dual_col;
2958 dual_col.setup(lp_.num_row_);
2959 dual_col.clear();
2960 for (HighsInt iRow = 0; iRow < lp_.num_row_; iRow++) {
2961 const double value = info_.workCost_[basis_.basicIndex_[iRow]] +
2962 info_.workShift_[basis_.basicIndex_[iRow]];
2963 if (value) {
2964 dual_col.index[dual_col.count++] = iRow;
2965 dual_col.array[iRow] = value;
2966 }
2967 }
2968 // If debugging, save the current duals
2969 const bool debug_compute_dual = false;
2970 if (debug_compute_dual) {
2971 debugComputeDual(true);
2972 debugSimplexDualInfeasible("(old duals)", true);
2973 }
2974 // Copy the costs in case the basic costs are all zero
2975 const HighsInt num_tot = lp_.num_col_ + lp_.num_row_;
2976 for (HighsInt i = 0; i < num_tot; i++)
2977 info_.workDual_[i] = info_.workCost_[i] + info_.workShift_[i];
2978
2979 if (dual_col.count) {
2980 fullBtran(dual_col);
2981 // Create a local buffer for the values of reduced costs
2982 HVector dual_row;
2983 dual_row.setup(lp_.num_col_);
2984 fullPrice(dual_col, dual_row);
2985 for (HighsInt i = 0; i < lp_.num_col_; i++)
2986 info_.workDual_[i] -= dual_row.array[i];
2987 for (HighsInt i = lp_.num_col_; i < num_tot; i++)
2988 info_.workDual_[i] -= dual_col.array[i - lp_.num_col_];
2989 if (debug_compute_dual) {
2990 debugComputeDual();
2991 debugSimplexDualInfeasible("(new duals)", true);
2992 }
2993 }
2994 // Indicate that the dual infeasibility information isn't known
2995 info_.num_dual_infeasibilities = kHighsIllegalInfeasibilityCount;
2996 info_.max_dual_infeasibility = kHighsIllegalInfeasibilityMeasure;
2997 info_.sum_dual_infeasibilities = kHighsIllegalInfeasibilityMeasure;
2998
2999 analysis_.simplexTimerStop(ComputeDualClock);
3000}
3001
3002double HEkk::computeDualForTableauColumn(const HighsInt iVar,
3003 const HVector& tableau_column) const {

Callers 5

solveMethod · 0.80
rebuildMethod · 0.80
cleanupMethod · 0.80
exitPhase1ResetDualsMethod · 0.80
rebuildMethod · 0.80

Calls 4

simplexTimerStartMethod · 0.80
simplexTimerStopMethod · 0.80
setupMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected