# Struct highs::Problem[−][src]

`pub struct Problem<MATRIX = ColMatrix> { /* fields omitted */ }`

A complete optimization problem. Depending on the `MATRIX` type parameter, the problem will be built constraint by constraint (with ColProblem), or variable by variable (with RowProblem)

## Implementations

### `impl Problem<ColMatrix>`[src]

To use these functions, you need to first add all your constraints, and then add variables one by one using the Row objects.

#### `pub fn add_row<N: Into<f64> + Copy, B: RangeBounds<N>>(    &mut self,     bounds: B) -> Row`[src]

Add a row (a constraint) to the problem. The concrete factors are added later, when creating columns.

#### `pub fn add_column<N: Into<f64> + Copy, B: RangeBounds<N>, ITEM: Borrow<(Row, f64)>, I: IntoIterator<Item = ITEM>>(    &mut self,     col_factor: f64,     bounds: B,     row_factors: I)`[src]

Add a variable to the problem.

• `col_factor` represents the factor in front of the variable in the objective function.
• `bounds` represents the maximal and minimal allowed values of the variable.
• `row_factors` defines how much this variable weights in each constraint.
```use highs::{ColProblem, Sense};
let mut pb = ColProblem::new();
let constraint = pb.add_row(..=5); // adds a constraint that cannot take a value over 5
// add a variable that has a coefficient 2 in the objective function, is >=0, and has a coefficient
// 2 in the constraint

### `impl Problem<RowMatrix>`[src]

Functions to use when first declaring variables, then constraints.

#### `pub fn add_column<N: Into<f64> + Copy, B: RangeBounds<N>>(    &mut self,     col_factor: f64,     bounds: B) -> Col`[src]

add a variable to the problem.

• `col_factor` is the coefficient in front of the variable in the objective function.
• `bounds` are the maximal and minimal values that the variable can take.

#### `pub fn add_row<N: Into<f64> + Copy, B: RangeBounds<N>, ITEM: Borrow<(Col, f64)>, I: IntoIterator<Item = ITEM>>(    &mut self,     bounds: B,     row_factors: I)`[src]

Add a constraint to the problem.

• `bounds` are the maximal and minimal allowed values for the linear expression in the constraint
• `row_factors` are the coefficients in the linear expression expressing the constraint
```use highs::*;
let mut pb = RowProblem::new();
// Optimize 3x - 2y with x<=6 and y>=5
pb.add_row(2.., &[(x, 3.), (y, 8.)]); // 2 <= x*3 + y*8```

### `impl<MATRIX: Default> Problem<MATRIX> where    Problem<ColMatrix>: From<Problem<MATRIX>>, `[src]

#### `pub fn num_cols(&self) -> usize`[src]

Number of variables in the problem

#### `pub fn num_rows(&self) -> usize`[src]

Number of constraints in the problem

#### `pub fn optimise(self, sense: Sense) -> Model`[src]

Create a model based on this problem. Don’t solve it yet. If the problem is a RowProblem, it will have to be converted to a ColProblem first, which takes an amount of time proportional to the size of the problem.

#### `pub fn new() -> Self`[src]

Create a new problem instance

## Blanket Implementations

### `impl<T> ToOwned for T where    T: Clone, `[src]

#### `type Owned = T`

The resulting type after obtaining ownership.

### `impl<T, U> TryFrom<U> for T where    U: Into<T>, `[src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

### `impl<T, U> TryInto<U> for T where    U: TryFrom<T>, `[src]

#### `type Error = <U as TryFrom<T>>::Error`

The type returned in the event of a conversion error.