Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions check/TestIis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,23 @@ TEST_CASE("lp-get-iis", "[iis]") {
highs.setOptionValue("output_flag", dev_run);
highs.passModel(lp);
HighsIis iis;
REQUIRE(highs.getIis(iis) == HighsStatus::kOk);
REQUIRE(highs.getModelStatus() == HighsModelStatus::kInfeasible);
REQUIRE(iis.col_index_.size() == 2);
REQUIRE(iis.row_index_.size() == 1);
REQUIRE(iis.col_index_[0] == 0);
REQUIRE(iis.col_index_[1] == 1);
REQUIRE(iis.row_index_[0] == 2);

const HighsLp& highs_lp = highs.getLp();
// First pass with incumbent matrix colwise; second with it
// rowwise
highs.ensureColwise();
REQUIRE(highs_lp.a_matrix_.isColwise());
for (HighsInt k = 0; k < 2; k++) {
REQUIRE(highs.getIis(iis) == HighsStatus::kOk);
REQUIRE(highs.getModelStatus() == HighsModelStatus::kInfeasible);
REQUIRE(iis.col_index_.size() == 2);
REQUIRE(iis.row_index_.size() == 1);
REQUIRE(iis.col_index_[0] == 0);
REQUIRE(iis.col_index_[1] == 1);
REQUIRE(iis.row_index_[0] == 2);
highs.clearSolver();
highs.ensureRowwise();
REQUIRE(highs_lp.a_matrix_.isRowwise());
}
highs.resetGlobalScheduler(true);
}

