File: glplpx.h

package info (click to toggle)
glpk 4.11-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,724 kB
  • ctags: 3,683
  • sloc: ansic: 39,762; sh: 330; makefile: 136
file content (1314 lines) | stat: -rw-r--r-- 50,228 bytes parent folder | download | duplicates (2)
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
/* glplpx.h (LP/MIP problem object) */

/*----------------------------------------------------------------------
-- This code is part of GNU Linear Programming Kit (GLPK).
--
-- Copyright (C) 2000, 01, 02, 03, 04, 05, 06 Andrew Makhorin,
-- Department for Applied Informatics, Moscow Aviation Institute,
-- Moscow, Russia. All rights reserved. E-mail: <mao@mai2.rcnet.ru>.
--
-- GLPK is free software; you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2, or (at your option)
-- any later version.
--
-- GLPK is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-- License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with GLPK; see the file COPYING. If not, write to the Free
-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-- 02110-1301, USA.
----------------------------------------------------------------------*/

#ifndef _GLPLPX_H
#define _GLPLPX_H

#include "glpavl.h"
#include "glpbfi.h"
#include "glpstr.h"

#define lpx_create_prob       glp_lpx_create_prob
#define lpx_set_prob_name     glp_lpx_set_prob_name
#define lpx_set_class         glp_lpx_set_class
#define lpx_set_obj_name      glp_lpx_set_obj_name
#define lpx_set_obj_dir       glp_lpx_set_obj_dir
#define lpx_add_rows          glp_lpx_add_rows
#define lpx_add_cols          glp_lpx_add_cols
#define lpx_set_row_name      glp_lpx_set_row_name
#define lpx_set_col_name      glp_lpx_set_col_name
#define lpx_set_col_kind      glp_lpx_set_col_kind
#define lpx_set_row_bnds      glp_lpx_set_row_bnds
#define lpx_set_col_bnds      glp_lpx_set_col_bnds
#define lpx_set_obj_coef      glp_lpx_set_obj_coef
#define lpx_set_mat_row       glp_lpx_set_mat_row
#define lpx_set_mat_col       glp_lpx_set_mat_col
#define lpx_load_matrix       glp_lpx_load_matrix
#define lpx_order_matrix      glp_lpx_order_matrix
#define lpx_set_rii           glp_lpx_set_rii
#define lpx_set_sjj           glp_lpx_set_sjj
#define lpx_set_row_stat      glp_lpx_set_row_stat
#define lpx_set_col_stat      glp_lpx_set_col_stat
#define lpx_del_rows          glp_lpx_del_rows
#define lpx_del_cols          glp_lpx_del_cols
#define lpx_delete_prob       glp_lpx_delete_prob
#if 1 /* 15/VIII-2004 */
#define lpx_create_index      glp_lpx_create_index
#define lpx_find_row          glp_lpx_find_row
#define lpx_find_col          glp_lpx_find_col
#define lpx_delete_index      glp_lpx_delete_index
#endif
#define lpx_put_lp_basis      glp_lpx_put_lp_basis
#define lpx_put_solution      glp_lpx_put_solution
#define lpx_put_ray_info      glp_lpx_put_ray_info
#define lpx_put_ipt_soln      glp_lpx_put_ipt_soln
#define lpx_put_mip_soln      glp_lpx_put_mip_soln

