* * (C) Carnegie-Mellon University, 2006. * This file is licensed under the Eclipse Public License (EPL) */ #include "asl.h" #include "nlp.h" #include "getstub.h" #include "r_opn.hd" /* for N_OPS */ #define CHR (char*) fint timing = 0; keyword keywds[] = { // must be alphabetical KW(CHR"timing", L_val, &timing, CHR"display timings for the run"), }; Option_Info Oinfo = { CHR"testampl", CHR"ANALYSIS TEST", CHR"concert_options", keywds, nkeywds, 0, CHR"ANALYSIS TEST" }; ASL *readASLfg (char **argv) { // read .nl file from first argument ////////////////////////// char *stub; // Create the ASL structure ASL* asl = (ASL*) ASL_alloc (ASL_read_fg); FILE *nl = NULL; stub = getstub (&argv, &Oinfo);
enum { kw_AS=1, kw_AUTO, kw_PRINTF, kw_PRINTAS, kw_NOPREFIX, kw_NOSUFFIX, kw_TRUNCATE, kw_WIDTH, kw_LEFT, kw_RIGHT, }; #define KW(a) { #a, kw_##a, 0 } static const Keyword SelectKeywordItems[] = { KW(AS), KW(AUTO), KW(LEFT), KW(NOPREFIX), KW(NOSUFFIX), KW(PRINTAS), KW(PRINTF), KW(RIGHT), KW(TRUNCATE), KW(WIDTH), }; #undef KW static const KeywordTable SelectKeywords = SORTED_TOKENER_TABLE(SelectKeywordItems); enum { gw_AS=1,
#include "getstub.h" // Defines #define CHR (char*) #define MODEL_NAME "./model/optrisk" // #define DISPLAY // to see more outputs // Global variables ASL *asl; fint showgrad = (fint)0; // A command-line option (integer) fint showname = (fint)0; // A command-line option (integer) keyword keywds[] = { // MUST appear in alphabetical order! KW(CHR"showgrad", L_val, &showgrad, CHR"Evaluate gradient"), KW(CHR"showname", L_val, &showname, CHR"Display objective name") }; Option_Info Oinfo = { CHR"miniampl", CHR"Mini AMPL Example", CHR"miniampl_options", keywds, nkeywds, 0, CHR"0.1", 0, 0, 0, 0, 0, 20091021 }; int main ( int argc, char **argv ) { FILE * nl; char * stub; FILE * point_file;
/* load in the standard collection of html tags that markdown supports */ main() { int i; #define KW(x) define_one_tag(x, 0) #define SC(x) define_one_tag(x, 1) KW("STYLE"); KW("SCRIPT"); KW("ADDRESS"); KW("BDO"); KW("BLOCKQUOTE"); KW("CENTER"); KW("DFN"); KW("DIV"); KW("OBJECT"); KW("H1"); KW("H2"); KW("H3"); KW("H4"); KW("H5"); KW("H6"); KW("LISTING"); KW("NOBR"); KW("UL"); KW("P"); KW("OL"); KW("DL"); KW("PLAINTEXT"); KW("PRE"); KW("TABLE"); KW("WBR"); KW("XMP"); SC("HR"); SC("BR"); KW("IFRAME"); KW("MAP"); qsort(T(blocktags), S(blocktags), sizeof(struct kw), (stfu)casort); printf("static struct kw blocktags[] = {\n"); for (i=0; i < S(blocktags); i++) printf(" { \"%s\", %d, %d },\n", T(blocktags)[i].id, T(blocktags)[i].size, T(blocktags)[i].selfclose ); printf("};\n\n"); printf("#define NR_blocktags %d\n", S(blocktags)); exit(0); }
static char * #ifdef KR_headers SK1_val(oi, kw, v) Option_Info *oi; keyword *kw; char *v; #else SK1_val(Option_Info *oi, keyword *kw, char *v) #endif { *(short*)(oi->uinfo + Intcast kw->info) = 1; return v; } #define v_off(x) voffset_of(lprec,x) static keyword keywds[] = { KW("cfirst", SK0_val, v_off(floor_first), "in IPs, take ceiling branch first"), KW("debug", SK1_val, v_off(debug), "debug mode"), KW("degen", IK1_val, v_off(anti_degen), "perturb degeneracies"), KW("eps", DU_val, v_off(epsilon), "=... tolerance for rounding to integer"), KW("objno", I_val, &nobj, "objective number: 0 = none, 1 (default) = first"), KW("obound", DU_val, v_off(obj_bound), "=... initial objective bound (for branch & bound)"), KW("prinv", SK1_val, v_off(print_at_invert), "print after inverting"), KW("prlp", IK1_val, &prlp, "print the LP"), KW("psols", SK1_val, v_off(print_sol), "print (intermediate) feasible solutions"), KW("scale", IK1_val, &scaling, "scale the problem"), KW("trace", SK1_val, v_off(trace), "trace pivot selections"), KW("verbose", SK1_val, v_off(verbose), "verbose mode"), KW("wantsol", WS_val, 0, WS_desc_ASL) }; static char lp_solve_version[24] = "LP_SOLVE X.X";
char buf[40], *rv; fint ignore; Not_Used(oi); Not_Used(kw); for(rv = v; *rv > ' '; rv++); if (rv > v) readpar_(v, &outlev, &minmax, &ignore, buf, buf, buf, buf, buf, &bigb, &ignore, (ftnlen)(rv - v), (ftnlen)40, (ftnlen)8, (ftnlen)8, (ftnlen)8, (ftnlen)8); return rv; } static keyword keywds[] = { KW("bargrow", D_val, &predp_.bargrw, "barrier growth bound"), KW("barmin", D_val, &predp_.barmin, "min. barrier threshold"), KW("barset", D_val, &predp_.barset, "barrier setup limit"), KW("bigbound", D_val, &bigb, "limit on finite bounds and ranges"), KW("center", D_val, &predc_.center, "centrality force"), KW("complimit", D_val, &compl_.climit, "improve if compl. < complim"), KW("comppar", D_val, &compl_.ccorr, "improve if compl. < comppar * avg. compl."), KW("corstop", D_val, &predc_.corstp, "correction stop factor"), KW("densgap", D_val, &setden_.densgap, "density gap param"), KW("denslen", L_val, &setden_.denslen, "nonzeros in \"dense\" columns"), KW("dinfs", D_val, &toler_.dinfs, "min. dual infeas. reduction"), KW("dslacklim", D_val, &drop_.slklim, "dual slack variable limit"), KW("dudare", D_val, ¶m_.dalpha, "max. dual steplength"), KW("dumin", D_val, &initv_.dumin, "min. initial slack value"), KW("feas1", D_val, &toler_.feas1, "abs. primal feas. tol."), KW("feas2", D_val, &toler_.feas2, "abs. dual feas. tol."),