Solved

Giving Parameters Dynamic Values


Userlevel 1
Badge

Hey everyone,

I´m currently using Aimms to build a model for my Bachelor Thesis. I have never worked with Aimms before so I´m pretty clueless in some regard.

 

So my problem is the following constraint:

sum [i, aSP(h,i)*x(i,t)] + sum [j, sum [m, aFP(h,m)*(y(j,m,t))]] <= Capacity(h)

 

Here x(i,t) and y(j,m,t) are the decision variables which represent the accepted requests for two Product types. i are the different types of Product x and j are different types for Product y. t stands for different Periods. aSP and aFP indicate if product x(i) or y(j) needs Ressource h for its production.

I have declared Capacity(h) as a parameter with values for each h.

My Problem is now that the Programm takes these values for each seperate period, but the capacity in period 2 is of course lower than the capacity in period 1 and so on. I also cant just declare Capacity parameters for each period, because the remaining capacity in the periods after period 1 depend on the sold products and therefore the already used capacity in prior periods.

 

I think the capacity must be declared as a variable, but all my tries to make it work that way failed.

 

If anyone knows how i can deal with this problem, i would be very happy for your help.

 

icon

Best answer by mateusarakawa 6 May 2020, 20:24

View original

7 replies

Userlevel 5
Badge +2

Hi, @AlexK.

 

I think the capacity must be declared as a variable

I agree with you.

If you create VarAvailableCapacity(h,t) with attribute range “nonnegative” and use in this constraint, you should also create other constraint to control its value.

 

Constraint_AvailableCapacity

Index domain: (h,t)

Definition:

VarAvailableCapacity(h,t)

=

Parameter_InitialCapacity(h)

-

! Sum used capacity in previous periods

sum [(i,t_aux) | (ord(t_aux) < ord(t)), aSP(h,i)*x(i,t_aux)] + sum [(j,t_aux) | (ord(t_aux) < ord(t)), sum [m, aFP(h,m)*(y(j,m,t_aux))]]

Remark: Your period set “t” must be ordered correctly.

“t_aux” is other index name for set “t”.

 

You can also use this sentence directly in your existing constraint:

sum [i, aSP(h,i)*x(i,t)] + sum [j, sum [m, aFP(h,m)*(y(j,m,t))]] 
<=
Parameter_InitialCapacity(h)

-

! Sum used capacity in previous periods

sum [(i,t_aux) | (ord(t_aux) < ord(t)), aSP(h,i)*x(i,t_aux)] + sum [(j,t_aux) | (ord(t_aux) < ord(t)), sum [m, aFP(h,m)*(y(j,m,t_aux))]]

 

Hope it helps.

Userlevel 1
Badge

Thank you very much for your quick reply. I implicated your advice into my program and it did work well.

Sadly I´m just at the beginning of the program and may encounter some more issues, as I´m, as is previously mentioned, absolutly new to Aimms.

Would it be okay to ask some more questions if they should occour?

Userlevel 5
Badge +2

No problem, AlexK.

 

Would it be okay to ask some more questions if they should occour?

I think this is the main idea of the community. We’ll try to help you!

As you are new to AIMMS, don’t forget to check its knowledge base. It can help you a lot as well.

Userlevel 6
Badge +6

@AlexK , are you aware of the 1-hour tutorial where you build your first little App. This is very helpful to grasp the concepts you need. 

 

You also might like this simplification of an optimization model. Good to know, the Objective is a variable you select from all the variables and is typically of sum of sorts (scalar value). The Math Program is the set of AllVariables (the Decisions to make) and AllConstraints (the Restrictions to uphold) by default; this can be adjusted in AIMMS to a subset such that you can run the same models with different restrictions to validate scenarios. Similarly you can change the Input data, the parameters of the model that are fixed when solving a model.

 

 

Userlevel 1
Badge

@Gertjan I did the 1 hour tutorial before i began to program my model. It helped a little bit, but since my program is a little more complex than the one in the tutorial it can´t answer all my questions. I also read many of the Aimms Instructionbooks.

 

@ all I have yet another question that i cannot seem to solve. I have the following constraint:

 

BidPreis(h,t) = InitialBidPreis(h) + (sum [t_aux| (ord(t_aux)< ord(t)), AvailableCapacity(h,t_aux)-AvailableCapacity(h,t) ])

 

With this constraint i want to set the Bid Price for a ressource h in  a specific period t. It is meant to be based on the InitialBidPreis(h) + the difference between the Available Capacity for h from the last periode and this period. But i dont know how to adress just the last period before t and not all of them.

Help would be greatly appreciated.

Userlevel 5
Badge +2

Hi, @AlexK .

sum [t_aux | (ord(t_aux) = (ord(t)-1)), AvailableCapacity(h,t_aux)] - AvailableCapacity(h,t)

Hope it helps.

 

Userlevel 1
Badge

@mateusarakawa 

yes it does. Thank you very much.

Reply


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

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