aboutsummaryrefslogtreecommitdiff
path: root/src/clp.f90
blob: 2fe45a970d436b71738f85b5e9e9ae6e9dabc9d8 (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
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
                    type(c_ptr), value :: model
                    integer(c_int), value ::numcols
                    integer(c_int), value ::numrows
                    type(c_ptr), value :: start
                    type(c_ptr), value :: 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
                    type(c_ptr), value :: model
                    integer(c_int), value ::numberColumns
                    type(c_ptr), value :: start
                    type(c_ptr), value :: 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(model,rowNames,columnNames) bind(C,name="Clp_copyNames")
                use iso_c_binding
                    type(c_ptr), value :: model
                    character(c_char) :: rowNames(*)
                    character(c_char) :: 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(model) bind(C,name="Clp_primalRowSolution")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_primalRowSolution
            end function
            function Clp_primalColumnSolution(model) bind(C,name="Clp_primalColumnSolution")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_primalColumnSolution
            end function
            function Clp_dualRowSolution(model) bind(C,name="Clp_dualRowSolution")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_dualRowSolution
            end function
            function Clp_dualColumnSolution(model) bind(C,name="Clp_dualColumnSolution")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_dualColumnSolution
            end function
            function Clp_rowLower(model) bind(C,name="Clp_rowLower")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_rowLower
            end function
            function Clp_rowUpper(model) bind(C,name="Clp_rowUpper")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_rowUpper
            end function
            function Clp_objective(model) bind(C,name="Clp_objective")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_objective
            end function
            function Clp_columnLower(model) bind(C,name="Clp_columnLower")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_columnLower
            end function
            function Clp_columnUpper(model) bind(C,name="Clp_columnUpper")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_columnUpper
            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(model) bind(C,name="Clp_getVectorStarts")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getVectorStarts
            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(model) bind(C,name="Clp_integerInformation")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_integerInformation
            end function
            function Clp_infeasibilityRay(model) bind(C,name="Clp_infeasibilityRay")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_infeasibilityRay
            end function
            function Clp_unboundedRay(model) bind(C,name="Clp_unboundedRay")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_unboundedRay
            end function
            subroutine Clp_freeRay(model,ray) bind(C,name="Clp_freeRay")
                use iso_c_binding
                    type(c_ptr), value :: model
                    real(c_double) :: 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(model,iRow,name) bind(C,name="Clp_rowName")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::iRow
                    character(c_char) :: name(*)
            end subroutine
            subroutine Clp_columnName(model,iColumn,name) bind(C,name="Clp_columnName")
                use iso_c_binding
                    type(c_ptr), value :: model
                    integer(c_int), value ::iColumn
                    character(c_char) :: name(*)
            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(model,fileName) bind(C,name="Clp_saveModel")
                use iso_c_binding
                    type(c_ptr), value :: model
                    character(c_char) :: fileName(*)
                    integer(c_int) :: Clp_saveModel
            end function
            function Clp_restoreModel(model,fileName) bind(C,name="Clp_restoreModel")
                use iso_c_binding
                    type(c_ptr), value :: model
                    character(c_char) :: fileName(*)
                    integer(c_int) :: Clp_restoreModel
            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(model) bind(C,name="Clp_getRowActivity")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getRowActivity
            end function
            function Clp_getColSolution(model) bind(C,name="Clp_getColSolution")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getColSolution
            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(model) bind(C,name="Clp_getRowPrice")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getRowPrice
            end function
            function Clp_getReducedCost(model) bind(C,name="Clp_getReducedCost")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getReducedCost
            end function
            function Clp_getRowLower(model) bind(C,name="Clp_getRowLower")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getRowLower
            end function
            function Clp_getRowUpper(model) bind(C,name="Clp_getRowUpper")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getRowUpper
            end function
            function Clp_getObjCoefficients(model) bind(C,name="Clp_getObjCoefficients")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getObjCoefficients
            end function
            function Clp_getColLower(model) bind(C,name="Clp_getColLower")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getColLower
            end function
            function Clp_getColUpper(model) bind(C,name="Clp_getColUpper")
                use iso_c_binding
                    type(c_ptr), value :: model
                    type(c_ptr) :: Clp_getColUpper
            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(model,prefix) bind(C,name="Clp_printModel")
                use iso_c_binding
                    type(c_ptr), value :: model
                    character(c_char) :: 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

end module clp