Need Assistance with AMPL Constraint Modeling

Hi @nolanmaris ,

The right way of writing indexed constraints in ampl is just specifying the index (there are no forall loops involved)

P_{t} \leq D_{t} + I_{t-1} - I_{t} + R_{t}, \quad \forall t \in Time

subject to meet_demand {t in Time: t > 0}:
	prod[t] <= demand_forecast[t] + inventory[t-1] - inventory[t] + resource_availability[t];

I added the t > 1 condition so you do not get an error for t = 0 (inventory[-1]?). It depends on what is the first time value you are considering.

You can use ordered sets to handle time in case it helps you:

set Time ordered := 1..100;
...
...
subject to meet_demand {t in Time: t != first(Time)}:
	prod[t] <= demand_forecast[t] + inventory[t-1] - inventory[t] + resource_availability[t];