title: in Pyomo, How to write a constraint that has different time periods based on another parameter?
body: <p>I'm working on a purchasing optimization model, below are some related inputs: </p>
  
  <p><strong>stets :</strong> </p>
  
  <ul>
  <li>model.b = Set(initialize=Brands, doc='Brands')</li>
  <li>model.s = Set(initialize=Suppliers, doc='Suppliers')</li>
  <li>model.t = Set(initialize=Time , doc='Time in days')</li>
  </ul>
  
  <p><strong>parameters:</strong> </p>
  
  <ul>
  <li>model.lt = Param(model.s, initialize=LeadTime, doc='Lead time to buy from supplier (s) in days')</li>
  </ul>
  
  <p><strong>variables:</strong> </p>
  
  <ul>
  <li>model.q = Var(model.b, model.t, model.s, domain=NonNegativeIntegers, bounds=(0.0,None), doc='Recived quantity of each brand (b), at time (t), form supplier (s).')</li>
  <li>model.pr = Var(model.b, model.t, model.s, domain=NonNegativeIntegers, bounds=(0.0,None), doc='Purshase Order quantity of each brand (b), at time (t), form supplier (s).')</li>
  </ul>
  
  <p>I'm struggling to write a constraint that makes quantity ordered before (LT) days from time (t) = quantity received now at time (t),  where LT is the lead time required by each supplier. 
  This is how I imagine the <strong>constraint</strong> but I don't know how to write it: </p>
  
  <p><em>quantity ordered at time (t - lead time) = quantity received at time (t)        ,  for all times (t), brands (b), and suppliers (s)</em> </p>
  
  <p>Your time and help are greatly appreciated!</p>