Skip to main content

Storing data iteratively in a parameter

  • May 8, 2024
  • 2 replies
  • 25 views

Forum|alt.badge.img+2

I am trying to develop a model and store the output iteratively. The code I have written is given below. I am trying to store the output “poFGAllocation(sr,d,p,b,f,n,a,s,l)” iteratively. Model is running and showing optimal solution. However, the output parameter returns empty dataframe. 

pLoopCount is a parameter with initial value 1. 

while (pCardFG > 0) do
for sr do
pr_Read_Input_Data;
solve mpMaximizeWagonCap where MIP_absolute_optimality_tolerance = 0.05;
showProgressWindow();
!vFGAllocationTonsLoop1(xy,sr,d,p,b,f,n,a,s,l) := vFGAllocationTonsLoop(sr,d,p,b,f,n,a,s,l);
poFGAllocation(sr,d,p,b,f,n,a,s,l) := vFGAllocationTons(d,p,b,f,n,a,s,l);
sFGLoaded := sFGLoaded + {f| sum[(d,p,b,n,a,s,l),vFGAllocationTons(d,p,b,f,n,a,s,l)] >= 0.99};
sFG_ID := sFG_ID - {f| sum[(d,p,b,n,a,s,l),vFGAllocationTons(d,p,b,f,n,a,s,l)] >= 0.95};
endfor;
pr_Write_Output_Data;
execute("cmd.exe /k 1interProcessData.bat", wait: 1, minimized:1);
pLoopCount += 1;
endwhile;

Kindly help if I am doing anything wrong. 

2 replies

Forum|alt.badge.img+2
  • Author
  • Enthusiast
  • 4 replies
  • May 8, 2024

I missed one thing i.e. sr is ElementRange(pLoopCount, pLoopCount);


gdiepen
AIMMS Champ
Forum|alt.badge.img+7
  • AIMMS Champ
  • 155 replies
  • May 8, 2024

Not sure what is going wrong based on just this piece of code.

My first action would be using the aimms debugger to go through this procedure step-by-step and at every step check whether the data I expect is there or not.



Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator