Skip to main content

Dear all

 

I have two variables: X and Y with index domain t.

I want to write in definition of X such as

XX0] = 0.3

XX1] = XX0] + YY1]

XX2] = XX1] + YY2]

….

How do I write in definition part of variable X ? Please help me

 

Thank you so much

I would try:

0.3 $ (Ord(t) = 1)

+

x(t-1) + y(t) $ (Ord(t) > 1)


It is very helpful. Thank you very much, @mateusarakawa 


@Huy , as your condition is dependent on the index domain and not on a variable, you could also use an if block in the definition of variable x(t). 

 

if ord(t) = 1 then

0.3

else

x(t-1) + y(t)

endif

 

This will generate the below constraints - assuming that the elements in set T are {0,1,2,3,...}

x(0) = 0.3

x(1) = x(0) + y(1)

x(2) = x(1) + y(2)

….


this command is easy to understand and useful. Thank you a lot @mohansx 


Reply


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

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