# Revision history [back]

The names x_i indicate the order in which the variables x[i] are accessed first. You can see it if you set parameter name of method new_variable.

sage: p = MixedIntegerLinearProgram(maximization=False, solver="GLPK")
....: x = p.new_variable(real=True, nonnegative=True, name="x")
....: p.set_integer(x)
....: p.add_constraint(2*x + 2*x + 3*x - 10*x <= 0)
....: p.add_constraint(6*x + 4*x - 11*x >= 0)
....: p.add_constraint(2*x - 6*x <= 0)
....: p.add_constraint(x - x - x >= 0)
....: p.set_objective(3*x + 6*x - 3*x)
....: p.show()
Minimization:
6.0 x + 3.0 x -3.0 x

Constraints:
3.0 x + 2.0 x + 2.0 x - 10.0 x <= 0.0
-4.0 x - 6.0 x + 11.0 x <= 0.0
2.0 x - 6.0 x <= 0.0
x - x + x <= 0.0
- x <= -1.0
Variables:
x = x_0 is an integer variable (min=0.0, max=+oo)
x = x_1 is a continuous variable (min=0.0, max=+oo)
x = x_2 is a continuous variable (min=0.0, max=+oo)
x = x_3 is a continuous variable (min=0.0, max=+oo)


The names x_i indicate the order in which the variables x[i] are accessed first. You can see it if you set parameter name of method new_variable. So variable x is correctly sets to integer, although it's internal name is x_0.

sage: p = MixedIntegerLinearProgram(maximization=False, solver="GLPK")
....: x = p.new_variable(real=True, nonnegative=True, name="x")
....: p.set_integer(x)
....: p.add_constraint(2*x + 2*x + 3*x - 10*x <= 0)
....: p.add_constraint(6*x + 4*x - 11*x >= 0)
....: p.add_constraint(2*x - 6*x <= 0)
....: p.add_constraint(x - x - x >= 0)
....: p.set_objective(3*x + 6*x - 3*x)
....: p.show()
Minimization:
6.0 x + 3.0 x -3.0 x

Constraints:
3.0 x + 2.0 x + 2.0 x - 10.0 x <= 0.0
-4.0 x - 6.0 x + 11.0 x <= 0.0
2.0 x - 6.0 x <= 0.0
x - x + x <= 0.0
- x <= -1.0
Variables:
x = x_0 is an integer variable (min=0.0, max=+oo)
x = x_1 is a continuous variable (min=0.0, max=+oo)
x = x_2 is a continuous variable (min=0.0, max=+oo)
x = x_3 is a continuous variable (min=0.0, max=+oo)