Hi I am trying to do a value assignment in AIMMS. Here is the example:
t and i are both the index of set time. n and r are the index for set Node. NodeInTime, needed_value are predetermined parameters. scenario is parameter changing in the process. noted_scenarios_index is a subset of Node. path is a mapping between index (r,t) and set Node.
for (n,t)| t<>first(time) and n<=NodeInTime(t) do
scenario := 1;
noted_scenarios_index := {r | r <= NodeInTime(t) and path(r, t) = n};
for r in noted_scenarios_index do
needed_value(scenario, n, t, i) := value(path(r,i), i);
scenario := scenario + 1;
endfor;
endfor;
I used debug move to check and surprisingly, the slowest part is:
needed_value(scenario, n, t, i) := value(path(r,i), i);
when it runs to this line, ‘scenario’, ‘n’, ‘t’ are determined and it took more than 30s to run this line….. So I don’t understand why it’s so slow.
I also tried using an additional parameter like:
addition(i) := value(path(r,i), i);
needed_value(scenario, n, t, i) := addition(i);
and addition(i) := value(path(r,i), i); runs quite fast.
However, needed_value(scenario, n, t, i) := addition(i); still runs very slow.
Can you give me some suggestion on how to improve the assignment speed?