|
From: | Rong, Ying |
Subject: | [Help-glpk] The question about the sequence of column(About lpk_get_col_prim) |
Date: | Thu, 10 Aug 2006 11:25:47 +0400 |
I need to use lpk_get_col_prim to get the value for each variables. And I let GLPK to read files from AMPL. Suppose AMPL files is: set ITEM; set STAGE; set TIME; set MACHINE; set RESOURCE; set SCEN; set PRE; ...... var X{ITEM,STAGE,TIME,MACHINE}>=0; var o{ITEM,STAGE,TIME}>=0; var gamma_plus{STAGE,TIME,MACHINE,RESOURCE}>=0; var gamma_minus{STAGE,TIME,MACHINE,RESOURCE}>=0; var kappa{STAGE,TIME,MACHINE,RESOURCE}>=0; var I{ITEM,STAGE,TIME,SCEN}>=0; var B{ITEM,TIME,SCEN}>=0; I think GLPK generates sequence of columns by types of variables first. Then there is problem. How GLPK generate X[i,s,t,m]. Originally I think it would like for ( i = 1...ITEM){ for ( s=1...STAGE){ for (t = 1...TIME){ for(m = 1...MACHINE){ column_number = i * STAGE*TIME*MACHINE + s * TIME*MACHINE + t * MACHINE + m; } } } } But it turn out this is not right. I post the column from 1 to 96 in the following. It seems that it loops first on i, then on m.... But for all other variables, it follows the rule I describe before. So I am wondering how GLPK generate sequence of columns(variables). In this case, suppose I don't how sequence of X is generated, how I can retrieve value for X. Also if we change the problem size, would the sequence of variables change? Thanks! //////////////////////////////////////////////////// No. Column name St Activity Lower bound Upper bound Marginal ------ ------------ -- ------------- ------------- ------------- ------------- 1 X[1,1,1,1] NL 0 0 7.29764 2 X[2,1,1,1] NL 0 0 7.32199 3 X[3,1,1,1] NL 0 0 7.65411 4 X[4,1,1,1] NL 0 0 7.44019 5 X[5,1,1,1] NL 0 0 6.83906 6 X[6,1,1,1] NL 0 0 7.59448 7 X[7,1,1,1] NL 0 0 0.0710351 8 X[8,1,1,1] NL 0 0 7.58844 9 X[9,1,1,1] NL 0 0 7.32145 10 X[10,1,1,1] NL 0 0 7.59391 11 X[11,1,1,1] NL 0 0 0.0145434 12 X[12,1,1,1] NL 0 0 7.38041 13 X[13,1,1,1] NL 0 0 0.128138 14 X[14,1,1,1] NL 0 0 7.50203 15 X[15,1,1,1] NL 0 0 0.231634 16 X[16,1,1,1] NL 0 0 8.27056 17 X[17,1,1,1] NL 0 0 5.00421 18 X[18,1,1,1] NL 0 0 7.56837 19 X[19,1,1,1] NL 0 0 7.84088 20 X[20,1,1,1] NL 0 0 7.55573 21 X[21,1,1,1] NL 0 0 7.02839 22 X[22,1,1,1] NL 0 0 7.72592 23 X[23,1,1,1] NL 0 0 0.0384819 24 X[24,1,1,1] NL 0 0 7.72971 25 X[25,1,1,1] NL 0 0 7.55034 26 X[26,1,1,1] NL 0 0 7.729 27 X[27,1,1,1] NL 0 0 0.131807 28 X[28,1,1,1] NL 0 0 7.38038 29 X[29,1,1,1] NL 0 0 7.8294 30 X[30,1,1,1] NL 0 0 7.17495 31 X[31,1,1,1] NL 0 0 0.18638 32 X[32,1,1,1] NL 0 0 7.48377 33 X[33,1,1,1] NL 0 0 13.6197 34 X[34,1,1,1] NL 0 0 7.53594 35 X[35,1,1,1] NL 0 0 7.74491 36 X[36,1,1,1] NL 0 0 7.53819 37 X[37,1,1,1] NL 0 0 0.128403 38 X[38,1,1,1] NL 0 0 7.53499 39 X[39,1,1,1] NL 0 0 0.170993 40 X[40,1,1,1] NL 0 0 7.46779 41 X[41,1,1,1] NL 0 0 7.38073 42 X[42,1,1,1] NL 0 0 6.4901 43 X[43,1,1,1] NL 0 0 0.090283 44 X[44,1,1,1] NL 0 0 7.48032 45 X[45,1,1,1] NL 0 0 7.48311 46 X[46,1,1,1] NL 0 0 7.54751 47 X[47,1,1,1] NL 0 0 3.83358 48 X[48,1,1,1] NL 0 0 3.83684 49 X[1,1,1,2] NL 0 0 6.92813 50 X[2,1,1,2] NL 0 0 6.97683 51 X[3,1,1,2] NL 0 0 7.04942 52 X[4,1,1,2] NL 0 0 7.21322 53 X[5,1,1,2] NL 0 0 6.01095 54 X[6,1,1,2] NL 0 0 7.52179 55 X[7,1,1,2] B 0 0 56 X[8,1,1,2] NL 0 0 7.50971 57 X[9,1,1,2] NL 0 0 6.97573 58 X[10,1,1,2] NL 0 0 7.52067 59 X[11,1,1,2] B 0 0 60 X[12,1,1,2] NL 0 0 7.09367 61 X[13,1,1,2] B 0 0 62 X[14,1,1,2] NL 0 0 7.3369 63 X[15,1,1,2] B 0 0 64 X[16,1,1,2] NL 0 0 7.47885 65 X[17,1,1,2] NL 0 0 2.34126 66 X[18,1,1,2] NL 0 0 7.46958 67 X[19,1,1,2] NL 0 0 7.30299 68 X[20,1,1,2] NL 0 0 7.44431 69 X[21,1,1,2] NL 0 0 6.38962 70 X[22,1,1,2] NL 0 0 7.60841 71 X[23,1,1,2] B 0 0 72 X[24,1,1,2] NL 0 0 7.61326 73 X[25,1,1,2] NL 0 0 7.43352 74 X[26,1,1,2] NL 0 0 7.6079 75 X[27,1,1,2] B 0 0 76 X[28,1,1,2] NL 0 0 7.09361 77 X[29,1,1,2] NL 0 0 7.66716 78 X[30,1,1,2] NL 0 0 6.68275 79 X[31,1,1,2] B 0 0 80 X[32,1,1,2] NL 0 0 7.30038 81 X[33,1,1,2] NL 0 0 13.55 82 X[34,1,1,2] NL 0 0 7.40471 83 X[35,1,1,2] NL 0 0 7.61432 84 X[36,1,1,2] NL 0 0 7.40921 85 X[37,1,1,2] B 0 0 86 X[38,1,1,2] NL 0 0 7.40282 87 X[39,1,1,2] B 0 0 88 X[40,1,1,2] NL 0 0 5.79489 89 X[41,1,1,2] NL 0 0 7.0943 90 X[42,1,1,2] NL 0 0 5.31304 91 X[43,1,1,2] B 0 0 92 X[44,1,1,2] NL 0 0 7.29348 93 X[45,1,1,2] NL 0 0 7.29907 94 X[46,1,1,2] NL 0 0 7.42787 95 X[47,1,1,2] B 0 0 96 X[48,1,1,2] NL 0 0 0.00652 Best Regards Rong, Ying
I need to use lpk_get_col_prim to get the value for
each variables.
And I let GLPK to read files from
AMPL.
Suppose AMPL files is:
set ITEM;
set STAGE; set TIME; set MACHINE; set RESOURCE; set SCEN; set PRE; ......
var X{ITEM,STAGE,TIME,MACHINE}>=0;
var o{ITEM,STAGE,TIME}>=0; var gamma_plus{STAGE,TIME,MACHINE,RESOURCE}>=0; var gamma_minus{STAGE,TIME,MACHINE,RESOURCE}>=0; var kappa{STAGE,TIME,MACHINE,RESOURCE}>=0; var I{ITEM,STAGE,TIME,SCEN}>=0; var B{ITEM,TIME,SCEN}>=0; I think GLPK generates sequence of columns by types
of variables first. Then there is problem. How GLPK generate X[i,s,t,m].
Originally I think it would like
for ( i = 1...ITEM){
for ( s=1...STAGE){
for (t =
1...TIME){
for(m = 1...MACHINE){
column_number
= i * STAGE*TIME*MACHINE
+
s * TIME*MACHINE
+
t * MACHINE
+ m;
}
}
}
}
But it turn out this is not right. I post
the column from 1 to 96 in the following. It seems that it loops first
on i, then on m.... But for all other variables, it follows the rule I describe
before. So I am wondering how GLPK generate sequence of columns(variables). In
this case, suppose I don't how sequence of X is generated, how I can retrieve
value for X. Also if we change the problem size, would the sequence of variables
change? Thanks!
////////////////////////////////////////////////////
No. Column name St
Activity Lower bound Upper
bound Marginal
------ ------------ -- ------------- ------------- ------------- ------------- 1 X[1,1,1,1] NL 0 0 7.29764 2 X[2,1,1,1] NL 0 0 7.32199 3 X[3,1,1,1] NL 0 0 7.65411 4 X[4,1,1,1] NL 0 0 7.44019 5 X[5,1,1,1] NL 0 0 6.83906 6 X[6,1,1,1] NL 0 0 7.59448 7 X[7,1,1,1] NL 0 0 0.0710351 8 X[8,1,1,1] NL 0 0 7.58844 9 X[9,1,1,1] NL 0 0 7.32145 10 X[10,1,1,1] NL 0 0 7.59391 11 X[11,1,1,1] NL 0 0 0.0145434 12 X[12,1,1,1] NL 0 0 7.38041 13 X[13,1,1,1] NL 0 0 0.128138 14 X[14,1,1,1] NL 0 0 7.50203 15 X[15,1,1,1] NL 0 0 0.231634 16 X[16,1,1,1] NL 0 0 8.27056 17 X[17,1,1,1] NL 0 0 5.00421 18 X[18,1,1,1] NL 0 0 7.56837 19 X[19,1,1,1] NL 0 0 7.84088 20 X[20,1,1,1] NL 0 0 7.55573 21 X[21,1,1,1] NL 0 0 7.02839 22 X[22,1,1,1] NL 0 0 7.72592 23 X[23,1,1,1] NL 0 0 0.0384819 24 X[24,1,1,1] NL 0 0 7.72971 25 X[25,1,1,1] NL 0 0 7.55034 26 X[26,1,1,1] NL 0 0 7.729 27 X[27,1,1,1] NL 0 0 0.131807 28 X[28,1,1,1] NL 0 0 7.38038 29 X[29,1,1,1] NL 0 0 7.8294 30 X[30,1,1,1] NL 0 0 7.17495 31 X[31,1,1,1] NL 0 0 0.18638 32 X[32,1,1,1] NL 0 0 7.48377 33 X[33,1,1,1] NL 0 0 13.6197 34 X[34,1,1,1] NL 0 0 7.53594 35 X[35,1,1,1] NL 0 0 7.74491 36 X[36,1,1,1] NL 0 0 7.53819 37 X[37,1,1,1] NL 0 0 0.128403 38 X[38,1,1,1] NL 0 0 7.53499 39 X[39,1,1,1] NL 0 0 0.170993 40 X[40,1,1,1] NL 0 0 7.46779 41 X[41,1,1,1] NL 0 0 7.38073 42 X[42,1,1,1] NL 0 0 6.4901 43 X[43,1,1,1] NL 0 0 0.090283 44 X[44,1,1,1] NL 0 0 7.48032 45 X[45,1,1,1] NL 0 0 7.48311 46 X[46,1,1,1] NL 0 0 7.54751 47 X[47,1,1,1] NL 0 0 3.83358 48 X[48,1,1,1] NL 0 0 3.83684 49 X[1,1,1,2] NL 0 0 6.92813 50 X[2,1,1,2] NL 0 0 6.97683 51 X[3,1,1,2] NL 0 0 7.04942 52 X[4,1,1,2] NL 0 0 7.21322 53 X[5,1,1,2] NL 0 0 6.01095 54 X[6,1,1,2] NL 0 0 7.52179 55 X[7,1,1,2] B 0 0 56 X[8,1,1,2] NL 0 0 7.50971 57 X[9,1,1,2] NL 0 0 6.97573 58 X[10,1,1,2] NL 0 0 7.52067 59 X[11,1,1,2] B 0 0 60 X[12,1,1,2] NL 0 0 7.09367 61 X[13,1,1,2] B 0 0 62 X[14,1,1,2] NL 0 0 7.3369 63 X[15,1,1,2] B 0 0 64 X[16,1,1,2] NL 0 0 7.47885 65 X[17,1,1,2] NL 0 0 2.34126 66 X[18,1,1,2] NL 0 0 7.46958 67 X[19,1,1,2] NL 0 0 7.30299 68 X[20,1,1,2] NL 0 0 7.44431 69 X[21,1,1,2] NL 0 0 6.38962 70 X[22,1,1,2] NL 0 0 7.60841 71 X[23,1,1,2] B 0 0 72 X[24,1,1,2] NL 0 0 7.61326 73 X[25,1,1,2] NL 0 0 7.43352 74 X[26,1,1,2] NL 0 0 7.6079 75 X[27,1,1,2] B 0 0 76 X[28,1,1,2] NL 0 0 7.09361 77 X[29,1,1,2] NL 0 0 7.66716 78 X[30,1,1,2] NL 0 0 6.68275 79 X[31,1,1,2] B 0 0 80 X[32,1,1,2] NL 0 0 7.30038 81 X[33,1,1,2] NL 0 0 13.55 82 X[34,1,1,2] NL 0 0 7.40471 83 X[35,1,1,2] NL 0 0 7.61432 84 X[36,1,1,2] NL 0 0 7.40921 85 X[37,1,1,2] B 0 0 86 X[38,1,1,2] NL 0 0 7.40282 87 X[39,1,1,2] B 0 0 88 X[40,1,1,2] NL 0 0 5.79489 89 X[41,1,1,2] NL 0 0 7.0943 90 X[42,1,1,2] NL 0 0 5.31304 91 X[43,1,1,2] B 0 0 92 X[44,1,1,2] NL 0 0 7.29348 93 X[45,1,1,2] NL 0 0 7.29907 94 X[46,1,1,2] NL 0 0 7.42787 95 X[47,1,1,2] B 0 0 96 X[48,1,1,2] NL 0 0 0.00652 Best Regards Rong, Ying |
[Prev in Thread] | Current Thread | [Next in Thread] |