12.07.2015 Views

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

char *inststr = NULL;char *envstr = NULL;/* Initialize the <strong>CPLEX</strong> environment */envstr = (char *) malloc (256);if ( envstr == NULL ) {fprintf (stderr, "Memory allocation for CPXputenv failed.\n");status = FAIL;goto TERMINATE;}else {inststr = (char *) getenv("MYAPP_HOME");if ( inststr == NULL ) {fprintf (stderr, "Unable to find installation directory.\n");status = FAIL;goto TERMINATE;}strcpy (envstr, "<strong>ILOG</strong>_LICENSE_FILE=");strcat (envstr, inststr);strcat (envstr, "\\license\\access.ilm");CPXputenv (envstr);}env = CPXopen<strong>CPLEX</strong> (&status);.Notes: This example assumes a Microsoft Windows file directory structure that requires anadditional backslash when specifying the path of the file containing the key. It also assumesthat the application uses an environment variable called MYAPP_HOME to identify thedirectory in which it was installed.The string argument to CPXputenv must remain active throughout the time <strong>ILOG</strong> <strong>CPLEX</strong>is active; the best way to do this is to malloc the string.The putenv Method for Java UsersHere is an example using Concert Technology for Java users:IloCplex.putenv("<strong>ILOG</strong>_LICENSE_FILE=\\license\\access.ilm");try {cplex = new IloCplex();}catch (IloException e) {System.err.println("Exception caught for runtime license:" + e);}158 <strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!