Skip to content

Commit 1fe40aa

Browse files
authored
Merge pull request #2638 from ERGO-Code/fix-2635
Corrected IIS LP generation and checking when incumbent LP is stored rowwise
2 parents 3cb7b05 + f01056f commit 1fe40aa

File tree

18 files changed

+233
-93
lines changed

18 files changed

+233
-93
lines changed

check/TestIis.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,23 @@ TEST_CASE("lp-get-iis", "[iis]") {
207207
highs.setOptionValue("output_flag", dev_run);
208208
highs.passModel(lp);
209209
HighsIis iis;
210-
REQUIRE(highs.getIis(iis) == HighsStatus::kOk);
211-
REQUIRE(highs.getModelStatus() == HighsModelStatus::kInfeasible);
212-
REQUIRE(iis.col_index_.size() == 2);
213-
REQUIRE(iis.row_index_.size() == 1);
214-
REQUIRE(iis.col_index_[0] == 0);
215-
REQUIRE(iis.col_index_[1] == 1);
216-
REQUIRE(iis.row_index_[0] == 2);
217-
210+
const HighsLp& highs_lp = highs.getLp();
211+
// First pass with incumbent matrix colwise; second with it
212+
// rowwise
213+
highs.ensureColwise();
214+
REQUIRE(highs_lp.a_matrix_.isColwise());
215+
for (HighsInt k = 0; k < 2; k++) {
216+
REQUIRE(highs.getIis(iis) == HighsStatus::kOk);
217+
REQUIRE(highs.getModelStatus() == HighsModelStatus::kInfeasible);
218+
REQUIRE(iis.col_index_.size() == 2);
219+
REQUIRE(iis.row_index_.size() == 1);
220+
REQUIRE(iis.col_index_[0] == 0);
221+
REQUIRE(iis.col_index_[1] == 1);
222+
REQUIRE(iis.row_index_[0] == 2);
223+
highs.clearSolver();
224+
highs.ensureRowwise();
225+
REQUIRE(highs_lp.a_matrix_.isRowwise());
226+
}
218227
highs.resetGlobalScheduler(true);
219228
}
220229

