#20602: MixedIntegerLinearProgram.gen() does not do anything useful
-----------------------------+------------------------
       Reporter:  mkoeppe    |        Owner:
           Type:  defect     |       Status:  new
       Priority:  major      |    Milestone:  sage-7.3
      Component:  numerical  |   Resolution:
       Keywords:  lp         |    Merged in:
        Authors:             |    Reviewers:
Report Upstream:  N/A        |  Work issues:
         Branch:             |       Commit:
   Dependencies:             |     Stopgaps:
-----------------------------+------------------------
Description changed by mkoeppe:

Old description:

> As observed in the comments in #20461:
>
> {{{
> sage: mip = MixedIntegerLinearProgram(solver='GLPK')
> sage: mip.gen(0)           ### Names a variable, but does not create it
> in the backend
> x_0
> sage: mip.number_of_variables()
> 0
> sage: mip[0]                  ### This now creates a variable. It prints
> the same as the result of gen(0), but is different.
> x_0
> sage: mip.get_values(mip.gen(0))
> [...]
> TypeError: Not a MIPVariable: x_0
> sage: mip.is_real(mip.gen(0))
> [...]
> KeyError: x_0
> sage: mip.is_real(mip[0])
> True
> }}}

New description:

 As observed in the comments in #20461:

 {{{
 sage: mip = MixedIntegerLinearProgram(solver='GLPK')
 sage: mip.gen(0)           ### Names a variable, but does not create it in
 the backend
 x_0
 sage: mip.number_of_variables()
 0
 sage: mip[0]                  ### This now creates a variable. It prints
 the same as the result of gen(0), but is different.
 x_0
 sage: mip.get_values(mip.gen(0))
 [...]
 TypeError: Not a MIPVariable: x_0
 sage: mip.is_real(mip.gen(0))
 [...]
 KeyError: x_0
 sage: mip.is_real(mip[0])
 True
 }}}

 I think mip.gen(i) should simply return the same variable that mip[i]
 returns (and like mip[i], it should create this variable in the backend if
 it does not exist yet).

--

--
Ticket URL: <http://trac.sagemath.org/ticket/20602#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to