• 17 November 2019
  • 5 replies


I have a binary variable in my model X(i,j,k,s) and I want that it assumes a value that I calculated in the deterministic model. For example I want that X(i,j,k,s)=X('Yorkshire and the Humber','MEA',k,s);
How can I write this in aimms?
I tried to write a constraint but after the run of the programme I don't have results for this variable.
Thanks for your help.

5 replies

Userlevel 5
Badge +4

You could add a constraint with definition:

X(i,j,k,s) = X('Yorkshire and the Humber','MEA',k,s).level

If you use

X(i,j,k,s)=X('Yorkshire and the Humber','MEA',k,s)

then the term on the right-hand-side is also considered a variable in the math program, and therefore not fixed to a value.

Dear @Marcel Hunting 

in this way the model it is not working, I don’t have any results for X. 

I thought to convert X in a parameter and then to fix the value that it should be have.

Is it correct?

Userlevel 5
Badge +4

You can also fix X('Yorkshire and the Humber','MEA',k,s) to a certain value by using the .nonvar suffix, so add the statement:

X('Yorkshire and the Humber','MEA',k,s).nonvar := 1;

before the second solve. And use a constraint:

X(i,j,k,s)=X('Yorkshire and the Humber','MEA',k,s)

You have to make sure that you do not empty or change the values of X between the deterministic and stochastic solve. If X is still empty then likely the model has either become infeasible or you are emptying X before the stochastic solve.


Hi @graleo ,

Was Marcel’s answer sufficient in providing a solution to your problem?

Best Regards

Dear @Andrew 

do you habe any other solution?



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

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