Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Helloooo everybody !!

Indeed, they are numbered this way just because of the order in which they are created. And there is no specific reason why they are called x. For the code you give as an example, I would not know from the inside of objects p or w that the value is stored in a variable which is named 'w'. Hence I do not know how to make this appear in Actually, there is in Sage a way to "name" variables :

sage: p=MixedIntegerLinearProgram()
sage: w=p.new_variable(name="w")
sage: p.add_constraint(-w[0]+2*w[2]+3*w[3]==4)
sage: p.add_constraint(w[0]+w[1]+w[3]==3)
sage: p.set_objective(w[0]- w[1])
  w[0] -w[1]
  R0: 4.0 <= -w[0] +2.0 w[2] +3.0 w[3] <= 4.0
  R1: 3.0 <= w[0] +w[3] +w[1] <= 3.0
  w[0] is a continuous variable (min=0.0, max=+oo)
  w[2] is a continuous variable (min=0.0, max=+oo)
  w[3] is a continuous variable (min=0.0, max=+oo)
  w[1] is a continuous variable (min=0.0, max=+oo)

But there you had to explicitely say that the variables had to be named by "w". Well. Now, this changes nothing to their numbering, and I have no idea how to fix that. In the part of the code that displays the formulas, the keys you used to access the variables have been forgotten a loooong time ago. I agree that the result of would be muc easier to read though...