Solved

Variable with Initial Value


Hi everybod,

I have a quick question and hope you can help me.


I calculate in my model the optimal stock level depending on the period and szenario specific demand.
The inventory level is defined as follows: Inventory_PreviousPeriod + ProductionQuantity_CurrentPeriod (also a variable) - DeliveryQuantity_CurrentPeriod.


How is it possible to preset the variable stock for the first period to a fixed inital value (in this case the opening inventory)?

I would be very grateful for your answer!

Best ragards, Hans

icon

Best answer by luispinto 28 July 2022, 23:22

View original

2 replies

Userlevel 4
Badge +5

Hello Hans,

 

I typically do this by including the initial stock from a parameter and conditioning that this will only be added if the constraint is being applied for the first period.

Something like this:

 

Constraint c_balance {
    IndexDomain: (i_period);
    Definition: 

        (p_initialInventory | (i_period = 'period_1’)) + v_inventory(i_period - 1) + v_production(i_period) = v_delivery(i_period) + v_inventory(i_period)
}

 

Hence the “| (i_period = 'period_1’)" will only add the p_initialInventory parameter when i_periodo is ‘period_1’.

Best regards,

Hu Luispinto,

thank you for your helpful reply!

This is exactly the kind of advice I was hoping for, you really helped me a lot.

 

Thanks again and best regards,

Hans

Reply


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

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