aboutsummaryrefslogtreecommitdiff
path: root/src/examples/basic.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-10-29 16:10:53 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2020-10-29 16:10:53 -0400
commit9b380489a4084097380b18f58bb2116613f891ee (patch)
treeedbb313fdd5bf3246d866d6d691d7aa22b92ded4 /src/examples/basic.f90
parent9fac184765c3756de6b22cf110a6fc3f626d2fe1 (diff)
downloadclp_fortran-9b380489a4084097380b18f58bb2116613f891ee.tar.gz
clp_fortran-9b380489a4084097380b18f58bb2116613f891ee.zip
Implemented the C example driver program in Fortran. Updates to name routines to read rather than write when appropriate. Minor callback fixes.
Diffstat (limited to 'src/examples/basic.f90')
-rw-r--r--src/examples/basic.f9030
1 files changed, 30 insertions, 0 deletions
diff --git a/src/examples/basic.f90 b/src/examples/basic.f90
new file mode 100644
index 0000000..ee69d39
--- /dev/null
+++ b/src/examples/basic.f90
@@ -0,0 +1,30 @@
+program main
+ use iso_c_binding
+ use clp
+ use clp_constants
+ implicit none
+
+ integer :: ret
+
+ type(c_ptr) :: lp
+ real(8), dimension(0:4) :: obj
+ real(8), dimension(0:4) :: row1
+
+ lp = Clp_newModel()
+
+ call Clp_resize(lp,4,4)
+
+! row1(0) = 0; row1(1) = 1; row1(2) = 1; row1(3) = 1; ret = add_constraint(lp,row1,LE,100.0_8);
+
+! write (*,*) Clp_VersionMajor()
+! write (*,*) Clp_VersionMinor()
+! write (*,*) Clp_VersionRelease()
+
+
+ write (*,*) Clp_numberRows(lp)
+ write (*,*) Clp_numberColumns(lp)
+
+! call Clp_printModel(lp,"name"//c_null_char) ! seems to be broken when model is not defined
+
+ call Clp_deleteModel(lp)
+end