#define lpx_get_prob_name     glp_lpx_get_prob_name
#define lpx_get_class         glp_lpx_get_class
#define lpx_get_obj_name      glp_lpx_get_obj_name
#define lpx_get_obj_dir       glp_lpx_get_obj_dir
#define lpx_get_num_rows      glp_lpx_get_num_rows
#define lpx_get_num_cols      glp_lpx_get_num_cols
#define lpx_get_num_int       glp_lpx_get_num_int
#define lpx_get_num_bin       glp_lpx_get_num_bin
#define lpx_get_row_name      glp_lpx_get_row_name
#define lpx_get_col_name      glp_lpx_get_col_name
#define lpx_get_col_kind      glp_lpx_get_col_kind
#define lpx_get_row_type      glp_lpx_get_row_type
#define lpx_get_row_lb        glp_lpx_get_row_lb
#define lpx_get_row_ub        glp_lpx_get_row_ub
#define lpx_get_col_type      glp_lpx_get_col_type
#define lpx_get_col_lb        glp_lpx_get_col_lb
#define lpx_get_col_ub        glp_lpx_get_col_ub
#define lpx_get_obj_coef      glp_lpx_get_obj_coef
#define lpx_get_num_nz        glp_lpx_get_num_nz
#define lpx_get_mat_row       glp_lpx_get_mat_row
#define lpx_get_mat_col       glp_lpx_get_mat_col
#define lpx_get_rii           glp_lpx_get_rii
#define lpx_get_sjj           glp_lpx_get_sjj
#define lpx_is_b_avail        glp_lpx_is_b_avail
#define lpx_get_b_info        glp_lpx_get_b_info
#define lpx_get_row_b_ind     glp_lpx_get_row_b_ind
#define lpx_get_col_b_ind     glp_lpx_get_col_b_ind
#define lpx_access_inv        glp_lpx_access_inv
#define lpx_get_status        glp_lpx_get_status
#define lpx_get_prim_stat     glp_lpx_get_prim_stat
#define lpx_get_dual_stat     glp_lpx_get_dual_stat
#define lpx_get_obj_val       glp_lpx_get_obj_val
#define lpx_get_row_stat      glp_lpx_get_row_stat
#define lpx_get_row_prim      glp_lpx_get_row_prim
#define lpx_get_row_dual      glp_lpx_get_row_dual
#define lpx_get_col_stat      glp_lpx_get_col_stat
#define lpx_get_col_prim      glp_lpx_get_col_prim
#define lpx_get_col_dual      glp_lpx_get_col_dual
#define lpx_get_ray_info      glp_lpx_get_ray_info
#define lpx_ipt_status        glp_lpx_ipt_status
#define lpx_ipt_obj_val       glp_lpx_ipt_obj_val
#define lpx_ipt_row_prim      glp_lpx_ipt_row_prim
#define lpx_ipt_row_dual      glp_lpx_ipt_row_dual
#define lpx_ipt_col_prim      glp_lpx_ipt_col_prim
#define lpx_ipt_col_dual      glp_lpx_ipt_col_dual
#define lpx_mip_status        glp_lpx_mip_status
#define lpx_mip_obj_val       glp_lpx_mip_obj_val
#define lpx_mip_row_val       glp_lpx_mip_row_val
#define lpx_mip_col_val       glp_lpx_mip_col_val
#define lpx_get_row_bnds      glp_lpx_get_row_bnds       /* obsolete */
#define lpx_get_col_bnds      glp_lpx_get_col_bnds       /* obsolete */
#define lpx_get_row_info      glp_lpx_get_row_info       /* obsolete */
#define lpx_get_col_info      glp_lpx_get_col_info       /* obsolete */

#define lpx_reset_parms       glp_lpx_reset_parms
#define lpx_set_int_parm      glp_lpx_set_int_parm
#define lpx_get_int_parm      glp_lpx_get_int_parm
#define lpx_set_real_parm     glp_lpx_set_real_parm
#define lpx_get_real_parm     glp_lpx_get_real_parm

#define lpx_scale_prob        glp_lpx_scale_prob
#define lpx_unscale_prob      glp_lpx_unscale_prob

#define lpx_std_basis         glp_lpx_std_basis
#define lpx_adv_basis         glp_lpx_adv_basis
#define lpx_cpx_basis         glp_lpx_cpx_basis

#define lpx_simplex           glp_lpx_simplex
#define lpx_check_kkt         glp_lpx_check_kkt
#define lpx_interior          glp_lpx_interior
#define lpx_integer           glp_lpx_integer
#define lpx_check_int         glp_lpx_check_int
#define lpx_intopt            glp_lpx_intopt
#define lpx_primal            glp_lpx_primal

#define lpx_invert            glp_lpx_invert
#define lpx_ftran             glp_lpx_ftran
#define lpx_btran             glp_lpx_btran
#define lpx_eval_b_prim       glp_lpx_eval_b_prim
#define lpx_eval_b_dual       glp_lpx_eval_b_dual
#define lpx_warm_up           glp_lpx_warm_up
#define lpx_eval_tab_row      glp_lpx_eval_tab_row
#define lpx_eval_tab_col      glp_lpx_eval_tab_col
#define lpx_transform_row     glp_lpx_transform_row
#define lpx_transform_col     glp_lpx_transform_col
#define lpx_prim_ratio_test   glp_lpx_prim_ratio_test
#define lpx_dual_ratio_test   glp_lpx_dual_ratio_test

