Skip to main content

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

  • January 30, 2023
  • 1 reply
  • 31 views

Forum|alt.badge.img+4

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?

 

1 reply

Chris Kuip
AIMMSian
Forum|alt.badge.img+7
  • AIMMSian
  • 125 replies
  • January 30, 2023

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



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

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