--- Begin Message ---
Subject: |
[Help-glpk] C#, GLPK, and The Fundamental Theorem of Arithmetic. |
Date: |
Mon, 18 Feb 2008 17:10:41 +0100 |
The attached C# program uses GLPK to find the least positve linear combination
of any 2 positive integers, see below for an example output using 2424 and 772.
If you want an example of using C# with GLPK you may add this to GLPK's
examples. C# was developed, in part, to make interworking with legacy non-C#
code as simple as possible. This means no other interface or binding code is
required.
Only:
const string glpkLibrary = "libglpk.so"
should be modified as appropriate.
bash-2.05b$ mono t1.bin 2424 772
a = 2424, b = 772
Hello Nigel
Trying 772
0: objval = 0.000000000e+00 infeas = 1.000000000e+00 (0)
1: objval = 0.000000000e+00 infeas = 0.000000000e+00 (0)
OPTIMAL SOLUTION FOUND
Integer optimization begins...
+ 1: mip = not found yet >= -inf (1; 0)
+ 3: >>>>> 0.000000000e+00 >= 0.000000000e+00 0.0% (3; 0)
+ 3: mip = 0.000000000e+00 >= tree is empty 0.0% (0; 5)
INTEGER OPTIMAL SOLUTION FOUND
x = 1, y = -3, a*x + b*y = 108
Trying 108
! 3: objval = 0.000000000e+00 infeas = 0.000000000e+00
OPTIMAL SOLUTION FOUND
Integer optimization begins...
+ 3: mip = not found yet >= -inf (1; 0)
+ 7: >>>>> 0.000000000e+00 >= 0.000000000e+00 0.0% (4; 1)
+ 7: mip = 0.000000000e+00 >= tree is empty 0.0% (0; 9)
INTEGER OPTIMAL SOLUTION FOUND
x = -7, y = 22, a*x + b*y = 16
Trying 16
! 7: objval = 0.000000000e+00 infeas = 0.000000000e+00
OPTIMAL SOLUTION FOUND
Integer optimization begins...
+ 7: mip = not found yet >= -inf (1; 0)
+ 21: >>>>> 0.000000000e+00 >= 0.000000000e+00 0.0% (5; 10)
+ 21: mip = 0.000000000e+00 >= tree is empty 0.0% (0; 29)
INTEGER OPTIMAL SOLUTION FOUND
x = -50, y = 157, a*x + b*y = 4
Trying 4
Solution is 4
Goodbye Nigel
bash-2.05b$
--
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 9 at http://www.opera.com
Powered by Outblaze
t1.cs
Description: Binary data
_______________________________________________
Help-glpk mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-glpk
--- End Message ---