readASLfg.cpp
Go to the documentation of this file.
1 /* $Id: readASLfg.cpp 607 2011-06-07 10:50:53Z pbelotti $
2  *
3  * Name: readASLfg.cpp
4  * Author: Pietro Belotti
5  * Purpose: re-read .nl file into a simpler ASL structure
6  *
7  * (C) Carnegie-Mellon University, 2006.
8  * This file is licensed under the Eclipse Public License (EPL)
9  */
10 
11 #include "asl.h"
12 #include "nlp.h"
13 #include "getstub.h"
14 #include "r_opn.hd" /* for N_OPS */
15 
16 #define CHR (char*)
17 
19 
20 keyword keywds[] = { // must be alphabetical
21  KW(CHR"timing", L_val, &timing, CHR"display timings for the run"),
22 };
23 
24 Option_Info Oinfo = { CHR"testampl", CHR"ANALYSIS TEST",
25  CHR"concert_options", keywds, nkeywds, 0, CHR"ANALYSIS TEST" };
26 
27 ASL *readASLfg (char **argv) {
28 
29  // read .nl file from first argument //////////////////////////
30 
31  char *stub;
32 
33  // Create the ASL structure
34  ASL* asl = (ASL*) ASL_alloc (ASL_read_fg);
35  FILE *nl = NULL;
36  stub = getstub (&argv, &Oinfo);
37 
38  // Although very intuitive, we shall explain why the second argument
39  // is passed with a minus sign: it is to tell the ASL to retrieve
40  // the nonlinear information too.
41  nl = jac0dim (stub, - (fint) strlen (stub));
42 
43  // Set options in the asl structure
44  want_xpi0 = 1 | 2; // allocate initial values for primal and dual if available
45  obj_no = 0; // always want to work with the first (and only?) objective
46 
47  // allocate space for initial values
48  X0 = new real [n_var];
49  havex0 = new char [n_var];
50  pi0 = new real [n_con];
51  havepi0 = new char [n_con];
52 
53  // read the rest of the nl file
54  fg_read (nl, ASL_return_read_err | ASL_findgroups);
55 
56  return asl;
57 }
keyword keywds[]
Definition: readASLfg.cpp:20
#define CHR
Definition: readASLfg.cpp:16
Bonmin::BqpdSolver::fint fint
ASL * readASLfg(char **argv)
Definition: readASLfg.cpp:27
Option_Info Oinfo
Definition: readASLfg.cpp:24
Bonmin::BqpdSolver::real real
fint timing
Definition: readASLfg.cpp:18