Solved

Variable with limited set index

  • 26 December 2019
  • 5 replies
  • 148 views

Userlevel 2
Badge +4

Dear All,

I want to model a variable that only can be applied for certaint set index. For example:

Variable NPGMax {
    IndexDomain: (i,g,ng)|ord(i) = 1 or ord(i) = 3 or ord(i) = 6;
}

where the variable NPGMax is only applied for index 1, 3, or 6 of set bus with index i.

Is it possibel to do it dynamiclly where the value 1,3, or 6 can be assigned as an input parameter?

Thank you very much.

icon

Best answer by Arthur 27 December 2019, 11:31

View original

5 replies

Userlevel 4
Badge +1

Hi @rahmat , 

 

I recommend you to declare a binary parameter indexed over your set, say BP_SelectedVariables(i), and apply this parameter in the domain condition of your variable:

Parameter BP_SelectedVariables {
    IndexDomain: (i);
    Range: binary;
}

Variable NPGMax {
    IndexDomain: (i,g,ng)| BP_SelectedVariables(i)
}

This BP_SelectedVariables can then be updated through an assignment in a procedure, or directly in your user interface (it will show some checkboxes)

As soon as BP_SelectedVarialbles is updated, the variable is updated too.

Userlevel 2
Badge +4

Hi @Arthur,

Many thanks for your suggestion. It works well…

Thank you.

Userlevel 2
Badge +4

Hello @Arthur,

Based on your reply, the approach can be used to substitute the compound set (that no longer supported by AIMMS). For example:

Set Bus {
    Index: i
}

Set GenTech {
    Index: g;
}

Set GenNum {
    Index: ng;
}

Set NewGen {
    SubsetOf: (Bus, GenTech);
    Index: cg;
}

Variable NPGMax {
    IndexDomain: (cg,ng);
    Range: integer;
}

can be replaced by:

Parameter NewGenBus {
   IndexDomain: (i,g);
   Range: binary;
}

Variable NPGMax {
    IndexDomain: (i,g,ng) | NewGenBus(i,g)
    Range: integer;
}

Is this correct?

Userlevel 5
Badge +5

Based on your reply, the approach can be used to substitute the compound set (that no longer supported by AIMMS). For example:

 

@rahmat , yes. The binary parameter acts as a condition to generate the valid tuples. NewGenBus(Bus1, GenTech1) = 1 indicates that NewGen is possible with i = Bus1 and g = GenTech1

Userlevel 2
Badge +4

Based on your reply, the approach can be used to substitute the compound set (that no longer supported by AIMMS). For example:

 

@rahmat , yes. The binary parameter acts as a condition to generate the valid tuples. NewGenBus(Bus1, GenTech1) = 1 indicates that NewGen is possible with i = Bus1 and g = GenTech1

@mohansx, 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