addVar ( lb=0.0, ub=GRB.INFINITY, obj=0.0, vtype=GRB.CONTINUOUS, name='''', column=None )

Add a decision variable to a model.


lb (optional): Lower bound for new variable.

ub (optional): Upper bound for new variable.

obj (optional): Objective coefficient for new variable.

vtype (optional): Variable type for new variable (GRB.CONTINUOUS, GRB.BINARY, GRB.INTEGER, GRB.SEMICONT, or GRB.SEMIINT).

name (optional): Name for new variable.

column (optional): Column object that indicates the set of constraints in which the new variable participates, and the associated coefficients.

Return value:

New variable object.

Example usage:

  x = model.addVar()                                     # all default arguments
  y = model.addVar(vtype=GRB.INTEGER, obj=1.0, name="y") # arguments by name
  z = model.addVar(0.0, 1.0, 1.0, GRB.BINARY, "z")       # arguments by position