title: Pulp Optimization Error - LPVariable Object Does Not Support Indexing
body: <p>I am consistently getting errors when trying to add the constraint located on line 31, model += ([MAHL[i][j] for (i,j) in yearlyhours]) &lt;= 40</p>
  
  <p>I am not sure how to correctly set up this constraint.  I am trying to say that at each index of i and j that the specific value needs to be less than 40 and do it for all i, j pairs.</p>
  
  <p>I am very new to PULP and trying to get a basic model up and running.  Input data is just a bunch of random values that are 365 rows long and 24 columns wide.</p>
  
  <pre><code>from pulp import *
  import pandas as pd
  import numpy as np
  import xlrd
  
  model = pulp.LpProblem("Basic Model", pulp.LpMaximize)
  
  YPER = 365
  HE = 24
  
  yearlyhours = [(i,j) for i in range(YPER) for j in range(HE)]
  
  xlsx = pd.ExcelFile('IvA.xlsx')
  df1 = pd.read_excel(xlsx, 'Sheet5')
  df2 = pd.read_excel(xlsx, 'Sheet3')
  df3 = pd.read_excel(xlsx, 'Sheet2')
  
  MAHL = pulp.LpVariable('MAHL', (YPER, HE), cat='Integer')
  MALL = pulp.LpVariable('MALL', cat='Integer')
  DAHL = pulp.LpVariable('DAHL', cat='Integer')
  DALL = pulp.LpVariable('DALL', cat='Integer')
  
  book = xlrd.open_workbook('IvA.xlsx')
  sheet10 = book.sheet_by_name('Sheet10')
  sheet11 = book.sheet_by_name('Sheet11')
  
  DAPRICE = [[sheet10.cell_value(r, c) for c in range(sheet10.ncols)] for r in range(sheet10.nrows)]
  LOAD = [[sheet11.cell_value(r, c) for c in range(sheet11.ncols)] for r in range(sheet11.nrows)]
  
  #model += (MAHL[i][j] for i in range(YPER) for j in range(HE)) &lt;= 40
  model += ([MAHL[i][j] for (i,j) in yearlyhours]) &lt;= 40
  
  model += (pulp.lpSum([DAPRICE[i][j] * LOAD[i][j] for i in range(YPER) for j in range(HE)]))
  
  model.solve()
  pulp.LpStatus[model.status]
  print("Status:", LpStatus[model.status])
  
  obj = value(model.objective)
  print(obj)
  </code></pre>
  
  <p>I am tried a few solutions, one additional is commented out.</p>
  
  <pre><code>Traceback (most recent call last):
    File "bs.py", line 31, in &lt;module&gt;
      model += ([MAHL[i][j] for (i,j) in yearlyhours]) &lt;= 40
    File "bs.py", line 31, in &lt;listcomp&gt;
      model += ([MAHL[i][j] for (i,j) in yearlyhours]) &lt;= 40
  TypeError: 'LpVariable' object does not support indexing
  </code></pre>