It is possible to use glpk_vfs to enable glpsol to interwork with an open office spreadsheet. Open office is not required to run the following examples, but obviously if you wish to change them or use your own it is. For convenience the examples are displayed below.
Attached:
KuKu.Sudoku.ods and KuKu.FutoshickiFicki.ods the open office spreadsheets
KuKu_vfs.rb the base class for interworking with the spreadsheets
FutoshickiFicki_vfs.rb and Sudoku_vfs.rb classes which extend KuKu_vfs.rb to understand the content of the spreadsheets
KuKu.mathprog a mathprog model for solving the problems
Example output from running the software follows the pictures. Typically:
glpsol --math KuKu.mathprog --data glpk_vfs/<sheet name>
x |
> |
x |
|
x |
|
x |
|
5 |
|
|
|
|
|
|
|
|
|
x |
|
x |
|
x |
|
x |
|
x |
|
|
|
/ |
V |
|
|
|
|
x |
|
x |
|
3 |
|
x |
|
x |
|
\ |
|
|
|
|
|
|
|
x |
|
x |
< |
x |
|
x |
|
x |
|
\ |
|
|
|
\ |
|
|
|
5 |
|
x |
|
4 |
|
x |
|
1 |
FutoshikiFicki_1
5 |
|
x |
|
x |
|
x |
|
x |
|
|
|
|
|
|
|
|
|
x |
|
4 |
|
x |
|
x |
|
x |
|
/ |
|
/ |
|
|
|
\ |
|
x |
|
x |
|
2 |
|
x |
|
x |
|
|
|
|
|
|
|
\ |
|
x |
|
x |
|
x |
|
3 |
|
1 |
A |
|
|
|
|
|
|
|
|
x |
|
x |
|
x |
|
x |
|
x |
FutoshikiFicki_2
x |
|
x |
> |
x |
|
x |
< |
x |
|
|
|
/ |
|
|
|
|
|
x |
|
x |
|
x |
|
x |
|
2 |
|
|
|
/ |
|
|
|
\ |
A |
x |
|
x |
> |
x |
|
1 |
|
x |
|
|
|
|
|
|
|
|
|
x |
|
3 |
> |
x |
|
x |
|
x |
|
|
|
|
|
|
|
|
|
x |
|
x |
> |
x |
|
x |
|
x |
FutoshikiFicki_3
2 |
x |
x |
x |
4 |
x |
x |
x |
x |
x |
x |
9 |
x |
x |
x |
x |
5 |
7 |
4 |
5 |
x |
6 |
x |
x |
x |
x |
8 |
x |
2 |
7 |
x |
x |
1 |
x |
6 |
x |
1 |
x |
x |
7 |
x |
x |
2 |
x |
x |
x |
x |
x |
x |
3 |
5 |
x |
9 |
x |
7 |
3 |
6 |
x |
x |
x |
x |
x |
x |
x |
x |
2 |
x |
x |
x |
6 |
x |
4 |
9 |
4 |
x |
x |
5 |
x |
x |
x |
x |
Sudoku_1
9 |
7 |
x |
3 |
x |
x |
x |
6 |
x |
x |
6 |
x |
7 |
5 |
x |
x |
x |
x |
x |
x |
x |
x |
x |
8 |
x |
5 |
x |
x |
x |
x |
x |
x |
x |
6 |
7 |
x |
x |
x |
x |
x |
3 |
x |
x |
x |
x |
x |
5 |
3 |
9 |
x |
x |
2 |
x |
x |
7 |
x |
x |
x |
2 |
5 |
x |
x |
x |
x |
x |
2 |
x |
1 |
x |
x |
x |
8 |
x |
4 |
x |
x |
x |
7 |
3 |
x |
x |
Sudoku_2
nigel@nigel-pcu:~/myRuby$ ruby FutoshikiFicki_vfs.rb glpk_vfs/ KuKu.FutoshikiFicki.ods &
[1] 22422
nigel@nigel-pcu:~/myRuby$ ls glpk_vfs/
FutoshikiFicki_1 FutoshikiFicki_2 FutoshikiFicki_3
nigel@nigel-pcu:~/myRuby$ /opt/glpk/bin/glpsol --math KuKu.mathprog --data glpk_vfs/FutoshikiFicki_1
Reading model section from KuKu.mathprog...
52 lines were read
Reading data section from glpk_vfs/FutoshikiFicki_1...
90 lines were read
Generating zumz...
Generating assignCells...
Generating cellsUniqueInBlocks...
Generating equalz...
Model has been successfully generated
glp_simplex: original LP has 91 rows, 125 columns, 490 non-zeros
glp_simplex: presolved LP has 71 rows, 71 columns, 284 non-zeros
lpx_adv_basis: size of triangular part = 71
0: objval = 0.000000000e+00 infeas = 1.000000000e+00 (0)
43: objval = 0.000000000e+00 infeas = 1.092506700e-16 (0)
OPTIMAL SOLUTION FOUND
Integer optimization begins...
+ 43: mip = not found yet >= -inf (1; 0)
+ 105: >>>>> 0.000000000e+00 >= 0.000000000e+00 0.0% (2; 3)
+ 105: mip = 0.000000000e+00 >= tree is empty 0.0% (0; 9)
INTEGER OPTIMAL SOLUTION FOUND
Time used: 0.0 secs
Memory used: 0.4 Mb (385522 bytes)
4 2 1 3 5
2 4 5 1 3
1 5 3 4 2
3 1 2 5 4
5 3 4 2 1
Model has been successfully processed
nigel@nigel-pcu:~/myRuby$ /opt/glpk/bin/glpsol --math KuKu.mathprog --data glpk_vfs/FutoshikiFicki_2
Reading model section from KuKu.mathprog...
52 lines were read
Reading data section from glpk_vfs/FutoshikiFicki_2...
84 lines were read
Generating zumz...
Generating assignCells...
Generating cellsUniqueInBlocks...
Generating equalz...
Model has been successfully generated
glp_simplex: original LP has 89 rows, 125 columns, 470 non-zeros
glp_simplex: presolved LP has 69 rows, 62 columns, 228 non-zeros
lpx_adv_basis: size of triangular part = 69
0: objval = 0.000000000e+00 infeas = 1.000000000e+00 (0)
44: objval = 0.000000000e+00 infeas = 1.823062666e-16 (0)
OPTIMAL SOLUTION FOUND
Integer optimization begins...
+ 44: mip = not found yet >= -inf (1; 0)
+ 44: >>>>> 0.000000000e+00 >= 0.000000000e+00 0.0% (1; 0)
+ 44: mip = 0.000000000e+00 >= tree is empty 0.0% (0; 1)
INTEGER OPTIMAL SOLUTION FOUND
Time used: 0.0 secs
Memory used: 0.3 Mb (366322 bytes)
5 2 1 4 3
1 4 3 5 2
4 3 2 1 5
2 5 4 3 1
3 1 5 2 4
Model has been successfully processed
nigel@nigel-pcu:~/myRuby$ /opt/glpk/bin/glpsol --math KuKu.mathprog --data glpk_vfs/FutoshikiFicki_3
Reading model section from KuKu.mathprog...
52 lines were read
Reading data section from glpk_vfs/FutoshikiFicki_3...
89 lines were read
Generating zumz...
Generating assignCells...
Generating cellsUniqueInBlocks...
Generating equalz...
Model has been successfully generated
glp_simplex: original LP has 90 rows, 125 columns, 498 non-zeros
glp_simplex: presolved LP has 78 rows, 86 columns, 340 non-zeros
lpx_adv_basis: size of triangular part = 78
0: objval = 0.000000000e+00 infeas = 1.000000000e+00 (0)
56: objval = 0.000000000e+00 infeas = 4.294151555e-16 (0)
OPTIMAL SOLUTION FOUND
Integer optimization begins...
+ 56: mip = not found yet >= -inf (1; 0)
+ 176: >>>>> 0.000000000e+00 >= 0.000000000e+00 0.0% (5; 2)
+ 176: mip = 0.000000000e+00 >= tree is empty 0.0% (0; 13)
INTEGER OPTIMAL SOLUTION FOUND
Time used: 0.0 secs
Memory used: 0.4 Mb (383258 bytes)
3 2 1 4 5
4 1 5 3 2
2 5 4 1 3
1 3 2 5 4
5 4 3 2 1
Model has been successfully processed
nigel@nigel-pcu:~/myRuby$
nigel@nigel-pcu:~/myRuby$ ruby Sudoku_vfs.rb glpk_vfs/ KuKu.Sudoku.ods &
[1] 29801
nigel@nigel-pcu:~/myRuby$ ls glpk_vfs/
Sudoku_1 Sudoku_2
nigel@nigel-pcu:~/myRuby$ /opt/glpk/bin/glpsol --math KuKu.mathprog --data glpk_vfs/Sudoku_1
Reading model section from KuKu.mathprog...
52 lines were read
Reading data section from glpk_vfs/Sudoku_1...
139 lines were read
Generating zumz...
Generating assignCells...
Generating cellsUniqueInBlocks...
Generating equalz...
Model has been successfully generated
glp_simplex: original LP has 352 rows, 729 columns, 2944 non-zeros
glp_simplex: presolved LP has 185 rows, 168 columns, 652 non-zeros
lpx_adv_basis: size of triangular part = 185
0: objval = 0.000000000e+00 infeas = 1.000000000e+00 (0)
90: objval = 0.000000000e+00 infeas = 0.000000000e+00 (0)
OPTIMAL SOLUTION FOUND
Integer optimization begins...
+ 90: mip = not found yet >= -inf (1; 0)
+ 90: >>>>> 0.000000000e+00 >= 0.000000000e+00 0.0% (1; 0)
+ 90: mip = 0.000000000e+00 >= tree is empty 0.0% (0; 1)
INTEGER OPTIMAL SOLUTION FOUND
Time used: 0.0 secs
Memory used: 1.2 Mb (1267922 bytes)
2 7 8 5 4 9 1 3 6
6 1 9 3 8 2 4 5 7
4 5 3 6 1 7 9 2 8
3 2 7 4 9 1 8 6 5
1 9 5 7 6 8 2 4 3
8 6 4 2 3 5 7 9 1
7 3 6 1 2 4 5 8 9
5 8 2 9 7 3 6 1 4
9 4 1 8 5 6 3 7 2
Model has been successfully processed
nigel@nigel-pcu:~/myRuby$ /opt/glpk/bin/glpsol --math KuKu.mathprog --data glpk_vfs/Sudoku_2
Reading model section from KuKu.mathprog...
52 lines were read
Reading data section from glpk_vfs/Sudoku_2...
/133 lines were read
Generating zumz...
Generating assignCells...
Generating cellsUniqueInBlocks...
Generating equalz...
Model has been successfully generated
glp_simplex: original LP has 349 rows, 729 columns, 2941 non-zeros
glp_simplex: presolved LP has 198 rows, 188 columns, 740 non-zeros
lpx_adv_basis: size of triangular part = 198
0: objval = 0.000000000e+00 infeas = 1.000000000e+00 (0)
130: objval = 0.000000000e+00 infeas = 0.000000000e+00 (0)
OPTIMAL SOLUTION FOUND
Integer optimization begins...
+ 130: mip = not found yet >= -inf (1; 0)
+ 130: >>>>> 0.000000000e+00 >= 0.000000000e+00 0.0% (1; 0)
+ 130: mip = 0.000000000e+00 >= tree is empty 0.0% (0; 1)
INTEGER OPTIMAL SOLUTION FOUND
Time used: 0.0 secs
Memory used: 1.2 Mb (1276294 bytes)
9 7 5 3 4 2 8 6 1
8 6 1 7 5 9 4 3 2
3 2 4 1 6 8 9 5 7
2 1 9 5 8 4 6 7 3
4 8 7 2 3 6 5 1 9
6 5 3 9 7 1 2 8 4
7 3 8 4 2 5 1 9 6
5 9 2 6 1 3 7 4 8
1 4 6 8 9 7 3 2 5
Model has been successfully processed
nigel@nigel-pcu:~/myRuby$