Package: cvxopt / 1.1.4-1.5+deb9u1

glpk-4.49.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
Description: Workaround for GLPK >= 4.49
 GLPK 4.49 removed the deprecated API functions. Cvxopt still uses them, so this
 patch adds compatibility routines that were provided by the upstream author of
 GLPK.
Author: Sébastien Villemot <sebastien@debian.org>
Author: Jean-Michel Nirgal Vourgère <jmv_deb@nirgal.com>
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=714368
Forwarded: not-needed
Last-Update: 2015-03-11
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: cvxopt-1.1.4/src/C/glpk.c
===================================================================
--- cvxopt-1.1.4.orig/src/C/glpk.c
+++ cvxopt-1.1.4/src/C/glpk.c
@@ -20,7 +20,7 @@
 
 #include "cvxopt.h"
 #include "misc.h"
-#include "glpk.h"
+#include "lpx.h"
 
 PyDoc_STRVAR(glpk__doc__,
     "Interface to the simplex and mixed integer LP algorithms in GLPK.\n\n"
Index: cvxopt-1.1.4/src/C/lpx.c
===================================================================
--- /dev/null
+++ cvxopt-1.1.4/src/C/lpx.c
@@ -0,0 +1,1511 @@
+/* lpx.c (old GLPK API) */
+
+/* Written by Andrew Makhorin <mao@gnu.org>, August 2013. */
+
+/* This file contains routines that implement the old GLPK API as it
+*  was defined in GLPK 4.48.
+*
+*  To compile an existing project using these routines you need to add
+*  to the project this file and the header lpx.h.
+*
+*  Please note that you may mix calls to old and new GLPK API routines
+*  (except calls to glp_create_prob and glp_delete_prob). */
+
+#include <float.h>
+#include <limits.h>
+#include "lpx.h"
+
+#if (GLP_MAJOR_VERSION == 4 && GLP_MINOR_VERSION >= 49) || GLP_MAJOR_VERSION > 4
+
+#define xassert glp_assert
+#define xerror  glp_error
+
+struct CPS
+{     /* control parameters */
+      LPX *lp;
+      /* pointer to corresponding problem object */
+      int msg_lev;
+      /* level of messages output by the solver:
+         0 - no output
+         1 - error messages only
+         2 - normal output
+         3 - full output (includes informational messages) */
+      int scale;
+      /* scaling option:
+         0 - no scaling
+         1 - equilibration scaling
+         2 - geometric mean scaling
+         3 - geometric mean scaling, then equilibration scaling */
+      int dual;
+      /* dual simplex option:
+         0 - use primal simplex
+         1 - use dual simplex */
+      int price;
+      /* pricing option (for both primal and dual simplex):
+         0 - textbook pricing
+         1 - steepest edge pricing */
+      double relax;
+      /* relaxation parameter used in the ratio test; if it is zero,
+         the textbook ratio test is used; if it is non-zero (should be
+         positive), Harris' two-pass ratio test is used; in the latter
+         case on the first pass basic variables (in the case of primal
+         simplex) or reduced costs of non-basic variables (in the case
+         of dual simplex) are allowed to slightly violate their bounds,
+         but not more than (relax * tol_bnd) or (relax * tol_dj) (thus,
+         relax is a percentage of tol_bnd or tol_dj) */
+      double tol_bnd;
+      /* relative tolerance used to check if the current basic solution
+         is primal feasible */
+      double tol_dj;
+      /* absolute tolerance used to check if the current basic solution
+         is dual feasible */
+      double tol_piv;
+      /* relative tolerance used to choose eligible pivotal elements of
+         the simplex table in the ratio test */
+      int round;
+      /* solution rounding option:
+         0 - report all computed values and reduced costs "as is"
+         1 - if possible (allowed by the tolerances), replace computed
+             values and reduced costs which are close to zero by exact
+             zeros */
+      double obj_ll;
+      /* lower limit of the objective function; if on the phase II the
+         objective function reaches this limit and continues decreasing,
+         the solver stops the search */
+      double obj_ul;
+      /* upper limit of the objective function; if on the phase II the
+         objective function reaches this limit and continues increasing,
+         the solver stops the search */
+      int it_lim;
+      /* simplex iterations limit; if this value is positive, it is
+         decreased by one each time when one simplex iteration has been
+         performed, and reaching zero value signals the solver to stop
+         the search; negative value means no iterations limit */
+      double tm_lim;
+      /* searching time limit, in seconds; if this value is positive,
+         it is decreased each time when one simplex iteration has been
+         performed by the amount of time spent for the iteration, and
+         reaching zero value signals the solver to stop the search;
+         negative value means no time limit */
+      int out_frq;
+      /* output frequency, in iterations; this parameter specifies how
+         frequently the solver sends information about the solution to
+         the standard output */
+      double out_dly;
+      /* output delay, in seconds; this parameter specifies how long
+         the solver should delay sending information about the solution
+         to the standard output; zero value means no delay */
+      int branch; /* MIP */
+      /* branching heuristic:
+         0 - branch on first variable
+         1 - branch on last variable
+         2 - branch using heuristic by Driebeck and Tomlin
+         3 - branch on most fractional variable */
+      int btrack; /* MIP */
+      /* backtracking heuristic:
+         0 - select most recent node (depth first search)
+         1 - select earliest node (breadth first search)
+         2 - select node using the best projection heuristic
+         3 - select node with best local bound */
+      double tol_int; /* MIP */
+      /* absolute tolerance used to check if the current basic solution
+         is integer feasible */
+      double tol_obj; /* MIP */
+      /* relative tolerance used to check if the value of the objective
+         function is not better than in the best known integer feasible
+         solution */
+      int mps_info; /* lpx_write_mps */
+      /* if this flag is set, the routine lpx_write_mps outputs several
+         comment cards that contains some information about the problem;
+         otherwise the routine outputs no comment cards */
+      int mps_obj; /* lpx_write_mps */
+      /* this parameter tells the routine lpx_write_mps how to output
+         the objective function row:
+         0 - never output objective function row
+         1 - always output objective function row
+         2 - output objective function row if and only if the problem
+             has no free rows */
+      int mps_orig; /* lpx_write_mps */
+      /* if this flag is set, the routine lpx_write_mps uses original
+         row and column symbolic names; otherwise the routine generates
+         plain names using ordinal numbers of rows and columns */
+      int mps_wide; /* lpx_write_mps */
+      /* if this flag is set, the routine lpx_write_mps uses all data
+         fields; otherwise the routine keeps fields 5 and 6 empty */
+      int mps_free; /* lpx_write_mps */
+      /* if this flag is set, the routine lpx_write_mps omits column
+         and vector names everytime if possible (free style); otherwise
+         the routine never omits these names (pedantic style) */
+      int mps_skip; /* lpx_write_mps */
+      /* if this flag is set, the routine lpx_write_mps skips empty
+         columns (i.e. which has no constraint coefficients); otherwise
+         the routine outputs all columns */
+      int lpt_orig; /* lpx_write_lpt */
+      /* if this flag is set, the routine lpx_write_lpt uses original
+         row and column symbolic names; otherwise the routine generates
+         plain names using ordinal numbers of rows and columns */
+      int presol; /* lpx_simplex */
+      /* LP presolver option:
+         0 - do not use LP presolver
+         1 - use LP presolver */
+      int binarize; /* lpx_intopt */
+      /* if this flag is set, the routine lpx_intopt replaces integer
+         columns by binary ones */
+      int use_cuts; /* lpx_intopt */
+      /* if this flag is set, the routine lpx_intopt tries generating
+         cutting planes:
+         LPX_C_COVER  - mixed cover cuts
+         LPX_C_CLIQUE - clique cuts
+         LPX_C_GOMORY - Gomory's mixed integer cuts
+         LPX_C_ALL    - all cuts */
+      double mip_gap; /* MIP */
+      /* relative MIP gap tolerance */
+      struct CPS *link;
+      /* pointer to CPS for another problem object */
+};
+
+static struct CPS *cps_ptr = NULL;
+/* initial pointer to CPS linked list */
+
+static struct CPS *find_cps(LPX *lp)
+{     /* find CPS for specified problem object */
+      struct CPS *cps;
+      for (cps = cps_ptr; cps != NULL; cps = cps->link)
+         if (cps->lp == lp) break;
+      /* if cps is NULL (not found), the problem object was created
+         with glp_create_prob rather than with lpx_create_prob */
+      xassert(cps != NULL);
+      return cps;
+}
+
+static void reset_cps(struct CPS *cps)
+{     /* reset control parameters to default values */
+      cps->msg_lev  = 3;
+      cps->scale    = 1;
+      cps->dual     = 0;
+      cps->price    = 1;
+      cps->relax    = 0.07;
+      cps->tol_bnd  = 1e-7;
+      cps->tol_dj   = 1e-7;
+      cps->tol_piv  = 1e-9;
+      cps->round    = 0;
+      cps->obj_ll   = -DBL_MAX;
+      cps->obj_ul   = +DBL_MAX;
+      cps->it_lim   = -1;
+      cps->tm_lim   = -1.0;
+      cps->out_frq  = 200;
+      cps->out_dly  = 0.0;
+      cps->branch   = 2;
+      cps->btrack   = 3;
+      cps->tol_int  = 1e-5;
+      cps->tol_obj  = 1e-7;
+      cps->mps_info = 1;
+      cps->mps_obj  = 2;
+      cps->mps_orig = 0;
+      cps->mps_wide = 1;
+      cps->mps_free = 0;
+      cps->mps_skip = 0;
+      cps->lpt_orig = 0;
+      cps->presol   = 0;
+      cps->binarize = 0;
+      cps->use_cuts = 0;
+      cps->mip_gap  = 0.0;
+      return;
+}
+
+LPX *lpx_create_prob(void)
+{     /* create problem object */
+      LPX *lp;
+      struct CPS *cps;
+      lp = glp_create_prob();
+      cps = glp_alloc(1, sizeof(struct CPS));
+      cps->lp = lp;
+      reset_cps(cps);
+      cps->link = cps_ptr;
+      cps_ptr = cps;
+      return lp;
+}
+
+void lpx_set_prob_name(LPX *lp, const char *name)
+{     /* assign (change) problem name */
+      glp_set_prob_name(lp, name);
+      return;
+}
+
+void lpx_set_obj_name(LPX *lp, const char *name)
+{     /* assign (change) objective function name */
+      glp_set_obj_name(lp, name);
+      return;
+}
+
+void lpx_set_obj_dir(LPX *lp, int dir)
+{     /* set (change) optimization direction flag */
+      glp_set_obj_dir(lp, dir - LPX_MIN + GLP_MIN);
+      return;
+}
+
+int lpx_add_rows(LPX *lp, int nrs)
+{     /* add new rows to problem object */
+      return glp_add_rows(lp, nrs);
+}
+
+int lpx_add_cols(LPX *lp, int ncs)
+{     /* add new columns to problem object */
+      return glp_add_cols(lp, ncs);
+}
+
+void lpx_set_row_name(LPX *lp, int i, const char *name)
+{     /* assign (change) row name */
+      glp_set_row_name(lp, i, name);
+      return;
+}
+
+void lpx_set_col_name(LPX *lp, int j, const char *name)
+{     /* assign (change) column name */
+      glp_set_col_name(lp, j, name);
+      return;
+}
+
+void lpx_set_row_bnds(LPX *lp, int i, int type, double lb, double ub)
+{     /* set (change) row bounds */
+      glp_set_row_bnds(lp, i, type - LPX_FR + GLP_FR, lb, ub);
+      return;
+}
+
+void lpx_set_col_bnds(LPX *lp, int j, int type, double lb, double ub)
+{     /* set (change) column bounds */
+      glp_set_col_bnds(lp, j, type - LPX_FR + GLP_FR, lb, ub);
+      return;
+}
+
+void lpx_set_obj_coef(glp_prob *lp, int j, double coef)
+{     /* set (change) obj. coefficient or constant term */
+      glp_set_obj_coef(lp, j, coef);
+      return;
+}
+
+void lpx_set_mat_row(LPX *lp, int i, int len, const int ind[],
+      const double val[])
+{     /* set (replace) row of the constraint matrix */
+      glp_set_mat_row(lp, i, len, ind, val);
+      return;
+}
+
+void lpx_set_mat_col(LPX *lp, int j, int len, const int ind[],
+      const double val[])
+{     /* set (replace) column of the constraint matrix */
+      glp_set_mat_col(lp, j, len, ind, val);
+      return;
+}
+
+void lpx_load_matrix(LPX *lp, int ne, const int ia[], const int ja[],
+      const double ar[])
+{     /* load (replace) the whole constraint matrix */
+      glp_load_matrix(lp, ne, ia, ja, ar);
+      return;
+}
+
+void lpx_del_rows(LPX *lp, int nrs, const int num[])
+{     /* delete specified rows from problem object */
+      glp_del_rows(lp, nrs, num);
+      return;
+}
+
+void lpx_del_cols(LPX *lp, int ncs, const int num[])
+{     /* delete specified columns from problem object */
+      glp_del_cols(lp, ncs, num);
+      return;
+}
+
+void lpx_delete_prob(LPX *lp)
+{     /* delete problem object */
+      struct CPS *cps = find_cps(lp);
+      if (cps_ptr == cps)
+         cps_ptr = cps->link;
+      else
+      {  struct CPS *prev;
+         for (prev = cps_ptr; prev != NULL; prev = prev->link)
+            if (prev->link == cps) break;
+         xassert(prev != NULL);
+         prev->link = cps->link;
+      }
+      glp_free(cps);
+      glp_delete_prob(lp);
+      return;
+}
+
+const char *lpx_get_prob_name(LPX *lp)
+{     /* retrieve problem name */
+      return glp_get_prob_name(lp);
+}
+
+const char *lpx_get_obj_name(LPX *lp)
+{     /* retrieve objective function name */
+      return glp_get_obj_name(lp);
+}
+
+int lpx_get_obj_dir(LPX *lp)
+{     /* retrieve optimization direction flag */
+      return glp_get_obj_dir(lp) - GLP_MIN + LPX_MIN;
+}
+
+int lpx_get_num_rows(LPX *lp)
+{     /* retrieve number of rows */
+      return glp_get_num_rows(lp);
+}
+
+int lpx_get_num_cols(LPX *lp)
+{     /* retrieve number of columns */
+      return glp_get_num_cols(lp);
+}
+
+const char *lpx_get_row_name(LPX *lp, int i)
+{     /* retrieve row name */
+      return glp_get_row_name(lp, i);
+}
+
+const char *lpx_get_col_name(LPX *lp, int j)
+{     /* retrieve column name */
+      return glp_get_col_name(lp, j);
+}
+
+int lpx_get_row_type(LPX *lp, int i)
+{     /* retrieve row type */
+      return glp_get_row_type(lp, i) - GLP_FR + LPX_FR;
+}
+
+double lpx_get_row_lb(glp_prob *lp, int i)
+{     /* retrieve row lower bound */
+      double lb;
+      lb = glp_get_row_lb(lp, i);
+      if (lb == -DBL_MAX) lb = 0.0;
+      return lb;
+}
+
+double lpx_get_row_ub(glp_prob *lp, int i)
+{     /* retrieve row upper bound */
+      double ub;
+      ub = glp_get_row_ub(lp, i);
+      if (ub == +DBL_MAX) ub = 0.0;
+      return ub;
+}
+
+void lpx_get_row_bnds(glp_prob *lp, int i, int *typx, double *lb,
+      double *ub)
+{     /* retrieve row bounds */
+      if (typx != NULL) *typx = lpx_get_row_type(lp, i);
+      if (lb != NULL) *lb = lpx_get_row_lb(lp, i);
+      if (ub != NULL) *ub = lpx_get_row_ub(lp, i);
+      return;
+}
+
+int lpx_get_col_type(LPX *lp, int j)
+{     /* retrieve column type */
+      return glp_get_col_type(lp, j) - GLP_FR + LPX_FR;
+}
+
+double lpx_get_col_lb(glp_prob *lp, int j)
+{     /* retrieve column lower bound */
+      double lb;
+      lb = glp_get_col_lb(lp, j);
+      if (lb == -DBL_MAX) lb = 0.0;
+      return lb;
+}
+
+double lpx_get_col_ub(glp_prob *lp, int j)
+{     /* retrieve column upper bound */
+      double ub;
+      ub = glp_get_col_ub(lp, j);
+      if (ub == +DBL_MAX) ub = 0.0;
+      return ub;
+}
+
+void lpx_get_col_bnds(glp_prob *lp, int j, int *typx, double *lb,
+      double *ub)
+{     /* retrieve column bounds */
+      if (typx != NULL) *typx = lpx_get_col_type(lp, j);
+      if (lb != NULL) *lb = lpx_get_col_lb(lp, j);
+      if (ub != NULL) *ub = lpx_get_col_ub(lp, j);
+      return;
+}
+
+double lpx_get_obj_coef(LPX *lp, int j)
+{     /* retrieve obj. coefficient or constant term */
+      return glp_get_obj_coef(lp, j);
+}
+
+int lpx_get_num_nz(LPX *lp)
+{     /* retrieve number of constraint coefficients */
+      return glp_get_num_nz(lp);
+}
+
+int lpx_get_mat_row(LPX *lp, int i, int ind[], double val[])
+{     /* retrieve row of the constraint matrix */
+      return glp_get_mat_row(lp, i, ind, val);
+}
+
+int lpx_get_mat_col(LPX *lp, int j, int ind[], double val[])
+{     /* retrieve column of the constraint matrix */
+      return glp_get_mat_col(lp, j, ind, val);
+}
+
+void lpx_create_index(LPX *lp)
+{     /* create the name index */
+      glp_create_index(lp);
+      return;
+}
+
+int lpx_find_row(LPX *lp, const char *name)
+{     /* find row by its name */
+      return glp_find_row(lp, name);
+}
+
+int lpx_find_col(LPX *lp, const char *name)
+{     /* find column by its name */
+      return glp_find_col(lp, name);
+}
+
+void lpx_delete_index(LPX *lp)
+{     /* delete the name index */
+      glp_delete_index(lp);
+      return;
+}
+
+void lpx_scale_prob(LPX *lp)
+{     /* scale problem data */
+      switch (lpx_get_int_parm(lp, LPX_K_SCALE))
+      {  case 0:
+            /* no scaling */
+            glp_unscale_prob(lp);
+            break;
+         case 1:
+            /* equilibration scaling */
+            glp_scale_prob(lp, GLP_SF_EQ);
+            break;
+         case 2:
+            /* geometric mean scaling */
+            glp_scale_prob(lp, GLP_SF_GM);
+            break;
+         case 3:
+            /* geometric mean scaling, then equilibration scaling */
+            glp_scale_prob(lp, GLP_SF_GM | GLP_SF_EQ);
+            break;
+         default:
+            xassert(lp != lp);
+      }
+      return;
+}
+
+void lpx_unscale_prob(LPX *lp)
+{     /* unscale problem data */
+      glp_unscale_prob(lp);
+      return;
+}
+
+void lpx_set_row_stat(LPX *lp, int i, int stat)
+{     /* set (change) row status */
+      glp_set_row_stat(lp, i, stat - LPX_BS + GLP_BS);
+      return;
+}
+
+void lpx_set_col_stat(LPX *lp, int j, int stat)
+{     /* set (change) column status */
+      glp_set_col_stat(lp, j, stat - LPX_BS + GLP_BS);
+      return;
+}
+
+void lpx_std_basis(LPX *lp)
+{     /* construct standard initial LP basis */
+      glp_std_basis(lp);
+      return;
+}
+
+void lpx_adv_basis(LPX *lp)
+{     /* construct advanced initial LP basis */
+      glp_adv_basis(lp, 0);
+      return;
+}
+
+void lpx_cpx_basis(LPX *lp)
+{     /* construct Bixby's initial LP basis */
+      glp_cpx_basis(lp);
+      return;
+}
+
+static void fill_smcp(LPX *lp, glp_smcp *parm)
+{     glp_init_smcp(parm);
+      switch (lpx_get_int_parm(lp, LPX_K_MSGLEV))
+      {  case 0:  parm->msg_lev = GLP_MSG_OFF;   break;
+         case 1:  parm->msg_lev = GLP_MSG_ERR;   break;
+         case 2:  parm->msg_lev = GLP_MSG_ON;    break;
+         case 3:  parm->msg_lev = GLP_MSG_ALL;   break;
+         default: xassert(lp != lp);
+      }
+      switch (lpx_get_int_parm(lp, LPX_K_DUAL))
+      {  case 0:  parm->meth = GLP_PRIMAL;       break;
+         case 1:  parm->meth = GLP_DUAL;         break;
+         default: xassert(lp != lp);
+      }
+      switch (lpx_get_int_parm(lp, LPX_K_PRICE))
+      {  case 0:  parm->pricing = GLP_PT_STD;    break;
+         case 1:  parm->pricing = GLP_PT_PSE;    break;
+         default: xassert(lp != lp);
+      }
+      if (lpx_get_real_parm(lp, LPX_K_RELAX) == 0.0)
+         parm->r_test = GLP_RT_STD;
+      else
+         parm->r_test = GLP_RT_HAR;
+      parm->tol_bnd = lpx_get_real_parm(lp, LPX_K_TOLBND);
+      parm->tol_dj  = lpx_get_real_parm(lp, LPX_K_TOLDJ);
+      parm->tol_piv = lpx_get_real_parm(lp, LPX_K_TOLPIV);
+      parm->obj_ll  = lpx_get_real_parm(lp, LPX_K_OBJLL);
+      parm->obj_ul  = lpx_get_real_parm(lp, LPX_K_OBJUL);
+      if (lpx_get_int_parm(lp, LPX_K_ITLIM) < 0)
+         parm->it_lim = INT_MAX;
+      else
+         parm->it_lim = lpx_get_int_parm(lp, LPX_K_ITLIM);
+      if (lpx_get_real_parm(lp, LPX_K_TMLIM) < 0.0)
+         parm->tm_lim = INT_MAX;
+      else
+         parm->tm_lim =
+            (int)(1000.0 * lpx_get_real_parm(lp, LPX_K_TMLIM));
+      parm->out_frq = lpx_get_int_parm(lp, LPX_K_OUTFRQ);
+      parm->out_dly =
+            (int)(1000.0 * lpx_get_real_parm(lp, LPX_K_OUTDLY));
+      switch (lpx_get_int_parm(lp, LPX_K_PRESOL))
+      {  case 0:  parm->presolve = GLP_OFF;      break;
+         case 1:  parm->presolve = GLP_ON;       break;
+         default: xassert(lp != lp);
+      }
+      return;
+}
+
+int lpx_simplex(LPX *lp)
+{     /* easy-to-use driver to the simplex method */
+      glp_smcp parm;
+      int ret;
+      fill_smcp(lp, &parm);
+      ret = glp_simplex(lp, &parm);
+      switch (ret)
+      {  case 0:           ret = LPX_E_OK;      break;
+         case GLP_EBADB:
+         case GLP_ESING:
+         case GLP_ECOND:
+         case GLP_EBOUND:  ret = LPX_E_FAULT;   break;
+         case GLP_EFAIL:   ret = LPX_E_SING;    break;
+         case GLP_EOBJLL:  ret = LPX_E_OBJLL;   break;
+         case GLP_EOBJUL:  ret = LPX_E_OBJUL;   break;
+         case GLP_EITLIM:  ret = LPX_E_ITLIM;   break;
+         case GLP_ETMLIM:  ret = LPX_E_TMLIM;   break;
+         case GLP_ENOPFS:  ret = LPX_E_NOPFS;   break;
+         case GLP_ENODFS:  ret = LPX_E_NODFS;   break;
+         default:          xassert(ret != ret);
+      }
+      return ret;
+}
+
+int lpx_exact(LPX *lp)
+{     /* easy-to-use driver to the exact simplex method */
+      glp_smcp parm;
+      int ret;
+      fill_smcp(lp, &parm);
+      ret = glp_exact(lp, &parm);
+      switch (ret)
+      {  case 0:           ret = LPX_E_OK;      break;
+         case GLP_EBADB:
+         case GLP_ESING:
+         case GLP_EBOUND:
+         case GLP_EFAIL:   ret = LPX_E_FAULT;   break;
+         case GLP_EITLIM:  ret = LPX_E_ITLIM;   break;
+         case GLP_ETMLIM:  ret = LPX_E_TMLIM;   break;
+         default:          xassert(ret != ret);
+      }
+      return ret;
+}
+
+int lpx_get_status(glp_prob *lp)
+{     /* retrieve generic status of basic solution */
+      int status;
+      switch (glp_get_status(lp))
+      {  case GLP_OPT:    status = LPX_OPT;    break;
+         case GLP_FEAS:   status = LPX_FEAS;   break;
+         case GLP_INFEAS: status = LPX_INFEAS; break;
+         case GLP_NOFEAS: status = LPX_NOFEAS; break;
+         case GLP_UNBND:  status = LPX_UNBND;  break;
+         case GLP_UNDEF:  status = LPX_UNDEF;  break;
+         default:         xassert(lp != lp);
+      }
+      return status;
+}
+
+int lpx_get_prim_stat(glp_prob *lp)
+{     /* retrieve status of primal basic solution */
+      return glp_get_prim_stat(lp) - GLP_UNDEF + LPX_P_UNDEF;
+}
+
+int lpx_get_dual_stat(glp_prob *lp)
+{     /* retrieve status of dual basic solution */
+      return glp_get_dual_stat(lp) - GLP_UNDEF + LPX_D_UNDEF;
+}
+
+double lpx_get_obj_val(LPX *lp)
+{     /* retrieve objective value (basic solution) */
+      return glp_get_obj_val(lp);
+}
+
+int lpx_get_row_stat(LPX *lp, int i)
+{     /* retrieve row status (basic solution) */
+      return glp_get_row_stat(lp, i) - GLP_BS + LPX_BS;
+}
+
+double lpx_get_row_prim(LPX *lp, int i)
+{     /* retrieve row primal value (basic solution) */
+      return glp_get_row_prim(lp, i);
+}
+
+double lpx_get_row_dual(LPX *lp, int i)
+{     /* retrieve row dual value (basic solution) */
+      return glp_get_row_dual(lp, i);
+}
+
+void lpx_get_row_info(glp_prob *lp, int i, int *tagx, double *vx,
+      double *dx)
+{     /* obtain row solution information */
+      if (tagx != NULL) *tagx = lpx_get_row_stat(lp, i);
+      if (vx != NULL) *vx = lpx_get_row_prim(lp, i);
+      if (dx != NULL) *dx = lpx_get_row_dual(lp, i);
+      return;
+}
+
+int lpx_get_col_stat(LPX *lp, int j)
+{     /* retrieve column status (basic solution) */
+      return glp_get_col_stat(lp, j) - GLP_BS + LPX_BS;
+}
+
+double lpx_get_col_prim(LPX *lp, int j)
+{     /* retrieve column primal value (basic solution) */
+      return glp_get_col_prim(lp, j);
+}
+
+double lpx_get_col_dual(glp_prob *lp, int j)
+{     /* retrieve column dual value (basic solution) */
+      return glp_get_col_dual(lp, j);
+}
+
+void lpx_get_col_info(glp_prob *lp, int j, int *tagx, double *vx,
+      double *dx)
+{     /* obtain column solution information */
+      if (tagx != NULL) *tagx = lpx_get_col_stat(lp, j);
+      if (vx != NULL) *vx = lpx_get_col_prim(lp, j);
+      if (dx != NULL) *dx = lpx_get_col_dual(lp, j);
+      return;
+}
+
+int lpx_get_ray_info(LPX *lp)
+{     /* determine what causes primal unboundness */
+      return glp_get_unbnd_ray(lp);
+}
+
+void lpx_check_kkt(LPX *lp, int scaled, LPXKKT *kkt)
+{     /* check Karush-Kuhn-Tucker conditions */
+      int m = glp_get_num_rows(lp);
+      int ae_ind, re_ind;
+      double ae_max, re_max;
+      xassert(scaled == scaled);
+      glp_check_kkt(lp, GLP_SOL, GLP_KKT_PE, &ae_max, &ae_ind, &re_max,
+         &re_ind);
+      kkt->pe_ae_max = ae_max;
+      kkt->pe_ae_row = ae_ind;
+      kkt->pe_re_max = re_max;
+      kkt->pe_re_row = re_ind;
+      if (re_max <= 1e-9)
+         kkt->pe_quality = 'H';
+      else if (re_max <= 1e-6)
+         kkt->pe_quality = 'M';
+      else if (re_max <= 1e-3)
+         kkt->pe_quality = 'L';
+      else
+         kkt->pe_quality = '?';
+      glp_check_kkt(lp, GLP_SOL, GLP_KKT_PB, &ae_max, &ae_ind, &re_max,
+         &re_ind);
+      kkt->pb_ae_max = ae_max;
+      kkt->pb_ae_ind = ae_ind;
+      kkt->pb_re_max = re_max;
+      kkt->pb_re_ind = re_ind;
+      if (re_max <= 1e-9)
+         kkt->pb_quality = 'H';
+      else if (re_max <= 1e-6)
+         kkt->pb_quality = 'M';
+      else if (re_max <= 1e-3)
+         kkt->pb_quality = 'L';
+      else
+         kkt->pb_quality = '?';
+      glp_check_kkt(lp, GLP_SOL, GLP_KKT_DE, &ae_max, &ae_ind, &re_max,
+         &re_ind);
+      kkt->de_ae_max = ae_max;
+      if (ae_ind == 0)
+         kkt->de_ae_col = 0;
+      else
+         kkt->de_ae_col = ae_ind - m;
+      kkt->de_re_max = re_max;
+      if (re_ind == 0)
+         kkt->de_re_col = 0;
+      else
+         kkt->de_re_col = ae_ind - m;
+      if (re_max <= 1e-9)
+         kkt->de_quality = 'H';
+      else if (re_max <= 1e-6)
+         kkt->de_quality = 'M';
+      else if (re_max <= 1e-3)
+         kkt->de_quality = 'L';
+      else
+         kkt->de_quality = '?';
+      glp_check_kkt(lp, GLP_SOL, GLP_KKT_DB, &ae_max, &ae_ind, &re_max,
+         &re_ind);
+      kkt->db_ae_max = ae_max;
+      kkt->db_ae_ind = ae_ind;
+      kkt->db_re_max = re_max;
+      kkt->db_re_ind = re_ind;
+      if (re_max <= 1e-9)
+         kkt->db_quality = 'H';
+      else if (re_max <= 1e-6)
+         kkt->db_quality = 'M';
+      else if (re_max <= 1e-3)
+         kkt->db_quality = 'L';
+      else
+         kkt->db_quality = '?';
+      kkt->cs_ae_max = 0.0, kkt->cs_ae_ind = 0;
+      kkt->cs_re_max = 0.0, kkt->cs_re_ind = 0;
+      kkt->cs_quality = 'H';
+      return;
+}
+
+int lpx_warm_up(LPX *lp)
+{     /* "warm up" LP basis */
+      int ret;
+      ret = glp_warm_up(lp);
+      if (ret == 0)
+         ret = LPX_E_OK;
+      else if (ret == GLP_EBADB)
+         ret = LPX_E_BADB;
+      else if (ret == GLP_ESING)
+         ret = LPX_E_SING;
+      else if (ret == GLP_ECOND)
+         ret = LPX_E_SING;
+      else
+         xassert(ret != ret);
+      return ret;
+}
+
+int lpx_eval_tab_row(LPX *lp, int k, int ind[], double val[])
+{     /* compute row of the simplex tableau */
+      return glp_eval_tab_row(lp, k, ind, val);
+}
+
+int lpx_eval_tab_col(LPX *lp, int k, int ind[], double val[])
+{     /* compute column of the simplex tableau */
+      return glp_eval_tab_col(lp, k, ind, val);
+}
+
+int lpx_transform_row(LPX *lp, int len, int ind[], double val[])
+{     /* transform explicitly specified row */
+      return glp_transform_row(lp, len, ind, val);
+}
+
+int lpx_transform_col(LPX *lp, int len, int ind[], double val[])
+{     /* transform explicitly specified column */
+      return glp_transform_col(lp, len, ind, val);
+}
+
+int lpx_prim_ratio_test(LPX *lp, int len, const int ind[],
+      const double val[], int how, double tol)
+{     /* perform primal ratio test */
+      int piv;
+      piv = glp_prim_rtest(lp, len, ind, val, how, tol);
+      xassert(0 <= piv && piv <= len);
+      return piv == 0 ? 0 : ind[piv];
+}
+
+int lpx_dual_ratio_test(LPX *lp, int len, const int ind[],
+      const double val[], int how, double tol)
+{     /* perform dual ratio test */
+      int piv;
+      piv = glp_dual_rtest(lp, len, ind, val, how, tol);
+      xassert(0 <= piv && piv <= len);
+      return piv == 0 ? 0 : ind[piv];
+}
+
+int lpx_interior(LPX *lp)
+{     /* easy-to-use driver to the interior-point method */
+      int ret;
+      ret = glp_interior(lp, NULL);
+      switch (ret)
+      {  case 0:           ret = LPX_E_OK;      break;
+         case GLP_EFAIL:   ret = LPX_E_FAULT;   break;
+         case GLP_ENOFEAS: ret = LPX_E_NOFEAS;  break;
+         case GLP_ENOCVG:  ret = LPX_E_NOCONV;  break;
+         case GLP_EITLIM:  ret = LPX_E_ITLIM;   break;
+         case GLP_EINSTAB: ret = LPX_E_INSTAB;  break;
+         default:          xassert(ret != ret);
+      }
+      return ret;
+}
+
+int lpx_ipt_status(glp_prob *lp)
+{     /* retrieve status of interior-point solution */
+      int status;
+      switch (glp_ipt_status(lp))
+      {  case GLP_UNDEF:  status = LPX_T_UNDEF;  break;
+         case GLP_OPT:    status = LPX_T_OPT;    break;
+         default:         xassert(lp != lp);
+      }
+      return status;
+}
+
+double lpx_ipt_obj_val(LPX *lp)
+{     /* retrieve objective value (interior point) */
+      return glp_ipt_obj_val(lp);
+}
+
+double lpx_ipt_row_prim(LPX *lp, int i)
+{     /* retrieve row primal value (interior point) */
+      return glp_ipt_row_prim(lp, i);
+}
+
+double lpx_ipt_row_dual(LPX *lp, int i)
+{     /* retrieve row dual value (interior point) */
+      return glp_ipt_row_dual(lp, i);
+}
+
+double lpx_ipt_col_prim(LPX *lp, int j)
+{     /* retrieve column primal value (interior point) */
+      return glp_ipt_col_prim(lp, j);
+}
+
+double lpx_ipt_col_dual(LPX *lp, int j)
+{     /* retrieve column dual value (interior point) */
+      return glp_ipt_col_dual(lp, j);
+}
+
+void lpx_set_class(LPX *lp, int klass)
+{     /* set problem class */
+      xassert(lp == lp);
+      if (!(klass == LPX_LP || klass == LPX_MIP))
+         xerror("lpx_set_class: invalid problem class\n");
+      return;
+}
+
+int lpx_get_class(LPX *lp)
+{     /* determine problem klass */
+      return glp_get_num_int(lp) == 0 ? LPX_LP : LPX_MIP;
+}
+
+void lpx_set_col_kind(LPX *lp, int j, int kind)
+{     /* set (change) column kind */
+      glp_set_col_kind(lp, j, kind - LPX_CV + GLP_CV);
+      return;
+}
+
+int lpx_get_col_kind(LPX *lp, int j)
+{     /* retrieve column kind */
+      return glp_get_col_kind(lp, j) == GLP_CV ? LPX_CV : LPX_IV;
+}
+
+int lpx_get_num_int(LPX *lp)
+{     /* retrieve number of integer columns */
+      return glp_get_num_int(lp);
+}
+
+int lpx_get_num_bin(LPX *lp)
+{     /* retrieve number of binary columns */
+      return glp_get_num_bin(lp);
+}
+
+static int solve_mip(LPX *lp, int presolve)
+{     glp_iocp parm;
+      int ret;
+      glp_init_iocp(&parm);
+      switch (lpx_get_int_parm(lp, LPX_K_MSGLEV))
+      {  case 0:  parm.msg_lev = GLP_MSG_OFF;   break;
+         case 1:  parm.msg_lev = GLP_MSG_ERR;   break;
+         case 2:  parm.msg_lev = GLP_MSG_ON;    break;
+         case 3:  parm.msg_lev = GLP_MSG_ALL;   break;
+         default: xassert(lp != lp);
+      }
+      switch (lpx_get_int_parm(lp, LPX_K_BRANCH))
+      {  case 0:  parm.br_tech = GLP_BR_FFV;    break;
+         case 1:  parm.br_tech = GLP_BR_LFV;    break;
+         case 2:  parm.br_tech = GLP_BR_DTH;    break;
+         case 3:  parm.br_tech = GLP_BR_MFV;    break;
+         default: xassert(lp != lp);
+      }
+      switch (lpx_get_int_parm(lp, LPX_K_BTRACK))
+      {  case 0:  parm.bt_tech = GLP_BT_DFS;    break;
+         case 1:  parm.bt_tech = GLP_BT_BFS;    break;
+         case 2:  parm.bt_tech = GLP_BT_BPH;    break;
+         case 3:  parm.bt_tech = GLP_BT_BLB;    break;
+         default: xassert(lp != lp);
+      }
+      parm.tol_int = lpx_get_real_parm(lp, LPX_K_TOLINT);
+      parm.tol_obj = lpx_get_real_parm(lp, LPX_K_TOLOBJ);
+      if (lpx_get_real_parm(lp, LPX_K_TMLIM) < 0.0 ||
+          lpx_get_real_parm(lp, LPX_K_TMLIM) > 1e6)
+         parm.tm_lim = INT_MAX;
+      else
+         parm.tm_lim =
+            (int)(1000.0 * lpx_get_real_parm(lp, LPX_K_TMLIM));
+      parm.mip_gap = lpx_get_real_parm(lp, LPX_K_MIPGAP);
+      if (lpx_get_int_parm(lp, LPX_K_USECUTS) & LPX_C_GOMORY)
+         parm.gmi_cuts = GLP_ON;
+      else
+         parm.gmi_cuts = GLP_OFF;
+      if (lpx_get_int_parm(lp, LPX_K_USECUTS) & LPX_C_MIR)
+         parm.mir_cuts = GLP_ON;
+      else
+         parm.mir_cuts = GLP_OFF;
+      if (lpx_get_int_parm(lp, LPX_K_USECUTS) & LPX_C_COVER)
+         parm.cov_cuts = GLP_ON;
+      else
+         parm.cov_cuts = GLP_OFF;
+      if (lpx_get_int_parm(lp, LPX_K_USECUTS) & LPX_C_CLIQUE)
+         parm.clq_cuts = GLP_ON;
+      else
+         parm.clq_cuts = GLP_OFF;
+      parm.presolve = presolve;
+      if (lpx_get_int_parm(lp, LPX_K_BINARIZE))
+         parm.binarize = GLP_ON;
+      ret = glp_intopt(lp, &parm);
+      switch (ret)
+      {  case 0:           ret = LPX_E_OK;      break;
+         case GLP_ENOPFS:  ret = LPX_E_NOPFS;   break;
+         case GLP_ENODFS:  ret = LPX_E_NODFS;   break;
+         case GLP_EBOUND:
+         case GLP_EROOT:   ret = LPX_E_FAULT;   break;
+         case GLP_EFAIL:   ret = LPX_E_SING;    break;
+         case GLP_EMIPGAP: ret = LPX_E_MIPGAP;  break;
+         case GLP_ETMLIM:  ret = LPX_E_TMLIM;   break;
+         default:          xassert(ret != ret);
+      }
+      return ret;
+}
+
+int lpx_integer(LPX *lp)
+{     /* easy-to-use driver to the branch-and-bound method */
+      return solve_mip(lp, GLP_OFF);
+}
+
+int lpx_intopt(LPX *lp)
+{     /* easy-to-use driver to the branch-and-bound method */
+      return solve_mip(lp, GLP_ON);
+}
+
+int lpx_mip_status(glp_prob *lp)
+{     /* retrieve status of MIP solution */
+      int status;
+      switch (glp_mip_status(lp))
+      {  case GLP_UNDEF:  status = LPX_I_UNDEF;  break;
+         case GLP_OPT:    status = LPX_I_OPT;    break;
+         case GLP_FEAS:   status = LPX_I_FEAS;   break;
+         case GLP_NOFEAS: status = LPX_I_NOFEAS; break;
+         default:         xassert(lp != lp);
+      }
+      return status;
+}
+
+double lpx_mip_obj_val(LPX *lp)
+{     /* retrieve objective value (MIP solution) */
+      return glp_mip_obj_val(lp);
+}
+
+double lpx_mip_row_val(LPX *lp, int i)
+{     /* retrieve row value (MIP solution) */
+      return glp_mip_row_val(lp, i);
+}
+
+double lpx_mip_col_val(LPX *lp, int j)
+{     /* retrieve column value (MIP solution) */
+      return glp_mip_col_val(lp, j);
+}
+
+void lpx_check_int(LPX *lp, LPXKKT *kkt)
+{     /* check integer feasibility conditions */
+      int ae_ind, re_ind;
+      double ae_max, re_max;
+      glp_check_kkt(lp, GLP_MIP, GLP_KKT_PE, &ae_max, &ae_ind, &re_max,
+         &re_ind);
+      kkt->pe_ae_max = ae_max;
+      kkt->pe_ae_row = ae_ind;
+      kkt->pe_re_max = re_max;
+      kkt->pe_re_row = re_ind;
+      if (re_max <= 1e-9)
+         kkt->pe_quality = 'H';
+      else if (re_max <= 1e-6)
+         kkt->pe_quality = 'M';
+      else if (re_max <= 1e-3)
+         kkt->pe_quality = 'L';
+      else
+         kkt->pe_quality = '?';
+      glp_check_kkt(lp, GLP_MIP, GLP_KKT_PB, &ae_max, &ae_ind, &re_max,
+         &re_ind);
+      kkt->pb_ae_max = ae_max;
+      kkt->pb_ae_ind = ae_ind;
+      kkt->pb_re_max = re_max;
+      kkt->pb_re_ind = re_ind;
+      if (re_max <= 1e-9)
+         kkt->pb_quality = 'H';
+      else if (re_max <= 1e-6)
+         kkt->pb_quality = 'M';
+      else if (re_max <= 1e-3)
+         kkt->pb_quality = 'L';
+      else
+         kkt->pb_quality = '?';
+      return;
+}
+
+void lpx_reset_parms(LPX *lp)
+{     /* reset control parameters to default values */
+      struct CPS *cps = find_cps(lp);
+      reset_cps(cps);
+      return;
+}
+
+void lpx_set_int_parm(LPX *lp, int parm, int val)
+{     /* set (change) integer control parameter */
+      struct CPS *cps = find_cps(lp);
+      switch (parm)
+      {  case LPX_K_MSGLEV:
+            if (!(0 <= val && val <= 3))
+               xerror("lpx_set_int_parm: MSGLEV = %d; invalid value\n",
+                  val);
+            cps->msg_lev = val;
+            break;
+         case LPX_K_SCALE:
+            if (!(0 <= val && val <= 3))
+               xerror("lpx_set_int_parm: SCALE = %d; invalid value\n",
+                  val);
+            cps->scale = val;
+            break;
+         case LPX_K_DUAL:
+            if (!(val == 0 || val == 1))
+               xerror("lpx_set_int_parm: DUAL = %d; invalid value\n",
+                  val);
+            cps->dual = val;
+            break;
+         case LPX_K_PRICE:
+            if (!(val == 0 || val == 1))
+               xerror("lpx_set_int_parm: PRICE = %d; invalid value\n",
+                  val);
+            cps->price = val;
+            break;
+         case LPX_K_ROUND:
+            if (!(val == 0 || val == 1))
+               xerror("lpx_set_int_parm: ROUND = %d; invalid value\n",
+                  val);
+            cps->round = val;
+            break;
+         case LPX_K_ITLIM:
+            cps->it_lim = val;
+            break;
+         case LPX_K_ITCNT:
+#if 0 /* FIXME: needs 4.53 */
+            glp_set_it_cnt(lp, val);
+#endif
+            break;
+         case LPX_K_OUTFRQ:
+            if (!(val > 0))
+               xerror("lpx_set_int_parm: OUTFRQ = %d; invalid value\n",
+                  val);
+            cps->out_frq = val;
+            break;
+         case LPX_K_BRANCH:
+            if (!(val == 0 || val == 1 || val == 2 || val == 3))
+               xerror("lpx_set_int_parm: BRANCH = %d; invalid value\n",
+                  val);
+            cps->branch = val;
+            break;
+         case LPX_K_BTRACK:
+            if (!(val == 0 || val == 1 || val == 2 || val == 3))
+               xerror("lpx_set_int_parm: BTRACK = %d; invalid value\n",
+                  val);
+            cps->btrack = val;
+            break;
+         case LPX_K_MPSINFO:
+            if (!(val == 0 || val == 1))
+               xerror("lpx_set_int_parm: MPSINFO = %d; invalid value\n",
+                  val);
+            cps->mps_info = val;
+            break;
+         case LPX_K_MPSOBJ:
+            if (!(val == 0 || val == 1 || val == 2))
+               xerror("lpx_set_int_parm: MPSOBJ = %d; invalid value\n",
+                  val);
+            cps->mps_obj = val;
+            break;
+         case LPX_K_MPSORIG:
+            if (!(val == 0 || val == 1))
+               xerror("lpx_set_int_parm: MPSORIG = %d; invalid value\n",
+                  val);
+            cps->mps_orig = val;
+            break;
+         case LPX_K_MPSWIDE:
+            if (!(val == 0 || val == 1))
+               xerror("lpx_set_int_parm: MPSWIDE = %d; invalid value\n",
+                  val);
+            cps->mps_wide = val;
+            break;
+         case LPX_K_MPSFREE:
+            if (!(val == 0 || val == 1))
+               xerror("lpx_set_int_parm: MPSFREE = %d; invalid value\n",
+                  val);
+            cps->mps_free = val;
+            break;
+         case LPX_K_MPSSKIP:
+            if (!(val == 0 || val == 1))
+               xerror("lpx_set_int_parm: MPSSKIP = %d; invalid value\n",
+                  val);
+            cps->mps_skip = val;
+            break;
+         case LPX_K_LPTORIG:
+            if (!(val == 0 || val == 1))
+               xerror("lpx_set_int_parm: LPTORIG = %d; invalid value\n",
+                  val);
+            cps->lpt_orig = val;
+            break;
+         case LPX_K_PRESOL:
+            if (!(val == 0 || val == 1))
+               xerror("lpx_set_int_parm: PRESOL = %d; invalid value\n",
+                  val);
+            cps->presol = val;
+            break;
+         case LPX_K_BINARIZE:
+            if (!(val == 0 || val == 1))
+               xerror("lpx_set_int_parm: BINARIZE = %d; invalid value\n"
+                  , val);
+            cps->binarize = val;
+            break;
+         case LPX_K_USECUTS:
+            if (val & ~LPX_C_ALL)
+            xerror("lpx_set_int_parm: USECUTS = 0x%X; invalid value\n",
+                  val);
+            cps->use_cuts = val;
+            break;
+         case LPX_K_BFTYPE:
+            {  glp_bfcp parm;
+               glp_get_bfcp(lp, &parm);
+               switch (val)
+               {  case 1:
+                     parm.type = GLP_BF_FT; break;
+                  case 2:
+                     parm.type = GLP_BF_BG; break;
+                  case 3:
+                     parm.type = GLP_BF_GR; break;
+                  default:
+                     xerror("lpx_set_int_parm: BFTYPE = %d; invalid val"
+                        "ue\n", val);
+               }
+               glp_set_bfcp(lp, &parm);
+            }
+            break;
+         default:
+            xerror("lpx_set_int_parm: parm = %d; invalid parameter\n",
+               parm);
+      }
+      return;
+}
+
+int lpx_get_int_parm(LPX *lp, int parm)
+{     /* query integer control parameter */
+      struct CPS *cps = find_cps(lp);
+      int val = 0;
+      switch (parm)
+      {  case LPX_K_MSGLEV:
+            val = cps->msg_lev; break;
+         case LPX_K_SCALE:
+            val = cps->scale; break;
+         case LPX_K_DUAL:
+            val = cps->dual; break;
+         case LPX_K_PRICE:
+            val = cps->price; break;
+         case LPX_K_ROUND:
+            val = cps->round; break;
+         case LPX_K_ITLIM:
+            val = cps->it_lim; break;
+         case LPX_K_ITCNT:
+#if 0 /* FIXME: needs 4.53 */
+            val = glp_get_it_cnt(lp); break;
+#else
+            val = 0; break;
+#endif
+         case LPX_K_OUTFRQ:
+            val = cps->out_frq; break;
+         case LPX_K_BRANCH:
+            val = cps->branch; break;
+         case LPX_K_BTRACK:
+            val = cps->btrack; break;
+         case LPX_K_MPSINFO:
+            val = cps->mps_info; break;
+         case LPX_K_MPSOBJ:
+            val = cps->mps_obj; break;
+         case LPX_K_MPSORIG:
+            val = cps->mps_orig; break;
+         case LPX_K_MPSWIDE:
+            val = cps->mps_wide; break;
+         case LPX_K_MPSFREE:
+            val = cps->mps_free; break;
+         case LPX_K_MPSSKIP:
+            val = cps->mps_skip; break;
+         case LPX_K_LPTORIG:
+            val = cps->lpt_orig; break;
+         case LPX_K_PRESOL:
+            val = cps->presol; break;
+         case LPX_K_BINARIZE:
+            val = cps->binarize; break;
+         case LPX_K_USECUTS:
+            val = cps->use_cuts; break;
+         case LPX_K_BFTYPE:
+            {  glp_bfcp parm;
+               glp_get_bfcp(lp, &parm);
+               switch (parm.type)
+               {  case GLP_BF_FT:
+                     val = 1; break;
+                  case GLP_BF_BG:
+                     val = 2; break;
+                  case GLP_BF_GR:
+                     val = 3; break;
+                  default:
+                     xassert(lp != lp);
+               }
+            }
+            break;
+         default:
+            xerror("lpx_get_int_parm: parm = %d; invalid parameter\n",
+               parm);
+      }
+      return val;
+}
+
+void lpx_set_real_parm(LPX *lp, int parm, double val)
+{     /* set (change) real control parameter */
+      struct CPS *cps = find_cps(lp);
+      switch (parm)
+      {  case LPX_K_RELAX:
+            if (!(0.0 <= val && val <= 1.0))
+               xerror("lpx_set_real_parm: RELAX = %g; invalid value\n",
+                  val);
+            cps->relax = val;
+            break;
+         case LPX_K_TOLBND:
+            if (!(DBL_EPSILON <= val && val <= 0.001))
+               xerror("lpx_set_real_parm: TOLBND = %g; invalid value\n",
+                  val);
+            cps->tol_bnd = val;
+            break;
+         case LPX_K_TOLDJ:
+            if (!(DBL_EPSILON <= val && val <= 0.001))
+               xerror("lpx_set_real_parm: TOLDJ = %g; invalid value\n",
+                  val);
+            cps->tol_dj = val;
+            break;
+         case LPX_K_TOLPIV:
+            if (!(DBL_EPSILON <= val && val <= 0.001))
+               xerror("lpx_set_real_parm: TOLPIV = %g; invalid value\n",
+                  val);
+            cps->tol_piv = val;
+            break;
+         case LPX_K_OBJLL:
+            cps->obj_ll = val;
+            break;
+         case LPX_K_OBJUL:
+            cps->obj_ul = val;
+            break;
+         case LPX_K_TMLIM:
+            cps->tm_lim = val;
+            break;
+         case LPX_K_OUTDLY:
+            cps->out_dly = val;
+            break;
+         case LPX_K_TOLINT:
+            if (!(DBL_EPSILON <= val && val <= 0.001))
+               xerror("lpx_set_real_parm: TOLINT = %g; invalid value\n",
+                  val);
+            cps->tol_int = val;
+            break;
+         case LPX_K_TOLOBJ:
+            if (!(DBL_EPSILON <= val && val <= 0.001))
+               xerror("lpx_set_real_parm: TOLOBJ = %g; invalid value\n",
+                  val);
+            cps->tol_obj = val;
+            break;
+         case LPX_K_MIPGAP:
+            if (val < 0.0)
+               xerror("lpx_set_real_parm: MIPGAP = %g; invalid value\n",
+                  val);
+            cps->mip_gap = val;
+            break;
+         default:
+            xerror("lpx_set_real_parm: parm = %d; invalid parameter\n",
+               parm);
+      }
+      return;
+}
+
+double lpx_get_real_parm(LPX *lp, int parm)
+{     /* query real control parameter */
+      struct CPS *cps = find_cps(lp);
+      double val = 0.0;
+      switch (parm)
+      {  case LPX_K_RELAX:
+            val = cps->relax;
+            break;
+         case LPX_K_TOLBND:
+            val = cps->tol_bnd;
+            break;
+         case LPX_K_TOLDJ:
+            val = cps->tol_dj;
+            break;
+         case LPX_K_TOLPIV:
+            val = cps->tol_piv;
+            break;
+         case LPX_K_OBJLL:
+            val = cps->obj_ll;
+            break;
+         case LPX_K_OBJUL:
+            val = cps->obj_ul;
+            break;
+         case LPX_K_TMLIM:
+            val = cps->tm_lim;
+            break;
+         case LPX_K_OUTDLY:
+            val = cps->out_dly;
+            break;
+         case LPX_K_TOLINT:
+            val = cps->tol_int;
+            break;
+         case LPX_K_TOLOBJ:
+            val = cps->tol_obj;
+            break;
+         case LPX_K_MIPGAP:
+            val = cps->mip_gap;
+            break;
+         default:
+            xerror("lpx_get_real_parm: parm = %d; invalid parameter\n",
+               parm);
+      }
+      return val;
+}
+
+LPX *lpx_read_mps(const char *fname)
+{     /* read problem data in fixed MPS format */
+      LPX *lp = lpx_create_prob();
+      if (glp_read_mps(lp, GLP_MPS_DECK, NULL, fname))
+         lpx_delete_prob(lp), lp = NULL;
+      return lp;
+}
+
+int lpx_write_mps(LPX *lp, const char *fname)
+{     /* write problem data in fixed MPS format */
+      return glp_write_mps(lp, GLP_MPS_DECK, NULL, fname);
+}
+
+int lpx_read_bas(LPX *lp, const char *fname)
+{     /* read LP basis in fixed MPS format */
+      xassert(lp == lp);
+      xassert(fname == fname);
+      xerror("lpx_read_bas: operation not supported\n");
+      return 0;
+}
+
+int lpx_write_bas(LPX *lp, const char *fname)
+{     /* write LP basis in fixed MPS format */
+      xassert(lp == lp);
+      xassert(fname == fname);
+      xerror("lpx_write_bas: operation not supported\n");
+      return 0;
+}
+
+LPX *lpx_read_freemps(const char *fname)
+{     /* read problem data in free MPS format */
+      LPX *lp = lpx_create_prob();
+      if (glp_read_mps(lp, GLP_MPS_FILE, NULL, fname))
+         lpx_delete_prob(lp), lp = NULL;
+      return lp;
+}
+
+int lpx_write_freemps(LPX *lp, const char *fname)
+{     /* write problem data in free MPS format */
+      return glp_write_mps(lp, GLP_MPS_FILE, NULL, fname);
+}
+
+LPX *lpx_read_cpxlp(const char *fname)
+{     /* read problem data in CPLEX LP format */
+      LPX *lp;
+      lp = lpx_create_prob();
+      if (glp_read_lp(lp, NULL, fname))
+         lpx_delete_prob(lp), lp = NULL;
+      return lp;
+}
+
+int lpx_write_cpxlp(LPX *lp, const char *fname)
+{     /* write problem data in CPLEX LP format */
+      return glp_write_lp(lp, NULL, fname);
+}
+
+LPX *lpx_read_model(const char *model, const char *data, const char
+      *output)
+{     /* read LP/MIP model written in GNU MathProg language */
+      LPX *lp = NULL;
+      glp_tran *tran;
+      /* allocate the translator workspace */
+      tran = glp_mpl_alloc_wksp();
+      /* read model section and optional data section */
+      if (glp_mpl_read_model(tran, model, data != NULL)) goto done;
+      /* read separate data section, if required */
+      if (data != NULL)
+         if (glp_mpl_read_data(tran, data)) goto done;
+      /* generate the model */
+      if (glp_mpl_generate(tran, output)) goto done;
+      /* build the problem instance from the model */
+      lp = lpx_create_prob();
+      glp_mpl_build_prob(tran, lp);
+done: /* free the translator workspace */
+      glp_mpl_free_wksp(tran);
+      /* bring the problem object to the calling program */
+      return lp;
+}
+
+int lpx_print_prob(LPX *lp, const char *fname)
+{     /* write problem data in plain text format */
+      return glp_write_lp(lp, NULL, fname);
+}
+
+int lpx_print_sol(LPX *lp, const char *fname)
+{     /* write LP problem solution in printable format */
+      return glp_print_sol(lp, fname);
+}
+
+int lpx_print_sens_bnds(LPX *lp, const char *fname)
+{     /* write bounds sensitivity information */
+      if (glp_get_status(lp) == GLP_OPT && !glp_bf_exists(lp))
+         glp_factorize(lp);
+      return glp_print_ranges(lp, 0, NULL, 0, fname);
+}
+
+int lpx_print_ips(LPX *lp, const char *fname)
+{     /* write interior point solution in printable format */
+      return glp_print_ipt(lp, fname);
+}
+
+int lpx_print_mip(LPX *lp, const char *fname)
+{     /* write MIP problem solution in printable format */
+      return glp_print_mip(lp, fname);
+}
+
+int lpx_is_b_avail(glp_prob *lp)
+{     /* check if LP basis is available */
+      return glp_bf_exists(lp);
+}
+
+#endif
+
+/* eof */
+
Index: cvxopt-1.1.4/src/C/lpx.h
===================================================================
--- /dev/null
+++ cvxopt-1.1.4/src/C/lpx.h
@@ -0,0 +1,565 @@
+/* lpx.h (old GLPK API) */
+
+/* Written by Andrew Makhorin <mao@gnu.org>, August 2013. */
+
+#ifndef LPX_H
+#define LPX_H
+
+#include <glpk.h>
+
+#if (GLP_MAJOR_VERSION == 4 && GLP_MINOR_VERSION >= 49) || GLP_MAJOR_VERSION > 4
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LPX glp_prob
+
+/* problem class: */
+#define LPX_LP          100   /* linear programming (LP) */
+#define LPX_MIP         101   /* mixed integer programming (MIP) */
+
+/* type of auxiliary/structural variable: */
+#define LPX_FR          110   /* free variable */
+#define LPX_LO          111   /* variable with lower bound */
+#define LPX_UP          112   /* variable with upper bound */
+#define LPX_DB          113   /* double-bounded variable */
+#define LPX_FX          114   /* fixed variable */
+
+/* optimization direction flag: */
+#define LPX_MIN         120   /* minimization */
+#define LPX_MAX         121   /* maximization */
+
+/* status of primal basic solution: */
+#define LPX_P_UNDEF     132   /* primal solution is undefined */
+#define LPX_P_FEAS      133   /* solution is primal feasible */
+#define LPX_P_INFEAS    134   /* solution is primal infeasible */
+#define LPX_P_NOFEAS    135   /* no primal feasible solution exists */
+
+/* status of dual basic solution: */
+#define LPX_D_UNDEF     136   /* dual solution is undefined */
+#define LPX_D_FEAS      137   /* solution is dual feasible */
+#define LPX_D_INFEAS    138   /* solution is dual infeasible */
+#define LPX_D_NOFEAS    139   /* no dual feasible solution exists */
+
+/* status of auxiliary/structural variable: */
+#define LPX_BS          140   /* basic variable */
+#define LPX_NL          141   /* non-basic variable on lower bound */
+#define LPX_NU          142   /* non-basic variable on upper bound */
+#define LPX_NF          143   /* non-basic free variable */
+#define LPX_NS          144   /* non-basic fixed variable */
+
+/* status of interior-point solution: */
+#define LPX_T_UNDEF     150   /* interior solution is undefined */
+#define LPX_T_OPT       151   /* interior solution is optimal */
+
+/* kind of structural variable: */
+#define LPX_CV          160   /* continuous variable */
+#define LPX_IV          161   /* integer variable */
+
+/* status of integer solution: */
+#define LPX_I_UNDEF     170   /* integer solution is undefined */
+#define LPX_I_OPT       171   /* integer solution is optimal */
+#define LPX_I_FEAS      172   /* integer solution is feasible */
+#define LPX_I_NOFEAS    173   /* no integer solution exists */
+
+/* status codes reported by the routine lpx_get_status: */
+#define LPX_OPT         180   /* optimal */
+#define LPX_FEAS        181   /* feasible */
+#define LPX_INFEAS      182   /* infeasible */
+#define LPX_NOFEAS      183   /* no feasible */
+#define LPX_UNBND       184   /* unbounded */
+#define LPX_UNDEF       185   /* undefined */
+
+/* exit codes returned by solver routines: */
+#define LPX_E_OK        200   /* success */
+#define LPX_E_EMPTY     201   /* empty problem */
+#define LPX_E_BADB      202   /* invalid initial basis */
+#define LPX_E_INFEAS    203   /* infeasible initial solution */
+#define LPX_E_FAULT     204   /* unable to start the search */
+#define LPX_E_OBJLL     205   /* objective lower limit reached */
+#define LPX_E_OBJUL     206   /* objective upper limit reached */
+#define LPX_E_ITLIM     207   /* iterations limit exhausted */
+#define LPX_E_TMLIM     208   /* time limit exhausted */
+#define LPX_E_NOFEAS    209   /* no feasible solution */
+#define LPX_E_INSTAB    210   /* numerical instability */
+#define LPX_E_SING      211   /* problems with basis matrix */
+#define LPX_E_NOCONV    212   /* no convergence (interior) */
+#define LPX_E_NOPFS     213   /* no primal feas. sol. (LP presolver) */
+#define LPX_E_NODFS     214   /* no dual feas. sol. (LP presolver) */
+#define LPX_E_MIPGAP    215   /* relative mip gap tolerance reached */
+
+/* control parameter identifiers: */
+#define LPX_K_MSGLEV    300   /* lp->msg_lev */
+#define LPX_K_SCALE     301   /* lp->scale */
+#define LPX_K_DUAL      302   /* lp->dual */
+#define LPX_K_PRICE     303   /* lp->price */
+#define LPX_K_RELAX     304   /* lp->relax */
+#define LPX_K_TOLBND    305   /* lp->tol_bnd */
+#define LPX_K_TOLDJ     306   /* lp->tol_dj */
+#define LPX_K_TOLPIV    307   /* lp->tol_piv */
+#define LPX_K_ROUND     308   /* lp->round */
+#define LPX_K_OBJLL     309   /* lp->obj_ll */
+#define LPX_K_OBJUL     310   /* lp->obj_ul */
+#define LPX_K_ITLIM     311   /* lp->it_lim */
+#define LPX_K_ITCNT     312   /* lp->it_cnt */
+#define LPX_K_TMLIM     313   /* lp->tm_lim */
+#define LPX_K_OUTFRQ    314   /* lp->out_frq */
+#define LPX_K_OUTDLY    315   /* lp->out_dly */
+#define LPX_K_BRANCH    316   /* lp->branch */
+#define LPX_K_BTRACK    317   /* lp->btrack */
+#define LPX_K_TOLINT    318   /* lp->tol_int */
+#define LPX_K_TOLOBJ    319   /* lp->tol_obj */
+#define LPX_K_MPSINFO   320   /* lp->mps_info */
+#define LPX_K_MPSOBJ    321   /* lp->mps_obj */
+#define LPX_K_MPSORIG   322   /* lp->mps_orig */
+#define LPX_K_MPSWIDE   323   /* lp->mps_wide */
+#define LPX_K_MPSFREE   324   /* lp->mps_free */
+#define LPX_K_MPSSKIP   325   /* lp->mps_skip */
+#define LPX_K_LPTORIG   326   /* lp->lpt_orig */
+#define LPX_K_PRESOL    327   /* lp->presol */
+#define LPX_K_BINARIZE  328   /* lp->binarize */
+#define LPX_K_USECUTS   329   /* lp->use_cuts */
+#define LPX_K_BFTYPE    330   /* lp->bfcp->type */
+#define LPX_K_MIPGAP    331   /* lp->mip_gap */
+
+#define LPX_C_COVER     0x01  /* mixed cover cuts */
+#define LPX_C_CLIQUE    0x02  /* clique cuts */
+#define LPX_C_GOMORY    0x04  /* Gomory's mixed integer cuts */
+#define LPX_C_MIR       0x08  /* mixed integer rounding cuts */
+#define LPX_C_ALL       0xFF  /* all cuts */
+
+typedef struct
+{     /* this structure contains results reported by the routines which
+         checks Karush-Kuhn-Tucker conditions (for details see comments
+         to those routines) */
+      /*--------------------------------------------------------------*/
+      /* xR - A * xS = 0 (KKT.PE) */
+      double pe_ae_max;
+      /* largest absolute error */
+      int    pe_ae_row;
+      /* number of row with largest absolute error */
+      double pe_re_max;
+      /* largest relative error */
+      int    pe_re_row;
+      /* number of row with largest relative error */
+      int    pe_quality;
+      /* quality of primal solution:
+         'H' - high
+         'M' - medium
+         'L' - low
+         '?' - primal solution is wrong */
+      /*--------------------------------------------------------------*/
+      /* l[k] <= x[k] <= u[k] (KKT.PB) */
+      double pb_ae_max;
+      /* largest absolute error */
+      int    pb_ae_ind;
+      /* number of variable with largest absolute error */
+      double pb_re_max;
+      /* largest relative error */
+      int    pb_re_ind;
+      /* number of variable with largest relative error */
+      int    pb_quality;
+      /* quality of primal feasibility:
+         'H' - high
+         'M' - medium
+         'L' - low
+         '?' - primal solution is infeasible */
+      /*--------------------------------------------------------------*/
+      /* A' * (dR - cR) + (dS - cS) = 0 (KKT.DE) */
+      double de_ae_max;
+      /* largest absolute error */
+      int    de_ae_col;
+      /* number of column with largest absolute error */
+      double de_re_max;
+      /* largest relative error */
+      int    de_re_col;
+      /* number of column with largest relative error */
+      int    de_quality;
+      /* quality of dual solution:
+         'H' - high
+         'M' - medium
+         'L' - low
+         '?' - dual solution is wrong */
+      /*--------------------------------------------------------------*/
+      /* d[k] >= 0 or d[k] <= 0 (KKT.DB) */
+      double db_ae_max;
+      /* largest absolute error */
+      int    db_ae_ind;
+      /* number of variable with largest absolute error */
+      double db_re_max;
+      /* largest relative error */
+      int    db_re_ind;
+      /* number of variable with largest relative error */
+      int    db_quality;
+      /* quality of dual feasibility:
+         'H' - high
+         'M' - medium
+         'L' - low
+         '?' - dual solution is infeasible */
+      /*--------------------------------------------------------------*/
+      /* (x[k] - bound of x[k]) * d[k] = 0 (KKT.CS) */
+      double cs_ae_max;
+      /* largest absolute error */
+      int    cs_ae_ind;
+      /* number of variable with largest absolute error */
+      double cs_re_max;
+      /* largest relative error */
+      int    cs_re_ind;
+      /* number of variable with largest relative error */
+      int    cs_quality;
+      /* quality of complementary slackness:
+         'H' - high
+         'M' - medium
+         'L' - low
+         '?' - primal and dual solutions are not complementary */
+} LPXKKT;
+
+LPX *lpx_create_prob(void);
+/* create problem object */
+
+void lpx_set_prob_name(LPX *lp, const char *name);
+/* assign (change) problem name */
+
+void lpx_set_obj_name(LPX *lp, const char *name);
+/* assign (change) objective function name */
+
+void lpx_set_obj_dir(LPX *lp, int dir);
+/* set (change) optimization direction flag */
+
+int lpx_add_rows(LPX *lp, int nrs);
+/* add new rows to problem object */
+
+int lpx_add_cols(LPX *lp, int ncs);
+/* add new columns to problem object */
+
+void lpx_set_row_name(LPX *lp, int i, const char *name);
+/* assign (change) row name */
+
+void lpx_set_col_name(LPX *lp, int j, const char *name);
+/* assign (change) column name */
+
+void lpx_set_row_bnds(LPX *lp, int i, int type, double lb, double ub);
+/* set (change) row bounds */
+
+void lpx_set_col_bnds(LPX *lp, int j, int type, double lb, double ub);
+/* set (change) column bounds */
+
+void lpx_set_obj_coef(glp_prob *lp, int j, double coef);
+/* set (change) obj. coefficient or constant term */
+
+void lpx_set_mat_row(LPX *lp, int i, int len, const int ind[],
+      const double val[]);
+/* set (replace) row of the constraint matrix */
+
+void lpx_set_mat_col(LPX *lp, int j, int len, const int ind[],
+      const double val[]);
+/* set (replace) column of the constraint matrix */
+
+void lpx_load_matrix(LPX *lp, int ne, const int ia[], const int ja[],
+      const double ar[]);
+/* load (replace) the whole constraint matrix */
+
+void lpx_del_rows(LPX *lp, int nrs, const int num[]);
+/* delete specified rows from problem object */
+
+void lpx_del_cols(LPX *lp, int ncs, const int num[]);
+/* delete specified columns from problem object */
+
+void lpx_delete_prob(LPX *lp);
+/* delete problem object */
+
+const char *lpx_get_prob_name(LPX *lp);
+/* retrieve problem name */
+
+const char *lpx_get_obj_name(LPX *lp);
+/* retrieve objective function name */
+
+int lpx_get_obj_dir(LPX *lp);
+/* retrieve optimization direction flag */
+
+int lpx_get_num_rows(LPX *lp);
+/* retrieve number of rows */
+
+int lpx_get_num_cols(LPX *lp);
+/* retrieve number of columns */
+
+const char *lpx_get_row_name(LPX *lp, int i);
+/* retrieve row name */
+
+const char *lpx_get_col_name(LPX *lp, int j);
+/* retrieve column name */
+
+int lpx_get_row_type(LPX *lp, int i);
+/* retrieve row type */
+
+double lpx_get_row_lb(LPX *lp, int i);
+/* retrieve row lower bound */
+
+double lpx_get_row_ub(LPX *lp, int i);
+/* retrieve row upper bound */
+
+void lpx_get_row_bnds(LPX *lp, int i, int *typx, double *lb,
+      double *ub);
+/* retrieve row bounds */
+
+int lpx_get_col_type(LPX *lp, int j);
+/* retrieve column type */
+
+double lpx_get_col_lb(LPX *lp, int j);
+/* retrieve column lower bound */
+
+double lpx_get_col_ub(LPX *lp, int j);
+/* retrieve column upper bound */
+
+void lpx_get_col_bnds(LPX *lp, int j, int *typx, double *lb,
+      double *ub);
+/* retrieve column bounds */
+
+double lpx_get_obj_coef(LPX *lp, int j);
+/* retrieve obj. coefficient or constant term */
+
+int lpx_get_num_nz(LPX *lp);
+/* retrieve number of constraint coefficients */
+
+int lpx_get_mat_row(LPX *lp, int i, int ind[], double val[]);
+/* retrieve row of the constraint matrix */
+
+int lpx_get_mat_col(LPX *lp, int j, int ind[], double val[]);
+/* retrieve column of the constraint matrix */
+
+void lpx_create_index(LPX *lp);
+/* create the name index */
+
+int lpx_find_row(LPX *lp, const char *name);
+/* find row by its name */
+
+int lpx_find_col(LPX *lp, const char *name);
+/* find column by its name */
+
+void lpx_delete_index(LPX *lp);
+/* delete the name index */
+
+void lpx_scale_prob(LPX *lp);
+/* scale problem data */
+
+void lpx_unscale_prob(LPX *lp);
+/* unscale problem data */
+
+void lpx_set_row_stat(LPX *lp, int i, int stat);
+/* set (change) row status */
+
+void lpx_set_col_stat(LPX *lp, int j, int stat);
+/* set (change) column status */
+
+void lpx_std_basis(LPX *lp);
+/* construct standard initial LP basis */
+
+void lpx_adv_basis(LPX *lp);
+/* construct advanced initial LP basis */
+
+void lpx_cpx_basis(LPX *lp);
+/* construct Bixby's initial LP basis */
+
+int lpx_simplex(LPX *lp);
+/* easy-to-use driver to the simplex method */
+
+int lpx_exact(LPX *lp);
+/* easy-to-use driver to the exact simplex method */
+
+int lpx_get_status(LPX *lp);
+/* retrieve generic status of basic solution */
+
+int lpx_get_prim_stat(LPX *lp);
+/* retrieve primal status of basic solution */
+
+int lpx_get_dual_stat(LPX *lp);
+/* retrieve dual status of basic solution */
+
+double lpx_get_obj_val(LPX *lp);
+/* retrieve objective value (basic solution) */
+
+int lpx_get_row_stat(LPX *lp, int i);
+/* retrieve row status (basic solution) */
+
+double lpx_get_row_prim(LPX *lp, int i);
+/* retrieve row primal value (basic solution) */
+
+double lpx_get_row_dual(LPX *lp, int i);
+/* retrieve row dual value (basic solution) */
+
+void lpx_get_row_info(LPX *lp, int i, int *tagx, double *vx,
+      double *dx);
+/* obtain row solution information */
+
+int lpx_get_col_stat(LPX *lp, int j);
+/* retrieve column status (basic solution) */
+
+double lpx_get_col_prim(LPX *lp, int j);
+/* retrieve column primal value (basic solution) */
+
+double lpx_get_col_dual(glp_prob *lp, int j);
+/* retrieve column dual value (basic solution) */
+
+void lpx_get_col_info(LPX *lp, int j, int *tagx, double *vx,
+      double *dx);
+/* obtain column solution information (obsolete) */
+
+int lpx_get_ray_info(LPX *lp);
+/* determine what causes primal unboundness */
+
+void lpx_check_kkt(LPX *lp, int scaled, LPXKKT *kkt);
+/* check Karush-Kuhn-Tucker conditions */
+
+int lpx_warm_up(LPX *lp);
+/* "warm up" LP basis */
+
+int lpx_eval_tab_row(LPX *lp, int k, int ind[], double val[]);
+/* compute row of the simplex table */
+
+int lpx_eval_tab_col(LPX *lp, int k, int ind[], double val[]);
+/* compute column of the simplex table */
+
+int lpx_transform_row(LPX *lp, int len, int ind[], double val[]);
+/* transform explicitly specified row */
+
+int lpx_transform_col(LPX *lp, int len, int ind[], double val[]);
+/* transform explicitly specified column */
+
+int lpx_prim_ratio_test(LPX *lp, int len, const int ind[],
+      const double val[], int how, double tol);
+/* perform primal ratio test */
+
+int lpx_dual_ratio_test(LPX *lp, int len, const int ind[],
+      const double val[], int how, double tol);
+/* perform dual ratio test */
+
+int lpx_interior(LPX *lp);
+/* easy-to-use driver to the interior point method */
+
+int lpx_ipt_status(LPX *lp);
+/* retrieve status of interior-point solution */
+
+double lpx_ipt_obj_val(LPX *lp);
+/* retrieve objective value (interior point) */
+
+double lpx_ipt_row_prim(LPX *lp, int i);
+/* retrieve row primal value (interior point) */
+
+double lpx_ipt_row_dual(LPX *lp, int i);
+/* retrieve row dual value (interior point) */
+
+double lpx_ipt_col_prim(LPX *lp, int j);
+/* retrieve column primal value (interior point) */
+
+double lpx_ipt_col_dual(LPX *lp, int j);
+/* retrieve column dual value (interior point) */
+
+void lpx_set_class(LPX *lp, int klass);
+/* set problem class */
+
+int lpx_get_class(LPX *lp);
+/* determine problem klass */
+
+void lpx_set_col_kind(LPX *lp, int j, int kind);
+/* set (change) column kind */
+
+int lpx_get_col_kind(LPX *lp, int j);
+/* retrieve column kind */
+
+int lpx_get_num_int(LPX *lp);
+/* retrieve number of integer columns */
+
+int lpx_get_num_bin(LPX *lp);
+/* retrieve number of binary columns */
+
+int lpx_integer(LPX *lp);
+/* easy-to-use driver to the branch-and-bound method */
+
+int lpx_intopt(LPX *lp);
+/* easy-to-use driver to the branch-and-bound method */
+
+int lpx_mip_status(LPX *lp);
+/* retrieve status of MIP solution */
+
+double lpx_mip_obj_val(LPX *lp);
+/* retrieve objective value (MIP solution) */
+
+double lpx_mip_row_val(LPX *lp, int i);
+/* retrieve row value (MIP solution) */
+
+double lpx_mip_col_val(LPX *lp, int j);
+/* retrieve column value (MIP solution) */
+
+void lpx_check_int(LPX *lp, LPXKKT *kkt);
+/* check integer feasibility conditions */
+
+void lpx_reset_parms(LPX *lp);
+/* reset control parameters to default values */
+
+void lpx_set_int_parm(LPX *lp, int parm, int val);
+/* set (change) integer control parameter */
+
+int lpx_get_int_parm(LPX *lp, int parm);
+/* query integer control parameter */
+
+void lpx_set_real_parm(LPX *lp, int parm, double val);
+/* set (change) real control parameter */
+
+double lpx_get_real_parm(LPX *lp, int parm);
+/* query real control parameter */
+
+LPX *lpx_read_mps(const char *fname);
+/* read problem data in fixed MPS format */
+
+int lpx_write_mps(LPX *lp, const char *fname);
+/* write problem data in fixed MPS format */
+
+int lpx_read_bas(LPX *lp, const char *fname);
+/* read LP basis in fixed MPS format */
+
+int lpx_write_bas(LPX *lp, const char *fname);
+/* write LP basis in fixed MPS format */
+
+LPX *lpx_read_freemps(const char *fname);
+/* read problem data in free MPS format */
+
+int lpx_write_freemps(LPX *lp, const char *fname);
+/* write problem data in free MPS format */
+
+LPX *lpx_read_cpxlp(const char *fname);
+/* read problem data in CPLEX LP format */
+
+int lpx_write_cpxlp(LPX *lp, const char *fname);
+/* write problem data in CPLEX LP format */
+
+LPX *lpx_read_model(const char *model, const char *data,
+      const char *output);
+/* read LP/MIP model written in GNU MathProg language */
+
+int lpx_print_prob(LPX *lp, const char *fname);
+/* write problem data in plain text format */
+
+int lpx_print_sol(LPX *lp, const char *fname);
+/* write LP problem solution in printable format */
+
+int lpx_print_sens_bnds(LPX *lp, const char *fname);
+/* write bounds sensitivity information */
+
+int lpx_print_ips(LPX *lp, const char *fname);
+/* write interior point solution in printable format */
+
+int lpx_print_mip(LPX *lp, const char *fname);
+/* write MIP problem solution in printable format */
+
+int lpx_is_b_avail(LPX *lp);
+/* check if LP basis is available */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+#endif
+/* eof */
Index: cvxopt-1.1.4/src/setup.py
===================================================================
--- cvxopt-1.1.4.orig/src/setup.py
+++ cvxopt-1.1.4/src/setup.py
@@ -63,7 +63,7 @@ if BUILD_GLPK:
     glpk = Extension('glpk', libraries = ['glpk'],
         include_dirs = [ GLPK_INC_DIR ],
         library_dirs = [ GLPK_LIB_DIR ],
-        sources = ['C/glpk.c'] )
+        sources = ['C/glpk.c', 'C/lpx.c'] )
     extmods += [glpk];
 
 if BUILD_DSDP: