aboutsummaryrefslogtreecommitdiff
path: root/src/clp.f90
blob: 427ec559170ca1216aba73077d3b3f33b35c5d53 (plain)
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
module clp
    use iso_c_binding
    implicit none
    
        interface
        
            ! Version Routines
            function Clp_Version_C() bind(C,name="Clp_Version")
                use iso_c_binding
                    type(c_ptr) :: Clp_Version_C
            end function
            
            function Clp_VersionMajor() bind(C,name="Clp_VersionMajor")
                use iso_c_binding
                    integer(c_int) :: Clp_VersionMajor
            end function
            
            function Clp_VersionMinor() bind(C,name="Clp_VersionMinor")
                use iso_c_binding
                    integer(c_int) :: Clp_VersionMinor
            end function
            
            function Clp_VersionRelease() bind(C,name="Clp_VersionRelease")
                use iso_c_binding
                    integer(c_int) :: Clp_VersionRelease
            end function

            ! Model management
            function Clp_newModel() bind(C,name="Clp_newModel")
                use iso_c_binding
                    type(c_ptr) :: Clp_newModel
            end function
            
            subroutine Clp_deleteModel(model) bind(C,name="Clp_deleteModel")
                use iso_c_binding
                    type(c_ptr), value :: model
            end subroutine
            
            ! Solver management
            function ClpSolve_new() bind(C,name="ClpSolve_new")
                use iso_c_binding
                    type(c_ptr) :: ClpSolve_new
            end function
            
            subroutine ClpSolve_delete(solve) bind(C,name="ClpSolve_delete")
                use iso_c_binding
                    type(c_ptr), value :: solve
            end subroutine
            
            subroutine Clp_loadProblem(model,numcols,numrows,start, &
                index,value,collb,colub,obj,rowlb,rowub) bind(C,name="Clp_loadProblem")
                use iso_c_binding
                use clp_constants
                    type(c_ptr), value :: model
                    integer(c_int), value ::numcols
                    integer(c_int), value ::numrows
                    integer(CoinBigIndex_t) :: start(*)
                    integer(c_int) :: index(*)
                    real(c_double) :: value(*)
                    real(c_double) :: collb(*)
                    real(c_double) :: colub(*)
                    real(c_double) :: obj(*)
                    real(c_double) :: rowlb(*)
                    real(c_double) :: rowub(*)
            end subroutine
            
            subroutine Clp_loadQuadraticObjective(model,numberColumns, &
                start,column,element) bind(C,name="Clp_loadQuadraticObjective")
                use iso_c_binding
                use clp_constants
                    type(c_ptr), value :: model
                    integer(c_int), value ::numberColumns
                    integer(CoinBigIndex_t) :: start(*)
                    integer(c_int) :: column(*)
                    real(c_double) :: element(*)
            end subroutine
            
            function Clp_readMps_C(model,filename,keepNames,ignoreErrors) bind(C,name="Clp_readMps")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr), value :: filename
                    integer(c_int), value ::keepNames
                    integer(c_int), value ::ignoreErrors
                    integer(c_int) :: Clp_readMps_C
            end function

            subroutine Clp_copyInIntegerInformation_C(model,information) bind(C,name="Clp_copyInIntegerInformation")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr), value :: information
            end subroutine
            
            subroutine Clp_deleteIntegerInformation(model) bind(C,name="Clp_deleteIntegerInformation")
                use iso_c_binding
                    type(c_ptr), value :: model
            end subroutine
            
            subroutine Clp_resize(model,newNumberRows,newNumberColumns) bind(C,name="Clp_resize")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::newNumberRows
                    integer(c_int), value ::newNumberColumns
            end subroutine
            
            subroutine Clp_deleteRows(model,number,which) bind(C,name="Clp_deleteRows")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::number
                    integer(c_int), dimension(*) :: which
            end subroutine
            
            subroutine Clp_addRows(model,number,rowLower, &
                rowUpper,rowStarts,columns,elements) bind(C,name="Clp_addRows")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::number
                    real(c_double) :: rowLower(*)
                    real(c_double) :: rowUpper(*)
                    type(c_ptr), value :: rowStarts
                    type(c_ptr), value :: columns
                    real(c_double) :: elements(*)
            end subroutine
            
            subroutine Clp_deleteColumns(model,number,which) bind(C,name="Clp_deleteColumns")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value :: number
                    integer(kind=c_int), dimension(*) :: which
            end subroutine
            
            subroutine Clp_addColumns(model,number,columnLower,columnUpper, &
                objective,columnStarts,rows,elements) bind(C,name="Clp_addColumns")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::number
                    real(c_double) :: columnLower(*)
                    real(c_double) :: columnUpper(*)
                    real(c_double) :: objective(*)
                    integer(c_long) :: columnStarts(*)
                    integer(c_int) :: rows(*)
                    real(c_double) :: elements(*)
            end subroutine
            
            subroutine Clp_chgRowLower(model,rowLower) bind(C,name="Clp_chgRowLower")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: rowLower(*)
            end subroutine
            
            subroutine Clp_chgRowUpper(model,rowUpper) bind(C,name="Clp_chgRowUpper")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: rowUpper(*)
            end subroutine
            
            subroutine Clp_chgColumnLower(model,columnLower) bind(C,name="Clp_chgColumnLower")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: columnLower(*)
            end subroutine
            
            subroutine Clp_chgColumnUpper(model,columnUpper) bind(C,name="Clp_chgColumnUpper")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: columnUpper(*)
            end subroutine
            
            subroutine Clp_chgObjCoefficients(model,objIn) bind(C,name="Clp_chgObjCoefficients")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: objIn(*)
            end subroutine
            
            subroutine Clp_dropNames(model) bind(C,name="Clp_dropNames")
                use iso_c_binding
                    type(c_ptr), value :: model
            end subroutine

            subroutine Clp_copyNames_C(model,rowNames,columnNames) bind(C,name="Clp_copyNames")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr), value :: rowNames
                    type(c_ptr), value :: columnNames
            end subroutine 
            
            function Clp_numberRows(model) bind(C,name="Clp_numberRows")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_numberRows
            end function
            
            function Clp_numberColumns(model) bind(C,name="Clp_numberColumns")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_numberColumns
            end function
            
            function Clp_primalTolerance(model) bind(C,name="Clp_primalTolerance")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: Clp_primalTolerance
            end function
            
            subroutine Clp_setPrimalTolerance(model,value) bind(C,name="Clp_setPrimalTolerance")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double), value :: value
            end subroutine
            
            function Clp_dualTolerance(model) bind(C,name="Clp_dualTolerance")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: Clp_dualTolerance
            end function
            
            subroutine Clp_setDualTolerance(model,value) bind(C,name="Clp_setDualTolerance")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double), value :: value
            end subroutine
            
            function Clp_dualObjectiveLimit(model) bind(C,name="Clp_dualObjectiveLimit")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: Clp_dualObjectiveLimit
            end function
            
            subroutine Clp_setDualObjectiveLimit(model,value) bind(C,name="Clp_setDualObjectiveLimit")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double), value :: value
            end subroutine
            
            function Clp_objectiveOffset(model) bind(C,name="Clp_objectiveOffset")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: Clp_objectiveOffset
            end function
            
            subroutine Clp_setObjectiveOffset(model,value) bind(C,name="Clp_setObjectiveOffset")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double), value :: value
            end subroutine
            
            subroutine Clp_problemName_C(model,maxNumberCharacters,array) bind(C,name="Clp_problemName")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::maxNumberCharacters
                    type(c_ptr), value :: array
            end subroutine
            
            function Clp_setProblemName_C(model,maxNumberCharacters,array) bind(C,name="Clp_setProblemName")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::maxNumberCharacters
                    type(c_ptr) :: array
                    integer(c_int) :: Clp_setProblemName_C
            end function
            
            function Clp_numberIterations(model) bind(C,name="Clp_numberIterations")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_numberIterations
            end function
            
            subroutine Clp_setNumberIterations(model,numberIterations) bind(C,name="Clp_setNumberIterations")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::numberIterations
            end subroutine
            
            function maximumIterations(model) bind(C,name="maximumIterations")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: maximumIterations
            end function
            
            subroutine Clp_setMaximumIterations(model,value) bind(C,name="Clp_setMaximumIterations")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::value
            end subroutine
            
            function Clp_maximumSeconds(model) bind(C,name="Clp_maximumSeconds")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: Clp_maximumSeconds
            end function
            
            subroutine Clp_setMaximumSeconds(model,value) bind(C,name="Clp_setMaximumSeconds")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double), value :: value
            end subroutine
            
            function Clp_hitMaximumIterations(model) bind(C,name="Clp_hitMaximumIterations")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_hitMaximumIterations
            end function
            
            function Clp_status(model) bind(C,name="Clp_status")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_status
            end function
            
            subroutine Clp_setProblemStatus(model,problemStatus) bind(C,name="Clp_setProblemStatus")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::problemStatus
            end subroutine
            
            function Clp_secondaryStatus(model) bind(C,name="Clp_secondaryStatus")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_secondaryStatus
            end function
            
            subroutine Clp_setSecondaryStatus(model,status) bind(C,name="Clp_setSecondaryStatus")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::status
            end subroutine
            
            function Clp_optimizationDirection(model) bind(C,name="Clp_optimizationDirection")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: Clp_optimizationDirection
            end function
            
            subroutine Clp_setOptimizationDirection(model,value) bind(C,name="Clp_setOptimizationDirection")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double), value :: value
            end subroutine
            
            function Clp_primalRowSolution_C(model) bind(C,name="Clp_primalRowSolution")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_primalRowSolution_C
            end function
            
            function Clp_primalColumnSolution_C(model) bind(C,name="Clp_primalColumnSolution")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_primalColumnSolution_C
            end function
            
            function Clp_dualRowSolution_C(model) bind(C,name="Clp_dualRowSolution")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_dualRowSolution_C
            end function
            
            function Clp_dualColumnSolution_C(model) bind(C,name="Clp_dualColumnSolution")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_dualColumnSolution_C
            end function
            
            function Clp_rowLower_C(model) bind(C,name="Clp_rowLower")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_rowLower_C
            end function
            
            function Clp_rowUpper_C(model) bind(C,name="Clp_rowUpper")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_rowUpper_C
            end function
            
            function Clp_objective_C(model) bind(C,name="Clp_objective")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_objective_C
            end function
            
            function Clp_columnLower_C(model) bind(C,name="Clp_columnLower")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_columnLower_C
            end function
            
            function Clp_columnUpper_C(model) bind(C,name="Clp_columnUpper")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_columnUpper_C
            end function
            
            function Clp_getNumElements(model) bind(C,name="Clp_getNumElements")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_getNumElements
            end function
            
            function Clp_getVectorStarts_C(model) bind(C,name="Clp_getVectorStarts")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getVectorStarts_C
            end function
            function Clp_getIndices(model) bind(C,name="Clp_getIndices")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getIndices
            end function
            function Clp_getVectorLengths(model) bind(C,name="Clp_getVectorLengths")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getVectorLengths
            end function
            function Clp_getElements(model) bind(C,name="Clp_getElements")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getElements
            end function
            function Clp_objectiveValue(model) bind(C,name="Clp_objectiveValue")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: Clp_objectiveValue
            end function
            
            function Clp_integerInformation_C(model) bind(C,name="Clp_integerInformation")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_integerInformation_C
            end function
            
            function Clp_infeasibilityRay_C(model) bind(C,name="Clp_infeasibilityRay")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_infeasibilityRay_C
            end function
            
            function Clp_unboundedRay_C(model) bind(C,name="Clp_unboundedRay")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_unboundedRay_C
            end function
            
            subroutine Clp_freeRay_C(model,ray) bind(C,name="Clp_freeRay")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr), value :: ray
            end subroutine
            
            function Clp_statusExists(model) bind(C,name="Clp_statusExists")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_statusExists
            end function
            function Clp_statusArray(model) bind(C,name="Clp_statusArray")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_statusArray
            end function
            subroutine Clp_copyinStatus(model,statusArray) bind(C,name="Clp_copyinStatus")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr), value :: statusArray
            end subroutine
            function Clp_getColumnStatus(model,sequence) bind(C,name="Clp_getColumnStatus")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::sequence
                    integer(c_int) :: Clp_getColumnStatus
            end function
            function Clp_getRowStatus(model,sequence) bind(C,name="Clp_getRowStatus")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::sequence
                    integer(c_int) :: Clp_getRowStatus
            end function
            subroutine Clp_setColumnStatus(model,sequence,value) bind(C,name="Clp_setColumnStatus")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::sequence
                    integer(c_int), value ::value
            end subroutine
            subroutine Clp_setRowStatus(model,sequence,value) bind(C,name="Clp_setRowStatus")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::sequence
                    integer(c_int), value ::value
            end subroutine
            subroutine Clp_setUserPointer(model,pointer) bind(C,name="Clp_setUserPointer")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr), value :: pointer
            end subroutine
            subroutine Clp_getUserPointer(model) bind(C,name="Clp_getUserPointer")
                use iso_c_binding
                    type(c_ptr) :: model
            end subroutine
            subroutine Clp_registerCallBack(model,userCallBack) bind(C,name="Clp_registerCallBack")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr), value :: userCallBack
            end subroutine
            subroutine Clp_clearCallBack(model) bind(C,name="Clp_clearCallBack")
                use iso_c_binding
                    type(c_ptr), value :: model
            end subroutine
            subroutine Clp_setLogLevel(model,value) bind(C,name="Clp_setLogLevel")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::value
            end subroutine
            function Clp_logLevel(model) bind(C,name="Clp_logLevel")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_logLevel
            end function
            function Clp_lengthNames(model) bind(C,name="Clp_lengthNames")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_lengthNames
            end function
            subroutine Clp_rowName_C(model,iRow,np) bind(C,name="Clp_rowName")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::iRow
                    type(c_ptr), value :: np
            end subroutine
            subroutine Clp_columnName_C(model,iColumn,np) bind(C,name="Clp_columnName")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::iColumn
                    type(c_ptr), value :: np
            end subroutine
            function Clp_initialSolve(model) bind(C,name="Clp_initialSolve")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_initialSolve
            end function
            function Clp_initialSolveWithOptions(model,solver) bind(C,name="Clp_initialSolveWithOptions")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr), value :: solver
                    integer(c_int) :: Clp_initialSolveWithOptions
            end function
            function Clp_initialDualSolve(model) bind(C,name="Clp_initialDualSolve")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_initialDualSolve
            end function
            function Clp_initialPrimalSolve(model) bind(C,name="Clp_initialPrimalSolve")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_initialPrimalSolve
            end function
            function Clp_initialBarrierSolve(model) bind(C,name="Clp_initialBarrierSolve")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_initialBarrierSolve
            end function
            function Clp_initialBarrierNoCrossSolve(model) bind(C,name="Clp_initialBarrierNoCrossSolve")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_initialBarrierNoCrossSolve
            end function
            function Clp_dual(model,ifValuesPass) bind(C,name="Clp_dual")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::ifValuesPass
                    integer(c_int) :: Clp_dual
            end function
            function Clp_primal(model,ifValuesPass) bind(C,name="Clp_primal")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::ifValuesPass
                    integer(c_int) :: Clp_primal
            end function
            subroutine Clp_idiot(model,tryhard) bind(C,name="Clp_idiot")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::tryhard
            end subroutine
            subroutine Clp_scaling(model,mode) bind(C,name="Clp_scaling")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::mode
            end subroutine
            function Clp_scalingFlag(model) bind(C,name="Clp_scalingFlag")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_scalingFlag
            end function
            function Clp_crash(model,gap,pivot) bind(C,name="Clp_crash")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double), value :: gap
                    integer(c_int), value ::pivot
                    integer(c_int) :: Clp_crash
            end function
            function Clp_primalFeasible(model) bind(C,name="Clp_primalFeasible")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_primalFeasible
            end function
            function Clp_dualFeasible(model) bind(C,name="Clp_dualFeasible")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_dualFeasible
            end function
            function Clp_dualBound(model) bind(C,name="Clp_dualBound")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: Clp_dualBound
            end function
            subroutine Clp_setDualBound(model,value) bind(C,name="Clp_setDualBound")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double), value :: value
            end subroutine
            function Clp_infeasibilityCost(model) bind(C,name="Clp_infeasibilityCost")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: Clp_infeasibilityCost
            end function
            subroutine Clp_setInfeasibilityCost(model,value) bind(C,name="Clp_setInfeasibilityCost")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double), value :: value
            end subroutine
            function Clp_perturbation(model) bind(C,name="Clp_perturbation")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_perturbation
            end function
            subroutine Clp_setPerturbation(model,value) bind(C,name="Clp_setPerturbation")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::value
            end subroutine
            function Clp_algorithm(model) bind(C,name="Clp_algorithm")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_algorithm
            end function
            subroutine Clp_setAlgorithm(model,value) bind(C,name="Clp_setAlgorithm")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::value
            end subroutine
            function Clp_sumDualInfeasibilities(model) bind(C,name="Clp_sumDualInfeasibilities")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: Clp_sumDualInfeasibilities
            end function
            function Clp_numberDualInfeasibilities(model) bind(C,name="Clp_numberDualInfeasibilities")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_numberDualInfeasibilities
            end function
            function Clp_sumPrimalInfeasibilities(model) bind(C,name="Clp_sumPrimalInfeasibilities")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: Clp_sumPrimalInfeasibilities
            end function
            function Clp_numberPrimalInfeasibilities(model) bind(C,name="Clp_numberPrimalInfeasibilities")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_numberPrimalInfeasibilities
            end function
            
            function Clp_saveModel_C(model,fileName) bind(C,name="Clp_saveModel")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr), value :: fileName
                    integer(c_int) :: Clp_saveModel_C
            end function
            
            function Clp_restoreModel_C(model,fileName) bind(C,name="Clp_restoreModel")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr), value :: fileName
                    integer(c_int) :: Clp_restoreModel_C
            end function
            
            subroutine Clp_checkSolution(model) bind(C,name="Clp_checkSolution")
                use iso_c_binding
                    type(c_ptr), value :: model
            end subroutine
            function Clp_getNumRows(model) bind(C,name="Clp_getNumRows")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_getNumRows
            end function
            function Clp_getNumCols(model) bind(C,name="Clp_getNumCols")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_getNumCols
            end function
            function Clp_getIterationCount(model) bind(C,name="Clp_getIterationCount")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_getIterationCount
            end function
            function Clp_isAbandoned(model) bind(C,name="Clp_isAbandoned")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_isAbandoned
            end function
            function Clp_isProvenOptimal(model) bind(C,name="Clp_isProvenOptimal")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_isProvenOptimal
            end function
            function Clp_isProvenPrimalInfeasible(model) bind(C,name="Clp_isProvenPrimalInfeasible")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_isProvenPrimalInfeasible
            end function
            function Clp_isProvenDualInfeasible(model) bind(C,name="Clp_isProvenDualInfeasible")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_isProvenDualInfeasible
            end function
            function Clp_isPrimalObjectiveLimitReached(model) bind(C,name="Clp_isPrimalObjectiveLimitReached")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_isPrimalObjectiveLimitReached
            end function
            function Clp_isDualObjectiveLimitReached(model) bind(C,name="Clp_isDualObjectiveLimitReached")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_isDualObjectiveLimitReached
            end function
            function Clp_isIterationLimitReached(model) bind(C,name="Clp_isIterationLimitReached")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int) :: Clp_isIterationLimitReached
            end function
            function Clp_getObjSense(model) bind(C,name="Clp_getObjSense")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: Clp_getObjSense
            end function
            subroutine Clp_setObjSense(model,objsen) bind(C,name="Clp_setObjSense")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double), value :: objsen
            end subroutine
            
            function Clp_getRowActivity_C(model) bind(C,name="Clp_getRowActivity")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getRowActivity_C
            end function
            
            function Clp_getColSolution_C(model) bind(C,name="Clp_getColSolution")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getColSolution_C
            end function
            
            subroutine Clp_setColSolution(model,input) bind(C,name="Clp_setColSolution")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: input(*)
            end subroutine
            
            function Clp_getRowPrice_C(model) bind(C,name="Clp_getRowPrice")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getRowPrice_C
            end function
            
            function Clp_getReducedCost_C(model) bind(C,name="Clp_getReducedCost")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getReducedCost_C
            end function
            
            function Clp_getRowLower_C(model) bind(C,name="Clp_getRowLower")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getRowLower_C
            end function
            
            function Clp_getRowUpper_C(model) bind(C,name="Clp_getRowUpper")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getRowUpper_C
            end function
            
            function Clp_getObjCoefficients_C(model) bind(C,name="Clp_getObjCoefficients")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getObjCoefficients_C
            end function
            
            function Clp_getColLower_C(model) bind(C,name="Clp_getColLower")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getColLower_C
            end function
            
            function Clp_getColUpper_C(model) bind(C,name="Clp_getColUpper")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getColUpper_C
            end function
            
            function Clp_getObjValue(model) bind(C,name="Clp_getObjValue")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: Clp_getObjValue
            end function
            
            subroutine Clp_printModel_C(model,prefix) bind(C,name="Clp_printModel")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr), value :: prefix
            end subroutine
            
            function Clp_getSmallElementValue(model) bind(C,name="Clp_getSmallElementValue")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: Clp_getSmallElementValue
            end function
            subroutine Clp_setSmallElementValue(model,value) bind(C,name="Clp_setSmallElementValue")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double), value :: value
            end subroutine
            subroutine ClpSolve_setSpecialOption(solver,which,value,extraInfo) bind(C,name="ClpSolve_setSpecialOption")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value ::which
                    integer(c_int), value ::value
                    integer(c_int), value ::extraInfo
            end subroutine
            function ClpSolve_getSpecialOption(solver,which) bind(C,name="ClpSolve_getSpecialOption")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value ::which
                    integer(c_int) :: ClpSolve_getSpecialOption
            end function
            subroutine ClpSolve_setSolveType(solver,method,extraInfo) bind(C,name="ClpSolve_setSolveType")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value ::method
                    integer(c_int), value ::extraInfo
            end subroutine
            function ClpSolve_getSolveType(solver) bind(C,name="ClpSolve_getSolveType")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int) :: ClpSolve_getSolveType
            end function
            subroutine ClpSolve_setPresolveType(solver,amount,extraInfo) bind(C,name="ClpSolve_setPresolveType")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value ::amount
                    integer(c_int), value ::extraInfo
            end subroutine
            function ClpSolve_getPresolveType(solver) bind(C,name="ClpSolve_getPresolveType")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int) :: ClpSolve_getPresolveType
            end function
            function ClpSolve_getPresolvePasses(solver) bind(C,name="ClpSolve_getPresolvePasses")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int) :: ClpSolve_getPresolvePasses
            end function
            function ClpSolve_getExtraInfo(solver,which) bind(C,name="ClpSolve_getExtraInfo")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value :: which
                    integer(c_int) :: ClpSolve_getExtraInfo
            end function
            subroutine ClpSolve_setInfeasibleReturn(solver,trueFalse) bind(C,name="ClpSolve_setInfeasibleReturn")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value ::trueFalse
            end subroutine
            function ClpSolve_infeasibleReturn(solver) bind(C,name="ClpSolve_infeasibleReturn")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int) :: ClpSolve_infeasibleReturn
            end function
            function ClpSolve_doDual(solver) bind(C,name="ClpSolve_doDual")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int) :: ClpSolve_doDual
            end function
            subroutine ClpSolve_setDoDual(solver,doDual) bind(C,name="ClpSolve_setDoDual")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value ::doDual
            end subroutine
            function ClpSolve_doSingleton(solver) bind(C,name="ClpSolve_doSingleton")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int) :: ClpSolve_doSingleton
            end function
            subroutine ClpSolve_setDoSingleton(solver,doSingleton) bind(C,name="ClpSolve_setDoSingleton")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value :: doSingleton
            end subroutine
            function ClpSolve_doDoubleton(solver) bind(C,name="ClpSolve_doDoubleton")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int) :: ClpSolve_doDoubleton
            end function
            subroutine ClpSolve_setDoDoubleton(solver,doDoubleton) bind(C,name="ClpSolve_setDoDoubleton")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value ::doDoubleton
            end subroutine
            function ClpSolve_doTripleton(solver) bind(C,name="ClpSolve_doTripleton")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int) :: ClpSolve_doTripleton
            end function
            subroutine ClpSolve_setDoTripleton(solver,doTripleton) bind(C,name="ClpSolve_setDoTripleton")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value ::doTripleton
            end subroutine
            function ClpSolve_doTighten(solver) bind(C,name="ClpSolve_doTighten")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int) :: ClpSolve_doTighten
            end function
            subroutine ClpSolve_setDoTighten(solver,doTighten) bind(C,name="ClpSolve_setDoTighten")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value ::doTighten
            end subroutine
            function ClpSolve_doForcing(solver) bind(C,name="ClpSolve_doForcing")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int) :: ClpSolve_doForcing
            end function
            subroutine ClpSolve_setDoForcing(solver,doForcing) bind(C,name="ClpSolve_setDoForcing")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value ::doForcing
            end subroutine
            function ClpSolve_doImpliedFree(solver) bind(C,name="ClpSolve_doImpliedFree")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int) :: ClpSolve_doImpliedFree
            end function
            subroutine ClpSolve_setDoImpliedFree(solver,doImpliedFree) bind(C,name="ClpSolve_setDoImpliedFree")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value :: doImpliedFree
            end subroutine
            function ClpSolve_doDupcol(solver) bind(C,name="ClpSolve_doDupcol")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int) :: ClpSolve_doDupcol
            end function
            subroutine ClpSolve_setDoDupcol(solver,doDupcol) bind(C,name="ClpSolve_setDoDupcol")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value ::doDupcol
            end subroutine
            function ClpSolve_doDuprow(solver) bind(C,name="ClpSolve_doDuprow")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int) :: ClpSolve_doDuprow
            end function
            subroutine ClpSolve_setDoDuprow(solver,doDuprow) bind(C,name="ClpSolve_setDoDuprow")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value ::doDuprow
            end subroutine
            function ClpSolve_doSingletonColumn(solver) bind(C,name="ClpSolve_doSingletonColumn")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int) :: ClpSolve_doSingletonColumn
            end function
            subroutine ClpSolve_setDoSingletonColumn(solver,doSingleton) bind(C,name="ClpSolve_setDoSingletonColumn")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value ::doSingleton
            end subroutine
            function ClpSolve_presolveActions(solver) bind(C,name="ClpSolve_presolveActions")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int) :: ClpSolve_presolveActions
            end function
            subroutine ClpSolve_setPresolveActions(solver,action) bind(C,name="ClpSolve_setPresolveActions")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value ::action
            end subroutine
            function ClpSolve_substitution(solver) bind(C,name="ClpSolve_substitution")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int) :: ClpSolve_substitution
            end function
            subroutine ClpSolve_setSubstitution(solver,value) bind(C,name="ClpSolve_setSubstitution")
                use iso_c_binding
                    type(c_ptr), value :: solver
                    integer(c_int), value ::value
            end subroutine
    end interface

