Skip to main content
Solved

How can I use part of an index

  • April 5, 2023
  • 2 replies
  • 51 views

Forum|alt.badge.img+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?

 

Best answer by Marcel Hunting

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;
}

 

2 replies

Marcel Hunting
AIMMSian
Forum|alt.badge.img+4
  • AIMMSian
  • 258 replies
  • Answer
  • April 5, 2023

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;
}

 


Forum|alt.badge.img+4
  • Author
  • Enthusiast
  • 19 replies
  • April 5, 2023

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!



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

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