Forum Discussion
FICO
6 years agoCommunity Manager
Additional usage info for btran and ftran?
Hi!
I'm using xpress for a 33-variable linear programming problem in python. I'm having some issues, though, figuring out how to properly use btran and ftran in my code.
I'm currently using btran to get the optimal simplex tableau for my constraints, but I'm having trouble understanding how to acquire the same for my variables using ftran. I'm not sure if I'm just misunderstanding the documentation (very possible!) but I'm getting essentially the same matrix back from both functions. If I could get an example of how to use both, I think that would help a ton!
Just to show how I'm currently getting the constraint tableau, the code I have for using btran is:
import numpy as np
constraints = problem.getConstraint()
n = len(constraints)
tableau = np.zeros((n, n))
for i in range(n):
y = [0]*n
y[i] = 1
problem.btran(y)
tableau[i, :] = yI would appreciate any help/direction! Thank you!
1 Reply
- FICOCommunity Manager
Hi Leigh,
Let's consider an LP in standard form: min cT x, A x = b, x >= 0. After using problem.solve(), A is partitioned into a basic part A_B and a nonbasic part A_N.
FTRAN is just a transposed version of BTRAN in the following sense. FTRAN(z) solves (finds y) such that A_B y = z. If z = e_i, the i'th unit vector, the solution y corresponds to the i'th column of A_B-1, the inverse of the basis matrix A_B. In contrast, BTRAN(z) solves A_BT y = z, such that for z = e_i, you obtain the i'th row vector of A_B-1.
Therefore, your code above exits with matrix tableau containing A_B-1. You could also use problem.ftran(y), in which case you would have to transpose the last line: tableau[ i , : ] becomes tableau[ :, i] in that case.
Note that both methods require an array of length problem.attributes.rows as input. There is no FTRAN operation on the variables (columns) of the problem.
This being said, it would be good to understand better what you are trying to achieve. The optimal simplex tableau is a table that holds information on the matrix, the right hand side, and the (reduced) cost vector, but not the variables.
All this information, you can query more easily than by computing the linear algebra by hand:
- use problem.getRCost() to obtain the reduced costs for each column.
- use problem.getbasis() to get more detailed information about the current basis
- use problem.getlpsolval() to get all information regarding solution values, slacks, dual multipliers, and reduced costs from one function call
Related Content
Related Content
Additional execution after crossover
I am running a problem with the Newton Barrier method using crossover as I need to compute dual variables. However, after crossover completes in approx 50 seconds it starts another process that take...3 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum1 unread comment1 unread0Views0likes1CommentHow to reduce memory usage by the solver?
We have a large model and it ran out of memory when it is starting concurrent solve with dual and barrier method. So is it possible to just pick one method here to reduce the memory requirement? Than...2 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum5 unread comments5 unread0Views0likes5CommentsMemory usage when repeatedly solving a problem
I want to solve for a facility problem the corresponding transport problems by enumerating all possible combinations of the binaries (12 DCs, so 2^12 combinations) - I need the optimal flows and cost...3 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum6 unread comments6 unread0Views0likes6Comments