#define lpx_remove_tiny       glp_lpx_remove_tiny
#define lpx_reduce_form       glp_lpx_reduce_form
#define lpx_eval_row          glp_lpx_eval_row
#define lpx_eval_degrad       glp_lpx_eval_degrad
#define lpx_gomory_cut        glp_lpx_gomory_cut
#define lpx_cover_cut         glp_lpx_cover_cut

#if 1 /* 19/IV-2006 */
#define lpx_create_cog        glp_lpx_create_cog
#define lpx_add_cog_edge      glp_lpx_add_cog_edge
#define lpx_clique_cut        glp_lpx_clique_cut
#define lpx_delete_cog        glp_lpx_delete_cog
#endif

#define lpx_read_mps          glp_lpx_read_mps
#define lpx_write_mps         glp_lpx_write_mps
#define lpx_read_bas          glp_lpx_read_bas
#define lpx_write_bas         glp_lpx_write_bas
#define lpx_read_freemps      glp_lpx_read_freemps
#define lpx_write_freemps     glp_lpx_write_freemps
#define lpx_print_prob        glp_lpx_print_prob
#define lpx_print_sol         glp_lpx_print_sol
#define lpx_print_ips         glp_lpx_print_ips
#define lpx_print_mip         glp_lpx_print_mip
#define lpx_print_sens_bnds   glp_lpx_print_sens_bnds
#define lpx_read_cpxlp        glp_lpx_read_cpxlp
#define lpx_write_cpxlp       glp_lpx_write_cpxlp
#define lpx_extract_prob      glp_lpx_extract_prob
#define lpx_read_model        glp_lpx_read_model
#define lpx_read_prob         glp_lpx_read_prob
#define lpx_write_prob        glp_lpx_write_prob

