Hi guys,
When I try to run the following code:
#Part 0 declaration of parameters
param n;
param m;
set N:=1…n; #number of bonds
set M:=0…m; #number of years
param a{N}; #price of bonds
param L{M}; #liabilities
param d{M,N}; #payment structure
#Part 1 declaration of variables
var x{N} >=0, integer; #investment on bonds
var z{M} >=0; #cash on hand
#Part 2 objective function
minimize cost: sum{j in N} a[j]*x[j];
#Part 3 constraints
subject to initial: z[0]=0;
subject to liability {i in M}: z[i-1]-z[i]+sum{j in N}d[i,j]*x[j]>=L[i];
I ran into the error saying
“Error executing “solve” command:
error processing constraint liability[0]:
invalid subscript z[-1]”
Can anyone help me solving this issue? I’m an absolute rookie to AMPL, any help is appreciated!