title: Linearizing the product of a binary and a continuous variable
body: <p>I'm trying to make a optimization problem that include product of a binary and a continuous variable in the objective, someone have an example or maybe how to fix it..</p>
  
  <pre><code>
  Touf = gp.Model('Time of Use FL')
  
  # Creacion de Estados ON y OFF Carga
  a = {}
  for j in range (1,Ncargas+1):
      for k in range(1,dia+1):
          a[j,k] = Touf.addVar(vtype=GRB.BINARY, name="a(%s,%s)" % (j,k))
  
  b = {}
  for k in range(1,dia+1):
      b[k] = Touf.addVar(lb=0.0, ub=0.5,vtype=GRB.CONTINUOUS)
  
  bdiss = {}
  for k in range(1,dia+1):
      bdiss[k] = Touf.addVar(lb=0.0, ub=0.5,vtype=GRB.CONTINUOUS)
  
  St= {}
  for k in range(1,dia+1):
      St[k] = Touf.addVar(lb=0.0, ub=0.5,vtype=GRB.CONTINUOUS)
  
  beff = 0.9
  
  
  Touf.setObjective((gp.quicksum(a[j,k]*Costo[k]*(Potencia[j-1]+b[k]-bdiss[k]) for j in range(1,Ncargas) for k in range(1,dia))), GRB.MINIMIZE)
  
  Touf.addConstr(gp.quicksum(a[j,k]*Potencia[j-1] for j in range(1,Ncargas) for k in range(1,dia)) &lt;= MD.item(0))
  
  for i in range(1,Ncargas+1):
      Touf.addConstr(gp.quicksum(a[i,j] for j in range(Sj.item(i-1),Fj.item(i-1)+1)) == lj[i-1])
  
  Touf.addConstrs(St[i]==St[i-1]+beff*b[i]-1/beff*bdiss[i] for i in range(1,dia))
  
  
  # Solve
  Touf.optimize()
  
  </code></pre>