[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-glpk] Sorting Vars?
From: |
Daniel Reckhard |
Subject: |
[Help-glpk] Sorting Vars? |
Date: |
Sat, 09 Feb 2008 16:35:44 +0100 |
User-agent: |
Thunderbird 2.0.0.9 (Windows/20071031) |
Hello everyone,
after specifying a 3-dimensional array of vars [1] in my model file I am
surprised to see that this array appears to be unsorted [2]. That is
very annoying as in the C API vars are always referenced by index [3].
So, to calculate a valid index from a given l, p and b [4] the array has
to be sorted! Is there any way to do that? Alternatively is there a
function which returns the var's index for a given name?
Because if sorting doesn't work and there is no such function I'll have
to write it myself. I.e. parse the problem file into a 3 dimensional
array in C with the mixed up index number as value. And that's really
ugly and time-consuming. :(
[1] var x{l in Line, j in Products, b in 0..Bucket} >= 0;
[2] Excerpt retreived with lpx_print_prob
...
4 x[1,1,2]
4 x[1,1,3]
10 x[2,1,0]
2 x[2,1,1]
2 x[2,1,2]
2 x[2,1,3]
3 x[1,1,4]
...
[3] E.g. lpx_set_mat_row needs a one-dimensional index to reference the
according variable.
[4] E.g. index = l * P_max * B_max + p * B_max + b;
Thanks for your time,
--
Daniel
- [Help-glpk] Sorting Vars?,
Daniel Reckhard <=