This was a "demonstration problem" - my actual application will involve 
arbitrary-precision reals with lots of constraints.

It appears that PPL not only supports rationals, but insists on them.  It 
seems to set the base_ring to QQ, as the output from the following code is 
"Rational Field", but I can find no way to alter base_ring.  Any 
suggestions on how I might accomplish that?  (For glpk the base_ring is 
"Real Double Field", and I can't find a way to alter that either.)

from sage.numerical.backends.generic_backend import get_solver
p = get_solver(solver = "PPL")
print p.base_ring()


On Thursday, October 23, 2014 5:06:14 PM UTC-4, Volker Braun wrote:
>
> If your problem is over QQ then just use that (PPL supports exact 
> rationals).
>
> On Thursday, October 23, 2014 4:38:39 AM UTC+1, Mike wrote:
>>
>> I'd like to be able to do linear programming to arbitrary precision.  The 
>> documentation that I've found claims that both the glpk  and PPL solvers 
>> should do this, but I haven't been able to get either to work.
>>
>> As an example, the following code prints c to high precision, but the 
>> solutions only to 12 digits.  Where should I look for guidance?
>> Note: this seeks to maximize x+y given that 3x<=1 and 3y<=1, so the 
>> solution is (1/3, 1/3)
>>
>> Mike M
>>
>> R=RealField(100)
>> c=Matrix(R, 2, 1, [-1, -1])
>> G=Matrix(R, 2, 2, [3, 0, 0, 3])
>> h=Matrix(R, 2, 1, [1, 1])
>> print c  # To check the precision being used by "print"
>> print
>>
>> sol=linear_program(c,G,h)
>> print sol['x']
>> sol=linear_program(c,G,h, solver='glpk')
>> print sol['x']
>> sol=linear_program(c,G,h, solver='PPL')
>> print sol['x']
>>
>>

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

Reply via email to