title: Difference of building constraints with BuildAction() vs normal way
body: <p>As referred in pyomo documentation, <code>BuildAction()</code> is an advance topic and additionally according to the documentation, it is somewhat more efficient to build/solve? constraints with <code>BuildAction()</code>.</p>
  
  <p><strong>An example constraint generated with <code>BuildAction()</code>:</strong></p>
  
  <pre><code>m.const1 = Constraint([(t, a) for t in m.TIME for a in m.AREA],
                        noruleinit=True)
  
  def const1_rule(m):
      for t in m.TIME:
          for a in m.AREA:
              lhs = (some_vars_1[t,a])
              rhs = (some_vars_2[t,a])
              m.const1.add((t,a), (lhs == rhs))
  
  m.const1_build = BuildAction(rule=const1_rule)
  </code></pre>
  
  <p>So <code>m.const1 = Constraint()</code> builds the pyomo constraint without any rule via <code>noruleinit=True</code>. </p>
  
  <p>Then <code>m.const1_build = BuildAction()</code> runs the function <code>const1_rule</code>, and in this function the constraints are added to <code>m.const1</code> via <code>.add()</code>.</p>
  
  <p><strong>An example constraint generated with normal way:</strong></p>
  
  <pre><code>def const1_rule(m, t, a):
      lhs = (some_vars_1[t,a])
      rhs = (some_vars_2[t,a])
      return lhs == rhs
  
  m.const1 = Constraint(m.TIME, m.AREA, rule=const1_rule)
  </code></pre>
  
  <p><strong>QUESTIONS:</strong></p>
  
  <blockquote>
    <p>Another application of BuildAction can be intialization of Pyomo model data from Python data structures, or efficient initialization of Pyomo model data from other Pyomo model data.</p>
  </blockquote>
  
  <p>1) In what way it is more efficient?</p>
  
  <p>2) What is the difference building the constraints with <code>BuildAction()</code>?</p>
  
  <p>3) Should I use it, yes-no-why?</p>
  
  <p>4) If <code>BuildAction()</code> is better, how would I take advantage of it? (for example; assume there is a different working principle of <code>BuildAction()</code>, and maybe because of that I don't need to create some pyomo <code>Set</code>s or <code>Param</code>s.)</p>