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

Function testIis

check/TestCAPI.c:2191–2408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2189}
2190
2191void testIis() {
2192 void* highs = Highs_create();
2193 Highs_setBoolOptionValue(highs, "output_flag", dev_run);
2194 HighsInt ret;
2195 double inf = Highs_getInfinity(highs);
2196 // For the constraints
2197 //
2198 // x + y - z = 2
2199 //
2200 // x + y + z <= 5
2201 //
2202 // x + 2y + z <= 1
2203 //
2204 // with variables in [0, 1], constraints 0 and 2 form an IIS with
2205 //
2206 // x free; 0 <= y; 0 <= z
2207 //
2208 // x + y - z >= 2; x + 2y + z <= 1
2209 //
2210 // x may be free, but can't immediately be removed, otherwise
2211 // removing y >= 0 yields an infeasible LP
2212 //
2213 ret = Highs_addCol(highs, 0.0, 0.0, 1.0, 0, NULL, NULL);
2214 assert(ret == 0);
2215 ret = Highs_addCol(highs, 0.0, 0.0, 1.0, 0, NULL, NULL);
2216 assert(ret == 0);
2217 ret = Highs_addCol(highs, 0.0, 0.0, 1.0, 0, NULL, NULL);
2218 assert(ret == 0);
2219 HighsInt index[3] = {0, 1, 2};
2220 double value_1[3] = {1, 1, -1};
2221 double value_2[3] = {1, 1, 1};
2222 double value_3[3] = {1, 2, 1};
2223 ret = Highs_addRow(highs, 2.0, 2.0, 3, index, value_1);
2224 assert(ret == 0);
2225 ret = Highs_addRow(highs, -inf, 5.0, 3, index, value_2);
2226 assert(ret == 0);
2227 ret = Highs_addRow(highs, -inf, 1.0, 3, index, value_3);
2228 assert(ret == 0);
2229
2230 HighsInt num_col;
2231 HighsInt num_row;
2232 HighsInt num_nz;
2233 HighsInt sense;
2234 double offset;
2235 ret = Highs_getLp(highs, kHighsMatrixFormatRowwise,
2236 &num_col, &num_row, &num_nz,
2237 &sense, &offset,
2238 NULL, NULL, NULL,
2239 NULL, NULL,
2240 NULL, NULL, NULL,
2241 NULL);
2242
2243 for (int k = 0 ; k < 2; k++) {
2244 HighsInt iis_num_col;
2245 HighsInt iis_num_row;
2246 ret = Highs_getIis(highs,
2247 &iis_num_col, &iis_num_row,
2248 NULL, NULL,

Callers 1

mainFunction · 0.85

Calls 12

Highs_createFunction · 0.85
Highs_setBoolOptionValueFunction · 0.85
Highs_getInfinityFunction · 0.85
Highs_addColFunction · 0.85
Highs_addRowFunction · 0.85
Highs_getLpFunction · 0.85
Highs_getIisFunction · 0.85
Highs_setIntOptionValueFunction · 0.85
Highs_clearModelFunction · 0.85
Highs_runFunction · 0.85
Highs_clearSolverFunction · 0.85
Highs_destroyFunction · 0.85

Tested by

no test coverage detected