Solved

How can I use part of an index


Badge +4

 

Like one day have 24 hours, I need to calculate the variables for 24 periods, but these variables are defined by 25 points, so I define the index t as “25”.

 

For example variable A contains 24 elements, A(1) = B(2)-B(1)…...A(24)=B(25)-B(24).

 

 If I define an index “t” as 25, I can simply define the B as B(t) using t (1 to 25) as the domain. But How can i define A which only contains 24 elements, actually from 1 to 24, can I use part of t domain from 1 to 24?

 

icon

Best answer by Marcel Hunting 5 April 2023, 09:27

View original

2 replies

Userlevel 5
Badge +4

Hi @Chunyang. You can use the domain condition t | t <> last(Periods) in the index domain of A:

 

Set Periods {
Index: t;
Definition: {
{ 1 .. 25 }
}
}
Variable B {
IndexDomain: t;
Range: nonnegative;
}
Variable A {
IndexDomain: t | t <> last(Periods);
Range: nonnegative;
}

 

Badge +4

Hi @Chunyang. You can use the domain condition t | t <> last(Periods) in the index domain of A:

 

Set Periods {
Index: t;
Definition: {
{ 1 .. 25 }
}
}
Variable B {
IndexDomain: t;
Range: nonnegative;
}
Variable A {
IndexDomain: t | t <> last(Periods);
Range: nonnegative;
}

 

Thanks a lot!

Reply


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

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