Struct lpsolve::Problem [] [src]

pub struct Problem { /* fields omitted */ }

A linear programming problem.

Methods

impl Problem
[src]

Initialize an empty problem with space for rows and cols.

Reads an lp-format model from path.

Read an mps-format model from path using the "free" formatting.

Read an mps-format model from path using the fixed formatting.

Write an lp-format model into out.

If there are any errors writing to out, false will be returned. Otherwise, true.

Write an mps-format model into out using the fixed formatting.

If there are any errors writing to out, false will be returned. Otherwise, true.

Write an mps-format model into out using the "free" formatting.

If there are any errors writing to out, false will be returned. Otherwise, true.

Write an mps-format model into out using formatting.

If there are any errors writing to out, false will be returned. Otherwise, true.

formatting must be 1 for fixed or 2 for free.

Reserve enough memory for rows and cols.

If rows or cols are less than the current number of rows or columns, the additional rows and columns will be deleted.

Returns true if successful.

Add a column to the model.

If values is empty, an all-zero column will be added.

This will assert that values has at least as many elements as the underlying model.

Add a column to the model, scattering values by indices.

The values for the column are taken from values. The value from values[i] will be placed into row indices[i]. The length used is the max of the lengths of values and indices. There is a debug_assert that these are equal.

Read a column from the model.

Read a row from the model.

Add a constraint to the model.

The constraint is that coeffs * vars OP target, where OP is specified by kind.

For optimal performance, use the matrix_builder method and add the objective function first. This method is otherwise very slow for large models.

Asserts that coeffs has at least as many elements as the underlying model.

Add a Special Ordered Set constraint.

The weights are scattered by variables, that is, weights[i] will be specified for column variables[i].

The length used is the max of the lengths of values and indices. There is a debug_assert that these are equal.

Delete a column from the model.

The other columns are shifted leftward. col cannot be 0, as that column represents the RHS, which must always be present.

Delete a constraint from the model.

The other constraints are shifted upwards. row cannot be 0, as that row represents the objective function, which must always be present.

Returns Some(true) if the specified column can be negative, Some(false) otherwise.

If the column is out-of-bounds, None is returned.

Set a variable to be either binary or floating point.

Get the type of a variable, None if col is out of bounds.

Set the upper and lower bounds of a variable.

Set the bounds mode to 'tighten'.

If the bounds mode is true, then when set_bounds, set_lower_bound, or set_upper_bound is used and the provided bound is less restrictive than the current bound (ie, its absolute value is larger), then the request will be ignored. However, if the new bound is more restrictive (ie, its absolute value is smaller) the request will go through.

If the bounds mode is false, the bounds will always be set as specified.

Get the bounds mode.

See set_bounds_mode for what this value means.

Set the type of a constraint.

Get the type of a constraint, or None if out of bounds or another error occurs.

Set a variable to be unbounded.

Check if a variable is unbounded.

Set the practical value for "infinite"

This is the bound of the absolute value of all variables. If the absolute value of a variable is larger than this, it is considered to have diverged.

Get the value of "infinite"

See set_infinite for more details.

Set a variable's integer type.

Check if a variable is an integer.

Sets the objective function.

Asserts that coeffs has at least as many elements as the underlying model.

Scatters coeffs into the objective function coefficients with indices.

The length used is the max of the lengths of coeffs and indices. There is a debug_assert that these are equal.

Sets the range of a constraint.

If the constraint type is <=, then the "actual" constraint will be RHS - range <= v <= RHS.

If the constraint type is >=, then the "actual" constraint will be RHS <= v <= RHS + range.

This puts a bound on the constraint and can give the solver more freedom, and is more efficient than adding an extra constraint.

Get the range on a constraint if one is set, otherwise None.

Solve the model.

Read out the values assigned to variables from the most recent solve.

Returns None if vars does not have at least as many elements as the underlying model has columns. Otherwise, returns Some with the slice truncated to the number of columns.

Construct a wrapper for a pre-existing lprec.

This is unsafe as the pointer is not null-checked etc.

Get the lprec that this wraps.

Don't delete_lp it, please.

Trait Implementations

impl Drop for Problem
[src]

A method called when the value goes out of scope. Read more

impl Clone for Problem
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Send for Problem
[src]