// Consider the following IP in standard form: // // min -2A - 3B - 2C // // udN 7 A + 5 B + 3 C + D = 50 // 2 A + B + 4 C + E = 35 // A + 4 B + 6 C + F = 40 // // Translation to polynomials: ring r = 0, (z1,z2,z3,w1,w2,w3,w4,w5,w6),(dp(3),Ws(2,3,2,0,0,0)); poly f1 = w1 - z1^7 * z2^2 * z3; poly f2 = w2 - z1^5 * z2 * z3^4; poly f3 = w3 - z1^3 * z2^4 * z3^6; poly f4 = w4 - z1; poly f5 = w5 - z2; poly f6 = w6 - z3; ideal I=f1,f2,f3,f4,f5,f6; ideal J=std(I); reduce(z1^50 * z2^35 * z3^40, J); // optimal solution: B=10, E=25 (result: -30) // // Now, let's see what is possible with Singular: LIB "intprog.lib"; // A random IP in standard form // // Ax = b // // with 10 restrictions, 8 variables + 10 slack variables // intmat A[10][18]; int i,j; for (i=1;i<=10;i++) { for (j=1;j<=8;j++) { A[i,j]=random(0,2); A[i,8+i]=-1; } } // The matrix A : A; // Some (positive) right-hand side and cost vector : intvec b=100,100,100,100,100,100,100,100,100,100; intvec c=1,2,3,4,5,6,7,8; c[18]=0; c; // solving by applying the algorithm of Conti/Traverso solve_IP(A,b,c,"ct"); // different right-hand sides: intvec b1=10,10,4,10,5,10,5,10,5,10; intvec b2=10,10,15,10,15,10,20,10,15,10; // solving by applying the algorithm of Conti/Traverso list L=b,b1,b2; solve_IP(A,L,c,"ct");