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

Function testAvgasGetCol

check/TestLpModification.cpp:2120–2258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2118}
2119
2120void testAvgasGetCol(Highs& h) {
2121 Avgas avgas;
2122 double cost;
2123 double lower;
2124 double upper;
2125 std::vector<HighsInt> index;
2126 std::vector<double> value;
2127 HighsInt get_num;
2128 HighsInt lp_nnz;
2129 std::vector<double> lp_cost(1);
2130 std::vector<double> lp_lower(1);
2131 std::vector<double> lp_upper(1);
2132 std::vector<HighsInt> lp_start(1);
2133 std::vector<HighsInt> lp_index(avgas_num_row);
2134 std::vector<double> lp_value(avgas_num_row);
2135 std::vector<HighsInt> set(1);
2136 std::vector<HighsInt> mask(avgas_num_col);
2137 mask.assign(avgas_num_col, 0);
2138 for (HighsInt col = 0; col < avgas_num_col; col++) {
2139 avgas.getCol(col, cost, lower, upper, index, value);
2140 HighsInt avgas_nnz = index.size();
2141 h.getCols(col, col, get_num, lp_cost.data(), lp_lower.data(),
2142 lp_upper.data(), lp_nnz, lp_start.data(), lp_index.data(),
2143 lp_value.data());
2144 REQUIRE(lp_cost[0] == cost);
2145 REQUIRE(lp_lower[0] == lower);
2146 REQUIRE(lp_upper[0] == upper);
2147 REQUIRE(equalSparseVectors(avgas_num_row, avgas_nnz, index.data(),
2148 value.data(), lp_nnz, lp_index.data(),
2149 lp_value.data()));
2150 set[0] = col;
2151 h.getCols(1, set.data(), get_num, lp_cost.data(), lp_lower.data(),
2152 lp_upper.data(), lp_nnz, lp_start.data(), lp_index.data(),
2153 lp_value.data());
2154 REQUIRE(lp_cost[0] == cost);
2155 REQUIRE(lp_lower[0] == lower);
2156 REQUIRE(lp_upper[0] == upper);
2157 REQUIRE(equalSparseVectors(avgas_num_row, avgas_nnz, index.data(),
2158 value.data(), lp_nnz, lp_index.data(),
2159 lp_value.data()));
2160 mask[col] = 1;
2161 h.getCols(mask.data(), get_num, lp_cost.data(), lp_lower.data(),
2162 lp_upper.data(), lp_nnz, lp_start.data(), lp_index.data(),
2163 lp_value.data());
2164 REQUIRE(lp_cost[0] == cost);
2165 REQUIRE(lp_lower[0] == lower);
2166 REQUIRE(lp_upper[0] == upper);
2167 REQUIRE(equalSparseVectors(avgas_num_row, avgas_nnz, index.data(),
2168 value.data(), lp_nnz, lp_index.data(),
2169 lp_value.data()));
2170 mask[col] = 0;
2171 }
2172 HighsInt from_col = 2;
2173 HighsInt to_col = 5;
2174 HighsInt num_col = to_col - from_col + 1;
2175 lp_cost.resize(num_col);
2176 lp_lower.resize(num_col);
2177 lp_upper.resize(num_col);

Callers 1

Calls 6

equalSparseVectorsFunction · 0.85
getColsMethod · 0.80
dataMethod · 0.80
getColMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected