@@ -58,6 +58,19 @@ void HighsPathSeparator::separateLpSolution(HighsLpRelaxation& lpRelaxation,
5858 rowtype[i] = RowType::kLeq ;
5959 }
6060
61+ std::vector<double > rowNorm (lp.num_row_ );
62+ std::vector<double > fracActivity (lp.num_row_ );
63+ for (HighsInt col = 0 ; col != lp.num_col_ ; ++col) {
64+ for (HighsInt i = lp.a_matrix_ .start_ [col];
65+ i != lp.a_matrix_ .start_ [col + 1 ]; ++i) {
66+ HighsInt row = lp.a_matrix_ .index_ [i];
67+ if (rowtype[row] == RowType::kUnusuable ) continue ;
68+ double val = std::abs (lp.a_matrix_ .value_ [i]);
69+ fracActivity[row] += val * transLp.getColFractionality (col);
70+ rowNorm[row] += val * val;
71+ }
72+ }
73+
6174 std::vector<HighsInt> numContinuous (lp.num_row_ );
6275
6376 size_t maxAggrRowSize = 0 ;
@@ -101,26 +114,26 @@ void HighsPathSeparator::separateLpSolution(HighsLpRelaxation& lpRelaxation,
101114 assert (mip.variableType (col) == HighsVarType::kContinuous );
102115 assert (transLp.boundDistance (col) > 0.0 );
103116
104- if (colSubstitutions[col].first != -1 ) continue ;
117+ // Overwrite existing substitution if fractional activity of new row is
118+ // larger
119+ if (colSubstitutions[col].first != -1 ) {
120+ if (fracActivity[colSubstitutions[col].first ] /
121+ std::max (rowNorm[colSubstitutions[col].first ],
122+ mip.mipdata_ ->feastol ) <
123+ fracActivity[i] / std::max (rowNorm[i], mip.mipdata_ ->feastol ) -
124+ mip.mipdata_ ->feastol ) {
125+ colSubstitutions[col].first = i;
126+ colSubstitutions[col].second = val;
127+ }
128+ continue ;
129+ }
105130
106131 colSubstitutions[col].first = i;
107132 colSubstitutions[col].second = val;
108133 rowtype[i] = RowType::kUnusuable ;
109134 }
110135
111136 // Score will be used for deciding order in which rows get aggregated
112- std::vector<double > rowNorm (lp.num_row_ );
113- std::vector<double > fracActivity (lp.num_row_ );
114- for (HighsInt col = 0 ; col != lp.num_col_ ; ++col) {
115- for (HighsInt i = lp.a_matrix_ .start_ [col];
116- i != lp.a_matrix_ .start_ [col + 1 ]; ++i) {
117- HighsInt row = lp.a_matrix_ .index_ [i];
118- if (rowtype[row] == RowType::kUnusuable ) continue ;
119- double val = std::abs (lp.a_matrix_ .value_ [i]);
120- fracActivity[row] += val * transLp.getColFractionality (col);
121- rowNorm[row] += val * val;
122- }
123- }
124137 std::vector<std::pair<HighsInt, double >> rowScore;
125138 rowScore.reserve (lp.num_row_ );
126139 for (HighsInt row = 0 ; row != lp.num_row_ ; ++row) {
0 commit comments