/home/coin/SVN-release/OS-2.4.0/Couenne/src/readnl/readASLfg.cpp

Go to the documentation of this file.
00001 /* $Id: readASLfg.cpp 607 2011-06-07 10:50:53Z pbelotti $
00002  *
00003  * Name:    readASLfg.cpp
00004  * Author:  Pietro Belotti
00005  * Purpose: re-read .nl file into a simpler ASL structure
00006  *
00007  * (C) Carnegie-Mellon University, 2006.
00008  * This file is licensed under the Eclipse Public License (EPL)
00009  */
00010 
00011 #include "asl.h"
00012 #include "nlp.h"
00013 #include "getstub.h"
00014 #include "r_opn.hd" /* for N_OPS */
00015 
00016 #define CHR (char*)
00017 
00018 fint timing = 0;
00019 
00020 keyword keywds[] = { // must be alphabetical
00021    KW(CHR"timing", L_val, &timing, CHR"display timings for the run"),
00022 };
00023 
00024 Option_Info Oinfo = { CHR"testampl", CHR"ANALYSIS TEST",
00025                       CHR"concert_options", keywds, nkeywds, 0, CHR"ANALYSIS TEST" };
00026 
00027 ASL *readASLfg (char **argv) {
00028 
00029   // read .nl file from first argument //////////////////////////
00030 
00031   char *stub;
00032 
00033   // Create the ASL structure
00034   ASL* asl = (ASL*) ASL_alloc (ASL_read_fg);
00035   FILE *nl = NULL;
00036   stub = getstub (&argv, &Oinfo);
00037 
00038   // Although very intuitive, we shall explain why the second argument
00039   // is passed with a minus sign: it is to tell the ASL to retrieve
00040   // the nonlinear information too.
00041   nl = jac0dim (stub, - (fint) strlen (stub));
00042 
00043   // Set options in the asl structure
00044   want_xpi0 = 1 | 2;  // allocate initial values for primal and dual if available
00045   obj_no = 0;         // always want to work with the first (and only?) objective
00046 
00047   // allocate space for initial values
00048   X0      = new real [n_var];
00049   havex0  = new char [n_var];
00050   pi0     = new real [n_con];
00051   havepi0 = new char [n_con];
00052 
00053   // read the rest of the nl file
00054   fg_read (nl, ASL_return_read_err | ASL_findgroups);
00055 
00056   return asl;
00057 }

Generated on Thu Sep 22 03:05:59 2011 by  doxygen 1.4.7