[OS] Linking with OS API

Kipp Martin Kipp.Martin at ChicagoGSB.edu
Sun Mar 23 12:55:41 EDT 2008


Hi Pete:


A few questions.

1) Did you first run configure and then test as described in


http://www.coin-or.org/OS/documentation/node11.html

Did you pass the unitTest?



> 
> I am planning to write global optimization solvers which use OS to
> read in
> .nl model instances. I have built OS on my Linux machine, but have
> been
> having difficulties including/linking to the OS API. Say for instance
> 
> #include <stdio.h>
> #include "OSInstance.h"
> #include "OSnLNode.h"
> #include "OSnl2osil.h"
> #include "DefaultSolver.h"
> #include "IpoptSolver.h"
> #include <vector>
> #include <math.h>
> 
> using namespace std;
> 
> int main(int argc, char **argv) {
>   OSInstance *osinstance;
>   OSnl2osil *nl2osil = NULL;
>   DefaultSolver *solver = NULL;
> 
>   osinstance = new OSInstance();
> }


If you are going to try something like the above, first do a

make install

it will put all of the necessary header files in an include file for you in

COIN-OS/include

and the libraries in

COIN-OS/lib

See Step 5 of the above link.


What I suggest you do is look at one of our examples. In particular, if 
you now get the trunk version of OS

svn co https://projects.coin-or.org/svn/OS/trunk COIN-OS

there is a good example that you will get in

COIN-OS/OS/examples/instanceGenerator

that will do exactly what you are trying to do in your int main() above. 
  Configure will generate a makefile for this example and you should be 
able to edit a few lines of the makefile where indicated to get things 
going.

See

http://www.coin-or.org/OS/documentation/node77.html

Let me know how this goes.

Thanks









> 
> it seems that not only do I have to specify the include path to the
> "include"
> folder created after installation, but a host of other folders
> associated with
> other COIN-OR or ThirdParty projects. In addition I compile errors
> would
> come up due to #error, preprocessor statements, forcing me to define
> variables
> such as -DHAVE_MATH_H -DHAVE_TIME_H.  Similar difficulties were
> encountered
> during linking.
> 
> Is it normal to do this in order to get it to work? Is there a better
> way?
> 
> I am sure I have done something silly. Could any of you point me to a
> good tutorial
> or example on using the COIN-OS API. I have been reading the User's
> Manual but it
> did not cover this aspect.
> 
> > 
> _______________________________________________
> OS mailing list
> OS at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/os


-- 
Kipp Martin
Professor of Operations Research
and Computing Technology
Graduate School of Business
University of Chicago
5807 South Woodlawn Avenue
Chicago, IL 60637
773-702-7456
kipp.martin at chicagogsb.edu
http://gsbkip.chicagogsb.edu
http://www.coin-or.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Optimization Services (OS)" group.
To post to this group, send email to optimizationservices at googlegroups.com
To unsubscribe from this group, send email to optimizationservices-unsubscribe at googlegroups.com
For more options, visit this group at http://groups.google.com/group/optimizationservices?hl=en
-~----------~----~----~----~------~----~------~--~---



More information about the OS mailing list