# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1263657713 3600
# Node ID aa038f082d348797931963a983c8963849b4f39c
# Parent 33c04bb5aea0255c4fac02782a9974deaf33f1ce
Smqll updqte of MixedIntegerLinearProgram.show
diff r 33c04bb5aea0 r aa038f082d34 sage/numerical/mip.pyx
a

b


370  370  sage: p = MixedIntegerLinearProgram() 
371  371  sage: x = p.new_variable() 
372  372  sage: p.set_objective(x[1] + x[2]) 
373   sage: p.add_constraint(3*x[1] + 2*x[2], max=2) 
 373  sage: p.add_constraint(3*x[1] + 2*x[2], max=2, name="Constraint_1") 
374  374  sage: p.show() 
375  375  Maximization: 
376  376  x_0 +x_1 
377  377  Constraints: 
378   3 x_0 +2 x_1 <= 2 
 378  Constraint_1: 3 x_0 +2 x_1 <= 2 
379  379  Variables: 
380  380  x_0 is a real variable (min=0.0, max=+oo) 
381  381  x_1 is a real variable (min=0.0, max=+oo) 
382  382  """ 
383  383  
 384  self._update_variables_name() 
 385  
384  386  inv_variables = [0]*len(self._variables) 
385  387  for (v,id) in self._variables.iteritems(): 
386  388  inv_variables[id]=v 
… 
… 

396  398  value+=str(sum([inv_variables[i]*c for (i,c) in zip(self._objective_i, self._objective_values)])) 
397  399  
398  400  value += "\nConstraints:" 
399   for (c,min,max) in self.constraints(): 
400   value += "\n " + (str(min)+" <= " if min!=None else "")+str(c)+(" <= "+str(max) if max!=None else "") 
 401  for (c,min,max), name in zip(self.constraints(), self._constraints_name): 
 402  value += "\n "+(name+":" if name is not None else "")+" " + (str(min)+" <= " if min!=None else "")+str(c)+(" <= "+str(max) if max!=None else "") 
401  403  value += "\nVariables:" 
402  404  for _,v in sorted([(str(x),x) for x in self._variables.keys()]): 
403  405  