/*----------------------------------------------------------------------
-- The structure LPX is an LP/MIP problem object, which corresponds to
-- the following problem statement:
--
--    minimize (or maximize)
--
--       Z = c[1]*x[m+1] + c[2]*x[m+2] + ... + c[n]*x[m+n] + c[0]    (1)
--
--    subject to linear constraints
--
--       x[1] = a[1,1]*x[m+1] + a[1,2]*x[m+1] + ... + a[1,n]*x[m+n]
--       x[2] = a[2,1]*x[m+1] + a[2,2]*x[m+1] + ... + a[2,n]*x[m+n]  (2)
--                . . . . . .
--       x[m] = a[m,1]*x[m+1] + a[m,2]*x[m+1] + ... + a[m,n]*x[m+n]
--
--    and bounds of variables
--
--         l[1] <= x[1]   <= u[1]
--         l[2] <= x[2]   <= u[2]                                    (3)
--             . . . . . .
--       l[m+n] <= x[m+n] <= u[m+n]
--
-- where:
-- x[1], ..., x[m]      - rows (auxiliary variables);
-- x[m+1], ..., x[m+n]  - columns (structural variables);
-- Z                    - objective function;
-- c[1], ..., c[n]      - coefficients of the objective function;
-- c[0]                 - constant term of the objective function;
-- a[1,1], ..., a[m,n]  - constraint coefficients;
-- l[1], ..., l[m+n]    - lower bounds of variables;
-- u[1], ..., u[m+n]    - upper bounds of variables.
--
-- Using vector-matrix notations the LP problem (1)-(3) can be written
-- as follows:
--
--    minimize (or maximize)
--
--       Z = c * x + c[0]                                            (4)
--
--    subject to linear constraints
--
--       xR = A * xS                                                 (5)
--
--    and bounds of variables
--
--       l <= x <= u                                                 (6)
--
-- where:
-- xR                   - vector of auxiliary variables;
-- xS                   - vector of structural variables;
-- x = (xR, xS)         - vector of all variables;
-- c                    - vector of objective coefficients;
-- A                    - constraint matrix (has m rows and n columns);
-- l                    - vector of lower bounds of variables;
-- u                    - vector of upper bounds of variables.
--
-- The system of constraints (5) can be written in homogeneous form as
-- follows:
--
--    A~ * x = 0,                                                    (7)
--
-- where
--
--    A~ = (I | -A)                                                  (8)
--
-- is an augmented constraint matrix (has m rows and m+n columns), I is
-- the unity matrix of the order m. Note that in the structure LPX only
-- the original constraint matrix A is explicitly stored.
--
-- The current basis is defined by partitioning columns of the matrix
-- A~ into basic and non-basic ones, in which case the system (7) can
-- be written as
--
--    B * xB + N * xN = 0,                                           (9)
--
-- where B is a square non-sigular mxm matrix built of basic columns
-- and called the basis matrix, N is a mxn matrix built of non-basic
-- columns, xB is vector of basic variables, xN is vector of non-basic
-- variables.
--
-- Using the partitioning (9) the LP problem (4)-(6) can be written in
-- a form, which defines components of the corresponding basic solution
-- and is called the simplex table:
--
--    Z = d * xN + c[0]                                             (10)
--
--    xB = A^ * xN                                                  (11)
--
--    lB <= xB <= uB                                                (12)
--
--    lN <= xN <= uN                                                (13)
--
-- where:
--
--    A^ = (alfa[i,j]) = - inv(B) * N                               (14)
--
-- is the mxn matrix of influence coefficients;
--
--    d = (d[j]) = cN - N' * pi                                     (15)
--
-- is the vector of reduced costs of non-basic variables; and
--
--    pi = (pi[i]) = inv(B') * cB                                   (16)
--
-- is the vector of simplex (Lagrange) multipliers, which correspond to
-- the equiality constraints (5).
--
-- Note that signs of the reduced costs d are determined by the formula
-- (15) in both cases of minimization and maximization.
--
-- The structure LPX allows scaling the problem. In the scaled problem
-- the constraint matrix is scaled and has the form:
--
--    A" = R * A * S,                                               (17)
--
-- where A is the constraint matrix of the original (unscaled) problem,
-- R and S are, respectively, diagonal scaling mxm and nxn matrices with
-- positive diagonal elements used to scale rows and columns of A.
--
-- The connection between the original and scaled components is defined
-- by (17) and expressed with the following formulae:
--
--    c"  = S * c          (objective coefficients)
--
--    xR" = R * xR         (values of auxiliary variables)
--    lR" = R * lR         (lower bounds of auxiliary variables)
--    uR" = R * uR         (upper bounds of auxiliary variables)
--
--    xS" = inv(S) * xS    (values of structural variables)
--    lS" = inv(S) * lS    (lower bounds of structural variables)
--    uS" = inv(S) * uS    (upper bounds of structural variables)
--
--    A"  = R * A * S      (constraint matrix)
--
-- Note that substitution scaled components into (4)-(6) gives the same
-- LP problem. */

typedef struct LPX LPX;
typedef struct LPXROW LPXROW;
typedef struct LPXCOL LPXCOL;
typedef struct LPXAIJ LPXAIJ;

