Pinned topic Can we use decision variable in post processing block calculations?
I am stuck with post processing block, I have few questions about it.
1) Can we use for loop and ifelse Condition on variable (defined in .mod) in post processing block.
2) Could decision variable be used for post processing block calculations?
Actually, in my problem, after doing optimization i have to calculate some variables using values of my decision variables. Though i can do that by using any other commercial software like matlab by writing first my dvar in spreadsheet and use that further. BUT! the problem is, my decision variable is 3D array x[i][j][k]. with arguments in the range of i=1..30 ; j=1..24; k=1..100.
Kindly suggest me, should i use post processing block for further calculation and how? or should i take dvar xi]ij[k] to spreadsheet but it needs to convert from 3D to 2D, and how can we do this?
Your response is highly appreciated.
Regards,

ACCEPTED ANSWER
Re: Can we use decision variable in post processing block calculations?
20130417T11:14:28Z in response to SystemAdminHi,
yes you can use dvar results in postprocessing.
Let me give you an example:
dvar float+ a[i in 1..10] in 0..1;
maximize sum (i in 1..10) a[i];
subject to{
}
float m=1/10*sum(i in 1..10) a[i];
execute
{
writeln(m);
}
regards
Alex Fleischer

ACCEPTED ANSWER
Re: Can we use decision variable in post processing block calculations?
20130422T18:02:58Z in response to AlexFleischerThank you Alex for your reply,
I did it in other way, that is, by writing my 3D dvar array to excel sheet, and calling that sheet into matlab and process it further.
I use following code to write 3D data on excel sheet.
/***** Data file ******
tuple INDVALS {float XX;float YY;float ZZ;float v;};{INDVALS} ThreeDArray2WriteOnExcel = { <x,y,z,ThreeDArray2WriteOnExcel_ti [x] [y] [z]>  i in XX, j in YY, k in ZZ};
int sz = card (ThreeDArray2WriteOnExcel);
string foo = "a1:d";execute {
range= "a1:d" + sz;}
/**** Data File *****/
SheetConnection sheet("MySheet.xlsx");
ThreeDArray2WriteOnExcel to SheetWrite(sheet,range);
Regards,
Waqas
