# [AMPL 24546] Ampl help

Hello everyone!

When running the following code,

#Part 0 declaration of parameters
param n;
param t;
set N:=1…n; # yield, years
set T:=1…t;

param r{N}; #rate of bonds
param L{T}; #liabilites
param LR{T}; #liability rates
param c{N,T}; #payment structure

param PVB{i in N} = sum{t in T}c[i,t]/(1+r[i])^(t); #PV of a cash flow stream

I am faced with the error saying:
syntax error
context: param PVB{i in N} = sum{t >>> in <<< T}c[i,t]/(1+r[i])^(t);

Any help is really appreciated!

You already defined t as a parameter, with the statement “param t”. So you cannot later define t as a set index in “param PVB {i in N} = sum {t in T} . . .”. When you try to do that, you get a syntax error on “t in T”.

To fix this, you will need to change either the name of the parameter or the name of the set index.