#ifndef _GLPLPX_UNLOCK
struct LPX { int none_; };
struct LPX_LOCKED
#else
struct LPX
#endif
{     /* LP/MIP problem object */
      /*--------------------------------------------------------------*/
      /* memory management */
      DMP *row_pool;
      /* memory pool for LPXROW objects */
      DMP *col_pool;
      /* memory pool for LPXCOL objects */
      DMP *aij_pool;
      /* memory pool for LPXAIJ objects */
      DMP *str_pool;
      /* memory pool for segmented character strings */
      char *str_buf; /* char str_buf[255+1]; */
      /* working buffer to store character strings */
      /*--------------------------------------------------------------*/
      /* LP/MIP data */
      STR *name;
      /* problem name (1 to 255 chars); NULL means no name is assigned
         to the problem */
      int klass;
      /* problem class: */
#define LPX_LP          100   /* linear programming (LP) */
#define LPX_MIP         101   /* mixed integer programming (MIP) */
      STR *obj;
      /* objective function name (1 to 255 chars); NULL means no name
         is assigned to the objective function */
      int dir;
      /* optimization direction flag (objective "sense"): */
#define LPX_MIN         120   /* minimization */
#define LPX_MAX         121   /* maximization */
      double c0;
      /* constant term of the objective function ("shift") */
      int m_max;
      /* length of the array of rows (enlarged automatically) */
      int n_max;
      /* length of the array of columns (enlarged automatically) */
      int m;
      /* number of rows, 0 <= m <= m_max */
      int n;
      /* number of columns, 0 <= n <= n_max */
      LPXROW **row; /* LPXROW *row[1+m_max]; */
      /* row[0] is not used;
         row[i], 1 <= i <= m, is a pointer to i-th row */
      LPXCOL **col; /* LPXCOL *col[1+n_max]; */
      /* col[0] is not used;
         col[j], 1 <= j <= n, is a pointer to j-th column */
#if 1 /* 15/VIII-2004 */
      AVLTREE *r_tree;
      /* row index to find rows by their names; NULL means this index
         does not exist */
      AVLTREE *c_tree;
      /* column index to find columns by their names; NULL means this
         index does not exist */
#endif
      /*--------------------------------------------------------------*/
      /* LP basis */
      int b_stat;
      /* basis status: */
#define LPX_B_UNDEF     130   /* current basis is undefined */
#define LPX_B_VALID     131   /* current basis is valid */
      int *basis; /* int basis[1+m_max]; */
      /* basis header (valid only if the basis status is LPX_B_VALID):
         basis[0] is not used;
         basis[i] = k is the ordinal number of auxiliary (1 <= k <= m)
         or structural (m+1 <= k <= m+n) variable which corresponds to
         i-th basic variable xB[i], 1 <= i <= m */
      BFI *b_inv; /* BFI b_inv[1:m,1:m]; */
      /* factorization (invertable form) of the current basis matrix;
         NULL means the factorization does not exist; it is valid only
         if the basis status is LPX_B_VALID */
      /*--------------------------------------------------------------*/
      /* LP/MIP solution */
      int p_stat;
      /* 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 */
      int d_stat;
      /* 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 */
      int some;
      /* ordinal number of some auxiliary or structural variable which
         has certain property, 0 <= some <= m+n */
      int t_stat;
      /* status of interior-point solution: */
#define LPX_T_UNDEF     150   /* interior solution is undefined */
#define LPX_T_OPT       151   /* interior solution is optimal */
      int i_stat;
      /* 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 */
      /*--------------------------------------------------------------*/
      /* control parameters and statistics */
      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 - do not use the dual simplex
         1 - if the initial basic solution being primal infeasible is
             dual feasible, use the 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 */
      int it_cnt;
      /* simplex iterations count; this count is increased by one each
         time when one simplex iteration has been performed */
      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 */
#if 1 /* 07/I-2006 */
      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: */
#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_ALL       0xFF  /* all cuts */
#endif
};

struct LPXROW
{     /* LP row (auxiliary variable) */
      int i;
      /* ordinal number (1 to m) assigned to this row */
      STR *name;
      /* row name (1 to 255 chars); NULL means no name is assigned to
         this row */
#if 1 /* 15/VIII-2004 */
      AVLNODE *node;
      /* pointer to corresponding node in the row index; NULL means
         that either the row index does not exist or this row has no
         name assigned */
#endif
      int type;
      /* type of the auxiliary 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 */
      double lb; /* non-scaled */
      /* lower bound; if the row has no lower bound, lb is zero */
      double ub; /* non-scaled */
      /* upper bound; if the row has no upper bound, ub is zero */
      /* if the row type is LPX_FX, ub is equal to lb */
      LPXAIJ *ptr; /* non-scaled */
      /* pointer to doubly linked list of constraint coefficients which
         are placed in this row */
      double rii;
      /* diagonal element r[i,i] of the scaling matrix R (see (17)) for
         this row; if the scaling is not used, r[i,i] is 1 */
      int stat;
      /* status of the auxiliary 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 */
      int b_ind;
      /* if the auxiliary variable is basic (LPX_BS), lpx.basis[b_ind]
         refers to this row; if the auxiliary variable is non-basic,
         b_ind is 0; this attribute is valid only if the basis status
         is LPX_B_VALID */
      double prim; /* non-scaled */
      /* primal value of the auxiliary variable in basic solution */
      double dual; /* non-scaled */
      /* dual value of the auxiliary variable in basic solution */
      double pval; /* non-scaled */
      /* primal value of the auxiliary variable in interior solution */
      double dval; /* non-scaled */
      /* dual value of the auxiliary variable in interior solution */
      double mipx; /* non-scaled */
      /* primal value of the auxiliary variable in integer solution */
};