contains

    subroutine Clp_Version(s)
    use clp_interface_utils, only: populate_fortran_string
    implicit none

        character(len=*), intent(out)::s

        call populate_fortran_string(Clp_Version_C(), s)

    end subroutine Clp_Version

    function Clp_readMps(model,filename,keepNames,ignoreErrors)
    use clp_interface_utils
    use iso_c_binding
    implicit none

        type(c_ptr)::model
        character(len=*)::filename

        integer, intent(in)::keepNames
        integer, intent(in)::ignoreErrors
        integer::Clp_readMps
        type(c_ptr)::c_filename

        c_filename = allocate_and_populate_c_string(filename)

        Clp_readMps = Clp_readMps_C(model, c_filename, keepNames, ignoreErrors)

        call c_free(c_filename)

    end function Clp_readMps

    subroutine Clp_copyInIntegerInformation(model, information)
    use clp_interface_utils
    use iso_c_binding
    implicit none
        
        type(c_ptr), intent(in)::model
        character(len=*), intent(in)::information
        type(c_ptr)::c_info
        
        c_info = allocate_and_populate_c_string(information)
        
        call Clp_copyInIntegerInformation_C(model, c_info)
        
        call c_free(c_info)
        
    end subroutine Clp_copyInIntegerInformation
    
    function Clp_setProblemName(model, maxNumberCharacters, array)
    use clp_interface_utils
    use iso_c_binding
    implicit none
    
        type(c_ptr), intent(in)::model
        integer, intent(in)::maxNumberCharacters
        character(len=*)::array
        
        type(c_ptr)::c_array
        
        integer::Clp_setProblemName
        
        c_array = allocate_and_populate_c_string(array)
    
        Clp_setProblemName = Clp_setProblemName_C(model, maxNumberCharacters, c_array)
        
        call c_free(c_array)
    
    end function Clp_SetProblemName
    
    subroutine Clp_problemName(model,maxNumberCharacters,array)
    use clp_interface_utils
    use iso_c_binding
    implicit none
    
        type(c_ptr) :: model
        integer(c_int), intent(in) :: maxNumberCharacters
        character(len=*) :: array
        
        type(c_ptr)::c_array
        
        c_array = allocate_and_populate_c_string(array)
        
        call Clp_problemName_C(model, maxNumberCharacters, c_array)
        
        call c_free(c_array)
        
    end subroutine Clp_problemName

    subroutine Clp_copyNames(model,rowNames,columnNames)
    use iso_c_binding
    use clp_interface_utils
    implicit none
    
        type(c_ptr) :: model
        
        character(len=*), dimension(:), intent(in) :: rowNames
        character(len=*), dimension(:), intent(in) :: columnNames

        type(c_ptr), dimension(:), pointer :: rn_c
        type(c_ptr), dimension(:), pointer :: cn_c
    
        integer::i
    
        allocate(rn_c(size(rowNames)))
        allocate(cn_c(size(columnNames)))

        do i = 1, size(rowNames)
            rn_c(i) = allocate_and_populate_c_string(rowNames(i))
        end do

        do i = 1, size(columnNames)
            rn_c(i) = allocate_and_populate_c_string(columnNames(i))
        end do
        
        call Clp_copyNames_C(model, c_loc(rn_c), c_loc(cn_c))

        do i = 1, size(rowNames)
            if(c_associated(rn_c(i))) then
                call c_free(rn_c(i))
            end if
        end do

        do i = 1, size(columnNames)
            if(c_associated(cn_c(i))) then
                call c_free(cn_c(i))
            end if
        end do
        
        deallocate(rn_c)
        deallocate(cn_c)

    end subroutine Clp_copyNames


    subroutine Clp_rowName(model,iRow,name)
    use iso_c_binding
    use clp_interface_utils
    implicit none
    
        type(c_ptr) :: model
        integer, intent(in)::iRow
        character(*), intent(in) :: name
        
        type(c_ptr) :: np
        
        np = allocate_and_populate_c_string(name)
        if(c_associated(np)) then
            call Clp_rowName_C(model, int(iRow, kind=c_int), np)
            call c_free(np)
        end if
        
    end subroutine Clp_rowName
    
    subroutine Clp_columnName(model,iColumn,name) 
    use iso_c_binding
    use clp_interface_utils
    implicit none
    
        type(c_ptr) :: model
        integer, intent(in)::iColumn
        character(*), intent(in) :: name
        
        type(c_ptr) :: np
        
        np = allocate_and_populate_c_string(name)
        if(c_associated(np)) then
            call Clp_rowName_C(model, int(iColumn, kind=c_int), np)
            call c_free(np)
        end if
        
    end subroutine Clp_columnName
    
    function Clp_saveModel(model,fileName)
    use iso_c_binding
    use clp_interface_utils
    implicit none
    
        type(c_ptr) :: model
        character(len=*) :: fileName
        integer :: Clp_saveModel
        
        type(c_ptr) :: fileName_C
        
        Clp_saveModel = -1
        
        fileName_C = allocate_and_populate_c_string(fileName)
        if(c_associated(fileName_C)) then
            Clp_saveModel = Clp_saveModel_C(model, fileName_C)
            call c_free(fileName_C)
        end if
        
    end function Clp_saveModel
            
    function Clp_restoreModel(model,fileName)
    use iso_c_binding
    use clp_interface_utils
    implicit none
    
        type(c_ptr) :: model
        character(len=*) :: fileName
        integer :: Clp_restoreModel
        
        type(c_ptr) :: fileName_C
        
        Clp_restoreModel = -1
        
        fileName_C = allocate_and_populate_c_string(fileName)
        if(c_associated(fileName_C)) then
            Clp_restoreModel = Clp_restoreModel_C(model, fileName_C)
            call c_free(fileName_C)
        end if
        
    end function Clp_restoreModel

    subroutine Clp_printModel(model,prefix)
    use iso_c_binding
    use clp_interface_utils
    implicit none
    
        type(c_ptr) :: model
        character(len=*) :: prefix
        
        type(c_ptr) :: prefix_C
        
        prefix_C = allocate_and_populate_c_string(prefix)
        if(c_associated(prefix_C)) then
            call Clp_printModel_C(model, prefix_C)
            call c_free(prefix_C)
        end if
        
    end subroutine Clp_printModel

    function Clp_getVectorStarts(model) result(starts)
    use iso_c_binding
    use clp_constants
    implicit none
        
        type(c_ptr) :: model
        integer(kind=CoinBigIndex_t), dimension(:), pointer :: starts
        
        type(c_ptr) :: c_res
        integer::ncols
        
        starts => null()
        
        c_res = Clp_getVectorStarts_C(model)
        
        if(c_associated(c_res)) then
            ncols = Clp_Numbercolumns(model)
            call c_f_pointer(c_res, starts, (/ ncols /))
        end if
        
    end function Clp_getVectorStarts

    function Clp_getRowActivity(model) result(res)
    use iso_c_binding
    implicit none
        
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: res
        integer::nrows
        type(c_ptr) :: c_res
        
        res => null()
        
        c_res = Clp_getRowActivity_C(model)
        if(c_associated(c_res)) then
            nrows = Clp_Numberrows(model)
            call c_f_pointer(c_res, res, (/ nrows /))
        end if
    
    end function Clp_getRowActivity
    
    function Clp_getColSolution(model) result(res)
    use iso_c_binding
    implicit none
        
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: res
        integer::ncols
        type(c_ptr) :: c_res
        
        res => null()
        
        c_res = Clp_getColSolution_C(model)
        if(c_associated(c_res)) then
            ncols = Clp_Numbercolumns(model)
            call c_f_pointer(c_res, res, (/ ncols /))
        end if
    
    end function Clp_getColSolution

    function Clp_getRowPrice(model) result(res)
    use iso_c_binding
    implicit none
        
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: res
        integer::nrows
        type(c_ptr) :: c_res
        
        res => null()
        
        c_res = Clp_getRowPrice_C(model)
        if(c_associated(c_res)) then
            nrows = Clp_Numberrows(model)
            call c_f_pointer(c_res, res, (/ nrows /))
        end if
    
    end function Clp_getRowPrice

    function Clp_getReducedCost(model) result(res)
    use iso_c_binding
    implicit none
        
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: res
        integer::ncols
        type(c_ptr) :: c_res
        
        res => null()
        
        c_res = Clp_getReducedCost_C(model)
        if(c_associated(c_res)) then
            ncols = Clp_Numbercolumns(model)
            call c_f_pointer(c_res, res, (/ ncols /))
        end if
    
    end function Clp_getReducedCost

    function Clp_getRowLower(model) result(res)
    use iso_c_binding
    implicit none
        
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: res
        integer::nrows
        type(c_ptr) :: c_res
        
        res => null()
        
        c_res = Clp_getRowLower_C(model)
        if(c_associated(c_res)) then
            nrows = Clp_Numberrows(model)
            call c_f_pointer(c_res, res, (/ nrows /))
        end if
    
    end function Clp_getRowLower
    
    function Clp_rowLower(model)
    implicit none
    
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: Clp_rowLower
    
        Clp_rowLower => Clp_getRowLower(model)
        
    end function Clp_rowLower
    
    function Clp_getRowUpper(model) result(res)
    use iso_c_binding
    implicit none
        
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: res
        integer::nrows
        type(c_ptr) :: c_res
        
        res => null()
        
        c_res = Clp_getRowUpper_C(model)
        if(c_associated(c_res)) then
            nrows = Clp_Numberrows(model)
            call c_f_pointer(c_res, res, (/ nrows /))
        end if
    
    end function Clp_getRowUpper
    
    function Clp_rowUpper(model)
    implicit none
    
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: Clp_rowUpper
    
        Clp_rowUpper => Clp_getRowUpper(model)
        
    end function Clp_rowUpper

    function Clp_objective(model) result(res)
    use iso_c_binding
    implicit none
        
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: res
        integer::ncols
        type(c_ptr) :: c_res
        
        res => null()
        
        c_res = Clp_objective_C(model)
        if(c_associated(c_res)) then
            ncols = Clp_Numbercolumns(model)
            call c_f_pointer(c_res, res, (/ ncols /))
        end if
    
    end function Clp_objective

    function Clp_getObjCoefficients(model) result(res)
    use iso_c_binding
    implicit none
        
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: res
        integer::ncols
        type(c_ptr) :: c_res
        
        res => null()
        
        c_res = Clp_getObjCoefficients_C(model)
        if(c_associated(c_res)) then
            ncols = Clp_Numbercolumns(model)
            call c_f_pointer(c_res, res, (/ ncols /))
        end if
    
    end function Clp_getObjCoefficients

    function Clp_getColLower(model) result(res)
    use iso_c_binding
    implicit none
        
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: res
        integer::ncols
        type(c_ptr) :: c_res
        
        res => null()
        
        c_res = Clp_getColLower_C(model)
        if(c_associated(c_res)) then
            ncols = Clp_Numbercolumns(model)
            call c_f_pointer(c_res, res, (/ ncols /))
        end if
    
    end function Clp_getColLower
    
    function Clp_columnLower(model)
    implicit none
    
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: Clp_columnLower
    
        Clp_columnLower => Clp_getColLower(model)
        
    end function Clp_columnLower
    
    function Clp_getColUpper(model) result(res)
    use iso_c_binding
    implicit none
        
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: res
        integer::ncols
        type(c_ptr) :: c_res
        
        res => null()
        
        c_res = Clp_getColUpper_C(model)
        if(c_associated(c_res)) then
            ncols = Clp_Numbercolumns(model)
            call c_f_pointer(c_res, res, (/ ncols /))
        end if
    
    end function Clp_getColUpper
    
    function Clp_columnUpper(model)
    implicit none
    
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: Clp_columnUpper
    
        Clp_columnUpper => Clp_getColUpper(model)
        
    end function Clp_columnUpper

    function Clp_primalRowSolution(model) result(res)
    use iso_c_binding
    implicit none
        
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: res
        integer::nrows
        type(c_ptr) :: c_res
        
        res => null()
        
        c_res = Clp_primalRowSolution_C(model)
        if(c_associated(c_res)) then
            nrows = Clp_Numberrows(model)
            call c_f_pointer(c_res, res, (/ nrows /))
        end if
    
    end function Clp_primalRowSolution
    
    function Clp_primalColumnSolution(model) result(res)
    use iso_c_binding
    implicit none
        
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: res
        integer::ncols
        type(c_ptr) :: c_res
        
        res => null()
        
        c_res = Clp_primalColumnSolution_C(model)
        if(c_associated(c_res)) then
            ncols = Clp_Numbercolumns(model)
            call c_f_pointer(c_res, res, (/ ncols /))
        end if
    
    end function Clp_primalColumnSolution

    function Clp_dualRowSolution(model) result(res)
    use iso_c_binding
    implicit none
        
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: res
        integer::nrows
        type(c_ptr) :: c_res
        
        res => null()
        
        c_res = Clp_dualRowSolution_C(model)
        if(c_associated(c_res)) then
            nrows = Clp_Numberrows(model)
            call c_f_pointer(c_res, res, (/ nrows /))
        end if
    
    end function Clp_dualRowSolution
    
    function Clp_dualColumnSolution(model) result(res)
    use iso_c_binding
    implicit none
        
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: res
        integer::ncols
        type(c_ptr) :: c_res
        
        res => null()
        
        c_res = Clp_dualColumnSolution_C(model)
        if(c_associated(c_res)) then
            ncols = Clp_Numbercolumns(model)
            call c_f_pointer(c_res, res, (/ ncols /))
        end if
    
    end function Clp_dualColumnSolution
    
    function Clp_infeasibilityRay(model) result(res)
    use iso_c_binding
    implicit none
        
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: res
        integer::nrows
        type(c_ptr) :: c_res
        
        res => null()
        
        c_res = Clp_infeasibilityRay_C(model)
        if(c_associated(c_res)) then
            nrows = Clp_Numberrows(model)
            call c_f_pointer(c_res, res, (/ nrows /))
        end if
    
    end function Clp_infeasibilityRay

    function Clp_unboundedRay(model) result(res)
    use iso_c_binding
    implicit none
        
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: res
        integer::ncols
        type(c_ptr) :: c_res
        
        res => null()
        
        c_res = Clp_unboundedRay_C(model)
        if(c_associated(c_res)) then
            ncols = Clp_Numbercolumns(model)
            call c_f_pointer(c_res, res, (/ ncols /))
        end if
    
    end function Clp_unboundedRay
    
    subroutine Clp_freeRay(model, ray)
    use iso_c_binding
    implicit none
    
        type(c_ptr) :: model
        real(c_double), dimension(:), pointer :: ray
        
        call Clp_freeRay_C(model, c_loc(ray))
        
    end subroutine Clp_freeRay

end module clp