Expand Down Expand Up @@ -397,7 +406,7 @@ void testMps(std::string& model, const HighsInt iis_strategy,
std::string model_file =
std::string(HIGHS_DIR) + "/check/instances/" + model + ".mps";
Highs highs;
highs.setOptionValue("output_flag", dev_run);
// highs.setOptionValue("output_flag", dev_run);

REQUIRE(highs.readModel(model_file) == HighsStatus::kOk);
// if (iis_strategy == kIisStrategyFromRayRowPriority ||
Expand Down
6 changes: 2 additions & 4 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
* *
* This file is part of the HiGHS linear optimization suite *
* *
* Written and engineered 2008-2024 by Julian Hall, Ivet Galabova, *
* Leona Gottwald and Michael Feldmeier *
* *
* Available as open-source under the MIT License *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *=#
Expand Down Expand Up @@ -68,7 +65,8 @@ Documenter.makedocs(
"structures/classes/HighsSparseMatrix.md",
"structures/classes/HighsLp.md",
"structures/classes/HighsHessian.md",
"structures/classes/HighsModel.md"
"structures/classes/HighsModel.md",
"structures/classes/HighsIis.md"
],
"Structures" => Any[
"structures/structs/index.md",
Expand Down
31 changes: 31 additions & 0 deletions docs/src/guide/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,34 @@ and
yield a specific row or column of ``B^{-1}A``. In all cases,
HiGHS can return the number and indices of the nonzeros in the result.

## [Irreducible infeasibility system (IIS) detection](@id highs-iis)

An Irreducible infeasibility system (IIS) consists of a set of
variables and a set of constraints in a model, together with
variable/constraint bound information, that cannot be satisfied (so is
infeasible). It is irreducible in that if any constraint or variable
bound is removed, then the system can be satisfied (so is feasible).

HiGHS has an IIS facility that is under development. Currently it can
only be used for LPs. The full IIS calculation is expensive, since it
requires the solution of multiple LPs. Although there is a prototype
implementation, it is not as robust or efficient as it will
be. Otherwise, there is a simple, cheap test that looks for
infeasibility due to incompatible variable oe constraint bounds, or
constraint bounds that cannot be satisfied given the range of values
on the constraint activity implied by bounds on variables.

The choice of IIS strategy is defined by the [iis_strategy](@id option-iis-strategy) option, which can take the value

- `kIisStrategyLight` = 0: The cheap test
- `kIisStrategyFromLpRowPriority` = 1: The full IIS calculation, aiming to have a minimal number of rows in the IIS
- `kIisStrategyFromLpColPriority` = 2: The full IIS calculation, aiming to have a minimal number of columns in the IIS

### IIS-related methods in the `Highs` class

- `const HighsLp& getIisLp()`: Return a const reference to the internal IIS LP instance
- `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.
- ` HighsStatus writeIisModel(const std::string& filename = "")`: Write out the internal IIS LP instance to a file.



4 changes: 2 additions & 2 deletions docs/src/guide/further.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ linear objective is represented by the following data, held in the

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

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

When there is at least one `HighsLinearObjective` instance in HiGHS,
the `col_cost_` data in the incumbent model is ignored.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/options/definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@
- Range: [0, inf]
- Default: 1e-07

## iis\_strategy
## [iis\_strategy](@id option-iis-strategy)
- Strategy for IIS calculation: Light test / Full and prioritise rows / Full and prioritise columns (0/1/2)
- Type: integer
- Range: {0, 2}
Expand Down
10 changes: 5 additions & 5 deletions docs/src/structures/classes/HighsHessian.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

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

- dim_: Scalar of type integer - Dimension of the Hessian
- format\_: Scalar of [HessianFormat](@ref) type - Format of the Hessian
- start\_: Vector of integer type - Start of each compressed column in the Hessian
- index\_: Vector of integer type - Indices of the nonzeros in the Hessian
- value\_: Vector of double type - Values of the nonzeros in the Hessian
- `dim_`: Scalar of type integer - Dimension of the Hessian
- `format_`: Scalar of [HessianFormat](@ref) type - Format of the Hessian
- `start_`: Vector of integer type - Start of each compressed column in the Hessian
- `index_`: Vector of integer type - Indices of the nonzeros in the Hessian
- `value_`: Vector of double type - Values of the nonzeros in the Hessian
16 changes: 16 additions & 0 deletions docs/src/structures/classes/HighsIis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# HighsIis

Irreducible infeasibility system (IIS) data are communicated via an instance of the `HighsIis` class.

- `valid_`: The data in the `HighsIis` instance is valid
- `strategy_`: The IIS strategy used
- `col_index_`: The indices of model columns in the IIS
- `row_index_`: The indices of model rows in the IIS
- `col_bound_`: The bounds on each column that define the IIS
- `row_bound_`: The bounds on each row that define the IIS
- `col_status_`: Indicates whether a column in the model is in an IIS, may be in an IIS, or is not in an IIS
- `row_status_`: Indicates whether a row in the model is in an IIS, may be in an IIS, or is not in an IIS
- `info_`: Data on the time and number of simplex iterations required to form the IIS
- `model_`: A [HighsModel](@ref) consisting of the variables, constraints and bounds in the IIS. Currently only its [HighsLp](@ref) instance is relevant


32 changes: 16 additions & 16 deletions docs/src/structures/classes/HighsLp.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# HighsLp

An LP model is communicated via an instance of the HighsLp class
An LP model is communicated via an instance of the `HighsLp` class

- num\_col\_: Scalar of type integer - Number of columns in the model
- num\_row\_: Scalar of type integer - Number of rows in the model
- col\_cost\_: Vector of type double - Coefficients of the linear term in the objective function
- col\_lower\_: Vector of type double - Lower bounds on the variables
- col\_upper\_: Vector of type double - Upper bounds on the variables
- row\_lower\_: Vector of type double - Lower bounds on the constraints
- row\_upper\_: Vector of type double - Upper bounds on the constraints
- a\_matrix\_: Instance of [HighsSparseMatrix](@ref) class - Constraint matrix
- sense\_: Scalar of type [ObjSense](@ref) - Optimization sense of the model
- offset\_: Scalar of type double - Constant term in the objective function
- model\_name\_: Scalar of type string - Name of the model
- objective\_name\_: Scalar of type string - Name of the objective function
- col\_names\_: Vector of type string - Names of the variables
- row\_names\_: Vector of type string - Names of the constraints
- integrality\_: Vector of type [HighsVarType](@ref) - Type of each variable
- `num_col_`: Scalar of type integer - Number of columns in the model
- `num_row_`: Scalar of type integer - Number of rows in the model
- `col_cost_`: Vector of type double - Coefficients of the linear term in the objective function
- `col_lower_`: Vector of type double - Lower bounds on the variables
- `col_upper_`: Vector of type double - Upper bounds on the variables
- `row_lower_`: Vector of type double - Lower bounds on the constraints
- `row_upper_`: Vector of type double - Upper bounds on the constraints
- `a_matrix_`: Instance of [HighsSparseMatrix](@ref) class - Constraint matrix
- `sense_`: Scalar of type [ObjSense](@ref) - Optimization sense of the model
- `offset_`: Scalar of type double - Constant term in the objective function
- `model_name_`: Scalar of type string - Name of the model
- `objective_name_`: Scalar of type string - Name of the objective function
- `col_names_`: Vector of type string - Names of the variables
- `row_names_`: Vector of type string - Names of the constraints
- `integrality_`: Vector of type [HighsVarType](@ref) - Type of each variable
5 changes: 2 additions & 3 deletions docs/src/structures/classes/HighsModel.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@

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

- lp\_: Instance of [HighsLp](@ref) class - LP components of the model

- hessian\_: Instance of [HighsHessian](@ref) class - Hessian matrix
- `lp_`: Instance of [HighsLp](@ref) class - LP components of the model
- `hessian_`: Instance of [HighsHessian](@ref) class - Hessian matrix
12 changes: 6 additions & 6 deletions docs/src/structures/classes/HighsSparseMatrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

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

- format\_: Scalar of [MatrixFormat](@ref) type - Format of the matrix
- num\_col\_ : Scalar of integer type - Number of columns in the matrix
- num\_row\_: Scalar of integer type - Number of rows in the matrix
- start\_: Vector of integer type - Start of each compressed vector in the matrix
- index\_: Vector of integer type - Indices of the nonzeros in the matrix
- value\_: Vector of double type - Values of the nonzeros in the matrix
- `format_`: Scalar of [MatrixFormat](@ref) type - Format of the matrix
- `num_col_ `: Scalar of integer type - Number of columns in the matrix
- `num_row_`: Scalar of integer type - Number of rows in the matrix
- `start_`: Vector of integer type - Start of each compressed vector in the matrix
- `index_`: Vector of integer type - Indices of the nonzeros in the matrix
- `value_`: Vector of double type - Values of the nonzeros in the matrix
1 change: 1 addition & 0 deletions docs/src/structures/classes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ The data members of fundamental classes in HiGHS are defined in this section.
* [HighsLp](@ref)
* [HighsHessian](@ref)
* [HighsModel](@ref)
* [HighsIis](@ref)

Class data members for internal use only are not documented.
2 changes: 1 addition & 1 deletion highs/lp_data/Highs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ HighsStatus Highs::optimizeModel() {
// kHighsDebugLevelMax;
//
// if (model_.lp_.num_row_>0 && model_.lp_.num_col_>0)
// writeLpMatrixPicToFile(options_, "LpMatrix", model_.lp_);
// writeLpMatrixPicToFile(options_, "LpMatrix", model_.lp_);
if (options_.highs_debug_level < min_highs_debug_level)
options_.highs_debug_level = min_highs_debug_level;

Expand Down
Loading
Loading