struct LPXCOL
{     /* LP column (structural variable) */
      int j;
      /* ordinal number (1 to n) assigned to this column */
      STR *name;
      /* column name (1 to 255 chars); NULL means no name is assigned
         to this column */
#if 1 /* 15/VIII-2004 */
      AVLNODE *node;
      /* pointer to corresponding node in the column index; NULL means
         that either the column index does not exist or the column has
         no name assigned */
#endif
      int kind;
      /* kind of the structural variable: */
#define LPX_CV          160   /* continuous variable */
#define LPX_IV          161   /* integer variable */
      int type;
      /* type of the 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 */
      double lb; /* non-scaled */
      /* lower bound; if the column has no lower bound, lb is zero */
      double ub; /* non-scaled */
      /* upper bound; if the column has no upper bound, ub is zero */
      /* if the column type is LPX_FX, ub is equal to lb */
      double coef; /* non-scaled */
      /* objective coefficient at the structural variable */
      LPXAIJ *ptr; /* non-scaled */
      /* pointer to doubly linked list of constraint coefficients which
         are placed in this column */
      double sjj;
      /* diagonal element s[j,j] of the scaling matrix S (see (17)) for
         this column; if the scaling is not used, s[j,j] is 1 */
      int stat;
      /* status of the 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 */
      int b_ind;
      /* if the structural variable is basic (LPX_BS), lpx.basis[b_ind]
         refers to this column; if the structural variable is non-basic,
         b_ind is 0; this attribute is valid only if the basis status
         is LPX_B_VALID */
      double prim; /* non-scaled */
      /* primal value of the structural variable in basic solution */
      double dual; /* non-scaled */
      /* dual value of the structural variable in basic solution */
      double pval; /* non-scaled */
      /* primal value of the structural variable in interior solution */
      double dval; /* non-scaled */
      /* dual value of the structural variable in interior solution */
      double mipx;
      /* primal value of the structural variable in integer solution */
};

struct LPXAIJ
{     /* constraint coefficient a[i,j]; see (2) and (5) */
      LPXROW *row;
      /* pointer to row, where this coefficient is placed */
      LPXCOL *col;
      /* pointer to column, where this coefficient is placed */
      double val;
      /* numeric (non-zero) value of this coefficient */
      LPXAIJ *r_prev;
      /* pointer to previous coefficient in the same row */
      LPXAIJ *r_next;
      /* pointer to next coefficient in the same row */
      LPXAIJ *c_prev;
      /* pointer to previous coefficient in the same column */
      LPXAIJ *c_next;
      /* pointer to next coefficient in the same column */
};

/* 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) */

/* 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 */

typedef struct LPXKKT LPXKKT;

struct LPXKKT
{     /* 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 */
};

/* problem creating and modifying routines ---------------------------*/

LPX *lpx_create_prob(void);
/* create problem object */

void lpx_set_prob_name(LPX *lp, char *name);
/* assign (change) problem name */

void lpx_set_class(LPX *lp, int klass);
/* set (change) problem class */

void lpx_set_obj_name(LPX *lp, 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, char *name);
/* assign (change) row name */

void lpx_set_col_name(LPX *lp, int j, char *name);
/* assign (change) column name */

void lpx_set_col_kind(LPX *lp, int j, int kind);
/* set (change) column kind */

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(LPX *lp, int j, double coef);
/* set (change) obj. coefficient or constant term */

void lpx_set_mat_row(LPX *lp, int i, int len, int ind[], double val[]);
/* set (replace) row of the constraint matrix */

void lpx_set_mat_col(LPX *lp, int j, int len, int ind[], double val[]);
/* set (replace) column of the constraint matrix */

void lpx_load_matrix(LPX *lp, int ne, int ia[], int ja[], double ar[]);
/* load (replace) the whole constraint matrix */