@@ -397,7 +406,7 @@ void testMps(std::string& model, const HighsInt iis_strategy,
397406
std::string model_file =
398407
std::string(HIGHS_DIR) + "/check/instances/" + model + ".mps";
399408
Highs highs;
400-
highs.setOptionValue("output_flag", dev_run);
409+
// highs.setOptionValue("output_flag", dev_run);
401410

402411
REQUIRE(highs.readModel(model_file) == HighsStatus::kOk);
403412
// if (iis_strategy == kIisStrategyFromRayRowPriority ||

docs/make.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
* *
33
* This file is part of the HiGHS linear optimization suite *
44
* *
5-
* Written and engineered 2008-2024 by Julian Hall, Ivet Galabova, *
6-
* Leona Gottwald and Michael Feldmeier *
7-
* *
85
* Available as open-source under the MIT License *
96
* *
107
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *=#
@@ -68,7 +65,8 @@ Documenter.makedocs(
6865
"structures/classes/HighsSparseMatrix.md",
6966
"structures/classes/HighsLp.md",
7067
"structures/classes/HighsHessian.md",
71-
"structures/classes/HighsModel.md"
68+
"structures/classes/HighsModel.md",
69+
"structures/classes/HighsIis.md"
7270
],
7371
"Structures" => Any[
7472
"structures/structs/index.md",

docs/src/guide/advanced.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,34 @@ and
2929
yield a specific row or column of ``B^{-1}A``. In all cases,
3030
HiGHS can return the number and indices of the nonzeros in the result.
3131

32+
## [Irreducible infeasibility system (IIS) detection](@id highs-iis)
33+
34+
An Irreducible infeasibility system (IIS) consists of a set of
35+
variables and a set of constraints in a model, together with
36+
variable/constraint bound information, that cannot be satisfied (so is
37+
infeasible). It is irreducible in that if any constraint or variable
38+
bound is removed, then the system can be satisfied (so is feasible).
39+
40+
HiGHS has an IIS facility that is under development. Currently it can
41+
only be used for LPs. The full IIS calculation is expensive, since it
42+
requires the solution of multiple LPs. Although there is a prototype
43+
implementation, it is not as robust or efficient as it will
44+
be. Otherwise, there is a simple, cheap test that looks for
45+
infeasibility due to incompatible variable oe constraint bounds, or
46+
constraint bounds that cannot be satisfied given the range of values
47+
on the constraint activity implied by bounds on variables.
48+
49+
The choice of IIS strategy is defined by the [iis_strategy](@id option-iis-strategy) option, which can take the value
50+
51+
- `kIisStrategyLight` = 0: The cheap test
52+
- `kIisStrategyFromLpRowPriority` = 1: The full IIS calculation, aiming to have a minimal number of rows in the IIS
53+
- `kIisStrategyFromLpColPriority` = 2: The full IIS calculation, aiming to have a minimal number of columns in the IIS
54+
55+
### IIS-related methods in the `Highs` class
56+
57+
- `const HighsLp& getIisLp()`: Return a const reference to the internal IIS LP instance
58+
- `HighsStatus getIis(HighsIis& iis)`: Try to find an IIS for the incumbent model. Gets the internal [HighsIis](@ref) instance, returning `HighsStatus::kError` if the calculation failed. Note that if the incumbent model is found to be feasible, this is a "success", and `HighsStatus::kOk` is returned.
59+
- ` HighsStatus writeIisModel(const std::string& filename = "")`: Write out the internal IIS LP instance to a file.
60+
61+
62+

docs/src/guide/further.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ linear objective is represented by the following data, held in the
125125

126126
Multi-objective optimization in HiGHS is defined by the following methods
127127

128-
- [addLinearObjective](@ref Multi-objective-optimization] - Add a single `HighsLinearObjective` instance to any already stored in HiGHS
129-
- [clearLinearObjectives](@ref Multi-objective-optimization] - Clears any linear objectives stored in HiGHS
128+
- [addLinearObjective](@ref Multi-objective-optimization) - Add a single `HighsLinearObjective` instance to any already stored in HiGHS
129+
- [clearLinearObjectives](@ref Multi-objective-optimization) - Clears any linear objectives stored in HiGHS
130130

131131
When there is at least one `HighsLinearObjective` instance in HiGHS,
132132
the `col_cost_` data in the incumbent model is ignored.

docs/src/options/definitions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@
486486
- Range: [0, inf]
487487
- Default: 1e-07
488488

489-
## iis\_strategy
489+
## [iis\_strategy](@id option-iis-strategy)
490490
- Strategy for IIS calculation: Light test / Full and prioritise rows / Full and prioritise columns (0/1/2)
491491
- Type: integer
492492
- Range: {0, 2}

docs/src/structures/classes/HighsHessian.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
A Hessian matrix is communicated via an instance of the HighsHessian class.
44

5-
- dim_: Scalar of type integer - Dimension of the Hessian
6-
- format\_: Scalar of [HessianFormat](@ref) type - Format of the Hessian
7-
- start\_: Vector of integer type - Start of each compressed column in the Hessian
8-
- index\_: Vector of integer type - Indices of the nonzeros in the Hessian
9-
- value\_: Vector of double type - Values of the nonzeros in the Hessian
5+
- `dim_`: Scalar of type integer - Dimension of the Hessian
6+
- `format_`: Scalar of [HessianFormat](@ref) type - Format of the Hessian
7+
- `start_`: Vector of integer type - Start of each compressed column in the Hessian
8+
- `index_`: Vector of integer type - Indices of the nonzeros in the Hessian
9+
- `value_`: Vector of double type - Values of the nonzeros in the Hessian
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# HighsIis
2+
3+
Irreducible infeasibility system (IIS) data are communicated via an instance of the `HighsIis` class.
4+
5+
- `valid_`: The data in the `HighsIis` instance is valid
6+
- `strategy_`: The IIS strategy used
7+
- `col_index_`: The indices of model columns in the IIS
8+
- `row_index_`: The indices of model rows in the IIS
9+
- `col_bound_`: The bounds on each column that define the IIS
10+
- `row_bound_`: The bounds on each row that define the IIS
11+
- `col_status_`: Indicates whether a column in the model is in an IIS, may be in an IIS, or is not in an IIS
12+
- `row_status_`: Indicates whether a row in the model is in an IIS, may be in an IIS, or is not in an IIS
13+
- `info_`: Data on the time and number of simplex iterations required to form the IIS
14+
- `model_`: A [HighsModel](@ref) consisting of the variables, constraints and bounds in the IIS. Currently only its [HighsLp](@ref) instance is relevant
15+
16+
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# HighsLp
22

3-
An LP model is communicated via an instance of the HighsLp class
3+
An LP model is communicated via an instance of the `HighsLp` class
44

5-
- num\_col\_: Scalar of type integer - Number of columns in the model
6-
- num\_row\_: Scalar of type integer - Number of rows in the model
7-
- col\_cost\_: Vector of type double - Coefficients of the linear term in the objective function
8-
- col\_lower\_: Vector of type double - Lower bounds on the variables
9-
- col\_upper\_: Vector of type double - Upper bounds on the variables
10-
- row\_lower\_: Vector of type double - Lower bounds on the constraints
11-
- row\_upper\_: Vector of type double - Upper bounds on the constraints
12-
- a\_matrix\_: Instance of [HighsSparseMatrix](@ref) class - Constraint matrix
13-
- sense\_: Scalar of type [ObjSense](@ref) - Optimization sense of the model
14-
- offset\_: Scalar of type double - Constant term in the objective function
15-
- model\_name\_: Scalar of type string - Name of the model
16-
- objective\_name\_: Scalar of type string - Name of the objective function
17-
- col\_names\_: Vector of type string - Names of the variables
18-
- row\_names\_: Vector of type string - Names of the constraints
19-
- integrality\_: Vector of type [HighsVarType](@ref) - Type of each variable
5+
- `num_col_`: Scalar of type integer - Number of columns in the model
6+
- `num_row_`: Scalar of type integer - Number of rows in the model
7+
- `col_cost_`: Vector of type double - Coefficients of the linear term in the objective function
8+
- `col_lower_`: Vector of type double - Lower bounds on the variables
9+
- `col_upper_`: Vector of type double - Upper bounds on the variables
10+
- `row_lower_`: Vector of type double - Lower bounds on the constraints
11+
- `row_upper_`: Vector of type double - Upper bounds on the constraints
12+
- `a_matrix_`: Instance of [HighsSparseMatrix](@ref) class - Constraint matrix
13+
- `sense_`: Scalar of type [ObjSense](@ref) - Optimization sense of the model
14+
- `offset_`: Scalar of type double - Constant term in the objective function
15+
- `model_name_`: Scalar of type string - Name of the model
16+
- `objective_name_`: Scalar of type string - Name of the objective function
17+
- `col_names_`: Vector of type string - Names of the variables
18+
- `row_names_`: Vector of type string - Names of the constraints
19+
- `integrality_`: Vector of type [HighsVarType](@ref) - Type of each variable

docs/src/structures/classes/HighsModel.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22

33
A QP model is communicated via an instance of the HighsModel class
44

5-
- lp\_: Instance of [HighsLp](@ref) class - LP components of the model
6-
7-
- hessian\_: Instance of [HighsHessian](@ref) class - Hessian matrix
5+
- `lp_`: Instance of [HighsLp](@ref) class - LP components of the model
6+
- `hessian_`: Instance of [HighsHessian](@ref) class - Hessian matrix

docs/src/structures/classes/HighsSparseMatrix.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
The constraint matrix of an LP model is communicated via an instance of the HighsSparseMatrix class
44

5-
- format\_: Scalar of [MatrixFormat](@ref) type - Format of the matrix
6-
- num\_col\_ : Scalar of integer type - Number of columns in the matrix
7-
- num\_row\_: Scalar of integer type - Number of rows in the matrix
8-
- start\_: Vector of integer type - Start of each compressed vector in the matrix
9-
- index\_: Vector of integer type - Indices of the nonzeros in the matrix
10-
- value\_: Vector of double type - Values of the nonzeros in the matrix
5+
- `format_`: Scalar of [MatrixFormat](@ref) type - Format of the matrix
6+
- `num_col_ `: Scalar of integer type - Number of columns in the matrix
7+
- `num_row_`: Scalar of integer type - Number of rows in the matrix
8+
- `start_`: Vector of integer type - Start of each compressed vector in the matrix
9+
- `index_`: Vector of integer type - Indices of the nonzeros in the matrix
10+
- `value_`: Vector of double type - Values of the nonzeros in the matrix

0 commit comments

Comments
 (0)