@@ -38,32 +38,6 @@ bool HighsLp::isBip() const {
3838 return true ;
3939}
4040
41- bool HighsLp::isKnapsack (HighsInt& capacity) const {
42- // Has to kave one constraint
43- if (this ->num_row_ != 1 ) return false ;
44- // Has to be a binary integer programming problem
45- if (!this ->isBip ()) return false ;
46- // Must be one-sided constraint
47- if (this ->row_lower_ [0 ] > -kHighsInf && this ->row_upper_ [0 ] < kHighsInf )
48- return false ;
49- const bool upper = this ->row_upper_ [0 ] < kHighsInf ;
50- const HighsInt constraint_sign = upper ? 1 : -1 ;
51- // Now check that all the (signed) coefficients are integer and non-negative
52- for (HighsInt iEl = 0 ; iEl < this ->a_matrix_ .numNz (); iEl++) {
53- double coeff = constraint_sign * this ->a_matrix_ .value_ [iEl];
54- if (coeff < 0 ) return false ;
55- if (fractionality (coeff) > 0 ) return false ;
56- }
57- // Capacity must be integer, but OK to round down any fractional
58- // values since activity of constraint is integer
59- double double_capacity =
60- upper ? this ->row_upper_ [0 ] : constraint_sign * this ->row_lower_ [0 ];
61- const double capacity_margin = 1e-6 ;
62- capacity = std::floor (double_capacity + capacity_margin);
63- // Problem is knapsack!
64- return true ;
65- }
66-
6741bool HighsLp::hasInfiniteCost (const double infinite_cost) const {
6842 for (HighsInt iCol = 0 ; iCol < this ->num_col_ ; iCol++) {
6943 if (this ->col_cost_ [iCol] >= infinite_cost) return true ;
0 commit comments