Variable value after run

58 views
Skip to first unread message

Deema

unread,
Apr 22, 2019, 10:38:02 PM4/22/19
to AIMMS - The Modeling System
Hello, 

I have several runs for my model and i want to find a variable value after the model runs (not included in my main run) which could be calculated from the model results. 
Not sure how to do  that? 
if i define a variable and exclude it from the main run i get an error that its not feasible. 

Regards, 
Deema

Mohan

unread,
Apr 22, 2019, 10:56:42 PM4/22/19
to AIMMS - The Modeling System
Hello Deema,

Not sure what you mean by "variable not included in my main run". Can you elaborate ?

If you want to store and compare the values of this variable for each run, you have to store the variable value in a parameter. Suppose you have a for loop on index r (for run).
for r do

solve model
;

variable
:= store_parameter(r);

endfor
;

Deema Aljuhani

unread,
Apr 23, 2019, 8:15:17 AM4/23/19
to ai...@googlegroups.com
Hi, 

I need a simple mathematical calculation from the results provided by Aimms. For example if I have two variables in Aimms to be solved x(I) and y(I) after the run I get valises x(I) is 100 and y(I) is 50 
Now I want to do a multiplication post run a(I) = x(I) * y(I)
 I cannot include that in my model itself as it’s a linear model . 


Thank you 

Regards, 
Deema 
--
You received this message because you are subscribed to the Google Groups "AIMMS - The Modeling System" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aimms+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aimms/67fa78f7-42c1-4cad-91e4-81a0f580a2b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Deema Aljuhani

unread,
Apr 23, 2019, 11:01:19 AM4/23/19
to ai...@googlegroups.com
Hi, 

Thank you, I found a workaround for that. 

Regards, 
Deema 


From: ai...@googlegroups.com <ai...@googlegroups.com> on behalf of Deema Aljuhani <dm...@hotmail.com>
Sent: 23 April 2019 13:11
To: ai...@googlegroups.com
Subject: Re: [AIMMS] Re: Variable value after run
 

Mohan

unread,
Apr 23, 2019, 12:45:36 PM4/23/19
to AIMMS - The Modeling System
Glad to know you worked it out.

If you want to do some calculations outside the linear math model, you would have to use a parameter like I suggested before. You can use a definition for the parameter - however, this value will be updated whenever the values of the variables change. Another option is to use an assignment statement.

a(l) := x(l) * y(l)


To unsubscribe from this group and stop receiving emails from it, send an email to aimms+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "AIMMS - The Modeling System" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aimms+unsubscribe@googlegroups.com.

Deema

unread,
Apr 26, 2019, 4:06:56 PM4/26/19
to AIMMS - The Modeling System
Hello, 


Another question regarding the loops and saving the variable values into Parameters: 



The model runs in several loops (lo) , I have created a parameter value for each variable to store the different values from each run into it but for some reason only the objective function value (z) is stored while all the other variables just repeat the same results into the parameter for all loops . Below is what i have included into my model in the body of the main execution: 
I have introduced 2 equations for the integer cuts to get different values for each run: 


Start_Stop_watch;
ITER := 0;

while( ITER < card(lo)) do 

for lo do 

w(i) := bi_choice(i,lo) ;
TBU:=  To_used(lo);
z := ob_value(lo) ;
x(i) := XX(i,lo) ;
y(i) := YY(i,lo) ;
a(i) := aa(i,lo) ; 
b(i) := bb(i,lo) ;  


upp(i,lo)$((ord(lo) = ITER) AND (w.level(i) =  1)) := yes;
low(i,lo)$((ord(lo) = ITER) AND (w.level(i) =  0)) := yes;

SOLVE  Model;

ITER := ITER + 1;



endfor ;
endwhile;
Stop_Stop_watch;
put Results;


Regards, 
Deema 

Mohan

unread,
Apr 28, 2019, 9:11:21 PM4/28/19
to ai...@googlegroups.com
Hi,

I think your statement to increment the ITER operator must be outside the for loop. Update your procedure like below.

SOLVE  Model;
endfor
;

ITER
:= ITER + 1;
endwhile;

Reply all
Reply to author
Forward
0 new messages