Solved

Indexing a variable with an initial value or constraint

  • 23 March 2020
  • 2 replies
  • 81 views

Hi everyone.


I'm starting with Aimms, I have two questions

 

First

How can I index a variable with an initial value or constraint? .

For example

X (i) is the dependent variable of the set (for example 4 things) with index i.

And what I need is

X (1)> = 50
X (2) <= 250

 

Variable X {
    IndexDomain: i;
    Range: nonnegative;
}
 

Second

How can I implement or call benders decomposition modules, stochastic programming etc. inside the MainExecution procedure?


Thank you
Thanking you for your support.

icon

Best answer by mohansx 24 March 2020, 19:42

@Manuel 

 

#1. As your constraint as two signs (<= and 😆, you will need to declare two constraints. Use single quotes to refer to individual elements in your set. 

 

con1 with definition X(‘1’) >= 50

con2 with definition X(‘2’) <= 250

 

You can also extend this with the index, say you want X(2), X(3), X(4) to be <= 250 then 

 

Constraint conIndex {

    IndexDomain: i|ord(i) >= 2 and ord(i) <= 4;

    Definition: X(i) <= 250

}

 

Ord is the function which returns the position of the element in the set. Here, I assume your set starts at 1 - {1, 2, 3, 4, 5 ..} 

#2. You can look at these two examples for implementations of stochastic programming and bender’s decomposition in AIMMS. 

 

https://www.aimms.com/english/developers/resources/examples/modeling-book-examples/power-system-expansion/

https://www.aimms.com/english/developers/resources/examples/functional-examples/stochastic-programming/

 

Note that MainExecution is just a procedure which is linked to a keyboard shortcut, you can create new procedures as well. 

View original

2 replies

Userlevel 4

@Manuel 

 

#1. As your constraint as two signs (<= and >=), you will need to declare two constraints. Use single quotes to refer to individual elements in your set. 

 

con1 with definition X(‘1’) >= 50

con2 with definition X(‘2’) <= 250

 

You can also extend this with the index, say you want X(2), X(3), X(4) to be <= 250 then 

 

Constraint conIndex {

    IndexDomain: i|ord(i) >= 2 and ord(i) <= 4;

    Definition: X(i) <= 250

}

 

Ord is the function which returns the position of the element in the set. Here, I assume your set starts at 1 - {1, 2, 3, 4, 5 ..} 

#2. You can look at these two examples for implementations of stochastic programming and bender’s decomposition in AIMMS. 

 

https://www.aimms.com/english/developers/resources/examples/modeling-book-examples/power-system-expansion/

https://www.aimms.com/english/developers/resources/examples/functional-examples/stochastic-programming/

 

Note that MainExecution is just a procedure which is linked to a keyboard shortcut, you can create new procedures as well. 

Thank you very much. 

I'm going to check that. 

Best regards. 

@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