void lpx_order_matrix(LPX *lp);
/* order rows and columns of the constraint matrix */

void lpx_set_rii(LPX *lp, int i, double rii);
/* set (change) row scale factor */

void lpx_set_sjj(LPX *lp, int j, double sjj);
/* set (change) column scale factor */

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_del_rows(LPX *lp, int nrs, int num[]);
/* delete specified rows from problem object */

void lpx_del_cols(LPX *lp, int ncs, int num[]);
/* delete specified columns from problem object */

void lpx_delete_prob(LPX *lp);
/* delete problem object */

#if 1 /* 15/VIII-2004 */
void lpx_create_index(LPX *lp);
int lpx_find_row(LPX *lp, char *name);
int lpx_find_col(LPX *lp, char *name);
void lpx_delete_index(LPX *lp);
#endif

void lpx_put_lp_basis(LPX *lp, int b_stat, int basis[], BFI *b_inv);
/* store LP basis information */

void lpx_put_solution(LPX *lp, int p_stat, int d_stat,
      int row_stat[], double row_prim[], double row_dual[],
      int col_stat[], double col_prim[], double col_dual[]);
/* store basic solution components */

void lpx_put_ray_info(LPX *lp, int k);
/* store row/column which causes unboundness */

void lpx_put_ipt_soln(LPX *lp, int t_stat, double row_pval[],
      double row_dval[], double col_pval[], double col_dval[]);
/* store interior-point solution components */

void lpx_put_mip_soln(LPX *lp, int i_stat, double row_mipx[],
      double col_mipx[]);
/* store mixed integer solution components */

/* problem retrieving routines ---------------------------------------*/

char *lpx_get_prob_name(LPX *lp);
/* retrieve problem name */

int lpx_get_class(LPX *lp);
/* retrieve problem class */

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 */

int lpx_get_num_int(LPX *lp);
/* retrieve number of integer columns */

int lpx_get_num_bin(LPX *lp);
/* retrieve number of binary columns */

char *lpx_get_row_name(LPX *lp, int i);
/* retrieve row name */

char *lpx_get_col_name(LPX *lp, int j);
/* retrieve column name */

int lpx_get_col_kind(LPX *lp, int j);
/* retrieve column kind */

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 */

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 */

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 */

double lpx_get_rii(LPX *lp, int i);
/* retrieve row scale factor */

double lpx_get_sjj(LPX *lp, int j);
/* retrieve column scale factor */

int lpx_is_b_avail(LPX *lp);
/* check if LP basis is available */

int lpx_get_b_info(LPX *lp, int i);
/* retrieve LP basis information */

int lpx_get_row_b_ind(LPX *lp, int i);
/* retrieve row index in LP basis */

int lpx_get_col_b_ind(LPX *lp, int j);
/* retrieve column index in LP basis */

BFI *lpx_access_inv(LPX *lp);
/* access factorization of basis matrix */

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) */

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(LPX *lp, int j);
/* retrieve column dual value (basic solution) */

int lpx_get_ray_info(LPX *lp);
/* determine what causes primal unboundness */

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) */

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_get_row_bnds(LPX *lp, int i, int *typx, double *lb,
      double *ub);
/* obtain row bounds */

void lpx_get_col_bnds(LPX *lp, int j, int *typx, double *lb,
      double *ub);
/* obtain column bounds */

void lpx_get_row_info(LPX *lp, int i, int *tagx, double *vx,
      double *dx);
/* obtain row solution information */

void lpx_get_col_info(LPX *lp, int j, int *tagx, double *vx,
      double *dx);
/* obtain column solution information */

/* control parameters and statistics routines ------------------------*/

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 */

/* problem scaling routines ------------------------------------------*/

void lpx_scale_prob(LPX *lp);
/* scale problem data */

void lpx_unscale_prob(LPX *lp);
/* unscale problem data */

/* LP basis constructing routines ------------------------------------*/

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 */

/* solver routines ---------------------------------------------------*/

int lpx_simplex(LPX *lp);
/* easy-to-use driver to the simplex method */

void lpx_check_kkt(LPX *lp, int scaled, LPXKKT *kkt);
/* check Karush-Kuhn-Tucker conditions */

