title: Use tupla(i,j) instead of a single variable(j)
body: <p>I want to create a tupla variable for this model p(i,j) instead of only variable p(j). 
  I have to change it here and on the variables that impacts it.</p>
  
  <h2><a href="https://i.stack.imgur.com/uxb86.png" rel="nofollow noreferrer">Current model example</a></h2>
  
  <h2>Code</h2>
  
  <pre><code>def buildBaseModel():
      global nVars,nClauses,kbRulesLit,kbRulesProbMin,kbRulesProbMax,kbRulesCard,Q
      # Create Model
      m = pulp.LpProblem("Profit maximising problem",pulp.LpMaximize)
  
      nPsatVars = 2 ** nVars
  
      # Create variables p_i --&gt;HERE SHOULD BE p[i]_[j]
      p = {}    
      for j in range(nPsatVars):
          p[j]=pulp.LpVariable(lowBound=0,cat='Continuous',name='p_'+str(j))
  
      #m += sum([p[j] for j in range(nPsatVars)]) --&gt; HERE CHANGE OBJECTIVE FUNCTION
  
      # Create variables pai_i
      pai = {}
      for j in range(1,Q + 1):
          #pai[j] = kbRulesProb[j]
          pai[j]= pulp.LpVariable(lowBound=kbRulesProbMin[j],upBound=kbRulesProbMax[j],cat='Continuous',name='pai_'+str(j))        
      for j in range(Q + 1,nClauses + 1):
          pai[j]= pulp.LpVariable(lowBound=0,cat='Continuous',name='pai_'+str(j))
  
      # Create variables qp_i
      qp = {}
      for j in range(1,Q+1): #not first rule
          qp[j]=pulp.LpVariable(lowBound=0,cat='Continuous',name='qp_'+str(j))
  
      # Create variables qn_i
      qn = {}
      for j in range(1,Q+1): #not first rule
          qn[j]=pulp.LpVariable(lowBound=0,cat='Continuous',name='qn_'+str(j))
  
      #construct the matrix A
      A=np.array([[1] * nPsatVars] * (nClauses + 1))#0
      x = {}
      for j in range(nVars):
          x[j] = 0
      for i in range(1,nClauses + 1):
          for j in range(nPsatVars):
              r = j
              #the value of x is the assignment of the Var,such as [0,1,1,0,0,0]
              for k in range(nVars):
                  x[k] = (r &gt;&gt; k)%2
              t = 0
              for k in kbRulesLit[i]:
                  if k == 0 and x[0] == 1:
                      t = 1
                  if k &gt; 0 and x[k] == 1:
                      t = 1
                  if k &lt; 0 and x[-k] == 0:
                      t = 1
              if t == 1:
                  A[i][j] = 0
  
      #constrict
          m+=sum([p[j] for j in range(nPsatVars)])== 1.0 
  
          #constrict
          for i in range(1,Q + 1):
              m+=sum([p[j]*A[i][j] for j in range(nPsatVars)])-qp[i] &lt;= kbRulesProbMax[i]
  
          for i in range(1,Q + 1):
              m+=sum([p[j]*A[i][j] for j in range(nPsatVars)])+qn[i] &gt;= kbRulesProbMin[i]
  
          for i in range(Q + 1,nClauses + 1):
              m+=sum([p[j] * A[i][j] for j in range(nPsatVars)]) - pai[i] == 0 
  
      #USE GUROBI
      m.solve(pulp.GUROBI())
      pulp.LpStatus[m.status]
  
      if(m.status==-1):
          print("there is no solution for the CONDSAT problem")
      else :
          print("find solution\n")
  
      varsdict = {}
      for v in m.variables():
          print(v.name,"=", v.varValue)
      m.writeLP('c.lp')
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/3351l.png" rel="nofollow noreferrer">Final Model that the code should do</a>
  So at final model we will have p_i_j instead of p_j like this code generate today.</p>
  
  <p>besides this, I need help to change the objective function of the model is to add an objective function that maximize the sum of all variables p(i,j) (that needs to be done after the first change)</p>