On Wednesday 08 October 2008, Marshall Hampton wrote:
> Martin - is that already accessible in sage or would some sort of
> wrapper have to be written?

Here are the Singular examples done with Sage:

sage: singular.LIB("intprog.lib")

1. call with single right-hand vector

sage: A = matrix(ZZ, 2, 3, [1,1,0,0,1,1])
sage: b1 = vector(ZZ,[1,1])
sage: c = vector(ZZ,[2,2,1])
sage: singular.eval('intmat A[2][3]=%s'%str(A.list())[1:-1]) # todo make this 
nicer
sage: A = singular("A")
sage: b1 = singular(str(b1.list())[1:-1],'intvec'); # todo make this nicer
sage: c = singular(str(c.list())[1:-1],'intvec'); # todo make this nicer
sage: print singular.solve_IP(A,b1,c,'"pct"')
0,
1,
0 

2. call with list of right-hand vectors

sage: b2 = vector(ZZ,[-1,1])
sage: b2 = singular(str(b2.list())[1:-1],'intvec'); # todo make this nicer
sage: #l = singular.list([b1,2])  # bug in singular.list function
sage: l = singular("%s,%s"%(b1.name(),b2.name()),"list")
sage: print singular.solve_IP(A,l,c,'"ct"')
[1]:
   0,1,0
[2]:
   not solvable

3. call with single initial solution vector

sage: singular.eval('intmat A[2][3]=2,1,-1,-1,1,2') # todo make this nicer
sage: A = singular("A")
sage: b1 = singular("3,4,5",'intvec'); # todo make this nicer
sage: singular.solve_IP(A,b1,c,'"du"')
0,
7,
2 

4. call with single initial solution vector and algorithm needing a positive 
row space vector

sage: singular.solve_IP(A,b1,c,'"hs"')
0 

5. call with single initial solution vector and positive row space vector

sage: prsv = singular('1,2,1','intvec')
sage: singular.solve_IP(A,b1,c,'"hs"',prsv);
0,
7,
2 

6. call with list of initial solution vectors and positive row space vector

sage: b2 =  singular('7,8,0','intvec')
sage: l = singular("%s,%s"%(b1.name(),b2.name()),"list")
sage: singular.solve_IP(A,l,c,'"blr"',prsv);
[1]:
   0,7,2
[2]:
   7,8,0


-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: [EMAIL PROTECTED]


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to