int lpx_interior(LPX *lp);
/* easy-to-use driver to the interior point method */

int lpx_integer(LPX *lp);
/* easy-to-use driver to the branch-and-bound method */

void lpx_check_int(LPX *lp, LPXKKT *kkt);
/* check integer feasibility conditions */

int lpx_intopt(LPX *mip);
/* easy-to-use driver to the branch-and-bound method */

int lpx_primal(LPX *lp);
/* easy-to-use driver to the primal simplex method */

/* LP basis and simplex table routines -------------------------------*/

int lpx_invert(LPX *lp);
/* compute factorization of basis matrix */

void lpx_ftran(LPX *lp, double x[]);
/* forward transformation (solve system B*x = b) */

void lpx_btran(LPX *lp, double x[]);
/* backward transformation (solve system B'*x = b) */

void lpx_eval_b_prim(LPX *lp, double row_prim[], double col_prim[]);
/* compute primal basic solution components */

void lpx_eval_b_dual(LPX *lp, double row_dual[], double col_dual[]);
/* compute dual basic solution components */

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, int ind[], double val[],
      int how, double tol);
/* perform primal ratio test */

int lpx_dual_ratio_test(LPX *lp, int len, int ind[], double val[],
      int how, double tol);
/* perform dual ratio test */

/*--------------------------------------------------------------------*/

int lpx_remove_tiny(int ne, int ia[], int ja[], double ar[],
      double eps);
/* remove zero and tiny elements */

int lpx_reduce_form(LPX *lp, int len, int ind[], double val[],
      double work[]);
/* reduce linear form */

double lpx_eval_row(LPX *lp, int len, int ind[], double val[]);
/* compute explicitly specified row */

double lpx_eval_degrad(LPX *lp, int len, int ind[], double val[],
      int type, double rhs);
/* compute degradation of the objective function */

int lpx_gomory_cut(LPX *lp, int len, int ind[], double val[],
      double work[]);
/* generate Gomory's mixed integer cut */

int lpx_cover_cut(LPX *lp, int len, int ind[], double val[],
      double work[]);
/* generate mixed cover cut */

/*--------------------------------------------------------------------*/

void *lpx_create_cog(LPX *lp);
/* create the conflict graph */

void lpx_add_cog_edge(void *cog, int i, int j);
/* add edge to the conflict graph */

int lpx_clique_cut(LPX *lp, void *cog, int ind[], double val[]);
/* generate clique cut */

void lpx_delete_cog(void *cog);
/* delete the conflict graph */

/* additional utility routines ---------------------------------------*/

LPX *lpx_read_mps(char *fname);
/* read problem data in fixed MPS format */

int lpx_write_mps(LPX *lp, char *fname);
/* write problem data in fixed MPS format */

int lpx_read_bas(LPX *lp, char *fname);
/* read LP basis in fixed MPS format */

int lpx_write_bas(LPX *lp, char *fname);
/* write LP basis in fixed MPS format */

LPX *lpx_read_freemps(char *fname);
/* read problem data in free MPS format */

int lpx_write_freemps(LPX *lp, char *fname);
/* write problem data in free MPS format */

int lpx_print_prob(LPX *lp, char *fname);
/* write problem data in plain text format */

int lpx_print_sol(LPX *lp, char *fname);
/* write LP problem solution in printable format */

int lpx_print_ips(LPX *lp, char *fname);
/* write interior point solution in printable format */

int lpx_print_mip(LPX *lp, char *fname);
/* write MIP problem solution in printable format */

int lpx_print_sens_bnds(LPX *lp, char *fname);
/* write bounds sensitivity information */

LPX *lpx_read_cpxlp(char *fname);
/* read problem data in CPLEX LP format */

int lpx_write_cpxlp(LPX *lp, char *fname);
/* write problem data in CPLEX LP format */

LPX *lpx_extract_prob(void *mpl);
/* extract problem instance from MathProg model */

LPX *lpx_read_model(char *model, char *data, char *output);
/* read LP/MIP model written in GNU MathProg language */

LPX *lpx_read_prob(char *fname);
/* read problem data in GNU LP format */

int lpx_write_prob(LPX *lp, char *fname);
/* write problem data in GNU LP format */

#endif

/* eof */