title: Evaluating expressions in pulp
body: <p>I have developed a LP problem and this works. However, when I print out total_transfers it just gives me an expression like &quot;buy10__Aarons,_M + buy10__Adams,_C + buy10__Adrian + buy10__Ait_Nouri,_R + buy10__Ajer,_K +....&quot; whereas I thought it should be a number. How can this be printed out as a number? I really want to put this into my objective function as a panalty value but unable to do this</p>
  <pre><code># Define constriant for starting team i.e first week (week 4) 
  for player in players:
      fpl_problem += lineup[0][player] == starting_team[player] + tran_in[0][player] - tran_out[0][player]
      fpl_problem += tran_in[0][player] + tran_out[0][player] &lt;= 1    
      fpl_problem += cpt[0][player]  &lt;= lineup[0][player] 
  # Define constriants for teams for rest of the weeks (week 5 and 6. The code is generic and automatically scales for additional weeks)
  
  for week in range(0,len(weeks)-1):
    for player in players:
      fpl_problem += lineup[week+1][player] == lineup[week][player] + tran_in[week+1][player] - tran_out[week+1][player]
      fpl_problem += tran_in[week+1][player] + tran_out[week+1][player] &lt;= 1
      fpl_problem += cpt[week+1][player]  &lt;= lineup[week+1][player] 
      
  for week in range(0,len(weeks)):
    fpl_problem += sum(tran_in[week][player] for player in players) &lt;=11          # trade in players should be &lt;= 11 per week
    fpl_problem += sum(lineup[week][player] for player in players) == n_players   # Lineup size should be equal to maximum players per week
    fpl_problem += sum(cpt[week][player] for player in players) == 1              # There should be only 1 captain per week
    fpl_problem += sum([player_cost[player] * lineup[week][player] for player in players]) &lt;= float(max_budget)     # Total cost constriant per week
    total_transfers = total_transfers + sum(tran_in[week][player] for player in players)
  fpl_problem += total_transfers &lt;= transfers_left
  </code></pre>