# How can I define a parameter in relation to some elements in the variable

• 22 views

+4
• Enthusiast
• 18 replies

Example:

For all t, H(t) = Z(t+1) + Z(t).

Z(t) is the variable. And H(t) is the parameter calculated with the adjacent elements in the variable. How can I do this?

BTW, in this instance, what’s the ‘index domain’ of the parameter H, as the index t=1,2,……,24, i.e. the maximum element in Z is Z(24), if I define the ‘index domain’ of H as t directly, which means that there exists H(24) = Z(25)+Z(24), which should not be existed. Would this cause error or how can I limit the index domain of H to t = 1,2,…..,23?

Userlevel 5
+7

Hello Chunyang,

You can declare the parameter H has:

• index domain:  t
• definition: Z(t+1) + Z(t)

You are correct that for t=24, Z(t+1) does not exist. AIMMS defines indexing over a non-existing element as 0. AIMMS does not throw an exception for this.

So with the above declaration, H(24) will be Z(24).

Does this help?

Does this give you the results you want?

With kind regards,

Chris