0

Some background information:

We use linear programming (scip/ZIMPL) to solve a optimization problem

As a result variables have subscripts in the mathematical formulation

Currently using mySQL/HeidiSQL for database/interface

Currently we take the variables (constraints) and put them into indexes which are individual columns in a table.

i.e. variable "v" is index01, which refers to timeperiods, index02 refers to centralinventories

However currently only 6 indexes/columns are created - although there are no variables with 6 subscripts (indexes), some do have rows with more than 6 indexes.

Yes we could do a quick fix and double the number of indexes, but that isn't the long term solution

How do we map the the subscripts outputted by zimpl/scip back to the original meaningful variable names without creating a new column for each variable?

1 Answer 1

0

Use a table with separate columns for the variable and the subscript.

CREATE TABLE arrays (
    variable VARCHAR(10),
    index SMALLINT,
    value FLOAT,
    PRIMARY KEY (variable, index));
Sign up to request clarification or add additional context in comments.

Comments

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.