Skip to main content

Hey everybody,

I have a small question. Is it possible to define a parameter in relation to a Variable.

I want to use this parameter in a Constraint.

For example If the optimization variable is 5 - the parameter has to take the value 1.8.

If the variabel is 2, the parameter has to have the value 1.3.

I guess most likely it is possible to use a if- or switch-Function, but I am not sure…

Can I load a table with these parameters in Aimms, so that he can give the parameter the right value, or are their any other ways to do this?

Thanks a lot in advance!

Do you mean the parameter should take the value during the optimization, or in a postprocessing step?

 

If you want the parameter to change during the optimization, it is not a parameter, but actually a variable. 

 

If you want the parameter to be calculated in post processing step, there are multiple ways. One way would be to if-then-else items. You can also create other, more complex/generalized approaches with additional sets/lower/upperbound parameters and select the value of the option that corresponds with the bounds


Hey, the value has to change during the optimization. But there should be a kind of value table. So in relation to another variabel the variable should take certain values. 

So there are two variables. Called a (the one that should take certain values) and b, which defines which value a should take. 

For example if b is 5 → a has to be 1.8. If b is 2 → a has to be 1.3 and so on.

Can I use if-then-else items in the variable definition to create this relationship or are there any better ways to do this?

 

Thank you really much for your help!! 


Hi,

you can use if-then-else statements in constraint definitions, however, this means that you problem becomes non-linear!

If you want to do it in a way that your problem stays linear, you will need to apply some modeling tricks. How to exactly model this will depend a bit on the details of your problem, but you can take a look at the AIMMS Modeling Guide for some ideas with regards to modeling generic logical constraints. See chapter 7 in the AIMMS modeling guide: https://documentation.aimms.com/_downloads/AIMMS_modeling.pdf


Hi,

my first Idea is to use the if-then-else statements in the variable defnition. So the variable a is defined in relation to the variable b.

I want to use this structure and repeat the conditions for Values from 1-10.

I hop it is okay to use this structure in the variable definition.

I guess this should work, or what do you think? Thank you really much for your help!

 

 


H Simon,

Putting an expression in the definition of a variable means that AIMMS will generate the equality constraint based on that expression automatically for you. This does mean that if your variable is FaktorHandlingsafwandWerker, you cannot use the above because it requires you to only state the value in the definition that that variable should get in case the if-condition holds.

 

Furthermore, you can use these kind of if-then-else conditions,  but I really would like to stress that the resulting problem is Non-Linear and therefore you will not have the nice properties of a linear model anymore, like finding the global optimum, etc.

 


You are absolutely right. The way I used lead to different warnings and problems in my model. I checked the modelling tricks but not really found a suitable solution for my problem.

To describe it as clearly as possible. I have the two variables “AnzahlFertigungsstationen” and “FaktorHandlingsaufwandWerker”. “AnzahlBauteile” is a fixed integer parameter.

In relation to the solution of “AnzahlBauteile/AnzahlFertigungsstationen” the variable “FaktorHandlingsaufwandWerker” should take certain pre-defined values.

The Variable “FaktorHandlingsaufwandWerker” is then used in a constraint as a factor of a parameter.

For me the definition of the variable “FaktorHandlingsaufwandWerker” is the problem. It should be a certain value in relation of the mathematical expression I described before. I guess this is a “simple” problem, but for me as a beginner in aimms diffecult to handle.

 


Hi @Simon Küter. Using your formulation of variables a and b such that

For example if b is 5 → a has to be 1.8. If b is 2 → a has to be 1.3 and so on.

you can formulate this by introducing a binary variable for each of the possible values that b can take. For example, a new binary variable i5 that becomes 1 if b equals 5 and a new binary variable i2 that becomes 1 if b equals 2. Then you have to add the following three constraints:

b = 5*i5 + 2*i2
i5 + i2 = 1
a = 1.8*i5 + 1.3*i2

 


Hey, thanks for your help
I was able to solve the problem!!


Reply


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

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