linprog#

swordfish.function.linprog()#

Solve the following optimization problem with a linear objective function and a set of linear constraints.

\[\begin{split}\min_{x} f^T x \quad \text{such that} \quad \begin{cases} A \cdot x \le b \\ Aeq \cdot x = beq \\ lb \le x \le ub \end{cases}\end{split}\]
Parameters:
  • A (Constant) – A matrix.

  • Aeq (Constant) – A matrix. A and Aeq must be with the same number of columns.

  • f (Constant) – A vector.

  • b (Constant) – A vector.

  • beq (Constant) – A vector.

  • lb (Constant) – A scalar or vector.

  • ub (Constant) –

    A scalar or vector. lb and ub are with the same length as x indicating the lower bounds and upper bounds of x.

    • If lb or ub is a scalar, all elements of x are subject to the same lower bound or upper bound constraint.

    • If lb or ub is null, there is no lower bound or upper bound constraint for x.

    • If lb or ub is a vector, an element of x is subject to the lower bound or upper bound constraint specified by the corresponding element of lb or ub.

  • method (Constant) – A string indicating the optimization algorithm. It can be either ‘simplex’ (recommended) or ‘interior-point’.

Returns:

A 2-element tuple. The first element is the minimum value of the objective function. The second element is the value of x where the value of the objective function is minimized.

Return type:

Constant