Make some linting
This commit is contained in:
-38
@@ -142,41 +142,3 @@ Result simplex(Vector &C, Matrix &A, Vector &b, double eps = 0.01, bool maximize
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
Function_name(C, A, b, eps = eps_default)
|
||||
|
||||
Input:
|
||||
- C: A vector of coefficients of the objective function
|
||||
- A: A matrix of coefficients of the constraint functions
|
||||
- b: A vector of right-hand side values
|
||||
- eps: Approximation accuracy (optional, default = eps_default)
|
||||
|
||||
Steps:
|
||||
1. Print the optimization problem:
|
||||
- max (or min) z = C[0] * x1 + C[1] * x2 + ... + C[n] * xn
|
||||
- subject to the constraints:
|
||||
- A[0] * x <= b[0]
|
||||
- A[1] * x <= b[1]
|
||||
- ...
|
||||
- A[m] * x <= b[m]
|
||||
|
||||
2. Initialize:
|
||||
- Form the initial tableau by introducing slack variables to convert inequalities into equalities.
|
||||
|
||||
3. Iteratively apply the Simplex method:
|
||||
- Step 1: Identify the entering variable (most negative coefficient in the objective row).
|
||||
- Step 2: Identify the leaving variable (smallest positive ratio of RHS to pivot column).
|
||||
- Step 3: Perform pivot operations to update the tableau.
|
||||
|
||||
4. Check for optimality or unboundedness:
|
||||
- If all coefficients in the objective function row are non-negative, the solution is optimal.
|
||||
- If no leaving variable exists, the problem is unbounded.
|
||||
|
||||
5. Return:
|
||||
- solver_state: {solved, unbounded}
|
||||
- x*: Optimal vector of decision variables (if solved)
|
||||
- z: Maximum (or minimum) value of the objective function (if solved)
|
||||
|
||||
End Function
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user