2

I am spinning up on ILPs using Matlab tools as the "vehicle" for this. They have both a conventional "solver" based (SB) formulation and a "problem" based (PB) formulation at a higher level of abstraction.

The difference between SB and PB is that, for PB, the user doesn't have to worry about what problem variables map to elements of the ILP column vector of variables. An optimization problem object accepts the optimization function and equality/inequality constraints in symbolic form, and the class methods handle the bookkeeping of defining a column vector of problem variables, the coefficients of the optimization function and the matrices & associated RHSs for equality & inequality constraints.

One can actually examine the SB counterpart to the PB formulation by using prob2struct to convert from PB to SB. Unfortunately, it isn't clear how prob2struct decides which PB variables map to which elements of the column vector of variables.

I tried searching through the optimization problem object in the PB formulation to see if it contains its own internal SB formulation details (regardless if it matches those of prob2struct), or at least the variable mapping. I couldn't find such details.

For prob2struct, is there a reliable rule for us to know which symbolic PB variables maps to which elements in the SB's column vector of variables?

1 Answer 1

3

Try the varindex function. It was introduced in R2019a.

Sign up to request clarification or add additional context in comments.

2 Comments

@mcfeneton: Thanks, I can't believe that It's referenced right in the prob2struct page. In my defence, I'm practically blind in terms of close-up materials, despite progressive lenses. Doesn't bode well for a career in analysis. The doc page says that the returned result idx contains linear indices, but I'm wondering if that also means that the elements in multidimension ILP variables are taken in linearly indexed order as well, e.g., the 3x3 variable y in the example? That's a crucial detail in knowing the mapping to idx.
Actually, the answer is in the Algorithms section of the prob2struct page. The variables are taken in the same order in which they are displayed in the optiproblem property Variables. For multidimensional variables, the elements correspond to the scalar variables in an archetypal ILP problem, and they are taken in linear indexing order. In my mind, this leads to questions about how variables are ordered in the optiproblem.Variables property, and whether there is any way to control the ordering.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.