diff --git a/resources/3rdparty/glpk-4.57/doc/glpk.pdf b/resources/3rdparty/glpk-4.57/doc/glpk.pdf deleted file mode 100644 index 51f0a4a3d..000000000 Binary files a/resources/3rdparty/glpk-4.57/doc/glpk.pdf and /dev/null differ diff --git a/resources/3rdparty/glpk-4.57/doc/gmpl_es.pdf b/resources/3rdparty/glpk-4.57/doc/gmpl_es.pdf deleted file mode 100644 index 2d5ca8e0c..000000000 Binary files a/resources/3rdparty/glpk-4.57/doc/gmpl_es.pdf and /dev/null differ diff --git a/resources/3rdparty/glpk-4.57/doc/graphs.pdf b/resources/3rdparty/glpk-4.57/doc/graphs.pdf deleted file mode 100644 index 896dd7cd6..000000000 Binary files a/resources/3rdparty/glpk-4.57/doc/graphs.pdf and /dev/null differ diff --git a/resources/3rdparty/glpk-4.57/doc/notes/dfeas.pdf b/resources/3rdparty/glpk-4.57/doc/notes/dfeas.pdf deleted file mode 100644 index 35f5d3aa5..000000000 Binary files a/resources/3rdparty/glpk-4.57/doc/notes/dfeas.pdf and /dev/null differ diff --git a/resources/3rdparty/glpk-4.57/doc/notes/simplex1.pdf b/resources/3rdparty/glpk-4.57/doc/notes/simplex1.pdf deleted file mode 100644 index 828ad9970..000000000 Binary files a/resources/3rdparty/glpk-4.57/doc/notes/simplex1.pdf and /dev/null differ diff --git a/resources/3rdparty/glpk-4.57/doc/notes/simplex2.pdf b/resources/3rdparty/glpk-4.57/doc/notes/simplex2.pdf deleted file mode 100644 index a9c2878d6..000000000 Binary files a/resources/3rdparty/glpk-4.57/doc/notes/simplex2.pdf and /dev/null differ diff --git a/resources/3rdparty/glpk-4.57/examples/glpsol.c b/resources/3rdparty/glpk-4.57/examples/glpsol.c deleted file mode 100644 index b1014500e..000000000 --- a/resources/3rdparty/glpk-4.57/examples/glpsol.c +++ /dev/null @@ -1,10 +0,0 @@ -/* glpsol.c */ - -#include - -int main(int argc, const char *argv[]) -{ /* stand-alone LP/MIP solver */ - return glp_main(argc, argv); -} - -/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/Makefile.am b/resources/3rdparty/glpk-4.57/src/Makefile.am deleted file mode 100644 index 836ef11bd..000000000 --- a/resources/3rdparty/glpk-4.57/src/Makefile.am +++ /dev/null @@ -1,178 +0,0 @@ -## Process this file with automake to produce Makefile.in ## - -include_HEADERS = glpk.h - -lib_LTLIBRARIES = libglpk.la - -libglpk_la_CPPFLAGS = \ --I$(srcdir) \ --I$(srcdir)/amd \ --I$(srcdir)/bflib \ --I$(srcdir)/cglib \ --I$(srcdir)/colamd \ --I$(srcdir)/env \ --I$(srcdir)/minisat \ --I$(srcdir)/misc \ --I$(srcdir)/proxy \ --I$(srcdir)/simplex \ --I$(srcdir)/zlib - -libglpk_la_LDFLAGS = \ --version-info 38:0:2 \ --export-symbols-regex '^glp_*' - -libglpk_la_SOURCES = \ -avl.c \ -bfd.c \ -bfx.c \ -glpapi01.c \ -glpapi02.c \ -glpapi03.c \ -glpapi04.c \ -glpapi05.c \ -glpapi06.c \ -glpapi07.c \ -glpapi08.c \ -glpapi09.c \ -glpapi10.c \ -glpapi11.c \ -glpapi12.c \ -glpapi13.c \ -glpapi14.c \ -glpapi15.c \ -glpapi16.c \ -glpapi17.c \ -glpapi18.c \ -glpapi19.c \ -glpapi20.c \ -glpapi21.c \ -glpcpx.c \ -glpdmx.c \ -glpgmp.c \ -glphbm.c \ -glpini01.c \ -glpini02.c \ -glpios01.c \ -glpios02.c \ -glpios03.c \ -glpios04.c \ -glpios05.c \ -glpios06.c \ -glpios07.c \ -glpios08.c \ -glpios09.c \ -glpios10.c \ -glpios11.c \ -glpios12.c \ -glpipm.c \ -glpmat.c \ -glpmpl01.c \ -glpmpl02.c \ -glpmpl03.c \ -glpmpl04.c \ -glpmpl05.c \ -glpmpl06.c \ -glpmps.c \ -glpnet03.c \ -glpnet04.c \ -glpnet05.c \ -glpnpp01.c \ -glpnpp02.c \ -glpnpp03.c \ -glpnpp04.c \ -glpnpp05.c \ -glpnpp06.c \ -glprgr.c \ -glpscl.c \ -glpsdf.c \ -glpspm.c \ -glpsql.c \ -glpssx01.c \ -glpssx02.c \ -lux.c \ -amd/amd_1.c \ -amd/amd_2.c \ -amd/amd_aat.c \ -amd/amd_control.c \ -amd/amd_defaults.c \ -amd/amd_dump.c \ -amd/amd_info.c \ -amd/amd_order.c \ -amd/amd_post_tree.c \ -amd/amd_postorder.c \ -amd/amd_preprocess.c \ -amd/amd_valid.c \ -bflib/btf.c \ -bflib/btfint.c \ -bflib/fhv.c \ -bflib/fhvint.c \ -bflib/ifu.c \ -bflib/luf.c \ -bflib/lufint.c \ -bflib/scf.c \ -bflib/scfint.c \ -bflib/sgf.c \ -bflib/sva.c \ -cglib/cfg.c \ -cglib/cfg1.c \ -colamd/colamd.c \ -env/alloc.c \ -env/dlsup.c \ -env/env.c \ -env/error.c \ -env/stdout.c \ -env/stream.c \ -env/time.c \ -env/tls.c \ -minisat/minisat.c \ -misc/bignum.c \ -misc/dmp.c \ -misc/ffalg.c \ -misc/fp2rat.c \ -misc/gcd.c \ -misc/jd.c \ -misc/keller.c \ -misc/mc13d.c \ -misc/mc21a.c \ -misc/okalg.c \ -misc/qmd.c \ -misc/relax4.c \ -misc/rng.c \ -misc/rng1.c \ -misc/round2n.c \ -misc/str2int.c \ -misc/str2num.c \ -misc/strspx.c \ -misc/strtrim.c \ -misc/triang.c \ -misc/wclique.c \ -misc/wclique1.c \ -proxy/proxy.c \ -proxy/proxy1.c \ -simplex/spxat.c \ -simplex/spxchuzc.c \ -simplex/spxchuzr.c \ -simplex/spxlp.c \ -simplex/spxnt.c \ -simplex/spxprim.c \ -simplex/spxprob.c \ -simplex/spychuzc.c \ -simplex/spychuzr.c \ -simplex/spydual.c \ -zlib/adler32.c \ -zlib/compress.c \ -zlib/crc32.c \ -zlib/deflate.c \ -zlib/gzclose.c \ -zlib/gzlib.c \ -zlib/gzread.c \ -zlib/gzwrite.c \ -zlib/inffast.c \ -zlib/inflate.c \ -zlib/inftrees.c \ -zlib/trees.c \ -zlib/uncompr.c \ -zlib/zio.c \ -zlib/zutil.c - -## eof ## diff --git a/resources/3rdparty/glpk-4.57/src/glpapi11.c b/resources/3rdparty/glpk-4.57/src/glpapi11.c deleted file mode 100644 index 7bc528172..000000000 --- a/resources/3rdparty/glpk-4.57/src/glpapi11.c +++ /dev/null @@ -1,1235 +0,0 @@ -/* glpapi11.c (utility routines) */ - -/*********************************************************************** -* This code is part of GLPK (GNU Linear Programming Kit). -* -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied -* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights -* reserved. E-mail: . -* -* GLPK is free software: you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GLPK is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -* License for more details. -* -* You should have received a copy of the GNU General Public License -* along with GLPK. If not, see . -***********************************************************************/ - -#include "env.h" -#include "glpsdf.h" -#include "prob.h" - -#define xfprintf glp_format - -int glp_print_sol(glp_prob *P, const char *fname) -{ /* write basic solution in printable format */ - glp_file *fp; - GLPROW *row; - GLPCOL *col; - int i, j, t, ae_ind, re_ind, ret; - double ae_max, re_max; - xprintf("Writing basic solution to '%s'...\n", fname); - fp = glp_open(fname, "w"); - if (fp == NULL) - { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xfprintf(fp, "%-12s%s\n", "Problem:", - P->name == NULL ? "" : P->name); - xfprintf(fp, "%-12s%d\n", "Rows:", P->m); - xfprintf(fp, "%-12s%d\n", "Columns:", P->n); - xfprintf(fp, "%-12s%d\n", "Non-zeros:", P->nnz); - t = glp_get_status(P); - xfprintf(fp, "%-12s%s\n", "Status:", - t == GLP_OPT ? "OPTIMAL" : - t == GLP_FEAS ? "FEASIBLE" : - t == GLP_INFEAS ? "INFEASIBLE (INTERMEDIATE)" : - t == GLP_NOFEAS ? "INFEASIBLE (FINAL)" : - t == GLP_UNBND ? "UNBOUNDED" : - t == GLP_UNDEF ? "UNDEFINED" : "???"); - xfprintf(fp, "%-12s%s%s%.10g (%s)\n", "Objective:", - P->obj == NULL ? "" : P->obj, - P->obj == NULL ? "" : " = ", P->obj_val, - P->dir == GLP_MIN ? "MINimum" : - P->dir == GLP_MAX ? "MAXimum" : "???"); - xfprintf(fp, "\n"); - xfprintf(fp, " No. Row name St Activity Lower bound " - " Upper bound Marginal\n"); - xfprintf(fp, "------ ------------ -- ------------- ------------- " - "------------- -------------\n"); - for (i = 1; i <= P->m; i++) - { row = P->row[i]; - xfprintf(fp, "%6d ", i); - if (row->name == NULL || strlen(row->name) <= 12) - xfprintf(fp, "%-12s ", row->name == NULL ? "" : row->name); - else - xfprintf(fp, "%s\n%20s", row->name, ""); - xfprintf(fp, "%s ", - row->stat == GLP_BS ? "B " : - row->stat == GLP_NL ? "NL" : - row->stat == GLP_NU ? "NU" : - row->stat == GLP_NF ? "NF" : - row->stat == GLP_NS ? "NS" : "??"); - xfprintf(fp, "%13.6g ", - fabs(row->prim) <= 1e-9 ? 0.0 : row->prim); - if (row->type == GLP_LO || row->type == GLP_DB || - row->type == GLP_FX) - xfprintf(fp, "%13.6g ", row->lb); - else - xfprintf(fp, "%13s ", ""); - if (row->type == GLP_UP || row->type == GLP_DB) - xfprintf(fp, "%13.6g ", row->ub); - else - xfprintf(fp, "%13s ", row->type == GLP_FX ? "=" : ""); - if (row->stat != GLP_BS) - { if (fabs(row->dual) <= 1e-9) - xfprintf(fp, "%13s", "< eps"); - else - xfprintf(fp, "%13.6g ", row->dual); - } - xfprintf(fp, "\n"); - } - xfprintf(fp, "\n"); - xfprintf(fp, " No. Column name St Activity Lower bound " - " Upper bound Marginal\n"); - xfprintf(fp, "------ ------------ -- ------------- ------------- " - "------------- -------------\n"); - for (j = 1; j <= P->n; j++) - { col = P->col[j]; - xfprintf(fp, "%6d ", j); - if (col->name == NULL || strlen(col->name) <= 12) - xfprintf(fp, "%-12s ", col->name == NULL ? "" : col->name); - else - xfprintf(fp, "%s\n%20s", col->name, ""); - xfprintf(fp, "%s ", - col->stat == GLP_BS ? "B " : - col->stat == GLP_NL ? "NL" : - col->stat == GLP_NU ? "NU" : - col->stat == GLP_NF ? "NF" : - col->stat == GLP_NS ? "NS" : "??"); - xfprintf(fp, "%13.6g ", - fabs(col->prim) <= 1e-9 ? 0.0 : col->prim); - if (col->type == GLP_LO || col->type == GLP_DB || - col->type == GLP_FX) - xfprintf(fp, "%13.6g ", col->lb); - else - xfprintf(fp, "%13s ", ""); - if (col->type == GLP_UP || col->type == GLP_DB) - xfprintf(fp, "%13.6g ", col->ub); - else - xfprintf(fp, "%13s ", col->type == GLP_FX ? "=" : ""); - if (col->stat != GLP_BS) - { if (fabs(col->dual) <= 1e-9) - xfprintf(fp, "%13s", "< eps"); - else - xfprintf(fp, "%13.6g ", col->dual); - } - xfprintf(fp, "\n"); - } - xfprintf(fp, "\n"); - xfprintf(fp, "Karush-Kuhn-Tucker optimality conditions:\n"); - xfprintf(fp, "\n"); - glp_check_kkt(P, GLP_SOL, GLP_KKT_PE, &ae_max, &ae_ind, &re_max, - &re_ind); - xfprintf(fp, "KKT.PE: max.abs.err = %.2e on row %d\n", - ae_max, ae_ind); - xfprintf(fp, " max.rel.err = %.2e on row %d\n", - re_max, re_ind); - xfprintf(fp, "%8s%s\n", "", - re_max <= 1e-9 ? "High quality" : - re_max <= 1e-6 ? "Medium quality" : - re_max <= 1e-3 ? "Low quality" : "PRIMAL SOLUTION IS WRONG"); - xfprintf(fp, "\n"); - glp_check_kkt(P, GLP_SOL, GLP_KKT_PB, &ae_max, &ae_ind, &re_max, - &re_ind); - xfprintf(fp, "KKT.PB: max.abs.err = %.2e on %s %d\n", - ae_max, ae_ind <= P->m ? "row" : "column", - ae_ind <= P->m ? ae_ind : ae_ind - P->m); - xfprintf(fp, " max.rel.err = %.2e on %s %d\n", - re_max, re_ind <= P->m ? "row" : "column", - re_ind <= P->m ? re_ind : re_ind - P->m); - xfprintf(fp, "%8s%s\n", "", - re_max <= 1e-9 ? "High quality" : - re_max <= 1e-6 ? "Medium quality" : - re_max <= 1e-3 ? "Low quality" : "PRIMAL SOLUTION IS INFEASIBL" - "E"); - xfprintf(fp, "\n"); - glp_check_kkt(P, GLP_SOL, GLP_KKT_DE, &ae_max, &ae_ind, &re_max, - &re_ind); - xfprintf(fp, "KKT.DE: max.abs.err = %.2e on column %d\n", - ae_max, ae_ind == 0 ? 0 : ae_ind - P->m); - xfprintf(fp, " max.rel.err = %.2e on column %d\n", - re_max, re_ind == 0 ? 0 : re_ind - P->m); - xfprintf(fp, "%8s%s\n", "", - re_max <= 1e-9 ? "High quality" : - re_max <= 1e-6 ? "Medium quality" : - re_max <= 1e-3 ? "Low quality" : "DUAL SOLUTION IS WRONG"); - xfprintf(fp, "\n"); - glp_check_kkt(P, GLP_SOL, GLP_KKT_DB, &ae_max, &ae_ind, &re_max, - &re_ind); - xfprintf(fp, "KKT.DB: max.abs.err = %.2e on %s %d\n", - ae_max, ae_ind <= P->m ? "row" : "column", - ae_ind <= P->m ? ae_ind : ae_ind - P->m); - xfprintf(fp, " max.rel.err = %.2e on %s %d\n", - re_max, re_ind <= P->m ? "row" : "column", - re_ind <= P->m ? re_ind : re_ind - P->m); - xfprintf(fp, "%8s%s\n", "", - re_max <= 1e-9 ? "High quality" : - re_max <= 1e-6 ? "Medium quality" : - re_max <= 1e-3 ? "Low quality" : "DUAL SOLUTION IS INFEASIBLE") - ; - xfprintf(fp, "\n"); - xfprintf(fp, "End of output\n"); -#if 0 /* FIXME */ - xfflush(fp); -#endif - if (glp_ioerr(fp)) - { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - ret = 0; -done: if (fp != NULL) glp_close(fp); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_read_sol - read basic solution from text file -* -* SYNOPSIS -* -* int glp_read_sol(glp_prob *lp, const char *fname); -* -* DESCRIPTION -* -* The routine glp_read_sol reads basic solution from a text file whose -* name is specified by the parameter fname into the problem object. -* -* For the file format see description of the routine glp_write_sol. -* -* RETURNS -* -* On success the routine returns zero, otherwise non-zero. */ - -int glp_read_sol(glp_prob *lp, const char *fname) -{ glp_data *data; - jmp_buf jump; - int i, j, k, ret = 0; - xprintf("Reading basic solution from '%s'...\n", fname); - data = glp_sdf_open_file(fname); - if (data == NULL) - { ret = 1; - goto done; - } - if (setjmp(jump)) - { ret = 1; - goto done; - } - glp_sdf_set_jump(data, jump); - /* number of rows, number of columns */ - k = glp_sdf_read_int(data); - if (k != lp->m) - glp_sdf_error(data, "wrong number of rows\n"); - k = glp_sdf_read_int(data); - if (k != lp->n) - glp_sdf_error(data, "wrong number of columns\n"); - /* primal status, dual status, objective value */ - k = glp_sdf_read_int(data); - if (!(k == GLP_UNDEF || k == GLP_FEAS || k == GLP_INFEAS || - k == GLP_NOFEAS)) - glp_sdf_error(data, "invalid primal status\n"); - lp->pbs_stat = k; - k = glp_sdf_read_int(data); - if (!(k == GLP_UNDEF || k == GLP_FEAS || k == GLP_INFEAS || - k == GLP_NOFEAS)) - glp_sdf_error(data, "invalid dual status\n"); - lp->dbs_stat = k; - lp->obj_val = glp_sdf_read_num(data); - /* rows (auxiliary variables) */ - for (i = 1; i <= lp->m; i++) - { GLPROW *row = lp->row[i]; - /* status, primal value, dual value */ - k = glp_sdf_read_int(data); - if (!(k == GLP_BS || k == GLP_NL || k == GLP_NU || - k == GLP_NF || k == GLP_NS)) - glp_sdf_error(data, "invalid row status\n"); - glp_set_row_stat(lp, i, k); - row->prim = glp_sdf_read_num(data); - row->dual = glp_sdf_read_num(data); - } - /* columns (structural variables) */ - for (j = 1; j <= lp->n; j++) - { GLPCOL *col = lp->col[j]; - /* status, primal value, dual value */ - k = glp_sdf_read_int(data); - if (!(k == GLP_BS || k == GLP_NL || k == GLP_NU || - k == GLP_NF || k == GLP_NS)) - glp_sdf_error(data, "invalid column status\n"); - glp_set_col_stat(lp, j, k); - col->prim = glp_sdf_read_num(data); - col->dual = glp_sdf_read_num(data); - } - xprintf("%d lines were read\n", glp_sdf_line(data)); -done: if (ret) lp->pbs_stat = lp->dbs_stat = GLP_UNDEF; - if (data != NULL) glp_sdf_close_file(data); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_write_sol - write basic solution to text file -* -* SYNOPSIS -* -* int glp_write_sol(glp_prob *lp, const char *fname); -* -* DESCRIPTION -* -* The routine glp_write_sol writes the current basic solution to a -* text file whose name is specified by the parameter fname. This file -* can be read back with the routine glp_read_sol. -* -* RETURNS -* -* On success the routine returns zero, otherwise non-zero. -* -* FILE FORMAT -* -* The file created by the routine glp_write_sol is a plain text file, -* which contains the following information: -* -* m n -* p_stat d_stat obj_val -* r_stat[1] r_prim[1] r_dual[1] -* . . . -* r_stat[m] r_prim[m] r_dual[m] -* c_stat[1] c_prim[1] c_dual[1] -* . . . -* c_stat[n] c_prim[n] c_dual[n] -* -* where: -* m is the number of rows (auxiliary variables); -* n is the number of columns (structural variables); -* p_stat is the primal status of the basic solution (GLP_UNDEF = 1, -* GLP_FEAS = 2, GLP_INFEAS = 3, or GLP_NOFEAS = 4); -* d_stat is the dual status of the basic solution (GLP_UNDEF = 1, -* GLP_FEAS = 2, GLP_INFEAS = 3, or GLP_NOFEAS = 4); -* obj_val is the objective value; -* r_stat[i], i = 1,...,m, is the status of i-th row (GLP_BS = 1, -* GLP_NL = 2, GLP_NU = 3, GLP_NF = 4, or GLP_NS = 5); -* r_prim[i], i = 1,...,m, is the primal value of i-th row; -* r_dual[i], i = 1,...,m, is the dual value of i-th row; -* c_stat[j], j = 1,...,n, is the status of j-th column (GLP_BS = 1, -* GLP_NL = 2, GLP_NU = 3, GLP_NF = 4, or GLP_NS = 5); -* c_prim[j], j = 1,...,n, is the primal value of j-th column; -* c_dual[j], j = 1,...,n, is the dual value of j-th column. */ - -int glp_write_sol(glp_prob *lp, const char *fname) -{ glp_file *fp; - int i, j, ret = 0; - xprintf("Writing basic solution to '%s'...\n", fname); - fp = glp_open(fname, "w"); - if (fp == NULL) - { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - /* number of rows, number of columns */ - xfprintf(fp, "%d %d\n", lp->m, lp->n); - /* primal status, dual status, objective value */ - xfprintf(fp, "%d %d %.*g\n", lp->pbs_stat, lp->dbs_stat, DBL_DIG, - lp->obj_val); - /* rows (auxiliary variables) */ - for (i = 1; i <= lp->m; i++) - { GLPROW *row = lp->row[i]; - /* status, primal value, dual value */ - xfprintf(fp, "%d %.*g %.*g\n", row->stat, DBL_DIG, row->prim, - DBL_DIG, row->dual); - } - /* columns (structural variables) */ - for (j = 1; j <= lp->n; j++) - { GLPCOL *col = lp->col[j]; - /* status, primal value, dual value */ - xfprintf(fp, "%d %.*g %.*g\n", col->stat, DBL_DIG, col->prim, - DBL_DIG, col->dual); - } -#if 0 /* FIXME */ - xfflush(fp); -#endif - if (glp_ioerr(fp)) - { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xprintf("%d lines were written\n", 2 + lp->m + lp->n); -done: if (fp != NULL) glp_close(fp); - return ret; -} - -/**********************************************************************/ - -static char *format(char buf[13+1], double x) -{ /* format floating-point number in MPS/360-like style */ - if (x == -DBL_MAX) - strcpy(buf, " -Inf"); - else if (x == +DBL_MAX) - strcpy(buf, " +Inf"); - else if (fabs(x) <= 999999.99998) - { sprintf(buf, "%13.5f", x); -#if 1 - if (strcmp(buf, " 0.00000") == 0 || - strcmp(buf, " -0.00000") == 0) - strcpy(buf, " . "); - else if (memcmp(buf, " 0.", 8) == 0) - memcpy(buf, " .", 8); - else if (memcmp(buf, " -0.", 8) == 0) - memcpy(buf, " -.", 8); -#endif - } - else - sprintf(buf, "%13.6g", x); - return buf; -} - -int glp_print_ranges(glp_prob *P, int len, const int list[], - int flags, const char *fname) -{ /* print sensitivity analysis report */ - glp_file *fp = NULL; - GLPROW *row; - GLPCOL *col; - int m, n, pass, k, t, numb, type, stat, var1, var2, count, page, - ret; - double lb, ub, slack, coef, prim, dual, value1, value2, coef1, - coef2, obj1, obj2; - const char *name, *limit; - char buf[13+1]; - /* sanity checks */ - if (P == NULL || P->magic != GLP_PROB_MAGIC) - xerror("glp_print_ranges: P = %p; invalid problem object\n", - P); - m = P->m, n = P->n; - if (len < 0) - xerror("glp_print_ranges: len = %d; invalid list length\n", - len); - if (len > 0) - { if (list == NULL) - xerror("glp_print_ranges: list = %p: invalid parameter\n", - list); - for (t = 1; t <= len; t++) - { k = list[t]; - if (!(1 <= k && k <= m+n)) - xerror("glp_print_ranges: list[%d] = %d; row/column numb" - "er out of range\n", t, k); - } - } - if (flags != 0) - xerror("glp_print_ranges: flags = %d; invalid parameter\n", - flags); - if (fname == NULL) - xerror("glp_print_ranges: fname = %p; invalid parameter\n", - fname); - if (glp_get_status(P) != GLP_OPT) - { xprintf("glp_print_ranges: optimal basic solution required\n"); - ret = 1; - goto done; - } - if (!glp_bf_exists(P)) - { xprintf("glp_print_ranges: basis factorization required\n"); - ret = 2; - goto done; - } - /* start reporting */ - xprintf("Write sensitivity analysis report to '%s'...\n", fname); - fp = glp_open(fname, "w"); - if (fp == NULL) - { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); - ret = 3; - goto done; - } - page = count = 0; - for (pass = 1; pass <= 2; pass++) - for (t = 1; t <= (len == 0 ? m+n : len); t++) - { if (t == 1) count = 0; - k = (len == 0 ? t : list[t]); - if (pass == 1 && k > m || pass == 2 && k <= m) - continue; - if (count == 0) - { xfprintf(fp, "GLPK %-4s - SENSITIVITY ANALYSIS REPORT%73sPa" - "ge%4d\n", glp_version(), "", ++page); - xfprintf(fp, "\n"); - xfprintf(fp, "%-12s%s\n", "Problem:", - P->name == NULL ? "" : P->name); - xfprintf(fp, "%-12s%s%s%.10g (%s)\n", "Objective:", - P->obj == NULL ? "" : P->obj, - P->obj == NULL ? "" : " = ", P->obj_val, - P->dir == GLP_MIN ? "MINimum" : - P->dir == GLP_MAX ? "MAXimum" : "???"); - xfprintf(fp, "\n"); - xfprintf(fp, "%6s %-12s %2s %13s %13s %13s %13s %13s %13s " - "%s\n", "No.", pass == 1 ? "Row name" : "Column name", - "St", "Activity", pass == 1 ? "Slack" : "Obj coef", - "Lower bound", "Activity", "Obj coef", "Obj value at", - "Limiting"); - xfprintf(fp, "%6s %-12s %2s %13s %13s %13s %13s %13s %13s " - "%s\n", "", "", "", "", "Marginal", "Upper bound", - "range", "range", "break point", "variable"); - xfprintf(fp, "------ ------------ -- ------------- --------" - "----- ------------- ------------- ------------- ------" - "------- ------------\n"); - } - if (pass == 1) - { numb = k; - xassert(1 <= numb && numb <= m); - row = P->row[numb]; - name = row->name; - type = row->type; - lb = glp_get_row_lb(P, numb); - ub = glp_get_row_ub(P, numb); - coef = 0.0; - stat = row->stat; - prim = row->prim; - if (type == GLP_FR) - slack = - prim; - else if (type == GLP_LO) - slack = lb - prim; - else if (type == GLP_UP || type == GLP_DB || type == GLP_FX) - slack = ub - prim; - dual = row->dual; - } - else - { numb = k - m; - xassert(1 <= numb && numb <= n); - col = P->col[numb]; - name = col->name; - lb = glp_get_col_lb(P, numb); - ub = glp_get_col_ub(P, numb); - coef = col->coef; - stat = col->stat; - prim = col->prim; - slack = 0.0; - dual = col->dual; - } - if (stat != GLP_BS) - { glp_analyze_bound(P, k, &value1, &var1, &value2, &var2); - if (stat == GLP_NF) - coef1 = coef2 = coef; - else if (stat == GLP_NS) - coef1 = -DBL_MAX, coef2 = +DBL_MAX; - else if (stat == GLP_NL && P->dir == GLP_MIN || - stat == GLP_NU && P->dir == GLP_MAX) - coef1 = coef - dual, coef2 = +DBL_MAX; - else - coef1 = -DBL_MAX, coef2 = coef - dual; - if (value1 == -DBL_MAX) - { if (dual < -1e-9) - obj1 = +DBL_MAX; - else if (dual > +1e-9) - obj1 = -DBL_MAX; - else - obj1 = P->obj_val; - } - else - obj1 = P->obj_val + dual * (value1 - prim); - if (value2 == +DBL_MAX) - { if (dual < -1e-9) - obj2 = -DBL_MAX; - else if (dual > +1e-9) - obj2 = +DBL_MAX; - else - obj2 = P->obj_val; - } - else - obj2 = P->obj_val + dual * (value2 - prim); - } - else - { glp_analyze_coef(P, k, &coef1, &var1, &value1, &coef2, - &var2, &value2); - if (coef1 == -DBL_MAX) - { if (prim < -1e-9) - obj1 = +DBL_MAX; - else if (prim > +1e-9) - obj1 = -DBL_MAX; - else - obj1 = P->obj_val; - } - else - obj1 = P->obj_val + (coef1 - coef) * prim; - if (coef2 == +DBL_MAX) - { if (prim < -1e-9) - obj2 = -DBL_MAX; - else if (prim > +1e-9) - obj2 = +DBL_MAX; - else - obj2 = P->obj_val; - } - else - obj2 = P->obj_val + (coef2 - coef) * prim; - } - /*** first line ***/ - /* row/column number */ - xfprintf(fp, "%6d", numb); - /* row/column name */ - xfprintf(fp, " %-12.12s", name == NULL ? "" : name); - if (name != NULL && strlen(name) > 12) - xfprintf(fp, "%s\n%6s %12s", name+12, "", ""); - /* row/column status */ - xfprintf(fp, " %2s", - stat == GLP_BS ? "BS" : stat == GLP_NL ? "NL" : - stat == GLP_NU ? "NU" : stat == GLP_NF ? "NF" : - stat == GLP_NS ? "NS" : "??"); - /* row/column activity */ - xfprintf(fp, " %s", format(buf, prim)); - /* row slack, column objective coefficient */ - xfprintf(fp, " %s", format(buf, k <= m ? slack : coef)); - /* row/column lower bound */ - xfprintf(fp, " %s", format(buf, lb)); - /* row/column activity range */ - xfprintf(fp, " %s", format(buf, value1)); - /* row/column objective coefficient range */ - xfprintf(fp, " %s", format(buf, coef1)); - /* objective value at break point */ - xfprintf(fp, " %s", format(buf, obj1)); - /* limiting variable name */ - if (var1 != 0) - { if (var1 <= m) - limit = glp_get_row_name(P, var1); - else - limit = glp_get_col_name(P, var1 - m); - if (limit != NULL) - xfprintf(fp, " %s", limit); - } - xfprintf(fp, "\n"); - /*** second line ***/ - xfprintf(fp, "%6s %-12s %2s %13s", "", "", "", ""); - /* row/column reduced cost */ - xfprintf(fp, " %s", format(buf, dual)); - /* row/column upper bound */ - xfprintf(fp, " %s", format(buf, ub)); - /* row/column activity range */ - xfprintf(fp, " %s", format(buf, value2)); - /* row/column objective coefficient range */ - xfprintf(fp, " %s", format(buf, coef2)); - /* objective value at break point */ - xfprintf(fp, " %s", format(buf, obj2)); - /* limiting variable name */ - if (var2 != 0) - { if (var2 <= m) - limit = glp_get_row_name(P, var2); - else - limit = glp_get_col_name(P, var2 - m); - if (limit != NULL) - xfprintf(fp, " %s", limit); - } - xfprintf(fp, "\n"); - xfprintf(fp, "\n"); - /* print 10 items per page */ - count = (count + 1) % 10; - } - xfprintf(fp, "End of report\n"); -#if 0 /* FIXME */ - xfflush(fp); -#endif - if (glp_ioerr(fp)) - { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); - ret = 4; - goto done; - } - ret = 0; -done: if (fp != NULL) glp_close(fp); - return ret; -} - -/**********************************************************************/ - -int glp_print_ipt(glp_prob *P, const char *fname) -{ /* write interior-point solution in printable format */ - glp_file *fp; - GLPROW *row; - GLPCOL *col; - int i, j, t, ae_ind, re_ind, ret; - double ae_max, re_max; - xprintf("Writing interior-point solution to '%s'...\n", fname); - fp = glp_open(fname, "w"); - if (fp == NULL) - { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xfprintf(fp, "%-12s%s\n", "Problem:", - P->name == NULL ? "" : P->name); - xfprintf(fp, "%-12s%d\n", "Rows:", P->m); - xfprintf(fp, "%-12s%d\n", "Columns:", P->n); - xfprintf(fp, "%-12s%d\n", "Non-zeros:", P->nnz); - t = glp_ipt_status(P); - xfprintf(fp, "%-12s%s\n", "Status:", - t == GLP_OPT ? "OPTIMAL" : - t == GLP_UNDEF ? "UNDEFINED" : - t == GLP_INFEAS ? "INFEASIBLE (INTERMEDIATE)" : - t == GLP_NOFEAS ? "INFEASIBLE (FINAL)" : "???"); - xfprintf(fp, "%-12s%s%s%.10g (%s)\n", "Objective:", - P->obj == NULL ? "" : P->obj, - P->obj == NULL ? "" : " = ", P->ipt_obj, - P->dir == GLP_MIN ? "MINimum" : - P->dir == GLP_MAX ? "MAXimum" : "???"); - xfprintf(fp, "\n"); - xfprintf(fp, " No. Row name Activity Lower bound " - " Upper bound Marginal\n"); - xfprintf(fp, "------ ------------ ------------- ------------- " - "------------- -------------\n"); - for (i = 1; i <= P->m; i++) - { row = P->row[i]; - xfprintf(fp, "%6d ", i); - if (row->name == NULL || strlen(row->name) <= 12) - xfprintf(fp, "%-12s ", row->name == NULL ? "" : row->name); - else - xfprintf(fp, "%s\n%20s", row->name, ""); - xfprintf(fp, "%3s", ""); - xfprintf(fp, "%13.6g ", - fabs(row->pval) <= 1e-9 ? 0.0 : row->pval); - if (row->type == GLP_LO || row->type == GLP_DB || - row->type == GLP_FX) - xfprintf(fp, "%13.6g ", row->lb); - else - xfprintf(fp, "%13s ", ""); - if (row->type == GLP_UP || row->type == GLP_DB) - xfprintf(fp, "%13.6g ", row->ub); - else - xfprintf(fp, "%13s ", row->type == GLP_FX ? "=" : ""); - if (fabs(row->dval) <= 1e-9) - xfprintf(fp, "%13s", "< eps"); - else - xfprintf(fp, "%13.6g ", row->dval); - xfprintf(fp, "\n"); - } - xfprintf(fp, "\n"); - xfprintf(fp, " No. Column name Activity Lower bound " - " Upper bound Marginal\n"); - xfprintf(fp, "------ ------------ ------------- ------------- " - "------------- -------------\n"); - for (j = 1; j <= P->n; j++) - { col = P->col[j]; - xfprintf(fp, "%6d ", j); - if (col->name == NULL || strlen(col->name) <= 12) - xfprintf(fp, "%-12s ", col->name == NULL ? "" : col->name); - else - xfprintf(fp, "%s\n%20s", col->name, ""); - xfprintf(fp, "%3s", ""); - xfprintf(fp, "%13.6g ", - fabs(col->pval) <= 1e-9 ? 0.0 : col->pval); - if (col->type == GLP_LO || col->type == GLP_DB || - col->type == GLP_FX) - xfprintf(fp, "%13.6g ", col->lb); - else - xfprintf(fp, "%13s ", ""); - if (col->type == GLP_UP || col->type == GLP_DB) - xfprintf(fp, "%13.6g ", col->ub); - else - xfprintf(fp, "%13s ", col->type == GLP_FX ? "=" : ""); - if (fabs(col->dval) <= 1e-9) - xfprintf(fp, "%13s", "< eps"); - else - xfprintf(fp, "%13.6g ", col->dval); - xfprintf(fp, "\n"); - } - xfprintf(fp, "\n"); - xfprintf(fp, "Karush-Kuhn-Tucker optimality conditions:\n"); - xfprintf(fp, "\n"); - glp_check_kkt(P, GLP_IPT, GLP_KKT_PE, &ae_max, &ae_ind, &re_max, - &re_ind); - xfprintf(fp, "KKT.PE: max.abs.err = %.2e on row %d\n", - ae_max, ae_ind); - xfprintf(fp, " max.rel.err = %.2e on row %d\n", - re_max, re_ind); - xfprintf(fp, "%8s%s\n", "", - re_max <= 1e-9 ? "High quality" : - re_max <= 1e-6 ? "Medium quality" : - re_max <= 1e-3 ? "Low quality" : "PRIMAL SOLUTION IS WRONG"); - xfprintf(fp, "\n"); - glp_check_kkt(P, GLP_IPT, GLP_KKT_PB, &ae_max, &ae_ind, &re_max, - &re_ind); - xfprintf(fp, "KKT.PB: max.abs.err = %.2e on %s %d\n", - ae_max, ae_ind <= P->m ? "row" : "column", - ae_ind <= P->m ? ae_ind : ae_ind - P->m); - xfprintf(fp, " max.rel.err = %.2e on %s %d\n", - re_max, re_ind <= P->m ? "row" : "column", - re_ind <= P->m ? re_ind : re_ind - P->m); - xfprintf(fp, "%8s%s\n", "", - re_max <= 1e-9 ? "High quality" : - re_max <= 1e-6 ? "Medium quality" : - re_max <= 1e-3 ? "Low quality" : "PRIMAL SOLUTION IS INFEASIBL" - "E"); - xfprintf(fp, "\n"); - glp_check_kkt(P, GLP_IPT, GLP_KKT_DE, &ae_max, &ae_ind, &re_max, - &re_ind); - xfprintf(fp, "KKT.DE: max.abs.err = %.2e on column %d\n", - ae_max, ae_ind == 0 ? 0 : ae_ind - P->m); - xfprintf(fp, " max.rel.err = %.2e on column %d\n", - re_max, re_ind == 0 ? 0 : re_ind - P->m); - xfprintf(fp, "%8s%s\n", "", - re_max <= 1e-9 ? "High quality" : - re_max <= 1e-6 ? "Medium quality" : - re_max <= 1e-3 ? "Low quality" : "DUAL SOLUTION IS WRONG"); - xfprintf(fp, "\n"); - glp_check_kkt(P, GLP_IPT, GLP_KKT_DB, &ae_max, &ae_ind, &re_max, - &re_ind); - xfprintf(fp, "KKT.DB: max.abs.err = %.2e on %s %d\n", - ae_max, ae_ind <= P->m ? "row" : "column", - ae_ind <= P->m ? ae_ind : ae_ind - P->m); - xfprintf(fp, " max.rel.err = %.2e on %s %d\n", - re_max, re_ind <= P->m ? "row" : "column", - re_ind <= P->m ? re_ind : re_ind - P->m); - xfprintf(fp, "%8s%s\n", "", - re_max <= 1e-9 ? "High quality" : - re_max <= 1e-6 ? "Medium quality" : - re_max <= 1e-3 ? "Low quality" : "DUAL SOLUTION IS INFEASIBLE") - ; - xfprintf(fp, "\n"); - xfprintf(fp, "End of output\n"); -#if 0 /* FIXME */ - xfflush(fp); -#endif - if (glp_ioerr(fp)) - { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - ret = 0; -done: if (fp != NULL) glp_close(fp); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_read_ipt - read interior-point solution from text file -* -* SYNOPSIS -* -* int glp_read_ipt(glp_prob *lp, const char *fname); -* -* DESCRIPTION -* -* The routine glp_read_ipt reads interior-point solution from a text -* file whose name is specified by the parameter fname into the problem -* object. -* -* For the file format see description of the routine glp_write_ipt. -* -* RETURNS -* -* On success the routine returns zero, otherwise non-zero. */ - -int glp_read_ipt(glp_prob *lp, const char *fname) -{ glp_data *data; - jmp_buf jump; - int i, j, k, ret = 0; - xprintf("Reading interior-point solution from '%s'...\n", fname); - data = glp_sdf_open_file(fname); - if (data == NULL) - { ret = 1; - goto done; - } - if (setjmp(jump)) - { ret = 1; - goto done; - } - glp_sdf_set_jump(data, jump); - /* number of rows, number of columns */ - k = glp_sdf_read_int(data); - if (k != lp->m) - glp_sdf_error(data, "wrong number of rows\n"); - k = glp_sdf_read_int(data); - if (k != lp->n) - glp_sdf_error(data, "wrong number of columns\n"); - /* solution status, objective value */ - k = glp_sdf_read_int(data); - if (!(k == GLP_UNDEF || k == GLP_OPT)) - glp_sdf_error(data, "invalid solution status\n"); - lp->ipt_stat = k; - lp->ipt_obj = glp_sdf_read_num(data); - /* rows (auxiliary variables) */ - for (i = 1; i <= lp->m; i++) - { GLPROW *row = lp->row[i]; - /* primal value, dual value */ - row->pval = glp_sdf_read_num(data); - row->dval = glp_sdf_read_num(data); - } - /* columns (structural variables) */ - for (j = 1; j <= lp->n; j++) - { GLPCOL *col = lp->col[j]; - /* primal value, dual value */ - col->pval = glp_sdf_read_num(data); - col->dval = glp_sdf_read_num(data); - } - xprintf("%d lines were read\n", glp_sdf_line(data)); -done: if (ret) lp->ipt_stat = GLP_UNDEF; - if (data != NULL) glp_sdf_close_file(data); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_write_ipt - write interior-point solution to text file -* -* SYNOPSIS -* -* int glp_write_ipt(glp_prob *lp, const char *fname); -* -* DESCRIPTION -* -* The routine glp_write_ipt writes the current interior-point solution -* to a text file whose name is specified by the parameter fname. This -* file can be read back with the routine glp_read_ipt. -* -* RETURNS -* -* On success the routine returns zero, otherwise non-zero. -* -* FILE FORMAT -* -* The file created by the routine glp_write_ipt is a plain text file, -* which contains the following information: -* -* m n -* stat obj_val -* r_prim[1] r_dual[1] -* . . . -* r_prim[m] r_dual[m] -* c_prim[1] c_dual[1] -* . . . -* c_prim[n] c_dual[n] -* -* where: -* m is the number of rows (auxiliary variables); -* n is the number of columns (structural variables); -* stat is the solution status (GLP_UNDEF = 1 or GLP_OPT = 5); -* obj_val is the objective value; -* r_prim[i], i = 1,...,m, is the primal value of i-th row; -* r_dual[i], i = 1,...,m, is the dual value of i-th row; -* c_prim[j], j = 1,...,n, is the primal value of j-th column; -* c_dual[j], j = 1,...,n, is the dual value of j-th column. */ - -int glp_write_ipt(glp_prob *lp, const char *fname) -{ glp_file *fp; - int i, j, ret = 0; - xprintf("Writing interior-point solution to '%s'...\n", fname); - fp = glp_open(fname, "w"); - if (fp == NULL) - { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - /* number of rows, number of columns */ - xfprintf(fp, "%d %d\n", lp->m, lp->n); - /* solution status, objective value */ - xfprintf(fp, "%d %.*g\n", lp->ipt_stat, DBL_DIG, lp->ipt_obj); - /* rows (auxiliary variables) */ - for (i = 1; i <= lp->m; i++) - { GLPROW *row = lp->row[i]; - /* primal value, dual value */ - xfprintf(fp, "%.*g %.*g\n", DBL_DIG, row->pval, DBL_DIG, - row->dval); - } - /* columns (structural variables) */ - for (j = 1; j <= lp->n; j++) - { GLPCOL *col = lp->col[j]; - /* primal value, dual value */ - xfprintf(fp, "%.*g %.*g\n", DBL_DIG, col->pval, DBL_DIG, - col->dval); - } -#if 0 /* FIXME */ - xfflush(fp); -#endif - if (glp_ioerr(fp)) - { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xprintf("%d lines were written\n", 2 + lp->m + lp->n); -done: if (fp != NULL) glp_close(fp); - return ret; -} - -/**********************************************************************/ - -int glp_print_mip(glp_prob *P, const char *fname) -{ /* write MIP solution in printable format */ - glp_file *fp; - GLPROW *row; - GLPCOL *col; - int i, j, t, ae_ind, re_ind, ret; - double ae_max, re_max; - xprintf("Writing MIP solution to '%s'...\n", fname); - fp = glp_open(fname, "w"); - if (fp == NULL) - { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xfprintf(fp, "%-12s%s\n", "Problem:", - P->name == NULL ? "" : P->name); - xfprintf(fp, "%-12s%d\n", "Rows:", P->m); - xfprintf(fp, "%-12s%d (%d integer, %d binary)\n", "Columns:", - P->n, glp_get_num_int(P), glp_get_num_bin(P)); - xfprintf(fp, "%-12s%d\n", "Non-zeros:", P->nnz); - t = glp_mip_status(P); - xfprintf(fp, "%-12s%s\n", "Status:", - t == GLP_OPT ? "INTEGER OPTIMAL" : - t == GLP_FEAS ? "INTEGER NON-OPTIMAL" : - t == GLP_NOFEAS ? "INTEGER EMPTY" : - t == GLP_UNDEF ? "INTEGER UNDEFINED" : "???"); - xfprintf(fp, "%-12s%s%s%.10g (%s)\n", "Objective:", - P->obj == NULL ? "" : P->obj, - P->obj == NULL ? "" : " = ", P->mip_obj, - P->dir == GLP_MIN ? "MINimum" : - P->dir == GLP_MAX ? "MAXimum" : "???"); - xfprintf(fp, "\n"); - xfprintf(fp, " No. Row name Activity Lower bound " - " Upper bound\n"); - xfprintf(fp, "------ ------------ ------------- ------------- " - "-------------\n"); - for (i = 1; i <= P->m; i++) - { row = P->row[i]; - xfprintf(fp, "%6d ", i); - if (row->name == NULL || strlen(row->name) <= 12) - xfprintf(fp, "%-12s ", row->name == NULL ? "" : row->name); - else - xfprintf(fp, "%s\n%20s", row->name, ""); - xfprintf(fp, "%3s", ""); - xfprintf(fp, "%13.6g ", - fabs(row->mipx) <= 1e-9 ? 0.0 : row->mipx); - if (row->type == GLP_LO || row->type == GLP_DB || - row->type == GLP_FX) - xfprintf(fp, "%13.6g ", row->lb); - else - xfprintf(fp, "%13s ", ""); - if (row->type == GLP_UP || row->type == GLP_DB) - xfprintf(fp, "%13.6g ", row->ub); - else - xfprintf(fp, "%13s ", row->type == GLP_FX ? "=" : ""); - xfprintf(fp, "\n"); - } - xfprintf(fp, "\n"); - xfprintf(fp, " No. Column name Activity Lower bound " - " Upper bound\n"); - xfprintf(fp, "------ ------------ ------------- ------------- " - "-------------\n"); - for (j = 1; j <= P->n; j++) - { col = P->col[j]; - xfprintf(fp, "%6d ", j); - if (col->name == NULL || strlen(col->name) <= 12) - xfprintf(fp, "%-12s ", col->name == NULL ? "" : col->name); - else - xfprintf(fp, "%s\n%20s", col->name, ""); - xfprintf(fp, "%s ", - col->kind == GLP_CV ? " " : - col->kind == GLP_IV ? "*" : "?"); - xfprintf(fp, "%13.6g ", - fabs(col->mipx) <= 1e-9 ? 0.0 : col->mipx); - if (col->type == GLP_LO || col->type == GLP_DB || - col->type == GLP_FX) - xfprintf(fp, "%13.6g ", col->lb); - else - xfprintf(fp, "%13s ", ""); - if (col->type == GLP_UP || col->type == GLP_DB) - xfprintf(fp, "%13.6g ", col->ub); - else - xfprintf(fp, "%13s ", col->type == GLP_FX ? "=" : ""); - xfprintf(fp, "\n"); - } - xfprintf(fp, "\n"); - xfprintf(fp, "Integer feasibility conditions:\n"); - xfprintf(fp, "\n"); - glp_check_kkt(P, GLP_MIP, GLP_KKT_PE, &ae_max, &ae_ind, &re_max, - &re_ind); - xfprintf(fp, "KKT.PE: max.abs.err = %.2e on row %d\n", - ae_max, ae_ind); - xfprintf(fp, " max.rel.err = %.2e on row %d\n", - re_max, re_ind); - xfprintf(fp, "%8s%s\n", "", - re_max <= 1e-9 ? "High quality" : - re_max <= 1e-6 ? "Medium quality" : - re_max <= 1e-3 ? "Low quality" : "SOLUTION IS WRONG"); - xfprintf(fp, "\n"); - glp_check_kkt(P, GLP_MIP, GLP_KKT_PB, &ae_max, &ae_ind, &re_max, - &re_ind); - xfprintf(fp, "KKT.PB: max.abs.err = %.2e on %s %d\n", - ae_max, ae_ind <= P->m ? "row" : "column", - ae_ind <= P->m ? ae_ind : ae_ind - P->m); - xfprintf(fp, " max.rel.err = %.2e on %s %d\n", - re_max, re_ind <= P->m ? "row" : "column", - re_ind <= P->m ? re_ind : re_ind - P->m); - xfprintf(fp, "%8s%s\n", "", - re_max <= 1e-9 ? "High quality" : - re_max <= 1e-6 ? "Medium quality" : - re_max <= 1e-3 ? "Low quality" : "SOLUTION IS INFEASIBLE"); - xfprintf(fp, "\n"); - xfprintf(fp, "End of output\n"); -#if 0 /* FIXME */ - xfflush(fp); -#endif - if (glp_ioerr(fp)) - { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - ret = 0; -done: if (fp != NULL) glp_close(fp); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_read_mip - read MIP solution from text file -* -* SYNOPSIS -* -* int glp_read_mip(glp_prob *mip, const char *fname); -* -* DESCRIPTION -* -* The routine glp_read_mip reads MIP solution from a text file whose -* name is specified by the parameter fname into the problem object. -* -* For the file format see description of the routine glp_write_mip. -* -* RETURNS -* -* On success the routine returns zero, otherwise non-zero. */ - -int glp_read_mip(glp_prob *mip, const char *fname) -{ glp_data *data; - jmp_buf jump; - int i, j, k, ret = 0; - xprintf("Reading MIP solution from '%s'...\n", fname); - data = glp_sdf_open_file(fname); - if (data == NULL) - { ret = 1; - goto done; - } - if (setjmp(jump)) - { ret = 1; - goto done; - } - glp_sdf_set_jump(data, jump); - /* number of rows, number of columns */ - k = glp_sdf_read_int(data); - if (k != mip->m) - glp_sdf_error(data, "wrong number of rows\n"); - k = glp_sdf_read_int(data); - if (k != mip->n) - glp_sdf_error(data, "wrong number of columns\n"); - /* solution status, objective value */ - k = glp_sdf_read_int(data); - if (!(k == GLP_UNDEF || k == GLP_OPT || k == GLP_FEAS || - k == GLP_NOFEAS)) - glp_sdf_error(data, "invalid solution status\n"); - mip->mip_stat = k; - mip->mip_obj = glp_sdf_read_num(data); - /* rows (auxiliary variables) */ - for (i = 1; i <= mip->m; i++) - { GLPROW *row = mip->row[i]; - row->mipx = glp_sdf_read_num(data); - } - /* columns (structural variables) */ - for (j = 1; j <= mip->n; j++) - { GLPCOL *col = mip->col[j]; - col->mipx = glp_sdf_read_num(data); - if (col->kind == GLP_IV && col->mipx != floor(col->mipx)) - glp_sdf_error(data, "non-integer column value"); - } - xprintf("%d lines were read\n", glp_sdf_line(data)); -done: if (ret) mip->mip_stat = GLP_UNDEF; - if (data != NULL) glp_sdf_close_file(data); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_write_mip - write MIP solution to text file -* -* SYNOPSIS -* -* int glp_write_mip(glp_prob *mip, const char *fname); -* -* DESCRIPTION -* -* The routine glp_write_mip writes the current MIP solution to a text -* file whose name is specified by the parameter fname. This file can -* be read back with the routine glp_read_mip. -* -* RETURNS -* -* On success the routine returns zero, otherwise non-zero. -* -* FILE FORMAT -* -* The file created by the routine glp_write_sol is a plain text file, -* which contains the following information: -* -* m n -* stat obj_val -* r_val[1] -* . . . -* r_val[m] -* c_val[1] -* . . . -* c_val[n] -* -* where: -* m is the number of rows (auxiliary variables); -* n is the number of columns (structural variables); -* stat is the solution status (GLP_UNDEF = 1, GLP_FEAS = 2, -* GLP_NOFEAS = 4, or GLP_OPT = 5); -* obj_val is the objective value; -* r_val[i], i = 1,...,m, is the value of i-th row; -* c_val[j], j = 1,...,n, is the value of j-th column. */ - -int glp_write_mip(glp_prob *mip, const char *fname) -{ glp_file *fp; - int i, j, ret = 0; - xprintf("Writing MIP solution to '%s'...\n", fname); - fp = glp_open(fname, "w"); - if (fp == NULL) - { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - /* number of rows, number of columns */ - xfprintf(fp, "%d %d\n", mip->m, mip->n); - /* solution status, objective value */ - xfprintf(fp, "%d %.*g\n", mip->mip_stat, DBL_DIG, mip->mip_obj); - /* rows (auxiliary variables) */ - for (i = 1; i <= mip->m; i++) - xfprintf(fp, "%.*g\n", DBL_DIG, mip->row[i]->mipx); - /* columns (structural variables) */ - for (j = 1; j <= mip->n; j++) - xfprintf(fp, "%.*g\n", DBL_DIG, mip->col[j]->mipx); -#if 0 /* FIXME */ - xfflush(fp); -#endif - if (glp_ioerr(fp)) - { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xprintf("%d lines were written\n", 2 + mip->m + mip->n); -done: if (fp != NULL) glp_close(fp); - return ret; -} - -/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpapi16.c b/resources/3rdparty/glpk-4.57/src/glpapi16.c deleted file mode 100644 index 9af86e2bd..000000000 --- a/resources/3rdparty/glpk-4.57/src/glpapi16.c +++ /dev/null @@ -1,330 +0,0 @@ -/* glpapi16.c (graph and network analysis routines) */ - -/*********************************************************************** -* This code is part of GLPK (GNU Linear Programming Kit). -* -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied -* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights -* reserved. E-mail: . -* -* GLPK is free software: you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GLPK is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -* License for more details. -* -* You should have received a copy of the GNU General Public License -* along with GLPK. If not, see . -***********************************************************************/ - -#include "env.h" -#include "mc13d.h" -#include "prob.h" - -/*********************************************************************** -* NAME -* -* glp_weak_comp - find all weakly connected components of graph -* -* SYNOPSIS -* -* int glp_weak_comp(glp_graph *G, int v_num); -* -* DESCRIPTION -* -* The routine glp_weak_comp finds all weakly connected components of -* the specified graph. -* -* The parameter v_num specifies an offset of the field of type int -* in the vertex data block, to which the routine stores the number of -* a (weakly) connected component containing that vertex. If v_num < 0, -* no component numbers are stored. -* -* The components are numbered in arbitrary order from 1 to nc, where -* nc is the total number of components found, 0 <= nc <= |V|. -* -* RETURNS -* -* The routine returns nc, the total number of components found. */ - -int glp_weak_comp(glp_graph *G, int v_num) -{ glp_vertex *v; - glp_arc *a; - int f, i, j, nc, nv, pos1, pos2, *prev, *next, *list; - if (v_num >= 0 && v_num > G->v_size - (int)sizeof(int)) - xerror("glp_weak_comp: v_num = %d; invalid offset\n", v_num); - nv = G->nv; - if (nv == 0) - { nc = 0; - goto done; - } - /* allocate working arrays */ - prev = xcalloc(1+nv, sizeof(int)); - next = xcalloc(1+nv, sizeof(int)); - list = xcalloc(1+nv, sizeof(int)); - /* if vertex i is unlabelled, prev[i] is the index of previous - unlabelled vertex, and next[i] is the index of next unlabelled - vertex; if vertex i is labelled, then prev[i] < 0, and next[i] - is the connected component number */ - /* initially all vertices are unlabelled */ - f = 1; - for (i = 1; i <= nv; i++) - prev[i] = i - 1, next[i] = i + 1; - next[nv] = 0; - /* main loop (until all vertices have been labelled) */ - nc = 0; - while (f != 0) - { /* take an unlabelled vertex */ - i = f; - /* and remove it from the list of unlabelled vertices */ - f = next[i]; - if (f != 0) prev[f] = 0; - /* label the vertex; it begins a new component */ - prev[i] = -1, next[i] = ++nc; - /* breadth first search */ - list[1] = i, pos1 = pos2 = 1; - while (pos1 <= pos2) - { /* dequeue vertex i */ - i = list[pos1++]; - /* consider all arcs incoming to vertex i */ - for (a = G->v[i]->in; a != NULL; a = a->h_next) - { /* vertex j is adjacent to vertex i */ - j = a->tail->i; - if (prev[j] >= 0) - { /* vertex j is unlabelled */ - /* remove it from the list of unlabelled vertices */ - if (prev[j] == 0) - f = next[j]; - else - next[prev[j]] = next[j]; - if (next[j] == 0) - ; - else - prev[next[j]] = prev[j]; - /* label the vertex */ - prev[j] = -1, next[j] = nc; - /* and enqueue it for further consideration */ - list[++pos2] = j; - } - } - /* consider all arcs outgoing from vertex i */ - for (a = G->v[i]->out; a != NULL; a = a->t_next) - { /* vertex j is adjacent to vertex i */ - j = a->head->i; - if (prev[j] >= 0) - { /* vertex j is unlabelled */ - /* remove it from the list of unlabelled vertices */ - if (prev[j] == 0) - f = next[j]; - else - next[prev[j]] = next[j]; - if (next[j] == 0) - ; - else - prev[next[j]] = prev[j]; - /* label the vertex */ - prev[j] = -1, next[j] = nc; - /* and enqueue it for further consideration */ - list[++pos2] = j; - } - } - } - } - /* store component numbers */ - if (v_num >= 0) - { for (i = 1; i <= nv; i++) - { v = G->v[i]; - memcpy((char *)v->data + v_num, &next[i], sizeof(int)); - } - } - /* free working arrays */ - xfree(prev); - xfree(next); - xfree(list); -done: return nc; -} - -/*********************************************************************** -* NAME -* -* glp_strong_comp - find all strongly connected components of graph -* -* SYNOPSIS -* -* int glp_strong_comp(glp_graph *G, int v_num); -* -* DESCRIPTION -* -* The routine glp_strong_comp finds all strongly connected components -* of the specified graph. -* -* The parameter v_num specifies an offset of the field of type int -* in the vertex data block, to which the routine stores the number of -* a strongly connected component containing that vertex. If v_num < 0, -* no component numbers are stored. -* -* The components are numbered in arbitrary order from 1 to nc, where -* nc is the total number of components found, 0 <= nc <= |V|. However, -* the component numbering has the property that for every arc (i->j) -* in the graph the condition num(i) >= num(j) holds. -* -* RETURNS -* -* The routine returns nc, the total number of components found. */ - -int glp_strong_comp(glp_graph *G, int v_num) -{ glp_vertex *v; - glp_arc *a; - int i, k, last, n, na, nc, *icn, *ip, *lenr, *ior, *ib, *lowl, - *numb, *prev; - if (v_num >= 0 && v_num > G->v_size - (int)sizeof(int)) - xerror("glp_strong_comp: v_num = %d; invalid offset\n", - v_num); - n = G->nv; - if (n == 0) - { nc = 0; - goto done; - } - na = G->na; - icn = xcalloc(1+na, sizeof(int)); - ip = xcalloc(1+n, sizeof(int)); - lenr = xcalloc(1+n, sizeof(int)); - ior = xcalloc(1+n, sizeof(int)); - ib = xcalloc(1+n, sizeof(int)); - lowl = xcalloc(1+n, sizeof(int)); - numb = xcalloc(1+n, sizeof(int)); - prev = xcalloc(1+n, sizeof(int)); - k = 1; - for (i = 1; i <= n; i++) - { v = G->v[i]; - ip[i] = k; - for (a = v->out; a != NULL; a = a->t_next) - icn[k++] = a->head->i; - lenr[i] = k - ip[i]; - } - xassert(na == k-1); - nc = mc13d(n, icn, ip, lenr, ior, ib, lowl, numb, prev); - if (v_num >= 0) - { xassert(ib[1] == 1); - for (k = 1; k <= nc; k++) - { last = (k < nc ? ib[k+1] : n+1); - xassert(ib[k] < last); - for (i = ib[k]; i < last; i++) - { v = G->v[ior[i]]; - memcpy((char *)v->data + v_num, &k, sizeof(int)); - } - } - } - xfree(icn); - xfree(ip); - xfree(lenr); - xfree(ior); - xfree(ib); - xfree(lowl); - xfree(numb); - xfree(prev); -done: return nc; -} - -/*********************************************************************** -* NAME -* -* glp_top_sort - topological sorting of acyclic digraph -* -* SYNOPSIS -* -* int glp_top_sort(glp_graph *G, int v_num); -* -* DESCRIPTION -* -* The routine glp_top_sort performs topological sorting of vertices of -* the specified acyclic digraph. -* -* The parameter v_num specifies an offset of the field of type int in -* the vertex data block, to which the routine stores the vertex number -* assigned. If v_num < 0, vertex numbers are not stored. -* -* The vertices are numbered from 1 to n, where n is the total number -* of vertices in the graph. The vertex numbering has the property that -* for every arc (i->j) in the graph the condition num(i) < num(j) -* holds. Special case num(i) = 0 means that vertex i is not assigned a -* number, because the graph is *not* acyclic. -* -* RETURNS -* -* If the graph is acyclic and therefore all the vertices have been -* assigned numbers, the routine glp_top_sort returns zero. Otherwise, -* if the graph is not acyclic, the routine returns the number of -* vertices which have not been numbered, i.e. for which num(i) = 0. */ - -static int top_sort(glp_graph *G, int num[]) -{ glp_arc *a; - int i, j, cnt, top, *stack, *indeg; - /* allocate working arrays */ - indeg = xcalloc(1+G->nv, sizeof(int)); - stack = xcalloc(1+G->nv, sizeof(int)); - /* determine initial indegree of each vertex; push into the stack - the vertices having zero indegree */ - top = 0; - for (i = 1; i <= G->nv; i++) - { num[i] = indeg[i] = 0; - for (a = G->v[i]->in; a != NULL; a = a->h_next) - indeg[i]++; - if (indeg[i] == 0) - stack[++top] = i; - } - /* assign numbers to vertices in the sorted order */ - cnt = 0; - while (top > 0) - { /* pull vertex i from the stack */ - i = stack[top--]; - /* it has zero indegree in the current graph */ - xassert(indeg[i] == 0); - /* so assign it a next number */ - xassert(num[i] == 0); - num[i] = ++cnt; - /* remove vertex i from the current graph, update indegree of - its adjacent vertices, and push into the stack new vertices - whose indegree becomes zero */ - for (a = G->v[i]->out; a != NULL; a = a->t_next) - { j = a->head->i; - /* there exists arc (i->j) in the graph */ - xassert(indeg[j] > 0); - indeg[j]--; - if (indeg[j] == 0) - stack[++top] = j; - } - } - /* free working arrays */ - xfree(indeg); - xfree(stack); - return G->nv - cnt; -} - -int glp_top_sort(glp_graph *G, int v_num) -{ glp_vertex *v; - int i, cnt, *num; - if (v_num >= 0 && v_num > G->v_size - (int)sizeof(int)) - xerror("glp_top_sort: v_num = %d; invalid offset\n", v_num); - if (G->nv == 0) - { cnt = 0; - goto done; - } - num = xcalloc(1+G->nv, sizeof(int)); - cnt = top_sort(G, num); - if (v_num >= 0) - { for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - memcpy((char *)v->data + v_num, &num[i], sizeof(int)); - } - } - xfree(num); -done: return cnt; -} - -/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpapi17.c b/resources/3rdparty/glpk-4.57/src/glpapi17.c deleted file mode 100644 index 425c6a5a8..000000000 --- a/resources/3rdparty/glpk-4.57/src/glpapi17.c +++ /dev/null @@ -1,1269 +0,0 @@ -/* glpapi17.c (flow network problems) */ - -/*********************************************************************** -* This code is part of GLPK (GNU Linear Programming Kit). -* -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied -* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights -* reserved. E-mail: . -* -* GLPK is free software: you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GLPK is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -* License for more details. -* -* You should have received a copy of the GNU General Public License -* along with GLPK. If not, see . -***********************************************************************/ - -#include "env.h" -#include "ffalg.h" -#include "mc21a.h" -#include "okalg.h" -#include "prob.h" -#include "relax4.h" - -/*********************************************************************** -* NAME -* -* glp_mincost_lp - convert minimum cost flow problem to LP -* -* SYNOPSIS -* -* void glp_mincost_lp(glp_prob *lp, glp_graph *G, int names, -* int v_rhs, int a_low, int a_cap, int a_cost); -* -* DESCRIPTION -* -* The routine glp_mincost_lp builds an LP problem, which corresponds -* to the minimum cost flow problem on the specified network G. */ - -void glp_mincost_lp(glp_prob *lp, glp_graph *G, int names, int v_rhs, - int a_low, int a_cap, int a_cost) -{ glp_vertex *v; - glp_arc *a; - int i, j, type, ind[1+2]; - double rhs, low, cap, cost, val[1+2]; - if (!(names == GLP_ON || names == GLP_OFF)) - xerror("glp_mincost_lp: names = %d; invalid parameter\n", - names); - if (v_rhs >= 0 && v_rhs > G->v_size - (int)sizeof(double)) - xerror("glp_mincost_lp: v_rhs = %d; invalid offset\n", v_rhs); - if (a_low >= 0 && a_low > G->a_size - (int)sizeof(double)) - xerror("glp_mincost_lp: a_low = %d; invalid offset\n", a_low); - if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) - xerror("glp_mincost_lp: a_cap = %d; invalid offset\n", a_cap); - if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) - xerror("glp_mincost_lp: a_cost = %d; invalid offset\n", a_cost) - ; - glp_erase_prob(lp); - if (names) glp_set_prob_name(lp, G->name); - if (G->nv > 0) glp_add_rows(lp, G->nv); - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - if (names) glp_set_row_name(lp, i, v->name); - if (v_rhs >= 0) - memcpy(&rhs, (char *)v->data + v_rhs, sizeof(double)); - else - rhs = 0.0; - glp_set_row_bnds(lp, i, GLP_FX, rhs, rhs); - } - if (G->na > 0) glp_add_cols(lp, G->na); - for (i = 1, j = 0; i <= G->nv; i++) - { v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - { j++; - if (names) - { char name[50+1]; - sprintf(name, "x[%d,%d]", a->tail->i, a->head->i); - xassert(strlen(name) < sizeof(name)); - glp_set_col_name(lp, j, name); - } - if (a->tail->i != a->head->i) - { ind[1] = a->tail->i, val[1] = +1.0; - ind[2] = a->head->i, val[2] = -1.0; - glp_set_mat_col(lp, j, 2, ind, val); - } - if (a_low >= 0) - memcpy(&low, (char *)a->data + a_low, sizeof(double)); - else - low = 0.0; - if (a_cap >= 0) - memcpy(&cap, (char *)a->data + a_cap, sizeof(double)); - else - cap = 1.0; - if (cap == DBL_MAX) - type = GLP_LO; - else if (low != cap) - type = GLP_DB; - else - type = GLP_FX; - glp_set_col_bnds(lp, j, type, low, cap); - if (a_cost >= 0) - memcpy(&cost, (char *)a->data + a_cost, sizeof(double)); - else - cost = 0.0; - glp_set_obj_coef(lp, j, cost); - } - } - xassert(j == G->na); - return; -} - -/**********************************************************************/ - -int glp_mincost_okalg(glp_graph *G, int v_rhs, int a_low, int a_cap, - int a_cost, double *sol, int a_x, int v_pi) -{ /* find minimum-cost flow with out-of-kilter algorithm */ - glp_vertex *v; - glp_arc *a; - int nv, na, i, k, s, t, *tail, *head, *low, *cap, *cost, *x, *pi, - ret; - double sum, temp; - if (v_rhs >= 0 && v_rhs > G->v_size - (int)sizeof(double)) - xerror("glp_mincost_okalg: v_rhs = %d; invalid offset\n", - v_rhs); - if (a_low >= 0 && a_low > G->a_size - (int)sizeof(double)) - xerror("glp_mincost_okalg: a_low = %d; invalid offset\n", - a_low); - if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) - xerror("glp_mincost_okalg: a_cap = %d; invalid offset\n", - a_cap); - if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) - xerror("glp_mincost_okalg: a_cost = %d; invalid offset\n", - a_cost); - if (a_x >= 0 && a_x > G->a_size - (int)sizeof(double)) - xerror("glp_mincost_okalg: a_x = %d; invalid offset\n", a_x); - if (v_pi >= 0 && v_pi > G->v_size - (int)sizeof(double)) - xerror("glp_mincost_okalg: v_pi = %d; invalid offset\n", v_pi); - /* s is artificial source node */ - s = G->nv + 1; - /* t is artificial sink node */ - t = s + 1; - /* nv is the total number of nodes in the resulting network */ - nv = t; - /* na is the total number of arcs in the resulting network */ - na = G->na + 1; - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - if (v_rhs >= 0) - memcpy(&temp, (char *)v->data + v_rhs, sizeof(double)); - else - temp = 0.0; - if (temp != 0.0) na++; - } - /* allocate working arrays */ - tail = xcalloc(1+na, sizeof(int)); - head = xcalloc(1+na, sizeof(int)); - low = xcalloc(1+na, sizeof(int)); - cap = xcalloc(1+na, sizeof(int)); - cost = xcalloc(1+na, sizeof(int)); - x = xcalloc(1+na, sizeof(int)); - pi = xcalloc(1+nv, sizeof(int)); - /* construct the resulting network */ - k = 0; - /* (original arcs) */ - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - { k++; - tail[k] = a->tail->i; - head[k] = a->head->i; - if (tail[k] == head[k]) - { ret = GLP_EDATA; - goto done; - } - if (a_low >= 0) - memcpy(&temp, (char *)a->data + a_low, sizeof(double)); - else - temp = 0.0; - if (!(0.0 <= temp && temp <= (double)INT_MAX && - temp == floor(temp))) - { ret = GLP_EDATA; - goto done; - } - low[k] = (int)temp; - if (a_cap >= 0) - memcpy(&temp, (char *)a->data + a_cap, sizeof(double)); - else - temp = 1.0; - if (!((double)low[k] <= temp && temp <= (double)INT_MAX && - temp == floor(temp))) - { ret = GLP_EDATA; - goto done; - } - cap[k] = (int)temp; - if (a_cost >= 0) - memcpy(&temp, (char *)a->data + a_cost, sizeof(double)); - else - temp = 0.0; - if (!(fabs(temp) <= (double)INT_MAX && temp == floor(temp))) - { ret = GLP_EDATA; - goto done; - } - cost[k] = (int)temp; - } - } - /* (artificial arcs) */ - sum = 0.0; - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - if (v_rhs >= 0) - memcpy(&temp, (char *)v->data + v_rhs, sizeof(double)); - else - temp = 0.0; - if (!(fabs(temp) <= (double)INT_MAX && temp == floor(temp))) - { ret = GLP_EDATA; - goto done; - } - if (temp > 0.0) - { /* artificial arc from s to original source i */ - k++; - tail[k] = s; - head[k] = i; - low[k] = cap[k] = (int)(+temp); /* supply */ - cost[k] = 0; - sum += (double)temp; - } - else if (temp < 0.0) - { /* artificial arc from original sink i to t */ - k++; - tail[k] = i; - head[k] = t; - low[k] = cap[k] = (int)(-temp); /* demand */ - cost[k] = 0; - } - } - /* (feedback arc from t to s) */ - k++; - xassert(k == na); - tail[k] = t; - head[k] = s; - if (sum > (double)INT_MAX) - { ret = GLP_EDATA; - goto done; - } - low[k] = cap[k] = (int)sum; /* total supply/demand */ - cost[k] = 0; - /* find minimal-cost circulation in the resulting network */ - ret = okalg(nv, na, tail, head, low, cap, cost, x, pi); - switch (ret) - { case 0: - /* optimal circulation found */ - ret = 0; - break; - case 1: - /* no feasible circulation exists */ - ret = GLP_ENOPFS; - break; - case 2: - /* integer overflow occured */ - ret = GLP_ERANGE; - goto done; - case 3: - /* optimality test failed (logic error) */ - ret = GLP_EFAIL; - goto done; - default: - xassert(ret != ret); - } - /* store solution components */ - /* (objective function = the total cost) */ - if (sol != NULL) - { temp = 0.0; - for (k = 1; k <= na; k++) - temp += (double)cost[k] * (double)x[k]; - *sol = temp; - } - /* (arc flows) */ - if (a_x >= 0) - { k = 0; - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - { temp = (double)x[++k]; - memcpy((char *)a->data + a_x, &temp, sizeof(double)); - } - } - } - /* (node potentials = Lagrange multipliers) */ - if (v_pi >= 0) - { for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - temp = - (double)pi[i]; - memcpy((char *)v->data + v_pi, &temp, sizeof(double)); - } - } -done: /* free working arrays */ - xfree(tail); - xfree(head); - xfree(low); - xfree(cap); - xfree(cost); - xfree(x); - xfree(pi); - return ret; -} - -/**********************************************************************/ - -static int overflow(int u, int v) -{ /* check for integer overflow on computing u + v */ - if (u > 0 && v > 0 && u + v < 0) return 1; - if (u < 0 && v < 0 && u + v > 0) return 1; - return 0; -} - -int glp_mincost_relax4(glp_graph *G, int v_rhs, int a_low, int a_cap, - int a_cost, int crash, double *sol, int a_x, int a_rc) -{ /* find minimum-cost flow with Bertsekas-Tseng relaxation method - (RELAX-IV) */ - glp_vertex *v; - glp_arc *a; - struct relax4_csa csa; - int i, k, large, n, na, ret; - double cap, cost, low, rc, rhs, sum, x; - if (v_rhs >= 0 && v_rhs > G->v_size - (int)sizeof(double)) - xerror("glp_mincost_relax4: v_rhs = %d; invalid offset\n", - v_rhs); - if (a_low >= 0 && a_low > G->a_size - (int)sizeof(double)) - xerror("glp_mincost_relax4: a_low = %d; invalid offset\n", - a_low); - if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) - xerror("glp_mincost_relax4: a_cap = %d; invalid offset\n", - a_cap); - if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) - xerror("glp_mincost_relax4: a_cost = %d; invalid offset\n", - a_cost); - if (a_x >= 0 && a_x > G->a_size - (int)sizeof(double)) - xerror("glp_mincost_relax4: a_x = %d; invalid offset\n", - a_x); - if (a_rc >= 0 && a_rc > G->a_size - (int)sizeof(double)) - xerror("glp_mincost_relax4: a_rc = %d; invalid offset\n", - a_rc); - csa.n = n = G->nv; /* number of nodes */ - csa.na = na = G->na; /* number of arcs */ - csa.large = large = INT_MAX / 4; - csa.repeat = 0; - csa.crash = crash; - /* allocate working arrays */ - csa.startn = xcalloc(1+na, sizeof(int)); - csa.endn = xcalloc(1+na, sizeof(int)); - csa.fou = xcalloc(1+n, sizeof(int)); - csa.nxtou = xcalloc(1+na, sizeof(int)); - csa.fin = xcalloc(1+n, sizeof(int)); - csa.nxtin = xcalloc(1+na, sizeof(int)); - csa.rc = xcalloc(1+na, sizeof(int)); - csa.u = xcalloc(1+na, sizeof(int)); - csa.dfct = xcalloc(1+n, sizeof(int)); - csa.x = xcalloc(1+na, sizeof(int)); - csa.label = xcalloc(1+n, sizeof(int)); - csa.prdcsr = xcalloc(1+n, sizeof(int)); - csa.save = xcalloc(1+na, sizeof(int)); - csa.tfstou = xcalloc(1+n, sizeof(int)); - csa.tnxtou = xcalloc(1+na, sizeof(int)); - csa.tfstin = xcalloc(1+n, sizeof(int)); - csa.tnxtin = xcalloc(1+na, sizeof(int)); - csa.nxtqueue = xcalloc(1+n, sizeof(int)); - csa.scan = xcalloc(1+n, sizeof(char)); - csa.mark = xcalloc(1+n, sizeof(char)); - if (crash) - { csa.extend_arc = xcalloc(1+n, sizeof(int)); - csa.sb_level = xcalloc(1+n, sizeof(int)); - csa.sb_arc = xcalloc(1+n, sizeof(int)); - } - else - { csa.extend_arc = NULL; - csa.sb_level = NULL; - csa.sb_arc = NULL; - } - /* scan nodes */ - for (i = 1; i <= n; i++) - { v = G->v[i]; - /* get supply at i-th node */ - if (v_rhs >= 0) - memcpy(&rhs, (char *)v->data + v_rhs, sizeof(double)); - else - rhs = 0.0; - if (!(fabs(rhs) <= (double)large && rhs == floor(rhs))) - { ret = GLP_EDATA; - goto done; - } - /* set demand at i-th node */ - csa.dfct[i] = -(int)rhs; - } - /* scan arcs */ - k = 0; - for (i = 1; i <= n; i++) - { v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - { k++; - /* set endpoints of k-th arc */ - if (a->tail->i == a->head->i) - { /* self-loops not allowed */ - ret = GLP_EDATA; - goto done; - } - csa.startn[k] = a->tail->i; - csa.endn[k] = a->head->i; - /* set per-unit cost for k-th arc flow */ - if (a_cost >= 0) - memcpy(&cost, (char *)a->data + a_cost, sizeof(double)); - else - cost = 0.0; - if (!(fabs(cost) <= (double)large && cost == floor(cost))) - { ret = GLP_EDATA; - goto done; - } - csa.rc[k] = (int)cost; - /* get lower bound for k-th arc flow */ - if (a_low >= 0) - memcpy(&low, (char *)a->data + a_low, sizeof(double)); - else - low = 0.0; - if (!(0.0 <= low && low <= (double)large && - low == floor(low))) - { ret = GLP_EDATA; - goto done; - } - /* get upper bound for k-th arc flow */ - if (a_cap >= 0) - memcpy(&cap, (char *)a->data + a_cap, sizeof(double)); - else - cap = 1.0; - if (!(low <= cap && cap <= (double)large && - cap == floor(cap))) - { ret = GLP_EDATA; - goto done; - } - /* substitute x = x' + low, where 0 <= x' <= cap - low */ - csa.u[k] = (int)(cap - low); - /* correct demands at endpoints of k-th arc */ - if (overflow(csa.dfct[a->tail->i], +low)) - { ret = GLP_ERANGE; - goto done; - } - csa.dfct[a->tail->i] += low; - if (overflow(csa.dfct[a->head->i], -low)) - { ret = GLP_ERANGE; - goto done; - } - csa.dfct[a->head->i] -= low; - } - } - /* construct linked list for network topology */ - relax4_inidat(&csa); - /* find minimum-cost flow */ - ret = relax4(&csa); - if (ret != 0) - { /* problem is found to be infeasible */ - xassert(1 <= ret && ret <= 8); - ret = GLP_ENOPFS; - goto done; - } - /* store solution */ - sum = 0.0; - k = 0; - for (i = 1; i <= n; i++) - { v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - { k++; - /* get lower bound for k-th arc flow */ - if (a_low >= 0) - memcpy(&low, (char *)a->data + a_low, sizeof(double)); - else - low = 0.0; - /* store original flow x = x' + low thru k-th arc */ - x = (double)csa.x[k] + low; - if (a_x >= 0) - memcpy((char *)a->data + a_x, &x, sizeof(double)); - /* store reduced cost for k-th arc flow */ - rc = (double)csa.rc[k]; - if (a_rc >= 0) - memcpy((char *)a->data + a_rc, &rc, sizeof(double)); - /* get per-unit cost for k-th arc flow */ - if (a_cost >= 0) - memcpy(&cost, (char *)a->data + a_cost, sizeof(double)); - else - cost = 0.0; - /* compute the total cost */ - sum += cost * x; - } - } - /* store the total cost */ - if (sol != NULL) - *sol = sum; -done: /* free working arrays */ - xfree(csa.startn); - xfree(csa.endn); - xfree(csa.fou); - xfree(csa.nxtou); - xfree(csa.fin); - xfree(csa.nxtin); - xfree(csa.rc); - xfree(csa.u); - xfree(csa.dfct); - xfree(csa.x); - xfree(csa.label); - xfree(csa.prdcsr); - xfree(csa.save); - xfree(csa.tfstou); - xfree(csa.tnxtou); - xfree(csa.tfstin); - xfree(csa.tnxtin); - xfree(csa.nxtqueue); - xfree(csa.scan); - xfree(csa.mark); - if (crash) - { xfree(csa.extend_arc); - xfree(csa.sb_level); - xfree(csa.sb_arc); - } - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_maxflow_lp - convert maximum flow problem to LP -* -* SYNOPSIS -* -* void glp_maxflow_lp(glp_prob *lp, glp_graph *G, int names, int s, -* int t, int a_cap); -* -* DESCRIPTION -* -* The routine glp_maxflow_lp builds an LP problem, which corresponds -* to the maximum flow problem on the specified network G. */ - -void glp_maxflow_lp(glp_prob *lp, glp_graph *G, int names, int s, - int t, int a_cap) -{ glp_vertex *v; - glp_arc *a; - int i, j, type, ind[1+2]; - double cap, val[1+2]; - if (!(names == GLP_ON || names == GLP_OFF)) - xerror("glp_maxflow_lp: names = %d; invalid parameter\n", - names); - if (!(1 <= s && s <= G->nv)) - xerror("glp_maxflow_lp: s = %d; source node number out of rang" - "e\n", s); - if (!(1 <= t && t <= G->nv)) - xerror("glp_maxflow_lp: t = %d: sink node number out of range " - "\n", t); - if (s == t) - xerror("glp_maxflow_lp: s = t = %d; source and sink nodes must" - " be distinct\n", s); - if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) - xerror("glp_maxflow_lp: a_cap = %d; invalid offset\n", a_cap); - glp_erase_prob(lp); - if (names) glp_set_prob_name(lp, G->name); - glp_set_obj_dir(lp, GLP_MAX); - glp_add_rows(lp, G->nv); - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - if (names) glp_set_row_name(lp, i, v->name); - if (i == s) - type = GLP_LO; - else if (i == t) - type = GLP_UP; - else - type = GLP_FX; - glp_set_row_bnds(lp, i, type, 0.0, 0.0); - } - if (G->na > 0) glp_add_cols(lp, G->na); - for (i = 1, j = 0; i <= G->nv; i++) - { v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - { j++; - if (names) - { char name[50+1]; - sprintf(name, "x[%d,%d]", a->tail->i, a->head->i); - xassert(strlen(name) < sizeof(name)); - glp_set_col_name(lp, j, name); - } - if (a->tail->i != a->head->i) - { ind[1] = a->tail->i, val[1] = +1.0; - ind[2] = a->head->i, val[2] = -1.0; - glp_set_mat_col(lp, j, 2, ind, val); - } - if (a_cap >= 0) - memcpy(&cap, (char *)a->data + a_cap, sizeof(double)); - else - cap = 1.0; - if (cap == DBL_MAX) - type = GLP_LO; - else if (cap != 0.0) - type = GLP_DB; - else - type = GLP_FX; - glp_set_col_bnds(lp, j, type, 0.0, cap); - if (a->tail->i == s) - glp_set_obj_coef(lp, j, +1.0); - else if (a->head->i == s) - glp_set_obj_coef(lp, j, -1.0); - } - } - xassert(j == G->na); - return; -} - -int glp_maxflow_ffalg(glp_graph *G, int s, int t, int a_cap, - double *sol, int a_x, int v_cut) -{ /* find maximal flow with Ford-Fulkerson algorithm */ - glp_vertex *v; - glp_arc *a; - int nv, na, i, k, flag, *tail, *head, *cap, *x, ret; - char *cut; - double temp; - if (!(1 <= s && s <= G->nv)) - xerror("glp_maxflow_ffalg: s = %d; source node number out of r" - "ange\n", s); - if (!(1 <= t && t <= G->nv)) - xerror("glp_maxflow_ffalg: t = %d: sink node number out of ran" - "ge\n", t); - if (s == t) - xerror("glp_maxflow_ffalg: s = t = %d; source and sink nodes m" - "ust be distinct\n", s); - if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) - xerror("glp_maxflow_ffalg: a_cap = %d; invalid offset\n", - a_cap); - if (v_cut >= 0 && v_cut > G->v_size - (int)sizeof(int)) - xerror("glp_maxflow_ffalg: v_cut = %d; invalid offset\n", - v_cut); - /* allocate working arrays */ - nv = G->nv; - na = G->na; - tail = xcalloc(1+na, sizeof(int)); - head = xcalloc(1+na, sizeof(int)); - cap = xcalloc(1+na, sizeof(int)); - x = xcalloc(1+na, sizeof(int)); - if (v_cut < 0) - cut = NULL; - else - cut = xcalloc(1+nv, sizeof(char)); - /* copy the flow network */ - k = 0; - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - { k++; - tail[k] = a->tail->i; - head[k] = a->head->i; - if (tail[k] == head[k]) - { ret = GLP_EDATA; - goto done; - } - if (a_cap >= 0) - memcpy(&temp, (char *)a->data + a_cap, sizeof(double)); - else - temp = 1.0; - if (!(0.0 <= temp && temp <= (double)INT_MAX && - temp == floor(temp))) - { ret = GLP_EDATA; - goto done; - } - cap[k] = (int)temp; - } - } - xassert(k == na); - /* find maximal flow in the flow network */ - ffalg(nv, na, tail, head, s, t, cap, x, cut); - ret = 0; - /* store solution components */ - /* (objective function = total flow through the network) */ - if (sol != NULL) - { temp = 0.0; - for (k = 1; k <= na; k++) - { if (tail[k] == s) - temp += (double)x[k]; - else if (head[k] == s) - temp -= (double)x[k]; - } - *sol = temp; - } - /* (arc flows) */ - if (a_x >= 0) - { k = 0; - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - { temp = (double)x[++k]; - memcpy((char *)a->data + a_x, &temp, sizeof(double)); - } - } - } - /* (node flags) */ - if (v_cut >= 0) - { for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - flag = cut[i]; - memcpy((char *)v->data + v_cut, &flag, sizeof(int)); - } - } -done: /* free working arrays */ - xfree(tail); - xfree(head); - xfree(cap); - xfree(x); - if (cut != NULL) xfree(cut); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_check_asnprob - check correctness of assignment problem data -* -* SYNOPSIS -* -* int glp_check_asnprob(glp_graph *G, int v_set); -* -* RETURNS -* -* If the specified assignment problem data are correct, the routine -* glp_check_asnprob returns zero, otherwise, non-zero. */ - -int glp_check_asnprob(glp_graph *G, int v_set) -{ glp_vertex *v; - int i, k, ret = 0; - if (v_set >= 0 && v_set > G->v_size - (int)sizeof(int)) - xerror("glp_check_asnprob: v_set = %d; invalid offset\n", - v_set); - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - if (v_set >= 0) - { memcpy(&k, (char *)v->data + v_set, sizeof(int)); - if (k == 0) - { if (v->in != NULL) - { ret = 1; - break; - } - } - else if (k == 1) - { if (v->out != NULL) - { ret = 2; - break; - } - } - else - { ret = 3; - break; - } - } - else - { if (v->in != NULL && v->out != NULL) - { ret = 4; - break; - } - } - } - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_asnprob_lp - convert assignment problem to LP -* -* SYNOPSIS -* -* int glp_asnprob_lp(glp_prob *P, int form, glp_graph *G, int names, -* int v_set, int a_cost); -* -* DESCRIPTION -* -* The routine glp_asnprob_lp builds an LP problem, which corresponds -* to the assignment problem on the specified graph G. -* -* RETURNS -* -* If the LP problem has been successfully built, the routine returns -* zero, otherwise, non-zero. */ - -int glp_asnprob_lp(glp_prob *P, int form, glp_graph *G, int names, - int v_set, int a_cost) -{ glp_vertex *v; - glp_arc *a; - int i, j, ret, ind[1+2]; - double cost, val[1+2]; - if (!(form == GLP_ASN_MIN || form == GLP_ASN_MAX || - form == GLP_ASN_MMP)) - xerror("glp_asnprob_lp: form = %d; invalid parameter\n", - form); - if (!(names == GLP_ON || names == GLP_OFF)) - xerror("glp_asnprob_lp: names = %d; invalid parameter\n", - names); - if (v_set >= 0 && v_set > G->v_size - (int)sizeof(int)) - xerror("glp_asnprob_lp: v_set = %d; invalid offset\n", - v_set); - if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) - xerror("glp_asnprob_lp: a_cost = %d; invalid offset\n", - a_cost); - ret = glp_check_asnprob(G, v_set); - if (ret != 0) goto done; - glp_erase_prob(P); - if (names) glp_set_prob_name(P, G->name); - glp_set_obj_dir(P, form == GLP_ASN_MIN ? GLP_MIN : GLP_MAX); - if (G->nv > 0) glp_add_rows(P, G->nv); - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - if (names) glp_set_row_name(P, i, v->name); - glp_set_row_bnds(P, i, form == GLP_ASN_MMP ? GLP_UP : GLP_FX, - 1.0, 1.0); - } - if (G->na > 0) glp_add_cols(P, G->na); - for (i = 1, j = 0; i <= G->nv; i++) - { v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - { j++; - if (names) - { char name[50+1]; - sprintf(name, "x[%d,%d]", a->tail->i, a->head->i); - xassert(strlen(name) < sizeof(name)); - glp_set_col_name(P, j, name); - } - ind[1] = a->tail->i, val[1] = +1.0; - ind[2] = a->head->i, val[2] = +1.0; - glp_set_mat_col(P, j, 2, ind, val); - glp_set_col_bnds(P, j, GLP_DB, 0.0, 1.0); - if (a_cost >= 0) - memcpy(&cost, (char *)a->data + a_cost, sizeof(double)); - else - cost = 1.0; - glp_set_obj_coef(P, j, cost); - } - } - xassert(j == G->na); -done: return ret; -} - -/**********************************************************************/ - -int glp_asnprob_okalg(int form, glp_graph *G, int v_set, int a_cost, - double *sol, int a_x) -{ /* solve assignment problem with out-of-kilter algorithm */ - glp_vertex *v; - glp_arc *a; - int nv, na, i, k, *tail, *head, *low, *cap, *cost, *x, *pi, ret; - double temp; - if (!(form == GLP_ASN_MIN || form == GLP_ASN_MAX || - form == GLP_ASN_MMP)) - xerror("glp_asnprob_okalg: form = %d; invalid parameter\n", - form); - if (v_set >= 0 && v_set > G->v_size - (int)sizeof(int)) - xerror("glp_asnprob_okalg: v_set = %d; invalid offset\n", - v_set); - if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) - xerror("glp_asnprob_okalg: a_cost = %d; invalid offset\n", - a_cost); - if (a_x >= 0 && a_x > G->a_size - (int)sizeof(int)) - xerror("glp_asnprob_okalg: a_x = %d; invalid offset\n", a_x); - if (glp_check_asnprob(G, v_set)) - return GLP_EDATA; - /* nv is the total number of nodes in the resulting network */ - nv = G->nv + 1; - /* na is the total number of arcs in the resulting network */ - na = G->na + G->nv; - /* allocate working arrays */ - tail = xcalloc(1+na, sizeof(int)); - head = xcalloc(1+na, sizeof(int)); - low = xcalloc(1+na, sizeof(int)); - cap = xcalloc(1+na, sizeof(int)); - cost = xcalloc(1+na, sizeof(int)); - x = xcalloc(1+na, sizeof(int)); - pi = xcalloc(1+nv, sizeof(int)); - /* construct the resulting network */ - k = 0; - /* (original arcs) */ - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - { k++; - tail[k] = a->tail->i; - head[k] = a->head->i; - low[k] = 0; - cap[k] = 1; - if (a_cost >= 0) - memcpy(&temp, (char *)a->data + a_cost, sizeof(double)); - else - temp = 1.0; - if (!(fabs(temp) <= (double)INT_MAX && temp == floor(temp))) - { ret = GLP_EDATA; - goto done; - } - cost[k] = (int)temp; - if (form != GLP_ASN_MIN) cost[k] = - cost[k]; - } - } - /* (artificial arcs) */ - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - k++; - if (v->out == NULL) - tail[k] = i, head[k] = nv; - else if (v->in == NULL) - tail[k] = nv, head[k] = i; - else - xassert(v != v); - low[k] = (form == GLP_ASN_MMP ? 0 : 1); - cap[k] = 1; - cost[k] = 0; - } - xassert(k == na); - /* find minimal-cost circulation in the resulting network */ - ret = okalg(nv, na, tail, head, low, cap, cost, x, pi); - switch (ret) - { case 0: - /* optimal circulation found */ - ret = 0; - break; - case 1: - /* no feasible circulation exists */ - ret = GLP_ENOPFS; - break; - case 2: - /* integer overflow occured */ - ret = GLP_ERANGE; - goto done; - case 3: - /* optimality test failed (logic error) */ - ret = GLP_EFAIL; - goto done; - default: - xassert(ret != ret); - } - /* store solution components */ - /* (objective function = the total cost) */ - if (sol != NULL) - { temp = 0.0; - for (k = 1; k <= na; k++) - temp += (double)cost[k] * (double)x[k]; - if (form != GLP_ASN_MIN) temp = - temp; - *sol = temp; - } - /* (arc flows) */ - if (a_x >= 0) - { k = 0; - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - { k++; - if (ret == 0) - xassert(x[k] == 0 || x[k] == 1); - memcpy((char *)a->data + a_x, &x[k], sizeof(int)); - } - } - } -done: /* free working arrays */ - xfree(tail); - xfree(head); - xfree(low); - xfree(cap); - xfree(cost); - xfree(x); - xfree(pi); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_asnprob_hall - find bipartite matching of maximum cardinality -* -* SYNOPSIS -* -* int glp_asnprob_hall(glp_graph *G, int v_set, int a_x); -* -* DESCRIPTION -* -* The routine glp_asnprob_hall finds a matching of maximal cardinality -* in the specified bipartite graph G. It uses a version of the Fortran -* routine MC21A developed by I.S.Duff [1], which implements Hall's -* algorithm [2]. -* -* RETURNS -* -* The routine glp_asnprob_hall returns the cardinality of the matching -* found. However, if the specified graph is incorrect (as detected by -* the routine glp_check_asnprob), the routine returns negative value. -* -* REFERENCES -* -* 1. I.S.Duff, Algorithm 575: Permutations for zero-free diagonal, ACM -* Trans. on Math. Softw. 7 (1981), 387-390. -* -* 2. M.Hall, "An Algorithm for distinct representatives," Amer. Math. -* Monthly 63 (1956), 716-717. */ - -int glp_asnprob_hall(glp_graph *G, int v_set, int a_x) -{ glp_vertex *v; - glp_arc *a; - int card, i, k, loc, n, n1, n2, xij; - int *num, *icn, *ip, *lenr, *iperm, *pr, *arp, *cv, *out; - if (v_set >= 0 && v_set > G->v_size - (int)sizeof(int)) - xerror("glp_asnprob_hall: v_set = %d; invalid offset\n", - v_set); - if (a_x >= 0 && a_x > G->a_size - (int)sizeof(int)) - xerror("glp_asnprob_hall: a_x = %d; invalid offset\n", a_x); - if (glp_check_asnprob(G, v_set)) - return -1; - /* determine the number of vertices in sets R and S and renumber - vertices in S which correspond to columns of the matrix; skip - all isolated vertices */ - num = xcalloc(1+G->nv, sizeof(int)); - n1 = n2 = 0; - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - if (v->in == NULL && v->out != NULL) - n1++, num[i] = 0; /* vertex in R */ - else if (v->in != NULL && v->out == NULL) - n2++, num[i] = n2; /* vertex in S */ - else - { xassert(v->in == NULL && v->out == NULL); - num[i] = -1; /* isolated vertex */ - } - } - /* the matrix must be square, thus, if it has more columns than - rows, extra rows will be just empty, and vice versa */ - n = (n1 >= n2 ? n1 : n2); - /* allocate working arrays */ - icn = xcalloc(1+G->na, sizeof(int)); - ip = xcalloc(1+n, sizeof(int)); - lenr = xcalloc(1+n, sizeof(int)); - iperm = xcalloc(1+n, sizeof(int)); - pr = xcalloc(1+n, sizeof(int)); - arp = xcalloc(1+n, sizeof(int)); - cv = xcalloc(1+n, sizeof(int)); - out = xcalloc(1+n, sizeof(int)); - /* build the adjacency matrix of the bipartite graph in row-wise - format (rows are vertices in R, columns are vertices in S) */ - k = 0, loc = 1; - for (i = 1; i <= G->nv; i++) - { if (num[i] != 0) continue; - /* vertex i in R */ - ip[++k] = loc; - v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - { xassert(num[a->head->i] != 0); - icn[loc++] = num[a->head->i]; - } - lenr[k] = loc - ip[k]; - } - xassert(loc-1 == G->na); - /* make all extra rows empty (all extra columns are empty due to - the row-wise format used) */ - for (k++; k <= n; k++) - ip[k] = loc, lenr[k] = 0; - /* find a row permutation that maximizes the number of non-zeros - on the main diagonal */ - card = mc21a(n, icn, ip, lenr, iperm, pr, arp, cv, out); -#if 1 /* 18/II-2010 */ - /* FIXED: if card = n, arp remains clobbered on exit */ - for (i = 1; i <= n; i++) - arp[i] = 0; - for (i = 1; i <= card; i++) - { k = iperm[i]; - xassert(1 <= k && k <= n); - xassert(arp[k] == 0); - arp[k] = i; - } -#endif - /* store solution, if necessary */ - if (a_x < 0) goto skip; - k = 0; - for (i = 1; i <= G->nv; i++) - { if (num[i] != 0) continue; - /* vertex i in R */ - k++; - v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - { /* arp[k] is the number of matched column or zero */ - if (arp[k] == num[a->head->i]) - { xassert(arp[k] != 0); - xij = 1; - } - else - xij = 0; - memcpy((char *)a->data + a_x, &xij, sizeof(int)); - } - } -skip: /* free working arrays */ - xfree(num); - xfree(icn); - xfree(ip); - xfree(lenr); - xfree(iperm); - xfree(pr); - xfree(arp); - xfree(cv); - xfree(out); - return card; -} - -/*********************************************************************** -* NAME -* -* glp_cpp - solve critical path problem -* -* SYNOPSIS -* -* double glp_cpp(glp_graph *G, int v_t, int v_es, int v_ls); -* -* DESCRIPTION -* -* The routine glp_cpp solves the critical path problem represented in -* the form of the project network. -* -* The parameter G is a pointer to the graph object, which specifies -* the project network. This graph must be acyclic. Multiple arcs are -* allowed being considered as single arcs. -* -* The parameter v_t specifies an offset of the field of type double -* in the vertex data block, which contains time t[i] >= 0 needed to -* perform corresponding job j. If v_t < 0, it is assumed that t[i] = 1 -* for all jobs. -* -* The parameter v_es specifies an offset of the field of type double -* in the vertex data block, to which the routine stores earliest start -* time for corresponding job. If v_es < 0, this time is not stored. -* -* The parameter v_ls specifies an offset of the field of type double -* in the vertex data block, to which the routine stores latest start -* time for corresponding job. If v_ls < 0, this time is not stored. -* -* RETURNS -* -* The routine glp_cpp returns the minimal project duration, that is, -* minimal time needed to perform all jobs in the project. */ - -static void sorting(glp_graph *G, int list[]); - -double glp_cpp(glp_graph *G, int v_t, int v_es, int v_ls) -{ glp_vertex *v; - glp_arc *a; - int i, j, k, nv, *list; - double temp, total, *t, *es, *ls; - if (v_t >= 0 && v_t > G->v_size - (int)sizeof(double)) - xerror("glp_cpp: v_t = %d; invalid offset\n", v_t); - if (v_es >= 0 && v_es > G->v_size - (int)sizeof(double)) - xerror("glp_cpp: v_es = %d; invalid offset\n", v_es); - if (v_ls >= 0 && v_ls > G->v_size - (int)sizeof(double)) - xerror("glp_cpp: v_ls = %d; invalid offset\n", v_ls); - nv = G->nv; - if (nv == 0) - { total = 0.0; - goto done; - } - /* allocate working arrays */ - t = xcalloc(1+nv, sizeof(double)); - es = xcalloc(1+nv, sizeof(double)); - ls = xcalloc(1+nv, sizeof(double)); - list = xcalloc(1+nv, sizeof(int)); - /* retrieve job times */ - for (i = 1; i <= nv; i++) - { v = G->v[i]; - if (v_t >= 0) - { memcpy(&t[i], (char *)v->data + v_t, sizeof(double)); - if (t[i] < 0.0) - xerror("glp_cpp: t[%d] = %g; invalid time\n", i, t[i]); - } - else - t[i] = 1.0; - } - /* perform topological sorting to determine the list of nodes - (jobs) such that if list[k] = i and list[kk] = j and there - exists arc (i->j), then k < kk */ - sorting(G, list); - /* FORWARD PASS */ - /* determine earliest start times */ - for (k = 1; k <= nv; k++) - { j = list[k]; - es[j] = 0.0; - for (a = G->v[j]->in; a != NULL; a = a->h_next) - { i = a->tail->i; - /* there exists arc (i->j) in the project network */ - temp = es[i] + t[i]; - if (es[j] < temp) es[j] = temp; - } - } - /* determine the minimal project duration */ - total = 0.0; - for (i = 1; i <= nv; i++) - { temp = es[i] + t[i]; - if (total < temp) total = temp; - } - /* BACKWARD PASS */ - /* determine latest start times */ - for (k = nv; k >= 1; k--) - { i = list[k]; - ls[i] = total - t[i]; - for (a = G->v[i]->out; a != NULL; a = a->t_next) - { j = a->head->i; - /* there exists arc (i->j) in the project network */ - temp = ls[j] - t[i]; - if (ls[i] > temp) ls[i] = temp; - } - /* avoid possible round-off errors */ - if (ls[i] < es[i]) ls[i] = es[i]; - } - /* store results, if necessary */ - if (v_es >= 0) - { for (i = 1; i <= nv; i++) - { v = G->v[i]; - memcpy((char *)v->data + v_es, &es[i], sizeof(double)); - } - } - if (v_ls >= 0) - { for (i = 1; i <= nv; i++) - { v = G->v[i]; - memcpy((char *)v->data + v_ls, &ls[i], sizeof(double)); - } - } - /* free working arrays */ - xfree(t); - xfree(es); - xfree(ls); - xfree(list); -done: return total; -} - -static void sorting(glp_graph *G, int list[]) -{ /* perform topological sorting to determine the list of nodes - (jobs) such that if list[k] = i and list[kk] = j and there - exists arc (i->j), then k < kk */ - int i, k, nv, v_size, *num; - void **save; - nv = G->nv; - v_size = G->v_size; - save = xcalloc(1+nv, sizeof(void *)); - num = xcalloc(1+nv, sizeof(int)); - G->v_size = sizeof(int); - for (i = 1; i <= nv; i++) - { save[i] = G->v[i]->data; - G->v[i]->data = &num[i]; - list[i] = 0; - } - if (glp_top_sort(G, 0) != 0) - xerror("glp_cpp: project network is not acyclic\n"); - G->v_size = v_size; - for (i = 1; i <= nv; i++) - { G->v[i]->data = save[i]; - k = num[i]; - xassert(1 <= k && k <= nv); - xassert(list[k] == 0); - list[k] = i; - } - xfree(save); - xfree(num); - return; -} - -/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpdmx.c b/resources/3rdparty/glpk-4.57/src/glpdmx.c deleted file mode 100644 index e8a323da9..000000000 --- a/resources/3rdparty/glpk-4.57/src/glpdmx.c +++ /dev/null @@ -1,1693 +0,0 @@ -/* glpdmx.c (reading/writing data in DIMACS format) */ - -/*********************************************************************** -* This code is part of GLPK (GNU Linear Programming Kit). -* -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied -* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights -* reserved. E-mail: . -* -* GLPK is free software: you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GLPK is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -* License for more details. -* -* You should have received a copy of the GNU General Public License -* along with GLPK. If not, see . -***********************************************************************/ - -#include "env.h" -#include "misc.h" -#include "prob.h" - -#define xfprintf glp_format - -struct csa -{ /* common storage area */ - jmp_buf jump; - /* label for go to in case of error */ - const char *fname; - /* name of input text file */ - glp_file *fp; - /* stream assigned to input text file */ - int count; - /* line count */ - int c; - /* current character */ - char field[255+1]; - /* data field */ - int empty; - /* warning 'empty line ignored' was printed */ - int nonint; - /* warning 'non-integer data detected' was printed */ -}; - -static void error(struct csa *csa, const char *fmt, ...) -{ /* print error message and terminate processing */ - va_list arg; - xprintf("%s:%d: error: ", csa->fname, csa->count); - va_start(arg, fmt); - xvprintf(fmt, arg); - va_end(arg); - xprintf("\n"); - longjmp(csa->jump, 1); - /* no return */ -} - -static void warning(struct csa *csa, const char *fmt, ...) -{ /* print warning message and continue processing */ - va_list arg; - xprintf("%s:%d: warning: ", csa->fname, csa->count); - va_start(arg, fmt); - xvprintf(fmt, arg); - va_end(arg); - xprintf("\n"); - return; -} - -static void read_char(struct csa *csa) -{ /* read character from input text file */ - int c; - if (csa->c == '\n') csa->count++; - c = glp_getc(csa->fp); - if (c < 0) - { if (glp_ioerr(csa->fp)) - error(csa, "read error - %s", get_err_msg()); - else if (csa->c == '\n') - error(csa, "unexpected end of file"); - else - { warning(csa, "missing final end of line"); - c = '\n'; - } - } - else if (c == '\n') - ; - else if (isspace(c)) - c = ' '; - else if (iscntrl(c)) - error(csa, "invalid control character 0x%02X", c); - csa->c = c; - return; -} - -static void read_designator(struct csa *csa) -{ /* read one-character line designator */ - xassert(csa->c == '\n'); - read_char(csa); - for (;;) - { /* skip preceding white-space characters */ - while (csa->c == ' ') - read_char(csa); - if (csa->c == '\n') - { /* ignore empty line */ - if (!csa->empty) - { warning(csa, "empty line ignored"); - csa->empty = 1; - } - read_char(csa); - } - else if (csa->c == 'c') - { /* skip comment line */ - while (csa->c != '\n') - read_char(csa); - read_char(csa); - } - else - { /* hmm... looks like a line designator */ - csa->field[0] = (char)csa->c, csa->field[1] = '\0'; - /* check that it is followed by a white-space character */ - read_char(csa); - if (!(csa->c == ' ' || csa->c == '\n')) - error(csa, "line designator missing or invalid"); - break; - } - } - return; -} - -static void read_field(struct csa *csa) -{ /* read data field */ - int len = 0; - /* skip preceding white-space characters */ - while (csa->c == ' ') - read_char(csa); - /* scan data field */ - if (csa->c == '\n') - error(csa, "unexpected end of line"); - while (!(csa->c == ' ' || csa->c == '\n')) - { if (len == sizeof(csa->field)-1) - error(csa, "data field '%.15s...' too long", csa->field); - csa->field[len++] = (char)csa->c; - read_char(csa); - } - csa->field[len] = '\0'; - return; -} - -static void end_of_line(struct csa *csa) -{ /* skip white-space characters until end of line */ - while (csa->c == ' ') - read_char(csa); - if (csa->c != '\n') - error(csa, "too many data fields specified"); - return; -} - -static void check_int(struct csa *csa, double num) -{ /* print a warning if non-integer data are detected */ - if (!csa->nonint && num != floor(num)) - { warning(csa, "non-integer data detected"); - csa->nonint = 1; - } - return; -} - -/*********************************************************************** -* NAME -* -* glp_read_mincost - read min-cost flow problem data in DIMACS format -* -* SYNOPSIS -* -* int glp_read_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap, -* int a_cost, const char *fname); -* -* DESCRIPTION -* -* The routine glp_read_mincost reads minimum cost flow problem data in -* DIMACS format from a text file. -* -* RETURNS -* -* If the operation was successful, the routine returns zero. Otherwise -* it prints an error message and returns non-zero. */ - -int glp_read_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap, - int a_cost, const char *fname) -{ struct csa _csa, *csa = &_csa; - glp_vertex *v; - glp_arc *a; - int i, j, k, nv, na, ret = 0; - double rhs, low, cap, cost; - char *flag = NULL; - if (v_rhs >= 0 && v_rhs > G->v_size - (int)sizeof(double)) - xerror("glp_read_mincost: v_rhs = %d; invalid offset\n", - v_rhs); - if (a_low >= 0 && a_low > G->a_size - (int)sizeof(double)) - xerror("glp_read_mincost: a_low = %d; invalid offset\n", - a_low); - if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) - xerror("glp_read_mincost: a_cap = %d; invalid offset\n", - a_cap); - if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) - xerror("glp_read_mincost: a_cost = %d; invalid offset\n", - a_cost); - glp_erase_graph(G, G->v_size, G->a_size); - if (setjmp(csa->jump)) - { ret = 1; - goto done; - } - csa->fname = fname; - csa->fp = NULL; - csa->count = 0; - csa->c = '\n'; - csa->field[0] = '\0'; - csa->empty = csa->nonint = 0; - xprintf("Reading min-cost flow problem data from '%s'...\n", - fname); - csa->fp = glp_open(fname, "r"); - if (csa->fp == NULL) - { xprintf("Unable to open '%s' - %s\n", fname, get_err_msg()); - longjmp(csa->jump, 1); - } - /* read problem line */ - read_designator(csa); - if (strcmp(csa->field, "p") != 0) - error(csa, "problem line missing or invalid"); - read_field(csa); - if (strcmp(csa->field, "min") != 0) - error(csa, "wrong problem designator; 'min' expected"); - read_field(csa); - if (!(str2int(csa->field, &nv) == 0 && nv >= 0)) - error(csa, "number of nodes missing or invalid"); - read_field(csa); - if (!(str2int(csa->field, &na) == 0 && na >= 0)) - error(csa, "number of arcs missing or invalid"); - xprintf("Flow network has %d node%s and %d arc%s\n", - nv, nv == 1 ? "" : "s", na, na == 1 ? "" : "s"); - if (nv > 0) glp_add_vertices(G, nv); - end_of_line(csa); - /* read node descriptor lines */ - flag = xcalloc(1+nv, sizeof(char)); - memset(&flag[1], 0, nv * sizeof(char)); - if (v_rhs >= 0) - { rhs = 0.0; - for (i = 1; i <= nv; i++) - { v = G->v[i]; - memcpy((char *)v->data + v_rhs, &rhs, sizeof(double)); - } - } - for (;;) - { read_designator(csa); - if (strcmp(csa->field, "n") != 0) break; - read_field(csa); - if (str2int(csa->field, &i) != 0) - error(csa, "node number missing or invalid"); - if (!(1 <= i && i <= nv)) - error(csa, "node number %d out of range", i); - if (flag[i]) - error(csa, "duplicate descriptor of node %d", i); - read_field(csa); - if (str2num(csa->field, &rhs) != 0) - error(csa, "node supply/demand missing or invalid"); - check_int(csa, rhs); - if (v_rhs >= 0) - { v = G->v[i]; - memcpy((char *)v->data + v_rhs, &rhs, sizeof(double)); - } - flag[i] = 1; - end_of_line(csa); - } - xfree(flag), flag = NULL; - /* read arc descriptor lines */ - for (k = 1; k <= na; k++) - { if (k > 1) read_designator(csa); - if (strcmp(csa->field, "a") != 0) - error(csa, "wrong line designator; 'a' expected"); - read_field(csa); - if (str2int(csa->field, &i) != 0) - error(csa, "starting node number missing or invalid"); - if (!(1 <= i && i <= nv)) - error(csa, "starting node number %d out of range", i); - read_field(csa); - if (str2int(csa->field, &j) != 0) - error(csa, "ending node number missing or invalid"); - if (!(1 <= j && j <= nv)) - error(csa, "ending node number %d out of range", j); - read_field(csa); - if (!(str2num(csa->field, &low) == 0 && low >= 0.0)) - error(csa, "lower bound of arc flow missing or invalid"); - check_int(csa, low); - read_field(csa); - if (!(str2num(csa->field, &cap) == 0 && cap >= low)) - error(csa, "upper bound of arc flow missing or invalid"); - check_int(csa, cap); - read_field(csa); - if (str2num(csa->field, &cost) != 0) - error(csa, "per-unit cost of arc flow missing or invalid"); - check_int(csa, cost); - a = glp_add_arc(G, i, j); - if (a_low >= 0) - memcpy((char *)a->data + a_low, &low, sizeof(double)); - if (a_cap >= 0) - memcpy((char *)a->data + a_cap, &cap, sizeof(double)); - if (a_cost >= 0) - memcpy((char *)a->data + a_cost, &cost, sizeof(double)); - end_of_line(csa); - } - xprintf("%d lines were read\n", csa->count); -done: if (ret) glp_erase_graph(G, G->v_size, G->a_size); - if (csa->fp != NULL) glp_close(csa->fp); - if (flag != NULL) xfree(flag); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_write_mincost - write min-cost flow problem data in DIMACS format -* -* SYNOPSIS -* -* int glp_write_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap, -* int a_cost, const char *fname); -* -* DESCRIPTION -* -* The routine glp_write_mincost writes minimum cost flow problem data -* in DIMACS format to a text file. -* -* RETURNS -* -* If the operation was successful, the routine returns zero. Otherwise -* it prints an error message and returns non-zero. */ - -int glp_write_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap, - int a_cost, const char *fname) -{ glp_file *fp; - glp_vertex *v; - glp_arc *a; - int i, count = 0, ret; - double rhs, low, cap, cost; - if (v_rhs >= 0 && v_rhs > G->v_size - (int)sizeof(double)) - xerror("glp_write_mincost: v_rhs = %d; invalid offset\n", - v_rhs); - if (a_low >= 0 && a_low > G->a_size - (int)sizeof(double)) - xerror("glp_write_mincost: a_low = %d; invalid offset\n", - a_low); - if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) - xerror("glp_write_mincost: a_cap = %d; invalid offset\n", - a_cap); - if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) - xerror("glp_write_mincost: a_cost = %d; invalid offset\n", - a_cost); - xprintf("Writing min-cost flow problem data to '%s'...\n", - fname); - fp = glp_open(fname, "w"); - if (fp == NULL) - { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xfprintf(fp, "c %s\n", - G->name == NULL ? "unknown" : G->name), count++; - xfprintf(fp, "p min %d %d\n", G->nv, G->na), count++; - if (v_rhs >= 0) - { for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - memcpy(&rhs, (char *)v->data + v_rhs, sizeof(double)); - if (rhs != 0.0) - xfprintf(fp, "n %d %.*g\n", i, DBL_DIG, rhs), count++; - } - } - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - { if (a_low >= 0) - memcpy(&low, (char *)a->data + a_low, sizeof(double)); - else - low = 0.0; - if (a_cap >= 0) - memcpy(&cap, (char *)a->data + a_cap, sizeof(double)); - else - cap = 1.0; - if (a_cost >= 0) - memcpy(&cost, (char *)a->data + a_cost, sizeof(double)); - else - cost = 0.0; - xfprintf(fp, "a %d %d %.*g %.*g %.*g\n", - a->tail->i, a->head->i, DBL_DIG, low, DBL_DIG, cap, - DBL_DIG, cost), count++; - } - } - xfprintf(fp, "c eof\n"), count++; -#if 0 /* FIXME */ - xfflush(fp); -#endif - if (glp_ioerr(fp)) - { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xprintf("%d lines were written\n", count); - ret = 0; -done: if (fp != NULL) glp_close(fp); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_read_maxflow - read maximum flow problem data in DIMACS format -* -* SYNOPSIS -* -* int glp_read_maxflow(glp_graph *G, int *s, int *t, int a_cap, -* const char *fname); -* -* DESCRIPTION -* -* The routine glp_read_maxflow reads maximum flow problem data in -* DIMACS format from a text file. -* -* RETURNS -* -* If the operation was successful, the routine returns zero. Otherwise -* it prints an error message and returns non-zero. */ - -int glp_read_maxflow(glp_graph *G, int *_s, int *_t, int a_cap, - const char *fname) -{ struct csa _csa, *csa = &_csa; - glp_arc *a; - int i, j, k, s, t, nv, na, ret = 0; - double cap; - if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) - xerror("glp_read_maxflow: a_cap = %d; invalid offset\n", - a_cap); - glp_erase_graph(G, G->v_size, G->a_size); - if (setjmp(csa->jump)) - { ret = 1; - goto done; - } - csa->fname = fname; - csa->fp = NULL; - csa->count = 0; - csa->c = '\n'; - csa->field[0] = '\0'; - csa->empty = csa->nonint = 0; - xprintf("Reading maximum flow problem data from '%s'...\n", - fname); - csa->fp = glp_open(fname, "r"); - if (csa->fp == NULL) - { xprintf("Unable to open '%s' - %s\n", fname, get_err_msg()); - longjmp(csa->jump, 1); - } - /* read problem line */ - read_designator(csa); - if (strcmp(csa->field, "p") != 0) - error(csa, "problem line missing or invalid"); - read_field(csa); - if (strcmp(csa->field, "max") != 0) - error(csa, "wrong problem designator; 'max' expected"); - read_field(csa); - if (!(str2int(csa->field, &nv) == 0 && nv >= 2)) - error(csa, "number of nodes missing or invalid"); - read_field(csa); - if (!(str2int(csa->field, &na) == 0 && na >= 0)) - error(csa, "number of arcs missing or invalid"); - xprintf("Flow network has %d node%s and %d arc%s\n", - nv, nv == 1 ? "" : "s", na, na == 1 ? "" : "s"); - if (nv > 0) glp_add_vertices(G, nv); - end_of_line(csa); - /* read node descriptor lines */ - s = t = 0; - for (;;) - { read_designator(csa); - if (strcmp(csa->field, "n") != 0) break; - read_field(csa); - if (str2int(csa->field, &i) != 0) - error(csa, "node number missing or invalid"); - if (!(1 <= i && i <= nv)) - error(csa, "node number %d out of range", i); - read_field(csa); - if (strcmp(csa->field, "s") == 0) - { if (s > 0) - error(csa, "only one source node allowed"); - s = i; - } - else if (strcmp(csa->field, "t") == 0) - { if (t > 0) - error(csa, "only one sink node allowed"); - t = i; - } - else - error(csa, "wrong node designator; 's' or 't' expected"); - if (s > 0 && s == t) - error(csa, "source and sink nodes must be distinct"); - end_of_line(csa); - } - if (s == 0) - error(csa, "source node descriptor missing\n"); - if (t == 0) - error(csa, "sink node descriptor missing\n"); - if (_s != NULL) *_s = s; - if (_t != NULL) *_t = t; - /* read arc descriptor lines */ - for (k = 1; k <= na; k++) - { if (k > 1) read_designator(csa); - if (strcmp(csa->field, "a") != 0) - error(csa, "wrong line designator; 'a' expected"); - read_field(csa); - if (str2int(csa->field, &i) != 0) - error(csa, "starting node number missing or invalid"); - if (!(1 <= i && i <= nv)) - error(csa, "starting node number %d out of range", i); - read_field(csa); - if (str2int(csa->field, &j) != 0) - error(csa, "ending node number missing or invalid"); - if (!(1 <= j && j <= nv)) - error(csa, "ending node number %d out of range", j); - read_field(csa); - if (!(str2num(csa->field, &cap) == 0 && cap >= 0.0)) - error(csa, "arc capacity missing or invalid"); - check_int(csa, cap); - a = glp_add_arc(G, i, j); - if (a_cap >= 0) - memcpy((char *)a->data + a_cap, &cap, sizeof(double)); - end_of_line(csa); - } - xprintf("%d lines were read\n", csa->count); -done: if (ret) glp_erase_graph(G, G->v_size, G->a_size); - if (csa->fp != NULL) glp_close(csa->fp); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_write_maxflow - write maximum flow problem data in DIMACS format -* -* SYNOPSIS -* -* int glp_write_maxflow(glp_graph *G, int s, int t, int a_cap, -* const char *fname); -* -* DESCRIPTION -* -* The routine glp_write_maxflow writes maximum flow problem data in -* DIMACS format to a text file. -* -* RETURNS -* -* If the operation was successful, the routine returns zero. Otherwise -* it prints an error message and returns non-zero. */ - -int glp_write_maxflow(glp_graph *G, int s, int t, int a_cap, - const char *fname) -{ glp_file *fp; - glp_vertex *v; - glp_arc *a; - int i, count = 0, ret; - double cap; - if (!(1 <= s && s <= G->nv)) - xerror("glp_write_maxflow: s = %d; source node number out of r" - "ange\n", s); - if (!(1 <= t && t <= G->nv)) - xerror("glp_write_maxflow: t = %d: sink node number out of ran" - "ge\n", t); - if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) - xerror("glp_write_mincost: a_cap = %d; invalid offset\n", - a_cap); - xprintf("Writing maximum flow problem data to '%s'...\n", - fname); - fp = glp_open(fname, "w"); - if (fp == NULL) - { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xfprintf(fp, "c %s\n", - G->name == NULL ? "unknown" : G->name), count++; - xfprintf(fp, "p max %d %d\n", G->nv, G->na), count++; - xfprintf(fp, "n %d s\n", s), count++; - xfprintf(fp, "n %d t\n", t), count++; - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - { if (a_cap >= 0) - memcpy(&cap, (char *)a->data + a_cap, sizeof(double)); - else - cap = 1.0; - xfprintf(fp, "a %d %d %.*g\n", - a->tail->i, a->head->i, DBL_DIG, cap), count++; - } - } - xfprintf(fp, "c eof\n"), count++; -#if 0 /* FIXME */ - xfflush(fp); -#endif - if (glp_ioerr(fp)) - { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xprintf("%d lines were written\n", count); - ret = 0; -done: if (fp != NULL) glp_close(fp); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_read_asnprob - read assignment problem data in DIMACS format -* -* SYNOPSIS -* -* int glp_read_asnprob(glp_graph *G, int v_set, int a_cost, -* const char *fname); -* -* DESCRIPTION -* -* The routine glp_read_asnprob reads assignment problem data in DIMACS -* format from a text file. -* -* RETURNS -* -* If the operation was successful, the routine returns zero. Otherwise -* it prints an error message and returns non-zero. */ - -int glp_read_asnprob(glp_graph *G, int v_set, int a_cost, const char - *fname) -{ struct csa _csa, *csa = &_csa; - glp_vertex *v; - glp_arc *a; - int nv, na, n1, i, j, k, ret = 0; - double cost; - char *flag = NULL; - if (v_set >= 0 && v_set > G->v_size - (int)sizeof(int)) - xerror("glp_read_asnprob: v_set = %d; invalid offset\n", - v_set); - if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) - xerror("glp_read_asnprob: a_cost = %d; invalid offset\n", - a_cost); - glp_erase_graph(G, G->v_size, G->a_size); - if (setjmp(csa->jump)) - { ret = 1; - goto done; - } - csa->fname = fname; - csa->fp = NULL; - csa->count = 0; - csa->c = '\n'; - csa->field[0] = '\0'; - csa->empty = csa->nonint = 0; - xprintf("Reading assignment problem data from '%s'...\n", fname); - csa->fp = glp_open(fname, "r"); - if (csa->fp == NULL) - { xprintf("Unable to open '%s' - %s\n", fname, get_err_msg()); - longjmp(csa->jump, 1); - } - /* read problem line */ - read_designator(csa); - if (strcmp(csa->field, "p") != 0) - error(csa, "problem line missing or invalid"); - read_field(csa); - if (strcmp(csa->field, "asn") != 0) - error(csa, "wrong problem designator; 'asn' expected"); - read_field(csa); - if (!(str2int(csa->field, &nv) == 0 && nv >= 0)) - error(csa, "number of nodes missing or invalid"); - read_field(csa); - if (!(str2int(csa->field, &na) == 0 && na >= 0)) - error(csa, "number of arcs missing or invalid"); - if (nv > 0) glp_add_vertices(G, nv); - end_of_line(csa); - /* read node descriptor lines */ - flag = xcalloc(1+nv, sizeof(char)); - memset(&flag[1], 0, nv * sizeof(char)); - n1 = 0; - for (;;) - { read_designator(csa); - if (strcmp(csa->field, "n") != 0) break; - read_field(csa); - if (str2int(csa->field, &i) != 0) - error(csa, "node number missing or invalid"); - if (!(1 <= i && i <= nv)) - error(csa, "node number %d out of range", i); - if (flag[i]) - error(csa, "duplicate descriptor of node %d", i); - flag[i] = 1, n1++; - end_of_line(csa); - } - xprintf( - "Assignment problem has %d + %d = %d node%s and %d arc%s\n", - n1, nv - n1, nv, nv == 1 ? "" : "s", na, na == 1 ? "" : "s"); - if (v_set >= 0) - { for (i = 1; i <= nv; i++) - { v = G->v[i]; - k = (flag[i] ? 0 : 1); - memcpy((char *)v->data + v_set, &k, sizeof(int)); - } - } - /* read arc descriptor lines */ - for (k = 1; k <= na; k++) - { if (k > 1) read_designator(csa); - if (strcmp(csa->field, "a") != 0) - error(csa, "wrong line designator; 'a' expected"); - read_field(csa); - if (str2int(csa->field, &i) != 0) - error(csa, "starting node number missing or invalid"); - if (!(1 <= i && i <= nv)) - error(csa, "starting node number %d out of range", i); - if (!flag[i]) - error(csa, "node %d cannot be a starting node", i); - read_field(csa); - if (str2int(csa->field, &j) != 0) - error(csa, "ending node number missing or invalid"); - if (!(1 <= j && j <= nv)) - error(csa, "ending node number %d out of range", j); - if (flag[j]) - error(csa, "node %d cannot be an ending node", j); - read_field(csa); - if (str2num(csa->field, &cost) != 0) - error(csa, "arc cost missing or invalid"); - check_int(csa, cost); - a = glp_add_arc(G, i, j); - if (a_cost >= 0) - memcpy((char *)a->data + a_cost, &cost, sizeof(double)); - end_of_line(csa); - } - xprintf("%d lines were read\n", csa->count); -done: if (ret) glp_erase_graph(G, G->v_size, G->a_size); - if (csa->fp != NULL) glp_close(csa->fp); - if (flag != NULL) xfree(flag); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_write_asnprob - write assignment problem data in DIMACS format -* -* SYNOPSIS -* -* int glp_write_asnprob(glp_graph *G, int v_set, int a_cost, -* const char *fname); -* -* DESCRIPTION -* -* The routine glp_write_asnprob writes assignment problem data in -* DIMACS format to a text file. -* -* RETURNS -* -* If the operation was successful, the routine returns zero. Otherwise -* it prints an error message and returns non-zero. */ - -int glp_write_asnprob(glp_graph *G, int v_set, int a_cost, const char - *fname) -{ glp_file *fp; - glp_vertex *v; - glp_arc *a; - int i, k, count = 0, ret; - double cost; - if (v_set >= 0 && v_set > G->v_size - (int)sizeof(int)) - xerror("glp_write_asnprob: v_set = %d; invalid offset\n", - v_set); - if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) - xerror("glp_write_asnprob: a_cost = %d; invalid offset\n", - a_cost); - xprintf("Writing assignment problem data to '%s'...\n", fname); - fp = glp_open(fname, "w"); - if (fp == NULL) - { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xfprintf(fp, "c %s\n", - G->name == NULL ? "unknown" : G->name), count++; - xfprintf(fp, "p asn %d %d\n", G->nv, G->na), count++; - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - if (v_set >= 0) - memcpy(&k, (char *)v->data + v_set, sizeof(int)); - else - k = (v->out != NULL ? 0 : 1); - if (k == 0) - xfprintf(fp, "n %d\n", i), count++; - } - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - { if (a_cost >= 0) - memcpy(&cost, (char *)a->data + a_cost, sizeof(double)); - else - cost = 1.0; - xfprintf(fp, "a %d %d %.*g\n", - a->tail->i, a->head->i, DBL_DIG, cost), count++; - } - } - xfprintf(fp, "c eof\n"), count++; -#if 0 /* FIXME */ - xfflush(fp); -#endif - if (glp_ioerr(fp)) - { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xprintf("%d lines were written\n", count); - ret = 0; -done: if (fp != NULL) glp_close(fp); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_read_ccdata - read graph in DIMACS clique/coloring format -* -* SYNOPSIS -* -* int glp_read_ccdata(glp_graph *G, int v_wgt, const char *fname); -* -* DESCRIPTION -* -* The routine glp_read_ccdata reads an (undirected) graph in DIMACS -* clique/coloring format from a text file. -* -* RETURNS -* -* If the operation was successful, the routine returns zero. Otherwise -* it prints an error message and returns non-zero. */ - -int glp_read_ccdata(glp_graph *G, int v_wgt, const char *fname) -{ struct csa _csa, *csa = &_csa; - glp_vertex *v; - int i, j, k, nv, ne, ret = 0; - double w; - char *flag = NULL; - if (v_wgt >= 0 && v_wgt > G->v_size - (int)sizeof(double)) - xerror("glp_read_ccdata: v_wgt = %d; invalid offset\n", - v_wgt); - glp_erase_graph(G, G->v_size, G->a_size); - if (setjmp(csa->jump)) - { ret = 1; - goto done; - } - csa->fname = fname; - csa->fp = NULL; - csa->count = 0; - csa->c = '\n'; - csa->field[0] = '\0'; - csa->empty = csa->nonint = 0; - xprintf("Reading graph from '%s'...\n", fname); - csa->fp = glp_open(fname, "r"); - if (csa->fp == NULL) - { xprintf("Unable to open '%s' - %s\n", fname, get_err_msg()); - longjmp(csa->jump, 1); - } - /* read problem line */ - read_designator(csa); - if (strcmp(csa->field, "p") != 0) - error(csa, "problem line missing or invalid"); - read_field(csa); - if (strcmp(csa->field, "edge") != 0) - error(csa, "wrong problem designator; 'edge' expected"); - read_field(csa); - if (!(str2int(csa->field, &nv) == 0 && nv >= 0)) - error(csa, "number of vertices missing or invalid"); - read_field(csa); - if (!(str2int(csa->field, &ne) == 0 && ne >= 0)) - error(csa, "number of edges missing or invalid"); - xprintf("Graph has %d vert%s and %d edge%s\n", - nv, nv == 1 ? "ex" : "ices", ne, ne == 1 ? "" : "s"); - if (nv > 0) glp_add_vertices(G, nv); - end_of_line(csa); - /* read node descriptor lines */ - flag = xcalloc(1+nv, sizeof(char)); - memset(&flag[1], 0, nv * sizeof(char)); - if (v_wgt >= 0) - { w = 1.0; - for (i = 1; i <= nv; i++) - { v = G->v[i]; - memcpy((char *)v->data + v_wgt, &w, sizeof(double)); - } - } - for (;;) - { read_designator(csa); - if (strcmp(csa->field, "n") != 0) break; - read_field(csa); - if (str2int(csa->field, &i) != 0) - error(csa, "vertex number missing or invalid"); - if (!(1 <= i && i <= nv)) - error(csa, "vertex number %d out of range", i); - if (flag[i]) - error(csa, "duplicate descriptor of vertex %d", i); - read_field(csa); - if (str2num(csa->field, &w) != 0) - error(csa, "vertex weight missing or invalid"); - check_int(csa, w); - if (v_wgt >= 0) - { v = G->v[i]; - memcpy((char *)v->data + v_wgt, &w, sizeof(double)); - } - flag[i] = 1; - end_of_line(csa); - } - xfree(flag), flag = NULL; - /* read edge descriptor lines */ - for (k = 1; k <= ne; k++) - { if (k > 1) read_designator(csa); - if (strcmp(csa->field, "e") != 0) - error(csa, "wrong line designator; 'e' expected"); - read_field(csa); - if (str2int(csa->field, &i) != 0) - error(csa, "first vertex number missing or invalid"); - if (!(1 <= i && i <= nv)) - error(csa, "first vertex number %d out of range", i); - read_field(csa); - if (str2int(csa->field, &j) != 0) - error(csa, "second vertex number missing or invalid"); - if (!(1 <= j && j <= nv)) - error(csa, "second vertex number %d out of range", j); - glp_add_arc(G, i, j); - end_of_line(csa); - } - xprintf("%d lines were read\n", csa->count); -done: if (ret) glp_erase_graph(G, G->v_size, G->a_size); - if (csa->fp != NULL) glp_close(csa->fp); - if (flag != NULL) xfree(flag); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_write_ccdata - write graph in DIMACS clique/coloring format -* -* SYNOPSIS -* -* int glp_write_ccdata(glp_graph *G, int v_wgt, const char *fname); -* -* DESCRIPTION -* -* The routine glp_write_ccdata writes the specified graph in DIMACS -* clique/coloring format to a text file. -* -* RETURNS -* -* If the operation was successful, the routine returns zero. Otherwise -* it prints an error message and returns non-zero. */ - -int glp_write_ccdata(glp_graph *G, int v_wgt, const char *fname) -{ glp_file *fp; - glp_vertex *v; - glp_arc *e; - int i, count = 0, ret; - double w; - if (v_wgt >= 0 && v_wgt > G->v_size - (int)sizeof(double)) - xerror("glp_write_ccdata: v_wgt = %d; invalid offset\n", - v_wgt); - xprintf("Writing graph to '%s'\n", fname); - fp = glp_open(fname, "w"); - if (fp == NULL) - { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xfprintf(fp, "c %s\n", - G->name == NULL ? "unknown" : G->name), count++; - xfprintf(fp, "p edge %d %d\n", G->nv, G->na), count++; - if (v_wgt >= 0) - { for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - memcpy(&w, (char *)v->data + v_wgt, sizeof(double)); - if (w != 1.0) - xfprintf(fp, "n %d %.*g\n", i, DBL_DIG, w), count++; - } - } - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - for (e = v->out; e != NULL; e = e->t_next) - xfprintf(fp, "e %d %d\n", e->tail->i, e->head->i), count++; - } - xfprintf(fp, "c eof\n"), count++; -#if 0 /* FIXME */ - xfflush(fp); -#endif - if (glp_ioerr(fp)) - { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xprintf("%d lines were written\n", count); - ret = 0; -done: if (fp != NULL) glp_close(fp); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_read_prob - read problem data in GLPK format -* -* SYNOPSIS -* -* int glp_read_prob(glp_prob *P, int flags, const char *fname); -* -* The routine glp_read_prob reads problem data in GLPK LP/MIP format -* from a text file. -* -* RETURNS -* -* If the operation was successful, the routine returns zero. Otherwise -* it prints an error message and returns non-zero. */ - -int glp_read_prob(glp_prob *P, int flags, const char *fname) -{ struct csa _csa, *csa = &_csa; - int mip, m, n, nnz, ne, i, j, k, type, kind, ret, *ln = NULL, - *ia = NULL, *ja = NULL; - double lb, ub, temp, *ar = NULL; - char *rf = NULL, *cf = NULL; - if (P == NULL || P->magic != GLP_PROB_MAGIC) - xerror("glp_read_prob: P = %p; invalid problem object\n", - P); - if (flags != 0) - xerror("glp_read_prob: flags = %d; invalid parameter\n", - flags); - if (fname == NULL) - xerror("glp_read_prob: fname = %d; invalid parameter\n", - fname); - glp_erase_prob(P); - if (setjmp(csa->jump)) - { ret = 1; - goto done; - } - csa->fname = fname; - csa->fp = NULL; - csa->count = 0; - csa->c = '\n'; - csa->field[0] = '\0'; - csa->empty = csa->nonint = 0; - xprintf("Reading problem data from '%s'...\n", fname); - csa->fp = glp_open(fname, "r"); - if (csa->fp == NULL) - { xprintf("Unable to open '%s' - %s\n", fname, get_err_msg()); - longjmp(csa->jump, 1); - } - /* read problem line */ - read_designator(csa); - if (strcmp(csa->field, "p") != 0) - error(csa, "problem line missing or invalid"); - read_field(csa); - if (strcmp(csa->field, "lp") == 0) - mip = 0; - else if (strcmp(csa->field, "mip") == 0) - mip = 1; - else - error(csa, "wrong problem designator; 'lp' or 'mip' expected\n" - ); - read_field(csa); - if (strcmp(csa->field, "min") == 0) - glp_set_obj_dir(P, GLP_MIN); - else if (strcmp(csa->field, "max") == 0) - glp_set_obj_dir(P, GLP_MAX); - else - error(csa, "objective sense missing or invalid"); - read_field(csa); - if (!(str2int(csa->field, &m) == 0 && m >= 0)) - error(csa, "number of rows missing or invalid"); - read_field(csa); - if (!(str2int(csa->field, &n) == 0 && n >= 0)) - error(csa, "number of columns missing or invalid"); - read_field(csa); - if (!(str2int(csa->field, &nnz) == 0 && nnz >= 0)) - error(csa, "number of constraint coefficients missing or inval" - "id"); - if (m > 0) - { glp_add_rows(P, m); - for (i = 1; i <= m; i++) - glp_set_row_bnds(P, i, GLP_FX, 0.0, 0.0); - } - if (n > 0) - { glp_add_cols(P, n); - for (j = 1; j <= n; j++) - { if (!mip) - glp_set_col_bnds(P, j, GLP_LO, 0.0, 0.0); - else - glp_set_col_kind(P, j, GLP_BV); - } - } - end_of_line(csa); - /* allocate working arrays */ - rf = xcalloc(1+m, sizeof(char)); - memset(rf, 0, 1+m); - cf = xcalloc(1+n, sizeof(char)); - memset(cf, 0, 1+n); - ln = xcalloc(1+nnz, sizeof(int)); - ia = xcalloc(1+nnz, sizeof(int)); - ja = xcalloc(1+nnz, sizeof(int)); - ar = xcalloc(1+nnz, sizeof(double)); - /* read descriptor lines */ - ne = 0; - for (;;) - { read_designator(csa); - if (strcmp(csa->field, "i") == 0) - { /* row descriptor */ - read_field(csa); - if (str2int(csa->field, &i) != 0) - error(csa, "row number missing or invalid"); - if (!(1 <= i && i <= m)) - error(csa, "row number out of range"); - read_field(csa); - if (strcmp(csa->field, "f") == 0) - type = GLP_FR; - else if (strcmp(csa->field, "l") == 0) - type = GLP_LO; - else if (strcmp(csa->field, "u") == 0) - type = GLP_UP; - else if (strcmp(csa->field, "d") == 0) - type = GLP_DB; - else if (strcmp(csa->field, "s") == 0) - type = GLP_FX; - else - error(csa, "row type missing or invalid"); - if (type == GLP_LO || type == GLP_DB || type == GLP_FX) - { read_field(csa); - if (str2num(csa->field, &lb) != 0) - error(csa, "row lower bound/fixed value missing or in" - "valid"); - } - else - lb = 0.0; - if (type == GLP_UP || type == GLP_DB) - { read_field(csa); - if (str2num(csa->field, &ub) != 0) - error(csa, "row upper bound missing or invalid"); - } - else - ub = 0.0; - if (rf[i] & 0x01) - error(csa, "duplicate row descriptor"); - glp_set_row_bnds(P, i, type, lb, ub), rf[i] |= 0x01; - } - else if (strcmp(csa->field, "j") == 0) - { /* column descriptor */ - read_field(csa); - if (str2int(csa->field, &j) != 0) - error(csa, "column number missing or invalid"); - if (!(1 <= j && j <= n)) - error(csa, "column number out of range"); - if (!mip) - kind = GLP_CV; - else - { read_field(csa); - if (strcmp(csa->field, "c") == 0) - kind = GLP_CV; - else if (strcmp(csa->field, "i") == 0) - kind = GLP_IV; - else if (strcmp(csa->field, "b") == 0) - { kind = GLP_IV; - type = GLP_DB, lb = 0.0, ub = 1.0; - goto skip; - } - else - error(csa, "column kind missing or invalid"); - } - read_field(csa); - if (strcmp(csa->field, "f") == 0) - type = GLP_FR; - else if (strcmp(csa->field, "l") == 0) - type = GLP_LO; - else if (strcmp(csa->field, "u") == 0) - type = GLP_UP; - else if (strcmp(csa->field, "d") == 0) - type = GLP_DB; - else if (strcmp(csa->field, "s") == 0) - type = GLP_FX; - else - error(csa, "column type missing or invalid"); - if (type == GLP_LO || type == GLP_DB || type == GLP_FX) - { read_field(csa); - if (str2num(csa->field, &lb) != 0) - error(csa, "column lower bound/fixed value missing or" - " invalid"); - } - else - lb = 0.0; - if (type == GLP_UP || type == GLP_DB) - { read_field(csa); - if (str2num(csa->field, &ub) != 0) - error(csa, "column upper bound missing or invalid"); - } - else - ub = 0.0; -skip: if (cf[j] & 0x01) - error(csa, "duplicate column descriptor"); - glp_set_col_kind(P, j, kind); - glp_set_col_bnds(P, j, type, lb, ub), cf[j] |= 0x01; - } - else if (strcmp(csa->field, "a") == 0) - { /* coefficient descriptor */ - read_field(csa); - if (str2int(csa->field, &i) != 0) - error(csa, "row number missing or invalid"); - if (!(0 <= i && i <= m)) - error(csa, "row number out of range"); - read_field(csa); - if (str2int(csa->field, &j) != 0) - error(csa, "column number missing or invalid"); - if (!((i == 0 ? 0 : 1) <= j && j <= n)) - error(csa, "column number out of range"); - read_field(csa); - if (i == 0) - { if (str2num(csa->field, &temp) != 0) - error(csa, "objective %s missing or invalid", - j == 0 ? "constant term" : "coefficient"); - if (cf[j] & 0x10) - error(csa, "duplicate objective %s", - j == 0 ? "constant term" : "coefficient"); - glp_set_obj_coef(P, j, temp), cf[j] |= 0x10; - } - else - { if (str2num(csa->field, &temp) != 0) - error(csa, "constraint coefficient missing or invalid" - ); - if (ne == nnz) - error(csa, "too many constraint coefficient descripto" - "rs"); - ln[++ne] = csa->count; - ia[ne] = i, ja[ne] = j, ar[ne] = temp; - } - } - else if (strcmp(csa->field, "n") == 0) - { /* symbolic name descriptor */ - read_field(csa); - if (strcmp(csa->field, "p") == 0) - { /* problem name */ - read_field(csa); - if (P->name != NULL) - error(csa, "duplicate problem name"); - glp_set_prob_name(P, csa->field); - } - else if (strcmp(csa->field, "z") == 0) - { /* objective name */ - read_field(csa); - if (P->obj != NULL) - error(csa, "duplicate objective name"); - glp_set_obj_name(P, csa->field); - } - else if (strcmp(csa->field, "i") == 0) - { /* row name */ - read_field(csa); - if (str2int(csa->field, &i) != 0) - error(csa, "row number missing or invalid"); - if (!(1 <= i && i <= m)) - error(csa, "row number out of range"); - read_field(csa); - if (P->row[i]->name != NULL) - error(csa, "duplicate row name"); - glp_set_row_name(P, i, csa->field); - } - else if (strcmp(csa->field, "j") == 0) - { /* column name */ - read_field(csa); - if (str2int(csa->field, &j) != 0) - error(csa, "column number missing or invalid"); - if (!(1 <= j && j <= n)) - error(csa, "column number out of range"); - read_field(csa); - if (P->col[j]->name != NULL) - error(csa, "duplicate column name"); - glp_set_col_name(P, j, csa->field); - } - else - error(csa, "object designator missing or invalid"); - } - else if (strcmp(csa->field, "e") == 0) - break; - else - error(csa, "line designator missing or invalid"); - end_of_line(csa); - } - if (ne < nnz) - error(csa, "too few constraint coefficient descriptors"); - xassert(ne == nnz); - k = glp_check_dup(m, n, ne, ia, ja); - xassert(0 <= k && k <= nnz); - if (k > 0) - { csa->count = ln[k]; - error(csa, "duplicate constraint coefficient"); - } - glp_load_matrix(P, ne, ia, ja, ar); - /* print some statistics */ - if (P->name != NULL) - xprintf("Problem: %s\n", P->name); - if (P->obj != NULL) - xprintf("Objective: %s\n", P->obj); - xprintf("%d row%s, %d column%s, %d non-zero%s\n", - m, m == 1 ? "" : "s", n, n == 1 ? "" : "s", nnz, nnz == 1 ? - "" : "s"); - if (glp_get_num_int(P) > 0) - { int ni = glp_get_num_int(P); - int nb = glp_get_num_bin(P); - if (ni == 1) - { if (nb == 0) - xprintf("One variable is integer\n"); - else - xprintf("One variable is binary\n"); - } - else - { xprintf("%d integer variables, ", ni); - if (nb == 0) - xprintf("none"); - else if (nb == 1) - xprintf("one"); - else if (nb == ni) - xprintf("all"); - else - xprintf("%d", nb); - xprintf(" of which %s binary\n", nb == 1 ? "is" : "are"); - } - } - xprintf("%d lines were read\n", csa->count); - /* problem data has been successfully read */ - glp_sort_matrix(P); - ret = 0; -done: if (csa->fp != NULL) glp_close(csa->fp); - if (rf != NULL) xfree(rf); - if (cf != NULL) xfree(cf); - if (ln != NULL) xfree(ln); - if (ia != NULL) xfree(ia); - if (ja != NULL) xfree(ja); - if (ar != NULL) xfree(ar); - if (ret) glp_erase_prob(P); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_write_prob - write problem data in GLPK format -* -* SYNOPSIS -* -* int glp_write_prob(glp_prob *P, int flags, const char *fname); -* -* The routine glp_write_prob writes problem data in GLPK LP/MIP format -* to a text file. -* -* RETURNS -* -* If the operation was successful, the routine returns zero. Otherwise -* it prints an error message and returns non-zero. */ - -int glp_write_prob(glp_prob *P, int flags, const char *fname) -{ glp_file *fp; - GLPROW *row; - GLPCOL *col; - GLPAIJ *aij; - int mip, i, j, count, ret; - if (P == NULL || P->magic != GLP_PROB_MAGIC) - xerror("glp_write_prob: P = %p; invalid problem object\n", - P); - if (flags != 0) - xerror("glp_write_prob: flags = %d; invalid parameter\n", - flags); - if (fname == NULL) - xerror("glp_write_prob: fname = %d; invalid parameter\n", - fname); - xprintf("Writing problem data to '%s'...\n", fname); - fp = glp_open(fname, "w"), count = 0; - if (fp == NULL) - { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - /* write problem line */ - mip = (glp_get_num_int(P) > 0); - xfprintf(fp, "p %s %s %d %d %d\n", !mip ? "lp" : "mip", - P->dir == GLP_MIN ? "min" : P->dir == GLP_MAX ? "max" : "???", - P->m, P->n, P->nnz), count++; - if (P->name != NULL) - xfprintf(fp, "n p %s\n", P->name), count++; - if (P->obj != NULL) - xfprintf(fp, "n z %s\n", P->obj), count++; - /* write row descriptors */ - for (i = 1; i <= P->m; i++) - { row = P->row[i]; - if (row->type == GLP_FX && row->lb == 0.0) - goto skip1; - xfprintf(fp, "i %d ", i), count++; - if (row->type == GLP_FR) - xfprintf(fp, "f\n"); - else if (row->type == GLP_LO) - xfprintf(fp, "l %.*g\n", DBL_DIG, row->lb); - else if (row->type == GLP_UP) - xfprintf(fp, "u %.*g\n", DBL_DIG, row->ub); - else if (row->type == GLP_DB) - xfprintf(fp, "d %.*g %.*g\n", DBL_DIG, row->lb, DBL_DIG, - row->ub); - else if (row->type == GLP_FX) - xfprintf(fp, "s %.*g\n", DBL_DIG, row->lb); - else - xassert(row != row); -skip1: if (row->name != NULL) - xfprintf(fp, "n i %d %s\n", i, row->name), count++; - } - /* write column descriptors */ - for (j = 1; j <= P->n; j++) - { col = P->col[j]; - if (!mip && col->type == GLP_LO && col->lb == 0.0) - goto skip2; - if (mip && col->kind == GLP_IV && col->type == GLP_DB && - col->lb == 0.0 && col->ub == 1.0) - goto skip2; - xfprintf(fp, "j %d ", j), count++; - if (mip) - { if (col->kind == GLP_CV) - xfprintf(fp, "c "); - else if (col->kind == GLP_IV) - xfprintf(fp, "i "); - else - xassert(col != col); - } - if (col->type == GLP_FR) - xfprintf(fp, "f\n"); - else if (col->type == GLP_LO) - xfprintf(fp, "l %.*g\n", DBL_DIG, col->lb); - else if (col->type == GLP_UP) - xfprintf(fp, "u %.*g\n", DBL_DIG, col->ub); - else if (col->type == GLP_DB) - xfprintf(fp, "d %.*g %.*g\n", DBL_DIG, col->lb, DBL_DIG, - col->ub); - else if (col->type == GLP_FX) - xfprintf(fp, "s %.*g\n", DBL_DIG, col->lb); - else - xassert(col != col); -skip2: if (col->name != NULL) - xfprintf(fp, "n j %d %s\n", j, col->name), count++; - } - /* write objective coefficient descriptors */ - if (P->c0 != 0.0) - xfprintf(fp, "a 0 0 %.*g\n", DBL_DIG, P->c0), count++; - for (j = 1; j <= P->n; j++) - { col = P->col[j]; - if (col->coef != 0.0) - xfprintf(fp, "a 0 %d %.*g\n", j, DBL_DIG, col->coef), - count++; - } - /* write constraint coefficient descriptors */ - for (i = 1; i <= P->m; i++) - { row = P->row[i]; - for (aij = row->ptr; aij != NULL; aij = aij->r_next) - xfprintf(fp, "a %d %d %.*g\n", i, aij->col->j, DBL_DIG, - aij->val), count++; - } - /* write end line */ - xfprintf(fp, "e o f\n"), count++; -#if 0 /* FIXME */ - xfflush(fp); -#endif - if (glp_ioerr(fp)) - { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xprintf("%d lines were written\n", count); - ret = 0; -done: if (fp != NULL) glp_close(fp); - return ret; -} - -/**********************************************************************/ - -int glp_read_cnfsat(glp_prob *P, const char *fname) -{ /* read CNF-SAT problem data in DIMACS format */ - struct csa _csa, *csa = &_csa; - int m, n, i, j, len, neg, rhs, ret = 0, *ind = NULL; - double *val = NULL; - char *map = NULL; - if (P == NULL || P->magic != GLP_PROB_MAGIC) - xerror("glp_read_cnfsat: P = %p; invalid problem object\n", - P); - if (fname == NULL) - xerror("glp_read_cnfsat: fname = %p; invalid parameter\n", - fname); - glp_erase_prob(P); - if (setjmp(csa->jump)) - { ret = 1; - goto done; - } - csa->fname = fname; - csa->fp = NULL; - csa->count = 0; - csa->c = '\n'; - csa->field[0] = '\0'; - csa->empty = csa->nonint = 0; - xprintf("Reading CNF-SAT problem data from '%s'...\n", fname); - csa->fp = glp_open(fname, "r"); - if (csa->fp == NULL) - { xprintf("Unable to open '%s' - %s\n", fname, get_err_msg()); - longjmp(csa->jump, 1); - } - /* read problem line */ - read_designator(csa); - if (strcmp(csa->field, "p") != 0) - error(csa, "problem line missing or invalid"); - read_field(csa); - if (strcmp(csa->field, "cnf") != 0) - error(csa, "wrong problem designator; 'cnf' expected\n"); - read_field(csa); - if (!(str2int(csa->field, &n) == 0 && n >= 0)) - error(csa, "number of variables missing or invalid\n"); - read_field(csa); - if (!(str2int(csa->field, &m) == 0 && m >= 0)) - error(csa, "number of clauses missing or invalid\n"); - xprintf("Instance has %d variable%s and %d clause%s\n", - n, n == 1 ? "" : "s", m, m == 1 ? "" : "s"); - end_of_line(csa); - if (m > 0) - glp_add_rows(P, m); - if (n > 0) - { glp_add_cols(P, n); - for (j = 1; j <= n; j++) - glp_set_col_kind(P, j, GLP_BV); - } - /* allocate working arrays */ - ind = xcalloc(1+n, sizeof(int)); - val = xcalloc(1+n, sizeof(double)); - map = xcalloc(1+n, sizeof(char)); - for (j = 1; j <= n; j++) map[j] = 0; - /* read clauses */ - for (i = 1; i <= m; i++) - { /* read i-th clause */ - len = 0, rhs = 1; - for (;;) - { /* skip white-space characters */ - while (csa->c == ' ' || csa->c == '\n') - read_char(csa); - /* read term */ - read_field(csa); - if (str2int(csa->field, &j) != 0) - error(csa, "variable number missing or invalid\n"); - if (j > 0) - neg = 0; - else if (j < 0) - neg = 1, j = -j, rhs--; - else - break; - if (!(1 <= j && j <= n)) - error(csa, "variable number out of range\n"); - if (map[j]) - error(csa, "duplicate variable number\n"); - len++, ind[len] = j, val[len] = (neg ? -1.0 : +1.0); - map[j] = 1; - } - glp_set_row_bnds(P, i, GLP_LO, (double)rhs, 0.0); - glp_set_mat_row(P, i, len, ind, val); - while (len > 0) map[ind[len--]] = 0; - } - xprintf("%d lines were read\n", csa->count); - /* problem data has been successfully read */ - glp_sort_matrix(P); -done: if (csa->fp != NULL) glp_close(csa->fp); - if (ind != NULL) xfree(ind); - if (val != NULL) xfree(val); - if (map != NULL) xfree(map); - if (ret) glp_erase_prob(P); - return ret; -} - -/**********************************************************************/ - -int glp_check_cnfsat(glp_prob *P) -{ /* check for CNF-SAT problem instance */ - int m = P->m; - int n = P->n; - GLPROW *row; - GLPCOL *col; - GLPAIJ *aij; - int i, j, neg; - if (P == NULL || P->magic != GLP_PROB_MAGIC) - xerror("glp_check_cnfsat: P = %p; invalid problem object\n", - P); - /* check columns */ - for (j = 1; j <= n; j++) - { col = P->col[j]; - /* the variable should be binary */ - if (!(col->kind == GLP_IV && col->type == GLP_DB && - col->lb == 0.0 && col->ub == 1.0)) - return 1; - } - /* objective function should be zero */ - if (P->c0 != 0.0) - return 2; - for (j = 1; j <= n; j++) - { col = P->col[j]; - if (col->coef != 0.0) - return 3; - } - /* check rows */ - for (i = 1; i <= m; i++) - { row = P->row[i]; - /* the row should be of ">=" type */ - if (row->type != GLP_LO) - return 4; - /* check constraint coefficients */ - neg = 0; - for (aij = row->ptr; aij != NULL; aij = aij->r_next) - { /* the constraint coefficient should be +1 or -1 */ - if (aij->val == +1.0) - ; - else if (aij->val == -1.0) - neg++; - else - return 5; - } - /* the right-hand side should be (1 - neg), where neg is the - number of negative constraint coefficients in the row */ - if (row->lb != (double)(1 - neg)) - return 6; - } - /* congratulations; this is CNF-SAT */ - return 0; -} - -/**********************************************************************/ - -int glp_write_cnfsat(glp_prob *P, const char *fname) -{ /* write CNF-SAT problem data in DIMACS format */ - glp_file *fp = NULL; - GLPAIJ *aij; - int i, j, len, count = 0, ret; - char s[50]; - if (P == NULL || P->magic != GLP_PROB_MAGIC) - xerror("glp_write_cnfsat: P = %p; invalid problem object\n", - P); - if (glp_check_cnfsat(P) != 0) - { xprintf("glp_write_cnfsat: problem object does not encode CNF-" - "SAT instance\n"); - ret = 1; - goto done; - } - xprintf("Writing CNF-SAT problem data to '%s'...\n", fname); - fp = glp_open(fname, "w"); - if (fp == NULL) - { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xfprintf(fp, "c %s\n", - P->name == NULL ? "unknown" : P->name), count++; - xfprintf(fp, "p cnf %d %d\n", P->n, P->m), count++; - for (i = 1; i <= P->m; i++) - { len = 0; - for (aij = P->row[i]->ptr; aij != NULL; aij = aij->r_next) - { j = aij->col->j; - if (aij->val < 0.0) j = -j; - sprintf(s, "%d", j); - if (len > 0 && len + 1 + strlen(s) > 72) - xfprintf(fp, "\n"), count++, len = 0; - xfprintf(fp, "%s%s", len == 0 ? "" : " ", s); - if (len > 0) len++; - len += strlen(s); - } - if (len > 0 && len + 1 + 1 > 72) - xfprintf(fp, "\n"), count++, len = 0; - xfprintf(fp, "%s0\n", len == 0 ? "" : " "), count++; - } - xfprintf(fp, "c eof\n"), count++; -#if 0 /* FIXME */ - xfflush(fp); -#endif - if (glp_ioerr(fp)) - { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xprintf("%d lines were written\n", count); - ret = 0; -done: if (fp != NULL) glp_close(fp); - return ret; -} - -/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpgmp.h b/resources/3rdparty/glpk-4.57/src/glpgmp.h deleted file mode 100644 index e1615ae27..000000000 --- a/resources/3rdparty/glpk-4.57/src/glpgmp.h +++ /dev/null @@ -1,190 +0,0 @@ -/* glpgmp.h (bignum arithmetic) */ - -/*********************************************************************** -* This code is part of GLPK (GNU Linear Programming Kit). -* -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied -* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights -* reserved. E-mail: . -* -* GLPK is free software: you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GLPK is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -* License for more details. -* -* You should have received a copy of the GNU General Public License -* along with GLPK. If not, see . -***********************************************************************/ - -#ifndef GLPGMP_H -#define GLPGMP_H - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef HAVE_GMP /* use GNU MP bignum library */ - -#include - -#define gmp_pool_count _glp_gmp_pool_count -#define gmp_free_mem _glp_gmp_free_mem - -int gmp_pool_count(void); -void gmp_free_mem(void); - -#else /* use GLPK bignum module */ - -/*---------------------------------------------------------------------- -// INTEGER NUMBERS -// -// Depending on its magnitude an integer number of arbitrary precision -// is represented either in short format or in long format. -// -// Short format corresponds to the int type and allows representing -// integer numbers in the range [-(2^31-1), +(2^31-1)]. Note that for -// the most negative number of int type the short format is not used. -// -// In long format integer numbers are represented using the positional -// system with the base (radix) 2^16 = 65536: -// -// x = (-1)^s sum{j in 0..n-1} d[j] * 65536^j, -// -// where x is the integer to be represented, s is its sign (+1 or -1), -// d[j] are its digits (0 <= d[j] <= 65535). -// -// RATIONAL NUMBERS -// -// A rational number is represented as an irreducible fraction: -// -// p / q, -// -// where p (numerator) and q (denominator) are integer numbers (q > 0) -// having no common divisors. */ - -struct mpz -{ /* integer number */ - int val; - /* if ptr is a null pointer, the number is in short format, and - val is its value; otherwise, the number is in long format, and - val is its sign (+1 or -1) */ - struct mpz_seg *ptr; - /* pointer to the linked list of the number segments ordered in - ascending of powers of the base */ -}; - -struct mpz_seg -{ /* integer number segment */ - unsigned short d[6]; - /* six digits of the number ordered in ascending of powers of the - base */ - struct mpz_seg *next; - /* pointer to the next number segment */ -}; - -struct mpq -{ /* rational number (p / q) */ - struct mpz p; - /* numerator */ - struct mpz q; - /* denominator */ -}; - -typedef struct mpz *mpz_t; -typedef struct mpq *mpq_t; - -#define gmp_get_atom _glp_gmp_get_atom -#define gmp_free_atom _glp_gmp_free_atom -#define gmp_pool_count _glp_gmp_pool_count -#define gmp_get_work _glp_gmp_get_work -#define gmp_free_mem _glp_gmp_free_mem - -#define _mpz_init _glp_mpz_init -#define mpz_clear _glp_mpz_clear -#define mpz_set _glp_mpz_set -#define mpz_set_si _glp_mpz_set_si -#define mpz_get_d _glp_mpz_get_d -#define mpz_get_d_2exp _glp_mpz_get_d_2exp -#define mpz_swap _glp_mpz_swap -#define mpz_add _glp_mpz_add -#define mpz_sub _glp_mpz_sub -#define mpz_mul _glp_mpz_mul -#define mpz_neg _glp_mpz_neg -#define mpz_abs _glp_mpz_abs -#define mpz_div _glp_mpz_div -#define mpz_gcd _glp_mpz_gcd -#define mpz_cmp _glp_mpz_cmp -#define mpz_sgn _glp_mpz_sgn -#define mpz_out_str _glp_mpz_out_str - -#define _mpq_init _glp_mpq_init -#define mpq_clear _glp_mpq_clear -#define mpq_canonicalize _glp_mpq_canonicalize -#define mpq_set _glp_mpq_set -#define mpq_set_si _glp_mpq_set_si -#define mpq_get_d _glp_mpq_get_d -#define mpq_set_d _glp_mpq_set_d -#define mpq_add _glp_mpq_add -#define mpq_sub _glp_mpq_sub -#define mpq_mul _glp_mpq_mul -#define mpq_div _glp_mpq_div -#define mpq_neg _glp_mpq_neg -#define mpq_abs _glp_mpq_abs -#define mpq_cmp _glp_mpq_cmp -#define mpq_sgn _glp_mpq_sgn -#define mpq_out_str _glp_mpq_out_str - -void *gmp_get_atom(int size); -void gmp_free_atom(void *ptr, int size); -int gmp_pool_count(void); -unsigned short *gmp_get_work(int size); -void gmp_free_mem(void); - -mpz_t _mpz_init(void); -#define mpz_init(x) (void)((x) = _mpz_init()) -void mpz_clear(mpz_t x); -void mpz_set(mpz_t z, mpz_t x); -void mpz_set_si(mpz_t x, int val); -double mpz_get_d(mpz_t x); -double mpz_get_d_2exp(int *exp, mpz_t x); -void mpz_swap(mpz_t x, mpz_t y); -void mpz_add(mpz_t, mpz_t, mpz_t); -void mpz_sub(mpz_t, mpz_t, mpz_t); -void mpz_mul(mpz_t, mpz_t, mpz_t); -void mpz_neg(mpz_t z, mpz_t x); -void mpz_abs(mpz_t z, mpz_t x); -void mpz_div(mpz_t q, mpz_t r, mpz_t x, mpz_t y); -void mpz_gcd(mpz_t z, mpz_t x, mpz_t y); -int mpz_cmp(mpz_t x, mpz_t y); -int mpz_sgn(mpz_t x); -int mpz_out_str(void *fp, int base, mpz_t x); - -mpq_t _mpq_init(void); -#define mpq_init(x) (void)((x) = _mpq_init()) -void mpq_clear(mpq_t x); -void mpq_canonicalize(mpq_t x); -void mpq_set(mpq_t z, mpq_t x); -void mpq_set_si(mpq_t x, int p, unsigned int q); -double mpq_get_d(mpq_t x); -void mpq_set_d(mpq_t x, double val); -void mpq_add(mpq_t z, mpq_t x, mpq_t y); -void mpq_sub(mpq_t z, mpq_t x, mpq_t y); -void mpq_mul(mpq_t z, mpq_t x, mpq_t y); -void mpq_div(mpq_t z, mpq_t x, mpq_t y); -void mpq_neg(mpq_t z, mpq_t x); -void mpq_abs(mpq_t z, mpq_t x); -int mpq_cmp(mpq_t x, mpq_t y); -int mpq_sgn(mpq_t x); -int mpq_out_str(void *fp, int base, mpq_t x); - -#endif - -#endif - -/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpsdf.c b/resources/3rdparty/glpk-4.57/src/glpsdf.c deleted file mode 100644 index e14bd0662..000000000 --- a/resources/3rdparty/glpk-4.57/src/glpsdf.c +++ /dev/null @@ -1,259 +0,0 @@ -/* glpsdf.c (plain data file reading routines) */ - -/*********************************************************************** -* This code is part of GLPK (GNU Linear Programming Kit). -* -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied -* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights -* reserved. E-mail: . -* -* GLPK is free software: you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GLPK is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -* License for more details. -* -* You should have received a copy of the GNU General Public License -* along with GLPK. If not, see . -***********************************************************************/ - -#include "env.h" -#include "glpsdf.h" -#include "misc.h" - -struct glp_data -{ /* plain data file */ - char *fname; - /* name of data file */ - glp_file *fp; - /* stream assigned to data file */ - void *jump; /* jmp_buf jump; */ - /* label for go to in case of error */ - int count; - /* line count */ - int c; - /* current character of EOF */ - char item[255+1]; - /* current data item */ -}; - -static void next_char(glp_data *data); - -glp_data *glp_sdf_open_file(const char *fname) -{ /* open plain data file */ - glp_data *data = NULL; - glp_file *fp; - jmp_buf jump; - fp = glp_open(fname, "r"); - if (fp == NULL) - { xprintf("Unable to open '%s' - %s\n", fname, get_err_msg()); - goto done; - } - data = xmalloc(sizeof(glp_data)); - data->fname = xmalloc(strlen(fname)+1); - strcpy(data->fname, fname); - data->fp = fp; - data->jump = NULL; - data->count = 0; - data->c = '\n'; - data->item[0] = '\0'; - /* read the very first character */ - if (setjmp(jump)) - { glp_sdf_close_file(data); - data = NULL; - goto done; - } - data->jump = jump; - next_char(data); - data->jump = NULL; -done: return data; -} - -void glp_sdf_set_jump(glp_data *data, void *jump) -{ /* set up error handling */ - data->jump = jump; - return; -} - -void glp_sdf_error(glp_data *data, const char *fmt, ...) -{ /* print error message */ - va_list arg; - xprintf("%s:%d: ", data->fname, data->count); - va_start(arg, fmt); - xvprintf(fmt, arg); - va_end(arg); - if (data->jump == NULL) - xerror(""); - else - longjmp(data->jump, 1); - /* no return */ -} - -void glp_sdf_warning(glp_data *data, const char *fmt, ...) -{ /* print warning message */ - va_list arg; - xprintf("%s:%d: warning: ", data->fname, data->count); - va_start(arg, fmt); - xvprintf(fmt, arg); - va_end(arg); - return; -} - -static void next_char(glp_data *data) -{ /* read next character */ - int c; - if (data->c == EOF) - glp_sdf_error(data, "unexpected end of file\n"); - else if (data->c == '\n') - data->count++; - c = glp_getc(data->fp); - if (c < 0) - { if (glp_ioerr(data->fp)) - glp_sdf_error(data, "read error - %s\n", get_err_msg()); - else if (data->c == '\n') - c = EOF; - else - { glp_sdf_warning(data, "missing final end of line\n"); - c = '\n'; - } - } - else if (c == '\n') - ; - else if (isspace(c)) - c = ' '; - else if (iscntrl(c)) - glp_sdf_error(data, "invalid control character 0x%02X\n", c); - data->c = c; - return; -} - -static void skip_pad(glp_data *data) -{ /* skip uninteresting characters and comments */ -loop: while (data->c == ' ' || data->c == '\n') - next_char(data); - if (data->c == '/') - { next_char(data); - if (data->c != '*') - glp_sdf_error(data, "invalid use of slash\n"); - next_char(data); - for (;;) - { if (data->c == '*') - { next_char(data); - if (data->c == '/') - { next_char(data); - break; - } - } - next_char(data); - } - goto loop; - } - return; -} - -static void next_item(glp_data *data) -{ /* read next item */ - int len; - skip_pad(data); - len = 0; - while (!(data->c == ' ' || data->c == '\n')) - { data->item[len++] = (char)data->c; - if (len == sizeof(data->item)) - glp_sdf_error(data, "data item '%.31s...' too long\n", - data->item); - next_char(data); - } - data->item[len] = '\0'; - return; -} - -int glp_sdf_read_int(glp_data *data) -{ /* read integer number */ - int x; - next_item(data); - switch (str2int(data->item, &x)) - { case 0: - break; - case 1: - glp_sdf_error(data, "integer '%s' out of range\n", - data->item); - case 2: - glp_sdf_error(data, "cannot convert '%s' to integer\n", - data->item); - default: - xassert(data != data); - } - return x; -} - -double glp_sdf_read_num(glp_data *data) -{ /* read floating-point number */ - double x; - next_item(data); - switch (str2num(data->item, &x)) - { case 0: - break; - case 1: - glp_sdf_error(data, "number '%s' out of range\n", - data->item); - case 2: - glp_sdf_error(data, "cannot convert '%s' to number\n", - data->item); - default: - xassert(data != data); - } - return x; -} - -const char *glp_sdf_read_item(glp_data *data) -{ /* read data item */ - next_item(data); - return data->item; -} - -const char *glp_sdf_read_text(glp_data *data) -{ /* read text until end of line */ - int c, len = 0; - for (;;) - { c = data->c; - next_char(data); - if (c == ' ') - { /* ignore initial spaces */ - if (len == 0) continue; - /* and multiple ones */ - if (data->item[len-1] == ' ') continue; - } - else if (c == '\n') - { /* remove trailing space */ - if (len > 0 && data->item[len-1] == ' ') len--; - /* and stop reading */ - break; - } - /* add current character to the buffer */ - data->item[len++] = (char)c; - if (len == sizeof(data->item)) - glp_sdf_error(data, "line too long\n", data->item); - } - data->item[len] = '\0'; - return data->item; -} - -int glp_sdf_line(glp_data *data) -{ /* determine current line number */ - return data->count; -} - -void glp_sdf_close_file(glp_data *data) -{ /* close plain data file */ - glp_close(data->fp); - xfree(data->fname); - xfree(data); - return; -} - -/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpsdf.h b/resources/3rdparty/glpk-4.57/src/glpsdf.h deleted file mode 100644 index d327a1033..000000000 --- a/resources/3rdparty/glpk-4.57/src/glpsdf.h +++ /dev/null @@ -1,63 +0,0 @@ -/* glpsdf.h */ - -/*********************************************************************** -* This code is part of GLPK (GNU Linear Programming Kit). -* -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied -* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights -* reserved. E-mail: . -* -* GLPK is free software: you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GLPK is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -* License for more details. -* -* You should have received a copy of the GNU General Public License -* along with GLPK. If not, see . -***********************************************************************/ - -#ifndef GLPSDF_H -#define GLPSDF_H - -typedef struct glp_data glp_data; -/* plain data file */ - -glp_data *glp_sdf_open_file(const char *fname); -/* open plain data file */ - -void glp_sdf_set_jump(glp_data *data, void *jump); -/* set up error handling */ - -void glp_sdf_error(glp_data *data, const char *fmt, ...); -/* print error message */ - -void glp_sdf_warning(glp_data *data, const char *fmt, ...); -/* print warning message */ - -int glp_sdf_read_int(glp_data *data); -/* read integer number */ - -double glp_sdf_read_num(glp_data *data); -/* read floating-point number */ - -const char *glp_sdf_read_item(glp_data *data); -/* read data item */ - -const char *glp_sdf_read_text(glp_data *data); -/* read text until end of line */ - -int glp_sdf_line(glp_data *data); -/* determine current line number */ - -void glp_sdf_close_file(glp_data *data); -/* close plain data file */ - -#endif - -/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spychuzc.c b/resources/3rdparty/glpk-4.57/src/simplex/spychuzc.c deleted file mode 100644 index dbf8029bb..000000000 --- a/resources/3rdparty/glpk-4.57/src/simplex/spychuzc.c +++ /dev/null @@ -1,222 +0,0 @@ -/* spychuzc.c */ - -/*********************************************************************** -* This code is part of GLPK (GNU Linear Programming Kit). -* -* Copyright (C) 2015 Andrew Makhorin, Department for Applied -* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights -* reserved. E-mail: . -* -* GLPK is free software: you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GLPK is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -* License for more details. -* -* You should have received a copy of the GNU General Public License -* along with GLPK. If not, see . -***********************************************************************/ - -#include "env.h" -#include "spychuzc.h" - -/*********************************************************************** -* spy_chuzc_std - choose non-basic variable (dual textbook ratio test) -* -* This routine implements an improved dual textbook ratio test to -* choose non-basic variable xN[q]. -* -* Current reduced costs of non-basic variables should be placed in the -* array locations d[1], ..., d[n-m]. Note that d[j] is a value of dual -* basic variable lambdaN[j] in the current basis. -* -* The parameter s specifies the sign of bound violation for basic -* variable xB[p] chosen: s = +1.0 means that xB[p] violates its lower -* bound, so dual non-basic variable lambdaB[p] = lambda^+B[p] -* increases, and s = -1.0 means that xB[p] violates its upper bound, -* so dual non-basic variable lambdaB[p] = lambda^-B[p] decreases. -* (Thus, the dual ray parameter theta = s * lambdaB[p] >= 0.) -* -* Elements of p-th simplex table row t[p] = (t[p,j]) corresponding -* to basic variable xB[p] should be placed in the array locations -* trow[1], ..., trow[n-m]. -* -* The parameter tol_piv specifies a tolerance for elements of the -* simplex table row t[p]. If |t[p,j]| < tol_piv, dual basic variable -* lambdaN[j] is skipped, i.e. it is assumed that it does not depend on -* the dual ray parameter theta. -* -* The parameters tol and tol1 specify tolerances used to increase the -* choice freedom by simulating an artificial degeneracy as follows. -* If lambdaN[j] = lambda^+N[j] >= 0 and d[j] <= +delta[j], or if -* lambdaN[j] = lambda^-N[j] <= 0 and d[j] >= -delta[j], where -* delta[j] = tol + tol1 * |cN[j]|, cN[j] is objective coefficient at -* xN[j], then it is assumed that reduced cost d[j] is equal to zero. -* -* The routine determines the index 1 <= q <= n-m of non-basic variable -* xN[q], for which corresponding dual basic variable lambda^+N[j] or -* lambda^-N[j] reaches its zero bound first on increasing the dual ray -* parameter theta, and returns p on exit. And if theta may increase -* unlimitedly, the routine returns zero. */ - -int spy_chuzc_std(SPXLP *lp, const double d[/*1+n-m*/], - double s, const double trow[/*1+n-m*/], double tol_piv, - double tol, double tol1) -{ int m = lp->m; - int n = lp->n; - double *c = lp->c; - double *l = lp->l; - double *u = lp->u; - int *head = lp->head; - char *flag = lp->flag; - int j, k, q; - double alfa, biga, delta, teta, teta_min; - xassert(s == +1.0 || s == -1.0); - /* nothing is chosen so far */ - q = 0, teta_min = DBL_MAX, biga = 0.0; - /* walk thru the list of non-basic variables */ - for (j = 1; j <= n-m; j++) - { k = head[m+j]; /* x[k] = xN[j] */ - /* if xN[j] is fixed variable, skip it */ - if (l[k] == u[k]) - continue; - alfa = s * trow[j]; - if (alfa >= +tol_piv && !flag[j]) - { /* xN[j] is either free or has its lower bound active, so - * lambdaN[j] = d[j] >= 0 decreases down to zero */ - delta = tol + tol1 * (c[k] >= 0.0 ? +c[k] : -c[k]); - /* determine theta on which lambdaN[j] reaches zero */ - teta = (d[j] < +delta ? 0.0 : d[j] / alfa); - } - else if (alfa <= -tol_piv && (l[k] == -DBL_MAX || flag[j])) - { /* xN[j] is either free or has its upper bound active, so - * lambdaN[j] = d[j] <= 0 increases up to zero */ - delta = tol + tol1 * (c[k] >= 0.0 ? +c[k] : -c[k]); - /* determine theta on which lambdaN[j] reaches zero */ - teta = (d[j] > -delta ? 0.0 : d[j] / alfa); - } - else - { /* lambdaN[j] cannot reach zero on increasing theta */ - continue; - } - /* choose non-basic variable xN[q] by corresponding dual basic - * variable lambdaN[q] for which theta is minimal */ - xassert(teta >= 0.0); - alfa = (alfa >= 0.0 ? +alfa : -alfa); - if (teta_min > teta || (teta_min == teta && biga < alfa)) - q = j, teta_min = teta, biga = alfa; - } - return q; -} - -/*********************************************************************** -* spy_chuzc_harris - choose non-basic var. (dual Harris' ratio test) -* -* This routine implements dual Harris' ratio test to choose non-basic -* variable xN[q]. -* -* All the parameters, except tol and tol1, as well as the returned -* value have the same meaning as for the routine spx_chuzr_std (see -* above). -* -* The parameters tol and tol1 specify tolerances on zero bound -* violations for reduced costs of non-basic variables. For reduced -* cost d[j] the tolerance is delta[j] = tol + tol1 |cN[j]|, where -* cN[j] is objective coefficient at non-basic variable xN[j]. */ - -int spy_chuzc_harris(SPXLP *lp, const double d[/*1+n-m*/], - double s, const double trow[/*1+n-m*/], double tol_piv, - double tol, double tol1) -{ int m = lp->m; - int n = lp->n; - double *c = lp->c; - double *l = lp->l; - double *u = lp->u; - int *head = lp->head; - char *flag = lp->flag; - int j, k, q; - double alfa, biga, delta, teta, teta_min; - xassert(s == +1.0 || s == -1.0); - /*--------------------------------------------------------------*/ - /* first pass: determine teta_min for relaxed bounds */ - /*--------------------------------------------------------------*/ - teta_min = DBL_MAX; - /* walk thru the list of non-basic variables */ - for (j = 1; j <= n-m; j++) - { k = head[m+j]; /* x[k] = xN[j] */ - /* if xN[j] is fixed variable, skip it */ - if (l[k] == u[k]) - continue; - alfa = s * trow[j]; - if (alfa >= +tol_piv && !flag[j]) - { /* xN[j] is either free or has its lower bound active, so - * lambdaN[j] = d[j] >= 0 decreases down to zero */ - delta = tol + tol1 * (c[k] >= 0.0 ? +c[k] : -c[k]); - /* determine theta on which lambdaN[j] reaches -delta */ - teta = ((d[j] < 0.0 ? 0.0 : d[j]) + delta) / alfa; - } - else if (alfa <= -tol_piv && (l[k] == -DBL_MAX || flag[j])) - { /* xN[j] is either free or has its upper bound active, so - * lambdaN[j] = d[j] <= 0 increases up to zero */ - delta = tol + tol1 * (c[k] >= 0.0 ? +c[k] : -c[k]); - /* determine theta on which lambdaN[j] reaches +delta */ - teta = ((d[j] > 0.0 ? 0.0 : d[j]) - delta) / alfa; - } - else - { /* lambdaN[j] cannot reach zero on increasing theta */ - continue; - } - xassert(teta >= 0.0); - if (teta_min > teta) - teta_min = teta; - } - /*--------------------------------------------------------------*/ - /* second pass: choose non-basic variable xN[q] */ - /*--------------------------------------------------------------*/ - if (teta_min == DBL_MAX) - { /* theta may increase unlimitedly */ - q = 0; - goto done; - } - /* nothing is chosen so far */ - q = 0, biga = 0.0; - /* walk thru the list of non-basic variables */ - for (j = 1; j <= n-m; j++) - { k = head[m+j]; /* x[k] = xN[j] */ - /* if xN[j] is fixed variable, skip it */ - if (l[k] == u[k]) - continue; - alfa = s * trow[j]; - if (alfa >= +tol_piv && !flag[j]) - { /* xN[j] is either free or has its lower bound active, so - * lambdaN[j] = d[j] >= 0 decreases down to zero */ - /* determine theta on which lambdaN[j] reaches zero */ - teta = d[j] / alfa; - } - else if (alfa <= -tol_piv && (l[k] == -DBL_MAX || flag[j])) - { /* xN[j] is either free or has its upper bound active, so - * lambdaN[j] = d[j] <= 0 increases up to zero */ - /* determine theta on which lambdaN[j] reaches zero */ - teta = d[j] / alfa; - } - else - { /* lambdaN[j] cannot reach zero on increasing theta */ - continue; - } - /* choose non-basic variable for which theta is not greater - * than theta_min determined for relaxed bounds and which has - * best (largest in magnitude) pivot */ - alfa = (alfa >= 0.0 ? +alfa : -alfa); - if (teta <= teta_min && biga < alfa) - q = j, biga = alfa; - } - /* something must be chosen */ - xassert(1 <= q && q <= n-m); -done: return q; -} - -/* eof */ diff --git a/resources/3rdparty/glpk-4.57/w32/Makefile_VC b/resources/3rdparty/glpk-4.57/w32/Makefile_VC deleted file mode 100644 index e4853f789..000000000 --- a/resources/3rdparty/glpk-4.57/w32/Makefile_VC +++ /dev/null @@ -1,204 +0,0 @@ -## Build GLPK with Microsoft Visual Studio Express ## - -CFLAGS = \ -/I. \ -/I..\src \ -/I..\src\amd \ -/I..\src\bflib \ -/I..\src\cglib \ -/I..\src\colamd \ -/I..\src\env \ -/I..\src\minisat \ -/I..\src\misc \ -/I..\src\proxy \ -/I..\src\simplex \ -/I..\src\zlib \ -/DHAVE_CONFIG_H=1 \ -/D_CRT_SECURE_NO_WARNINGS=1 \ -/nologo \ -/W3 \ -/O2 \ -/Zi - -OBJSET = \ -..\src\avl.obj \ -..\src\bfd.obj \ -..\src\bfx.obj \ -..\src\glpapi01.obj \ -..\src\glpapi02.obj \ -..\src\glpapi03.obj \ -..\src\glpapi04.obj \ -..\src\glpapi05.obj \ -..\src\glpapi06.obj \ -..\src\glpapi07.obj \ -..\src\glpapi08.obj \ -..\src\glpapi09.obj \ -..\src\glpapi10.obj \ -..\src\glpapi11.obj \ -..\src\glpapi12.obj \ -..\src\glpapi13.obj \ -..\src\glpapi14.obj \ -..\src\glpapi15.obj \ -..\src\glpapi16.obj \ -..\src\glpapi17.obj \ -..\src\glpapi18.obj \ -..\src\glpapi19.obj \ -..\src\glpapi20.obj \ -..\src\glpapi21.obj \ -..\src\glpcpx.obj \ -..\src\glpdmx.obj \ -..\src\glpgmp.obj \ -..\src\glphbm.obj \ -..\src\glpini01.obj \ -..\src\glpini02.obj \ -..\src\glpios01.obj \ -..\src\glpios02.obj \ -..\src\glpios03.obj \ -..\src\glpios04.obj \ -..\src\glpios05.obj \ -..\src\glpios06.obj \ -..\src\glpios07.obj \ -..\src\glpios08.obj \ -..\src\glpios09.obj \ -..\src\glpios10.obj \ -..\src\glpios11.obj \ -..\src\glpios12.obj \ -..\src\glpipm.obj \ -..\src\glpmat.obj \ -..\src\glpmpl01.obj \ -..\src\glpmpl02.obj \ -..\src\glpmpl03.obj \ -..\src\glpmpl04.obj \ -..\src\glpmpl05.obj \ -..\src\glpmpl06.obj \ -..\src\glpmps.obj \ -..\src\glpnet03.obj \ -..\src\glpnet04.obj \ -..\src\glpnet05.obj \ -..\src\glpnpp01.obj \ -..\src\glpnpp02.obj \ -..\src\glpnpp03.obj \ -..\src\glpnpp04.obj \ -..\src\glpnpp05.obj \ -..\src\glpnpp06.obj \ -..\src\glprgr.obj \ -..\src\glpscl.obj \ -..\src\glpsdf.obj \ -..\src\glpspm.obj \ -..\src\glpsql.obj \ -..\src\glpssx01.obj \ -..\src\glpssx02.obj \ -..\src\lux.obj \ -..\src\amd\amd_1.obj \ -..\src\amd\amd_2.obj \ -..\src\amd\amd_aat.obj \ -..\src\amd\amd_control.obj \ -..\src\amd\amd_defaults.obj \ -..\src\amd\amd_dump.obj \ -..\src\amd\amd_info.obj \ -..\src\amd\amd_order.obj \ -..\src\amd\amd_post_tree.obj \ -..\src\amd\amd_postorder.obj \ -..\src\amd\amd_preprocess.obj \ -..\src\amd\amd_valid.obj \ -..\src\bflib\btf.obj \ -..\src\bflib\btfint.obj \ -..\src\bflib\fhv.obj \ -..\src\bflib\fhvint.obj \ -..\src\bflib\ifu.obj \ -..\src\bflib\luf.obj \ -..\src\bflib\lufint.obj \ -..\src\bflib\scf.obj \ -..\src\bflib\scfint.obj \ -..\src\bflib\sgf.obj \ -..\src\bflib\sva.obj \ -..\src\cglib\cfg.obj \ -..\src\cglib\cfg1.obj \ -..\src\colamd\colamd.obj \ -..\src\env\alloc.obj \ -..\src\env\dlsup.obj \ -..\src\env\env.obj \ -..\src\env\error.obj \ -..\src\env\stdout.obj \ -..\src\env\stream.obj \ -..\src\env\time.obj \ -..\src\env\tls.obj \ -..\src\minisat\minisat.obj \ -..\src\misc\bignum.obj \ -..\src\misc\dmp.obj \ -..\src\misc\ffalg.obj \ -..\src\misc\fp2rat.obj \ -..\src\misc\gcd.obj \ -..\src\misc\jd.obj \ -..\src\misc\keller.obj \ -..\src\misc\mc13d.obj \ -..\src\misc\mc21a.obj \ -..\src\misc\okalg.obj \ -..\src\misc\qmd.obj \ -..\src\misc\relax4.obj \ -..\src\misc\rng.obj \ -..\src\misc\rng1.obj \ -..\src\misc\round2n.obj \ -..\src\misc\str2int.obj \ -..\src\misc\str2num.obj \ -..\src\misc\strspx.obj \ -..\src\misc\strtrim.obj \ -..\src\misc\triang.obj \ -..\src\misc\wclique.obj \ -..\src\misc\wclique1.obj \ -..\src\proxy\proxy.obj \ -..\src\proxy\proxy1.obj \ -..\src\simplex\spxat.obj \ -..\src\simplex\spxchuzc.obj \ -..\src\simplex\spxchuzr.obj \ -..\src\simplex\spxlp.obj \ -..\src\simplex\spxnt.obj \ -..\src\simplex\spxprim.obj \ -..\src\simplex\spxprob.obj \ -..\src\simplex\spychuzc.obj \ -..\src\simplex\spychuzr.obj \ -..\src\simplex\spydual.obj \ -..\src\zlib\adler32.obj \ -..\src\zlib\compress.obj \ -..\src\zlib\crc32.obj \ -..\src\zlib\deflate.obj \ -..\src\zlib\gzclose.obj \ -..\src\zlib\gzlib.obj \ -..\src\zlib\gzread.obj \ -..\src\zlib\gzwrite.obj \ -..\src\zlib\inffast.obj \ -..\src\zlib\inflate.obj \ -..\src\zlib\inftrees.obj \ -..\src\zlib\trees.obj \ -..\src\zlib\uncompr.obj \ -..\src\zlib\zio.obj \ -..\src\zlib\zutil.obj - -.c.obj: - cl.exe $(CFLAGS) /Fo$*.obj /c $*.c - -all: glpk.lib glpsol.exe - -glpk.lib: $(OBJSET) - lib.exe /out:glpk.lib \ - ..\src\*.obj \ - ..\src\amd\*.obj \ - ..\src\bflib\*.obj \ - ..\src\cglib\*.obj \ - ..\src\colamd\*.obj \ - ..\src\env\*.obj \ - ..\src\minisat\*.obj \ - ..\src\misc\*.obj \ - ..\src\proxy\*.obj \ - ..\src\simplex\*.obj \ - ..\src\zlib\*.obj - -glpsol.exe: ..\examples\glpsol.obj glpk.lib - cl.exe $(CFLAGS) /Feglpsol.exe \ - ..\examples\glpsol.obj glpk.lib - -check: glpsol.exe - .\glpsol.exe --version - .\glpsol.exe --mps ..\examples\plan.mps - -## eof ## diff --git a/resources/3rdparty/glpk-4.57/w32/Makefile_VC_DLL b/resources/3rdparty/glpk-4.57/w32/Makefile_VC_DLL deleted file mode 100644 index 53467e0b5..000000000 --- a/resources/3rdparty/glpk-4.57/w32/Makefile_VC_DLL +++ /dev/null @@ -1,205 +0,0 @@ -## Build GLPK DLL with Microsoft Visual Studio Express ## - -CFLAGS = \ -/I. \ -/I..\src \ -/I..\src\amd \ -/I..\src\bflib \ -/I..\src\cglib \ -/I..\src\colamd \ -/I..\src\env \ -/I..\src\minisat \ -/I..\src\misc \ -/I..\src\proxy \ -/I..\src\simplex \ -/I..\src\zlib \ -/DHAVE_CONFIG_H=1 \ -/D_CRT_SECURE_NO_WARNINGS=1 \ -/nologo \ -/W3 \ -/O2 \ -/Zi - -OBJSET = \ -..\src\avl.obj \ -..\src\bfd.obj \ -..\src\bfx.obj \ -..\src\glpapi01.obj \ -..\src\glpapi02.obj \ -..\src\glpapi03.obj \ -..\src\glpapi04.obj \ -..\src\glpapi05.obj \ -..\src\glpapi06.obj \ -..\src\glpapi07.obj \ -..\src\glpapi08.obj \ -..\src\glpapi09.obj \ -..\src\glpapi10.obj \ -..\src\glpapi11.obj \ -..\src\glpapi12.obj \ -..\src\glpapi13.obj \ -..\src\glpapi14.obj \ -..\src\glpapi15.obj \ -..\src\glpapi16.obj \ -..\src\glpapi17.obj \ -..\src\glpapi18.obj \ -..\src\glpapi19.obj \ -..\src\glpapi20.obj \ -..\src\glpapi21.obj \ -..\src\glpcpx.obj \ -..\src\glpdmx.obj \ -..\src\glpgmp.obj \ -..\src\glphbm.obj \ -..\src\glpini01.obj \ -..\src\glpini02.obj \ -..\src\glpios01.obj \ -..\src\glpios02.obj \ -..\src\glpios03.obj \ -..\src\glpios04.obj \ -..\src\glpios05.obj \ -..\src\glpios06.obj \ -..\src\glpios07.obj \ -..\src\glpios08.obj \ -..\src\glpios09.obj \ -..\src\glpios10.obj \ -..\src\glpios11.obj \ -..\src\glpios12.obj \ -..\src\glpipm.obj \ -..\src\glpmat.obj \ -..\src\glpmpl01.obj \ -..\src\glpmpl02.obj \ -..\src\glpmpl03.obj \ -..\src\glpmpl04.obj \ -..\src\glpmpl05.obj \ -..\src\glpmpl06.obj \ -..\src\glpmps.obj \ -..\src\glpnet03.obj \ -..\src\glpnet04.obj \ -..\src\glpnet05.obj \ -..\src\glpnpp01.obj \ -..\src\glpnpp02.obj \ -..\src\glpnpp03.obj \ -..\src\glpnpp04.obj \ -..\src\glpnpp05.obj \ -..\src\glpnpp06.obj \ -..\src\glprgr.obj \ -..\src\glpscl.obj \ -..\src\glpsdf.obj \ -..\src\glpspm.obj \ -..\src\glpsql.obj \ -..\src\glpssx01.obj \ -..\src\glpssx02.obj \ -..\src\lux.obj \ -..\src\amd\amd_1.obj \ -..\src\amd\amd_2.obj \ -..\src\amd\amd_aat.obj \ -..\src\amd\amd_control.obj \ -..\src\amd\amd_defaults.obj \ -..\src\amd\amd_dump.obj \ -..\src\amd\amd_info.obj \ -..\src\amd\amd_order.obj \ -..\src\amd\amd_post_tree.obj \ -..\src\amd\amd_postorder.obj \ -..\src\amd\amd_preprocess.obj \ -..\src\amd\amd_valid.obj \ -..\src\bflib\btf.obj \ -..\src\bflib\btfint.obj \ -..\src\bflib\fhv.obj \ -..\src\bflib\fhvint.obj \ -..\src\bflib\ifu.obj \ -..\src\bflib\luf.obj \ -..\src\bflib\lufint.obj \ -..\src\bflib\scf.obj \ -..\src\bflib\scfint.obj \ -..\src\bflib\sgf.obj \ -..\src\bflib\sva.obj \ -..\src\cglib\cfg.obj \ -..\src\cglib\cfg1.obj \ -..\src\colamd\colamd.obj \ -..\src\env\alloc.obj \ -..\src\env\dlsup.obj \ -..\src\env\env.obj \ -..\src\env\error.obj \ -..\src\env\stdout.obj \ -..\src\env\stream.obj \ -..\src\env\time.obj \ -..\src\env\tls.obj \ -..\src\minisat\minisat.obj \ -..\src\misc\bignum.obj \ -..\src\misc\dmp.obj \ -..\src\misc\ffalg.obj \ -..\src\misc\fp2rat.obj \ -..\src\misc\gcd.obj \ -..\src\misc\jd.obj \ -..\src\misc\keller.obj \ -..\src\misc\mc13d.obj \ -..\src\misc\mc21a.obj \ -..\src\misc\okalg.obj \ -..\src\misc\qmd.obj \ -..\src\misc\relax4.obj \ -..\src\misc\rng.obj \ -..\src\misc\rng1.obj \ -..\src\misc\round2n.obj \ -..\src\misc\str2int.obj \ -..\src\misc\str2num.obj \ -..\src\misc\strspx.obj \ -..\src\misc\strtrim.obj \ -..\src\misc\triang.obj \ -..\src\misc\wclique.obj \ -..\src\misc\wclique1.obj \ -..\src\proxy\proxy.obj \ -..\src\proxy\proxy1.obj \ -..\src\simplex\spxat.obj \ -..\src\simplex\spxchuzc.obj \ -..\src\simplex\spxchuzr.obj \ -..\src\simplex\spxlp.obj \ -..\src\simplex\spxnt.obj \ -..\src\simplex\spxprim.obj \ -..\src\simplex\spxprob.obj \ -..\src\simplex\spychuzc.obj \ -..\src\simplex\spychuzr.obj \ -..\src\simplex\spydual.obj \ -..\src\zlib\adler32.obj \ -..\src\zlib\compress.obj \ -..\src\zlib\crc32.obj \ -..\src\zlib\deflate.obj \ -..\src\zlib\gzclose.obj \ -..\src\zlib\gzlib.obj \ -..\src\zlib\gzread.obj \ -..\src\zlib\gzwrite.obj \ -..\src\zlib\inffast.obj \ -..\src\zlib\inflate.obj \ -..\src\zlib\inftrees.obj \ -..\src\zlib\trees.obj \ -..\src\zlib\uncompr.obj \ -..\src\zlib\zio.obj \ -..\src\zlib\zutil.obj - -.c.obj: - cl.exe $(CFLAGS) /Fo$*.obj /c $*.c - -all: glpk_4_57.dll glpsol.exe - -glpk_4_57.dll: $(OBJSET) - cl.exe $(CFLAGS) /LD /Feglpk_4_57.dll \ - ..\src\*.obj \ - ..\src\amd\*.obj \ - ..\src\bflib\*.obj \ - ..\src\cglib\*.obj \ - ..\src\colamd\*.obj \ - ..\src\env\*.obj \ - ..\src\minisat\*.obj \ - ..\src\misc\*.obj \ - ..\src\proxy\*.obj \ - ..\src\simplex\*.obj \ - ..\src\zlib\*.obj \ - glpk_4_57.def - -glpsol.exe: ..\examples\glpsol.obj glpk_4_57.dll - cl.exe $(CFLAGS) /Feglpsol.exe \ - ..\examples\glpsol.obj glpk_4_57.lib - -check: glpsol.exe - .\glpsol.exe --version - .\glpsol.exe --mps ..\examples\plan.mps - -## eof ## diff --git a/resources/3rdparty/glpk-4.57/w64/makefile_VC b/resources/3rdparty/glpk-4.57/w64/makefile_VC deleted file mode 100644 index e4853f789..000000000 --- a/resources/3rdparty/glpk-4.57/w64/makefile_VC +++ /dev/null @@ -1,204 +0,0 @@ -## Build GLPK with Microsoft Visual Studio Express ## - -CFLAGS = \ -/I. \ -/I..\src \ -/I..\src\amd \ -/I..\src\bflib \ -/I..\src\cglib \ -/I..\src\colamd \ -/I..\src\env \ -/I..\src\minisat \ -/I..\src\misc \ -/I..\src\proxy \ -/I..\src\simplex \ -/I..\src\zlib \ -/DHAVE_CONFIG_H=1 \ -/D_CRT_SECURE_NO_WARNINGS=1 \ -/nologo \ -/W3 \ -/O2 \ -/Zi - -OBJSET = \ -..\src\avl.obj \ -..\src\bfd.obj \ -..\src\bfx.obj \ -..\src\glpapi01.obj \ -..\src\glpapi02.obj \ -..\src\glpapi03.obj \ -..\src\glpapi04.obj \ -..\src\glpapi05.obj \ -..\src\glpapi06.obj \ -..\src\glpapi07.obj \ -..\src\glpapi08.obj \ -..\src\glpapi09.obj \ -..\src\glpapi10.obj \ -..\src\glpapi11.obj \ -..\src\glpapi12.obj \ -..\src\glpapi13.obj \ -..\src\glpapi14.obj \ -..\src\glpapi15.obj \ -..\src\glpapi16.obj \ -..\src\glpapi17.obj \ -..\src\glpapi18.obj \ -..\src\glpapi19.obj \ -..\src\glpapi20.obj \ -..\src\glpapi21.obj \ -..\src\glpcpx.obj \ -..\src\glpdmx.obj \ -..\src\glpgmp.obj \ -..\src\glphbm.obj \ -..\src\glpini01.obj \ -..\src\glpini02.obj \ -..\src\glpios01.obj \ -..\src\glpios02.obj \ -..\src\glpios03.obj \ -..\src\glpios04.obj \ -..\src\glpios05.obj \ -..\src\glpios06.obj \ -..\src\glpios07.obj \ -..\src\glpios08.obj \ -..\src\glpios09.obj \ -..\src\glpios10.obj \ -..\src\glpios11.obj \ -..\src\glpios12.obj \ -..\src\glpipm.obj \ -..\src\glpmat.obj \ -..\src\glpmpl01.obj \ -..\src\glpmpl02.obj \ -..\src\glpmpl03.obj \ -..\src\glpmpl04.obj \ -..\src\glpmpl05.obj \ -..\src\glpmpl06.obj \ -..\src\glpmps.obj \ -..\src\glpnet03.obj \ -..\src\glpnet04.obj \ -..\src\glpnet05.obj \ -..\src\glpnpp01.obj \ -..\src\glpnpp02.obj \ -..\src\glpnpp03.obj \ -..\src\glpnpp04.obj \ -..\src\glpnpp05.obj \ -..\src\glpnpp06.obj \ -..\src\glprgr.obj \ -..\src\glpscl.obj \ -..\src\glpsdf.obj \ -..\src\glpspm.obj \ -..\src\glpsql.obj \ -..\src\glpssx01.obj \ -..\src\glpssx02.obj \ -..\src\lux.obj \ -..\src\amd\amd_1.obj \ -..\src\amd\amd_2.obj \ -..\src\amd\amd_aat.obj \ -..\src\amd\amd_control.obj \ -..\src\amd\amd_defaults.obj \ -..\src\amd\amd_dump.obj \ -..\src\amd\amd_info.obj \ -..\src\amd\amd_order.obj \ -..\src\amd\amd_post_tree.obj \ -..\src\amd\amd_postorder.obj \ -..\src\amd\amd_preprocess.obj \ -..\src\amd\amd_valid.obj \ -..\src\bflib\btf.obj \ -..\src\bflib\btfint.obj \ -..\src\bflib\fhv.obj \ -..\src\bflib\fhvint.obj \ -..\src\bflib\ifu.obj \ -..\src\bflib\luf.obj \ -..\src\bflib\lufint.obj \ -..\src\bflib\scf.obj \ -..\src\bflib\scfint.obj \ -..\src\bflib\sgf.obj \ -..\src\bflib\sva.obj \ -..\src\cglib\cfg.obj \ -..\src\cglib\cfg1.obj \ -..\src\colamd\colamd.obj \ -..\src\env\alloc.obj \ -..\src\env\dlsup.obj \ -..\src\env\env.obj \ -..\src\env\error.obj \ -..\src\env\stdout.obj \ -..\src\env\stream.obj \ -..\src\env\time.obj \ -..\src\env\tls.obj \ -..\src\minisat\minisat.obj \ -..\src\misc\bignum.obj \ -..\src\misc\dmp.obj \ -..\src\misc\ffalg.obj \ -..\src\misc\fp2rat.obj \ -..\src\misc\gcd.obj \ -..\src\misc\jd.obj \ -..\src\misc\keller.obj \ -..\src\misc\mc13d.obj \ -..\src\misc\mc21a.obj \ -..\src\misc\okalg.obj \ -..\src\misc\qmd.obj \ -..\src\misc\relax4.obj \ -..\src\misc\rng.obj \ -..\src\misc\rng1.obj \ -..\src\misc\round2n.obj \ -..\src\misc\str2int.obj \ -..\src\misc\str2num.obj \ -..\src\misc\strspx.obj \ -..\src\misc\strtrim.obj \ -..\src\misc\triang.obj \ -..\src\misc\wclique.obj \ -..\src\misc\wclique1.obj \ -..\src\proxy\proxy.obj \ -..\src\proxy\proxy1.obj \ -..\src\simplex\spxat.obj \ -..\src\simplex\spxchuzc.obj \ -..\src\simplex\spxchuzr.obj \ -..\src\simplex\spxlp.obj \ -..\src\simplex\spxnt.obj \ -..\src\simplex\spxprim.obj \ -..\src\simplex\spxprob.obj \ -..\src\simplex\spychuzc.obj \ -..\src\simplex\spychuzr.obj \ -..\src\simplex\spydual.obj \ -..\src\zlib\adler32.obj \ -..\src\zlib\compress.obj \ -..\src\zlib\crc32.obj \ -..\src\zlib\deflate.obj \ -..\src\zlib\gzclose.obj \ -..\src\zlib\gzlib.obj \ -..\src\zlib\gzread.obj \ -..\src\zlib\gzwrite.obj \ -..\src\zlib\inffast.obj \ -..\src\zlib\inflate.obj \ -..\src\zlib\inftrees.obj \ -..\src\zlib\trees.obj \ -..\src\zlib\uncompr.obj \ -..\src\zlib\zio.obj \ -..\src\zlib\zutil.obj - -.c.obj: - cl.exe $(CFLAGS) /Fo$*.obj /c $*.c - -all: glpk.lib glpsol.exe - -glpk.lib: $(OBJSET) - lib.exe /out:glpk.lib \ - ..\src\*.obj \ - ..\src\amd\*.obj \ - ..\src\bflib\*.obj \ - ..\src\cglib\*.obj \ - ..\src\colamd\*.obj \ - ..\src\env\*.obj \ - ..\src\minisat\*.obj \ - ..\src\misc\*.obj \ - ..\src\proxy\*.obj \ - ..\src\simplex\*.obj \ - ..\src\zlib\*.obj - -glpsol.exe: ..\examples\glpsol.obj glpk.lib - cl.exe $(CFLAGS) /Feglpsol.exe \ - ..\examples\glpsol.obj glpk.lib - -check: glpsol.exe - .\glpsol.exe --version - .\glpsol.exe --mps ..\examples\plan.mps - -## eof ## diff --git a/resources/3rdparty/glpk-4.57/w64/makefile_VC_DLL b/resources/3rdparty/glpk-4.57/w64/makefile_VC_DLL deleted file mode 100644 index 53467e0b5..000000000 --- a/resources/3rdparty/glpk-4.57/w64/makefile_VC_DLL +++ /dev/null @@ -1,205 +0,0 @@ -## Build GLPK DLL with Microsoft Visual Studio Express ## - -CFLAGS = \ -/I. \ -/I..\src \ -/I..\src\amd \ -/I..\src\bflib \ -/I..\src\cglib \ -/I..\src\colamd \ -/I..\src\env \ -/I..\src\minisat \ -/I..\src\misc \ -/I..\src\proxy \ -/I..\src\simplex \ -/I..\src\zlib \ -/DHAVE_CONFIG_H=1 \ -/D_CRT_SECURE_NO_WARNINGS=1 \ -/nologo \ -/W3 \ -/O2 \ -/Zi - -OBJSET = \ -..\src\avl.obj \ -..\src\bfd.obj \ -..\src\bfx.obj \ -..\src\glpapi01.obj \ -..\src\glpapi02.obj \ -..\src\glpapi03.obj \ -..\src\glpapi04.obj \ -..\src\glpapi05.obj \ -..\src\glpapi06.obj \ -..\src\glpapi07.obj \ -..\src\glpapi08.obj \ -..\src\glpapi09.obj \ -..\src\glpapi10.obj \ -..\src\glpapi11.obj \ -..\src\glpapi12.obj \ -..\src\glpapi13.obj \ -..\src\glpapi14.obj \ -..\src\glpapi15.obj \ -..\src\glpapi16.obj \ -..\src\glpapi17.obj \ -..\src\glpapi18.obj \ -..\src\glpapi19.obj \ -..\src\glpapi20.obj \ -..\src\glpapi21.obj \ -..\src\glpcpx.obj \ -..\src\glpdmx.obj \ -..\src\glpgmp.obj \ -..\src\glphbm.obj \ -..\src\glpini01.obj \ -..\src\glpini02.obj \ -..\src\glpios01.obj \ -..\src\glpios02.obj \ -..\src\glpios03.obj \ -..\src\glpios04.obj \ -..\src\glpios05.obj \ -..\src\glpios06.obj \ -..\src\glpios07.obj \ -..\src\glpios08.obj \ -..\src\glpios09.obj \ -..\src\glpios10.obj \ -..\src\glpios11.obj \ -..\src\glpios12.obj \ -..\src\glpipm.obj \ -..\src\glpmat.obj \ -..\src\glpmpl01.obj \ -..\src\glpmpl02.obj \ -..\src\glpmpl03.obj \ -..\src\glpmpl04.obj \ -..\src\glpmpl05.obj \ -..\src\glpmpl06.obj \ -..\src\glpmps.obj \ -..\src\glpnet03.obj \ -..\src\glpnet04.obj \ -..\src\glpnet05.obj \ -..\src\glpnpp01.obj \ -..\src\glpnpp02.obj \ -..\src\glpnpp03.obj \ -..\src\glpnpp04.obj \ -..\src\glpnpp05.obj \ -..\src\glpnpp06.obj \ -..\src\glprgr.obj \ -..\src\glpscl.obj \ -..\src\glpsdf.obj \ -..\src\glpspm.obj \ -..\src\glpsql.obj \ -..\src\glpssx01.obj \ -..\src\glpssx02.obj \ -..\src\lux.obj \ -..\src\amd\amd_1.obj \ -..\src\amd\amd_2.obj \ -..\src\amd\amd_aat.obj \ -..\src\amd\amd_control.obj \ -..\src\amd\amd_defaults.obj \ -..\src\amd\amd_dump.obj \ -..\src\amd\amd_info.obj \ -..\src\amd\amd_order.obj \ -..\src\amd\amd_post_tree.obj \ -..\src\amd\amd_postorder.obj \ -..\src\amd\amd_preprocess.obj \ -..\src\amd\amd_valid.obj \ -..\src\bflib\btf.obj \ -..\src\bflib\btfint.obj \ -..\src\bflib\fhv.obj \ -..\src\bflib\fhvint.obj \ -..\src\bflib\ifu.obj \ -..\src\bflib\luf.obj \ -..\src\bflib\lufint.obj \ -..\src\bflib\scf.obj \ -..\src\bflib\scfint.obj \ -..\src\bflib\sgf.obj \ -..\src\bflib\sva.obj \ -..\src\cglib\cfg.obj \ -..\src\cglib\cfg1.obj \ -..\src\colamd\colamd.obj \ -..\src\env\alloc.obj \ -..\src\env\dlsup.obj \ -..\src\env\env.obj \ -..\src\env\error.obj \ -..\src\env\stdout.obj \ -..\src\env\stream.obj \ -..\src\env\time.obj \ -..\src\env\tls.obj \ -..\src\minisat\minisat.obj \ -..\src\misc\bignum.obj \ -..\src\misc\dmp.obj \ -..\src\misc\ffalg.obj \ -..\src\misc\fp2rat.obj \ -..\src\misc\gcd.obj \ -..\src\misc\jd.obj \ -..\src\misc\keller.obj \ -..\src\misc\mc13d.obj \ -..\src\misc\mc21a.obj \ -..\src\misc\okalg.obj \ -..\src\misc\qmd.obj \ -..\src\misc\relax4.obj \ -..\src\misc\rng.obj \ -..\src\misc\rng1.obj \ -..\src\misc\round2n.obj \ -..\src\misc\str2int.obj \ -..\src\misc\str2num.obj \ -..\src\misc\strspx.obj \ -..\src\misc\strtrim.obj \ -..\src\misc\triang.obj \ -..\src\misc\wclique.obj \ -..\src\misc\wclique1.obj \ -..\src\proxy\proxy.obj \ -..\src\proxy\proxy1.obj \ -..\src\simplex\spxat.obj \ -..\src\simplex\spxchuzc.obj \ -..\src\simplex\spxchuzr.obj \ -..\src\simplex\spxlp.obj \ -..\src\simplex\spxnt.obj \ -..\src\simplex\spxprim.obj \ -..\src\simplex\spxprob.obj \ -..\src\simplex\spychuzc.obj \ -..\src\simplex\spychuzr.obj \ -..\src\simplex\spydual.obj \ -..\src\zlib\adler32.obj \ -..\src\zlib\compress.obj \ -..\src\zlib\crc32.obj \ -..\src\zlib\deflate.obj \ -..\src\zlib\gzclose.obj \ -..\src\zlib\gzlib.obj \ -..\src\zlib\gzread.obj \ -..\src\zlib\gzwrite.obj \ -..\src\zlib\inffast.obj \ -..\src\zlib\inflate.obj \ -..\src\zlib\inftrees.obj \ -..\src\zlib\trees.obj \ -..\src\zlib\uncompr.obj \ -..\src\zlib\zio.obj \ -..\src\zlib\zutil.obj - -.c.obj: - cl.exe $(CFLAGS) /Fo$*.obj /c $*.c - -all: glpk_4_57.dll glpsol.exe - -glpk_4_57.dll: $(OBJSET) - cl.exe $(CFLAGS) /LD /Feglpk_4_57.dll \ - ..\src\*.obj \ - ..\src\amd\*.obj \ - ..\src\bflib\*.obj \ - ..\src\cglib\*.obj \ - ..\src\colamd\*.obj \ - ..\src\env\*.obj \ - ..\src\minisat\*.obj \ - ..\src\misc\*.obj \ - ..\src\proxy\*.obj \ - ..\src\simplex\*.obj \ - ..\src\zlib\*.obj \ - glpk_4_57.def - -glpsol.exe: ..\examples\glpsol.obj glpk_4_57.dll - cl.exe $(CFLAGS) /Feglpsol.exe \ - ..\examples\glpsol.obj glpk_4_57.lib - -check: glpsol.exe - .\glpsol.exe --version - .\glpsol.exe --mps ..\examples\plan.mps - -## eof ## diff --git a/resources/3rdparty/glpk-4.57/AUTHORS b/resources/3rdparty/glpk-4.65/AUTHORS similarity index 100% rename from resources/3rdparty/glpk-4.57/AUTHORS rename to resources/3rdparty/glpk-4.65/AUTHORS diff --git a/resources/3rdparty/glpk-4.57/COPYING b/resources/3rdparty/glpk-4.65/COPYING similarity index 100% rename from resources/3rdparty/glpk-4.57/COPYING rename to resources/3rdparty/glpk-4.65/COPYING diff --git a/resources/3rdparty/glpk-4.57/ChangeLog b/resources/3rdparty/glpk-4.65/ChangeLog similarity index 83% rename from resources/3rdparty/glpk-4.57/ChangeLog rename to resources/3rdparty/glpk-4.65/ChangeLog index acf5867be..c71214ef6 100644 --- a/resources/3rdparty/glpk-4.57/ChangeLog +++ b/resources/3rdparty/glpk-4.65/ChangeLog @@ -1,3 +1,525 @@ +Thu Feb 16 10:00:00 2018 Andrew Makhorin + + * GLPK 4.65 (43:0:3) has been released. + + * src/glpk.h, src/api/npp.c + New API routines for LP/MIP preprocessing were added: + glp_npp_alloc_wksp allocate the preprocessor workspace + glp_npp_load_prob load original problem instance + glp_npp_preprocess1 perform basic LP/MIP preprocessing + glp_npp_build_prob build resultant problem instance + glp_npp_postprocess postprocess solution to resultant problem + glp_npp_obtain_sol obtain solution to original problem + glp_npp_free_wksp free the preprocessor workspace + See doc/npp.txt for detailed description of these API routines. + + * examples/nppsamp.c + An example program to demonstrate using of LP/MIP preprocessor + was added. + + The following modules were renamed to simplify maintenance. + * src/draft/glpnpp.h RENAMED -> src/npp/npp.h + * src/draft/glpnpp01.c RENAMED -> src/npp/npp1.c + * src/draft/glpnpp02.c RENAMED -> src/npp/npp2.c + * src/draft/glpnpp03.c RENAMED -> src/npp/npp3.c + * src/draft/glpnpp04.c RENAMED -> src/npp/npp4.c + * src/draft/glpnpp05.c RENAMED -> src/npp/npp5.c + * src/draft/glpnpp06.c RENAMED -> src/npp/npp6.c + * src/bflib/fvs.h RENAMED -> src/misc/fvs.h + * src/bflib/fvs.c RENAMED -> src/misc/fvs.c + * src/draft/glpios.h RENAMED -> src/draft/ios.h + * src/cglib/ RENAMED -> src/intopt/ + * src/draft/glpios10.c RENAMED -> src/intopt/fpump.c + + * src/glpk.h, src/intopt/covgen.c + A new, more robust implementation of locally valid simple cover + cuts was included in the MIP solver. + + * src/draft/ios.h, src/draft/glpios01.c, src/draft/glpios03.c + These modules were changed to use the new cover cut generator. + + * src/misc/ks.c, src/misc/ks.h + Routines to solve 0-1 knapsack problem (used by the new cover + cut generator) were added. + + * src/misc/mt1.c, src/misc/mt1.h, src/misc/mt1.f + Routines to solve 0-1 knapsack problem with Martello & Toth + algorithm (used by the new cover cut generator) were added. + (The original Fortran 77 code mt1.f is included for reference + purposes only.) + + * src/draft/glpapi09.c + The API routine glp_init_iocp was changed to enable long-step + dual simplex by default. + + * src/api/cplex.c + The internal routine col_name routine was changed to construct + a fake column name depending on the column's attributes. + + * examples/glpsol.c + A new option --hide was added. This option removes all symbolic + names from the model being processed. + + * src/env/stdc.h + CDECL macro was added. (This macro is defined by config.h only + on building the GLPK DLL with MSVC.) + The following modules affected by this change were changed: + * src/api/cpxbas.c + * src/draft/glpios11.c + * src/intopt/cfg1.c + * src/intopt/fpump.c + * src/intopt/gmigen.c + * src/intopt/mirgen.c + * src/misc/wclique1.c + * src/simplex/spxchuzr.c + * src/simplex/spychuzc.c + +Sat Dec 02 12:00:00 2017 Andrew Makhorin + + * GLPK 4.64 (42:3:2) has been released. + + * src/simplex/spydual.c + The internal routine play_coef of the dual simplex solver was + changed to perform more aggressive perturbation to prevent dual + degeneracy and avoid stalling even if the current dual basic + solution is strongly feasible (mainly if the objective is zero, + so all reduced costs are always zero). Thanks to David Monniaux + for bug report. + + * src/draft/glpssx.h, glpssx02.c, glpapi07.c + The exact simplex solver routines were changed to perform + terminal output according to the verbosity level (specified by + the control parameter smcp.msg_lev). Thanks to Jeroen Demeyer + for bug report. + + * src/simplex/spxchuzr.c + The directive #include was added. Thanks to Heinrich + Schuchardt for bug report. + + * examples/graceful.mod + An example model in MathProg was added. Thanks to Mike Appleby + for contribution. + + * examples/powpl25h.mod powplant.mod wolfra6d.lp wolfra6d.mod + Three example models in MathProg and one in Cplex LP format + were added. Thanks to Peter Naszvadi for + contribution. + +Tue Jul 25 12:00:00 2017 Andrew Makhorin + + * GLPK 4.63 (42:2:2) has been released. + + * src/simplex/spxchuzr.h, src/simplex/spxchuzr.c + An experimental feature (phase I long-step ratio test) was + included in the primal simplex solver. + + * src/simplex/spxprim.c, src/simplex/spydual.c + An internal scaling of the objective coefficients was added to + the primal and dual simplex solvers. + + * src/simplex/spxprim.c + A minor bug was fixed (correction of flags of fixed non-basic + variables after removing the perturbation). + + * src/glpk.h, src/glpapi06.c + New smcp parameters were added (not documented yet): + int excl (default: GLP_ON) + Internal simplex solver option: + GLP_ON - exclude fixed non-basic variables from the working LP; + GLP_OFF - keep original variables in the working LP. + int shift (default: GLP_ON) + Internal simplex solver option: + GLP_ON - shift bounds of variables in the working LP tow. zero; + GLP_OFF - keep original bounds of variables in the working LP. + int aorn (default: GLP_USE_NT) + Internal simplex solver option: + GLP_USE_AT - use A matrix in sparse row-wise format; + GLP_USE_NT - use N matrix in sparse row-wise format. + Parameter out_frq was changed to specify the output frequency + in milliseconds rather than in simplex iterations. + + src/env/time.c + The Posix version of glp_time was replaced by new one, which + doesn't use gmtime functions to improve portability. Thanks to + Rob Schroeder for bug report. + + src/spv.c, src/spv.h + These files were moved to src/cglib/, since they are used only + in the MIR cuts generator. + + examples/life_goe.mod, examples/tiling.mod, examples/toto.mod + Three new example models in MathProg were added. Thanks to + Peter Naszvadi for contribution. + +Wed Jun 14 12:00:00 2017 Andrew Makhorin + + * GLPK 4.62 (42:1:2) has been released. + + * src/simplex/spxprim.c + An experimental feature (bound perturbation) to improve + numerical stabilty and avoid cycling was included in the primal + simplex solver. Currently it is enabled by default. + + * src/simplex/spxprim.c + Some dense vectors were replaced by sparse ones in full-vector + storage (FVS) format. + + * src/simplex/spxprim.c, src/simplex/spydual.c + Assertions trow[q] != 0.0 and tcol[p] != 0.0 were replaced by + setting an error code to prevent abnormal termination. Thanks + to Chris Matrakidis for patch. + + * src/simplex/spydual.c + Removing perturbation was added if the perturbed problem is + dual infeasible while the original one is dual feasible. Thanks + to Chris Matrakidis for patch. + + * src/api/mps.c + A range bug was fixed. + Thanks to Chris Matrakidis for patch. + + * src/minisat/minisat.c + Changes were made to provide 64-bit portability. Thanks to + Chris Matrakidis for patch. + + * src/api/minisat1.c + Changes related to the minisat solver were made. Thanks to + Chris Matrakidis for patch. + + * src/api/intfeas1.c + Changes were made to skip objective integrality check when + no objective bound is specified. Thanks to Chris Matrakidis + for patch. + + * src/glphbm.c, src/glprgr.c, src/env/stream.c, src/env/time.c, + * src/mpl/mpl5.c, src/mpl/mpl6.c, src/mpl/mplsql.c + Calls to non-thread-safe functions gmtime, strerror, and strtok + were replaced by calls to corresponding thread-safe equivalents + (gmtime_r, strerror_r, and strtok_r for GNU/Linux). + + * w32/*.def, w64/*.def + glp_config symbol was added. Thanks to Heinrich Schuchardt + for bug report. + + * examples/pbn/pbn.mod + A bug was fixed (model didn't work for odd number of rows or + columns). Thanks to Chris Matrakidis for + bug report and patch provided. + +Sun Jan 22 12:00:00 2017 Andrew Makhorin + + * GLPK 4.61 (42:0:2) has been released. + + The following modules were renamed to simplify maintenance. + * src/prob.h RENAMED -> src/api/prob.h + * src/glpapi01.c RENAMED -> src/api/prob1.c + * src/glpapi02.c RENAMED -> src/api/prob2.c + * src/glpapi03.c RENAMED -> src/api/prob3.c + * src/glpapi04.c RENAMED -> src/api/prob4.c + * src/glpapi05.c RENAMED -> src/api/prob5.c + + * src/env/tls.c + TLS (thread local storage class specifier) option was added; + see comments in tls.c for details. + + * configure.ac, config.h.in + Test for TLS was added. + Thanks to David Monniaux for + suggestion and Chris Matrakidis for patch. + + * src/env/tls.c + Dll support was added. + Thanks to Heinrich Schuchardt for + contribution. + + The following modules were changed to add __cdecl specifier + for functions passed to qsort (this is needed only on compiling + GLPK with MSVC to run under MS Windows). + * src/api/cpxbas.c + * src/cglib/cfg1.c + * src/cglib/gmigen.c + * src/cglib/mirgen.c + * src/misc/wclique1.c + * src/simplex/spychuzc.c + * src/glpios10.c + * src/glpios11.c + * examples/glpsol.c + + * src/glpk.h, src/env/env.c + The API routine glp_version was changed to avoid initialization + of the GLPK environment. The new API routine glp_config was + added (but not documented yet). Thanks to Heinrich Schuchardt + for suggestion. + + * INSTALL + Description of the configure option '--with-zlib' was removed. + Thanks to Balaco Baco for bug report. + +Fri Apr 01 12:00:00 2016 Andrew Makhorin + + * GLPK 4.60 (41:0:1) has been released. + + * src/glpk.h + Declarations of all non-documented API routines were hidden by + #ifdef GLP_UNDOC / #endif. + + src/simplex/spydual.c + An experimental feature (objective coefficient perturbation) + to improve numerical stabilty and avoid cycling was included in + the dual simplex solver. + + This release also includes all the changes made in 4.59.2 and + 4.59.1 non-official test releases (see below). + +Fri Mar 18 12:00:00 2016 Andrew Makhorin + + * GLPK 4.59.2 (40:1:0) has been released. + + NOTE: THIS IS A NON-OFFICIAL TEST RELEASE. + + src/simplex/spxprim.c + Improvements were made in the internal routine choose_pivot to + prevent choosing a too small pivot in the primal simplex. + + src/simplex/spydual.c + Improvements were made in the internal routine choose_pivot to + prevent choosing a too small pivot in the dual simplex. + + src/simplex/spychuzc.c + The internal routine spy_eval_bp was added to determine break- + points of the dual objective function. + + src/simplex/spydual.c + An experimental feature (long-step ratio test) was included in + the dual simplex. + + src/glpk.h, src/glpapi06.c + The GLP_RT_FLIP option (long-step ratio test) was added to + the simplex solver. Currently it affects only the dual simplex. + For the primal simplex it is equivalent to GLP_RT_HAR. + + src/examples/glpsol.c + The '--flip' command-line option was added to glpsol (long-step + dual ratio test). + + src/proxy/proxy1.c + Additional check was added to reject wrong solutions somwtimes + reported by the PROXY heuristic. + + src/glpios10.c + A bug (memory leak) was fixed in the FPUMP heuristic routine. + Thanks to for bug report. + +Tue Mar 15 12:00:00 2016 Andrew Makhorin + + * GLPK 4.59.1 (40:1:0) has been released. + + NOTE: THIS IS A NON-OFFICIAL BUG-FIX RELEASE. + + * src/simplex/mpl6.c, src/simplex/sql.c, src/simplex/sql.h + The header sql.h was renamed to avoid conflicts with standard + ODBC headers. Thanks to Noli Sicad for bug + report. + + * src/simplex/spychuzc.c, src/simplex/spychuzc.h + Minor changes were made. + +Fri Mar 11 12:00:00 2016 Andrew Makhorin + + * GLPK 4.59 (40:0:0) has been released. + + * src/sgf.c, src/sgf.h + The routines sgf_reduce_nuc and sgf_factorize were changed to + correctly report structural singularity. + + * src/glpios01.c + The routine ios_solve_node was changed to retry solving node + problem in case of the simplex solver failure. Thanks to Chris + Matrakidis for patch. + + * src/glpios03.c + The routine ios_driver was changed to correctly process the + root node. Thanks to Chris Matrakidis for + patch. + + * src/glpios06.c + Some improvements were made in the MIR cut generation routines. + Thanks to Chris Matrakidis for patch. + + The following source modules were splitted/renamed to simplify + maintenance. + * src/glpios04.c RENAMED -> src/spv.c + * src/glpios05.c glp_gmi_cut (new) -> src/cglib/gmicut.c + * src/glpios05.c glp_gmi_gen (new) -> src/cglib/gmigen.c + * src/glpios05.c REMOVED + * src/glpios06.c glp_mir_init (new) -> src/cglib/mirgen.c + * src/glpios06.c glp_mir_gen (new) -> src/cglib/mirgen.c + * src/glpios06.c glp_mir_free (new) -> src/cglib/mirgen.c + * src/glpios06.c REMOVED + * src/glpios08.c glp_cfg_init (new) -> src/cglib/cfg2.c + * src/glpios08.c glp_cfg_free (new) -> src/cglib/cfg2.c + * src/glpios08.c glp_clq_cut (new) -> src/cglib/clqcut.c + * src/glpios08.c REMOVED + * src/glpmpl.h RENAMED -> src/mpl/mpl.h + * src/glpmpl01.c RENAMED -> src/mpl/mpl1.c + * src/glpmpl02.c RENAMED -> src/mpl/mpl2.c + * src/glpmpl03.c RENAMED -> src/mpl/mpl3.c + * src/glpmpl04.c RENAMED -> src/mpl/mpl4.c + * src/glpmpl05.c RENAMED -> src/mpl/mpl5.c + * src/glpmpl06.c RENAMED -> src/mpl/mpl6.c + * src/glpsql.h RENAMED -> src/mpl/sql.h + * src/glpsql.c RENAMED -> src/mpl/sql.c + + * src/proxy/proxy.c + Minor bug was fixed in the PROXY heuristic routine. Thanks to + Chris Matrakidis for bug report. + + * src/cglib/gmicut.c, src/glpk.h + New API routine glp_gmi_cut was added (not documented yet). + + * src/cglib/gmigen.c, src/glpk.h + New API routine glp_gmi_gen was added (not documented yet). + + * src/cglib/mirgen.c, src/glpk.h + New API routines glp_mir_init, glp_mir_gen, and glp_mir_free + were added (not documented yet). + + * src/cglib/cfg2.c, src/glpk.h + New API routines glp_cfg_init and glp_cfg_free were added (not + documented yet). + + * src/cglib/clqcut.c, src/glpk.h + New API routine glp_clq_cut was added (not documented yet). + + * src/api/rdcc.c, src/api/wrcc.c + API routines glp_read_graph and glp_write_graph were changed + due to changes in the data format. For details see the document + "GLPK: Graph and Network Routines". + + * src/api/rdgr.c, src/api/wrgr.c, src/glpsdf.c, src/glpsdf.h + Old versions of API routines glp_read_graph and glp_write_graph + were removed. + + * doc/gmpl_pt-BR.tex, doc/gmpl_pt-BR.pdf + Translation of the document "Modeling Language GNU MathProg" + to Brazilian Portuguese (pt-BR) was included (in LaTeX and pdf + formats). Thanks to Joao Flavio de Freitas Almeida + for contribution. + +Thu Feb 18 12:00:00 2016 Andrew Makhorin + + * GLPK 4.58 (39:0:0) has been released. + + * src/misc/dimacs.c, src/misc/dimacs.h + Routines to read data files in DIMACS format were implemented + as a separate module. + + The following source modules were splitted/renamed to simplify + maintenance. + * src/glpapi11.c glp_print_sol -> src/api/prsol.c + * src/glpapi11.c glp_read_sol -> src/api/rdsol.c + * src/glpapi11.c glp_write_sol -> src/api/wrsol.c + * src/glpapi11.c glp_print_ipt -> src/api/pript.c + * src/glpapi11.c glp_read_ipt -> src/api/rdipt.c + * src/glpapi11.c glp_write_ipt -> src/api/wript.c + * src/glpapi11.c glp_print_mip -> src/api/prmip.c + * src/glpapi11.c glp_read_mip -> src/api/rdmip.c + * src/glpapi11.c glp_write_mip -> src/api/wrmip.c + * src/glpapi11.c glp_print_ranges -> src/api/prrngs.c + * src/glpapi11.c REMOVED + * src/glpapi14.c RENAMED -> src/api/mpl.c + * src/glpapi15.c glp_read_graph -> src/api/rdgr.c + * src/glpapi15.c glp_write_graph -> src/api/wrgr.c + * src/glpapi15.c REMOVED + * src/glpapi16.c glp_weak_comp -> src/api/weak.c + * src/glpapi16.c glp_strong_comp -> src/api/strong.c + * src/glpapi16.c glp_top_sort -> src/api/topsort.c + * src/glpapi16.c REMOVED + * src/glpapi17.c glp_mincost_lp -> src/api/mcflp.c + * src/glpapi17.c glp_mincost_okalg -> src/api/mcfokalg.c + * src/glpapi17.c glp_mincost_relax4 -> src/api/mcfrelax.c + * src/glpapi17.c glp_maxflow_lp -> src/api/maxflp.c + * src/glpapi17.c glp_maxflow_ffalg -> src/api/maxffalg.c + * src/glpapi17.c glp_check_asnprob -> src/api/ckasn.c + * src/glpapi17.c glp_asnprob_lp -> src/api/asnlp.c + * src/glpapi17.c glp_asnprob_okalg -> src/api/asnokalg.c + * src/glpapi17.c glp_asnprob_hall -> src/api/asnhall.c + * src/glpapi17.c glp_cpp -> src/api/cpp.c + * src/glpapi17.c REMOVED + * src/glpapi18.c glp_wclique_exact -> src/api/wcliqex.c + * src/glpapi18.c REMOVED + * src/glpapi19.c RENAMED -> src/api/minisat1.c + * src/glpapi20.c RENAMED -> src/api/intfeas1.c + * src/glpapi21.c RENAMED -> examples/glpsol.c + * src/glpcpx.c RENAMED -> src/api/cplex.c + * src/glpdmx.c glp_read_mincost -> src/api/rdmcf.c + * src/glpdmx.c glp_write_mincost -> src/api/wrmcf.c + * src/glpdmx.c glp_read_maxflow -> src/api/rdmaxf.c + * src/glpdmx.c glp_write_maxflow -> src/api/wrmaxf.c + * src/glpdmx.c glp_read_asnprob -> src/api/rdasn.c + * src/glpdmx.c glp_write_asnprob -> src/api/wrasn.c + * src/glpdmx.c glp_read_ccdata -> src/api/rdcc.c + * src/glpdmx.c glp_write_ccdata -> src/api/wrcc.c + * src/glpdmx.c glp_read_prob -> src/api/rdprob.c + * src/glpdmx.c glp_write_prob -> src/api/wrprob.c + * src/glpdmx.c glp_read_cnfsat -> src/api/rdcnf.c + * src/glpdmx.c glp_write_cnfsat -> src/api/wrcnf.c + * src/glpdmx.c glp_check_cnfsat -> src/api/ckcnf.c + * src/glpdmx.c REMOVED + * src/glpgmp.c RENAMED -> src/misc/mygmp.c + * src/glpini01.c RENAMED -> src/api/advbas.c + * src/glpini02.c RENAMED -> src/api/cpxbas.c + * src/glpmps.c RENAMED -> src/api/mps.c + * src/glpnet03.c RENAMED -> src/api/netgen.c + * src/glpnet04.c RENAMED -> src/api/gridgen.c + * src/glpnet05.c RENAMED -> src/api/rmfgen.c + + The following source modules were changed due to changes in the + data formats: + * src/api/rdsol.c + * src/api/wrsol.c + * src/api/rdipt.c + * src/api/wript.c + * src/api/rdmip.c + * src/api/wrmip.c + + * src/glpk.h + New API routines were added: glp_mpl_init_rand (not documented + yet), glp_time, glp_difftime. The API routine glp_main (glpsol + main routine) was removed. + + * src/glpmpl.h, src/glpmpl01.c, src/glpmpl03.c + The function tan (trigonometric tangent) was added to MathProg. + Thanks to Chris Matrakidis for patch. + + * src/simplex/spydual.c + A minor typo in dual simplex (GLP_EITLIM instead of GLP_ETMLIM) + was fixed. Thanks to Chris Matrakidis for + patch. + + * src/glpapi09.c, src/glpios01.c, src/glpios03.c + A time limit problem was fixed. Thanks to Chris Matrakidis + for patch. + + * doc/gmpl_es.tex, doc/gmpl_es.pdf + A new version of the document "Modeling Language GNU MathProg" + in Spanish was included (in LaTeX and pdf formats). Thanks to + Pablo Yapura for contribution. + + * configure.ac + A check to determine if libtool needs '-no-undefined' flag to + build shared libraries on some platforms was added. + Thanks to Marco Atzeri and Heinrich + Schuchardt for suggestion. + + * autogen.sh + A script to regenerate the configure script and the Makefiles + was added. Thanks to Heinrich Schuchardt . + + * w32/glpk.def, w64/glpk.def + 'glp_at_error' symbol was added to the export list. Thanks to + Heinrich Schuchardt for bug report. + Sun Nov 08 12:00:00 2015 Andrew Makhorin * GLPK 4.57 (38:0:2) has been released. diff --git a/resources/3rdparty/glpk-4.57/INSTALL b/resources/3rdparty/glpk-4.65/INSTALL similarity index 93% rename from resources/3rdparty/glpk-4.57/INSTALL rename to resources/3rdparty/glpk-4.65/INSTALL index 749f33d0a..cf76b2e78 100644 --- a/resources/3rdparty/glpk-4.57/INSTALL +++ b/resources/3rdparty/glpk-4.65/INSTALL @@ -74,17 +74,6 @@ option should be passed to the configure script. For details about the GNU MP bignum library see its web page at . ---with-zlib Enable using the zlib data compression library - - This feature allows GLPK API routines and the stand-alone solver to - read and write compressed data files performing compression and - decompression "on the fly" (compressed data files are recognized by - suffix `.gz' in the file name). It may be useful in case of large - MPS files to save the disk space. - - For details about the zlib compression library see its web page at - . - --enable-dl The same as --enable-dl=ltdl --enable-dl=ltdl Enable shared library support (GNU) --enable-dl=dlfcn Enable shared library support (POSIX) diff --git a/resources/3rdparty/glpk-4.57/Makefile.am b/resources/3rdparty/glpk-4.65/Makefile.am similarity index 100% rename from resources/3rdparty/glpk-4.57/Makefile.am rename to resources/3rdparty/glpk-4.65/Makefile.am diff --git a/resources/3rdparty/glpk-4.57/Makefile.in b/resources/3rdparty/glpk-4.65/Makefile.in similarity index 99% rename from resources/3rdparty/glpk-4.57/Makefile.in rename to resources/3rdparty/glpk-4.65/Makefile.in index 5ae9553c6..7af088a5f 100644 --- a/resources/3rdparty/glpk-4.57/Makefile.in +++ b/resources/3rdparty/glpk-4.65/Makefile.in @@ -175,6 +175,7 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ +NOUNDEFINED = @NOUNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ diff --git a/resources/3rdparty/glpk-4.57/NEWS b/resources/3rdparty/glpk-4.65/NEWS similarity index 90% rename from resources/3rdparty/glpk-4.57/NEWS rename to resources/3rdparty/glpk-4.65/NEWS index 608086d1b..fdef77233 100644 --- a/resources/3rdparty/glpk-4.57/NEWS +++ b/resources/3rdparty/glpk-4.65/NEWS @@ -1,3 +1,191 @@ +GLPK 4.65 (release date: Feb 16, 2018) + + The following new API routines for LP/MIP preprocessing were + added: + + glp_npp_alloc_wksp allocate the preprocessor workspace + glp_npp_load_prob load original problem instance + glp_npp_preprocess1 perform basic LP/MIP preprocessing + glp_npp_build_prob build resultant problem instance + glp_npp_postprocess postprocess solution to resultant problem + glp_npp_obtain_sol obtain solution to original problem + glp_npp_free_wksp free the preprocessor workspace + + See doc/npp.txt for detailed description of these API routines. + + A new, more robust implementation of locally valid simple cover + cuts was included in the MIP solver. + + The API routine glp_init_iocp was changed to enable long-step + option of the dual simplex by default. + +GLPK 4.64 (release date: Dec 02, 2017) + + The dual simplex solver routine was changed to perform more + aggressive perturbation to prevent dual degeneracy and avoid + stalling even if the current dual basic solution is strongly + feasible (mainly if the objective is zero). Thanks to David + Monniaux for bug report + and example model. + + The exact simplex solver routine was changed to perform + terminal output according to the verbosity level (specified by + the control parameter smcp.msg_lev). Thanks to Jeroen Demeyer + for bug report. + + A minor bug (related to MS Windows version) was fixed. Thanks + to Heinrich Schuchardt for bug report. + + An example model (Graceful Tree Labeling Problem) in MathProg + was added. Thanks to Mike Appleby for + contribution. + + Three example models (Power plant LP scheduler, Neumann CA + grid emulator generator) in MathProg and one in Cplex LP format + were added. Thanks to Peter Naszvadi for + contribution. + +GLPK 4.63 (release date: Jul 25, 2017) + + A "smart" LP perturbation was implemented in the primal and + dual simplex solvers. Now LP is perturbed only if it is + necessary, and by default perturbation is not activated. + The sum of primal infeasibilites that appears in the terminal + output of the primal simplex solver (as "inf = ...") now + corresponds to the original bounds of variables. This allows to + see how much perturbed solution violates the original bounds. + + The long-step technique was implemented for phase I of the + primal simplex solver. This feature can be enabled by + specifying --flip option for glpsol or by specifying + glp_smcp.r_test = GLP_RT_FLIP on api level. For many LP + instances the long-step technique allows reducing the number + of simplex iterations to 30-70%. Please note that unlike the + dual simplex, where this technique can be used on both phase I + and II, for the primal simplex it can be used only on phase I, + where the sum of primal infeasibilities (which is a convex + piecewise linear function) is minimized. + + An internal objective scaling was included in both primal and + dual simplex solvers. For many LP/MIP instances this feature + improves numerical stability (for the dual solver) and prevents + cycling near the optimum (for the primal solver). + + The Posix version of glp_time (glpk/src/env/time.c) was changed + to resolve time_t issue on msys2. Thanks to Rob Schroeder + for bug report. + + Three new example models in MathProg were added: + life_goe.mod (Conway's Game of Life garden of eden checker); + tiling.mod (Rectifiable polyomino tilings generator); + toto.mod (Covering code generator). + Thanks to Peter Naszvadi for contribution. + +GLPK 4.62 (release date: Jun 14, 2017) + + The bound perturbation technique was included in the primal + simplex solver to improve numerical stability and avoid cycling. + Currently this feature is enabled by default. + + A range bug was fixed in the MPS reading routine. Thanks to + Chris Matrakidis for bug report and patch. + + Changes were made to provide 64-bit portability of the Minisat + solver. Thanks to Chris Matrakidis for + patch. + + Calls to non-thread-safe functions gmtime, strerror, and strtok + were replaced by calls to corresponding thread-safe equivalents + (gmtime_r, strerror_r, and strtok_r for GNU/Linux). + +GLPK 4.61 (release date: Jan 22, 2017) + + An option was added to build a re-entrant version of the + package suitable for running in a multi-threaded environment. + This option is enabled by default on configuring the package + if the compiler used supports the thread local storage class + specifier (e.g. _Thread_local or __thread). Thanks to + David Monniaux for suggestion and + Chris Matrakidis for configure.ac patch. + + A re-entrant version of the package allows running multiple + independent instances of glpk in different threads of a multi- + threaded application. Note that glpk is not thread-safe by + design, so if the application calls glpk routines from multiple + threads, no thread may access glpk program objects (glp_prob, + glp_tree, etc.) created by other threads; besides, each thread + before termination should call the API routine glp_free_env to + prevent memory leak. + + A DLL support was added. Thanks to Heinrich Schuchardt + for contribution. + + Some changes were made to allow compiling the package using + stdcall calling convention (this is needed only on compiling + GLPK with MSVC to run under MS Windows). + +GLPK 4.60 (release date: Apr 01, 2016) + + Some improvements were made in the primal and dual simplex + solvers to make the solution process more numerically stable. + + An experimental long-step ratio test feature was added to the + dual simplex. On API level this feature is available thru the + GLP_RT_FLIP option. For glpsol it is available thru the options + --flip (for MIP) or --flip and --dual (for LP). This feature is + not documented yet. + + Additional check was added to reject wrong solutions sometimes + reported by the PROXY heuristic. + + A bug (memory leak) was fixed in the FPUMP heuristic routine. + Thanks to for bug report. + + The header sql.h was renamed to avoid conflicts with standard + ODBC headers. Thanks to Noli Sicad for bug + report. + +GLPK 4.59 (release date: Mar 11, 2016) + + This is a maintainer release. + + Some bugs were fixed and some improvements were made in the MIP + solver. Thanks to Chris Matrakidis for bug + reports and patches. + + The data file format used by API routines glp_read_graph and + glp_write_graph was changed. For more details please see the + document "GLPK: Graph and Network Routines" included in the + distribution. + + Translation of the document "Modeling Language GNU MathProg" + to Brazilian Portuguese (pt-BR) was included (in LaTeX and pdf + formats). Thanks to Joao Flavio de Freitas Almeida + for contribution. + +GLPK 4.58 (release date: Feb 18, 2016) + + The solution file format used by API routines glp_read_sol, + glp_write_sol, glp_read_ipt, glp_write_ipt, glp_read_mip, and + glp_write_mip was changed. For more details please see the GLPK + reference manual included in the distribution. + + The tan function (trigonometric tangent) was added to + GNU MathProg modeling language. Thanks to Chris Matrakidis + for contribution. + + A new version of the document "Modeling Language GNU MathProg" + in Spanish was included (in LaTeX and pdf formats). Thanks to + Pablo Yapura for contribution. + + A check to determine if libtool needs '-no-undefined' flag to + build shared libraries on some platforms was added. + Thanks to Marco Atzeri and Heinrich + Schuchardt for suggestion. + + A script to regenerate the configure script and the Makefiles + was added. Thanks to Heinrich Schuchardt . + GLPK 4.57 (release date: Nov 08, 2015) A new, more efficient implementation of the dual simplex method diff --git a/resources/3rdparty/glpk-4.57/README b/resources/3rdparty/glpk-4.65/README similarity index 68% rename from resources/3rdparty/glpk-4.57/README rename to resources/3rdparty/glpk-4.65/README index 23550ef14..7d71d65bf 100644 --- a/resources/3rdparty/glpk-4.57/README +++ b/resources/3rdparty/glpk-4.65/README @@ -1,11 +1,11 @@ Olga K. gewidmet -GLPK (GNU Linear Programming Kit) Version 4.57 +GLPK (GNU Linear Programming Kit) Version 4.65 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -2009, 2010, 2011, 2013, 2014, 2015 Andrew Makhorin, Department for -Applied Informatics, Moscow Aviation Institute, Moscow, Russia. All -rights reserved. E-mail: . +2009, 2010, 2011, 2013, 2014, 2015, 2016, 2017, 2018 Andrew Makhorin, +Department for Applied Informatics, Moscow Aviation Institute, Moscow, +Russia. All rights reserved. E-mail: . GLPK is part of the GNU Project released under the aegis of GNU. @@ -25,14 +25,14 @@ large-scale linear programming (LP), mixed integer linear programming The GLPK package includes the following main components: -* implementation of the simplex method; -* implementation of the exact simplex method based on bignum (rational) - arithmetic; -* implementation of the primal-dual interior-point method; -* implementation of the branch-and-cut method; +* primal simplex method; +* dual simplex method; +* exact simplex method based on rational arithmetic; +* primal-dual interior-point method; +* branch-and-cut method; * application program interface (API); * GNU MathProg modeling language (a subset of AMPL); -* GLPSOL, a stand-alone LP/MIP solver. +* GLPSOL (stand-alone LP/MIP solver). See GLPK webpage . diff --git a/resources/3rdparty/glpk-4.57/THANKS b/resources/3rdparty/glpk-4.65/THANKS similarity index 88% rename from resources/3rdparty/glpk-4.57/THANKS rename to resources/3rdparty/glpk-4.65/THANKS index fc6fd047d..87af37b07 100644 --- a/resources/3rdparty/glpk-4.57/THANKS +++ b/resources/3rdparty/glpk-4.65/THANKS @@ -15,6 +15,8 @@ Anton Voropaev for bug and typo report. Axel Simon for bug report. +Balaco Baco for bug report. + Bernhard Schmidt for bug report. Boris Wirtz for bug report. @@ -35,13 +37,21 @@ Cedric[FR] for bug report. Charles Brixko for bug report. -Chris Matrakidis for suggestion. +Chris Matrakidis for contribution of a patch that +implements the tan function in MathProg. + +Chris Matrakidis for numerous useful suggestions, +contributions, and patches. Chris Rosebrugh for contribution of a new version of GLPK JNI (Java Native Interface). Christophe Caron for bug report. +David Monniaux for some suggestions. + +David Monniaux for bug report. + David T. Price for bug report. Dennis Schridde for bug report. @@ -90,8 +100,14 @@ language reference. Jeroen Demeyer for suggestion. +Jeroen Demeyer for bug report. + Jiri Spitz for bug report. +Joao Flavio de Freitas Almeida for +translation of the document "Modeling Language GNU MathProg" to +Brazilian Portuguese (pt-BR). + Joey Rios for some suggestions. Jonathan Senning for bug report. @@ -119,6 +135,8 @@ Markus Pilz for bug report. Martin Jacob for bug report. +Mike Appleby for example model in MathProg. + Minh Ha Duong for fixing doc typos. Morten Welinder for bug report. @@ -152,7 +170,7 @@ Olivier for bug report. Oscar Gustafsson for contribution of a routine to write data in OPB (pseudo boolean) format. -Pablo Yapura for translation the document +Pablo Yapura for translation of the document "Modeling Language GNU MathProg" to Spanish. Pedro P. Wong for bug report. @@ -165,6 +183,8 @@ Peter Ingerfeld for bug report. Peter Lee for example LP model and bug report. +Peter Naszvadi for example models in MathProg. + Pietro Scionti for report typos found in the reference manual. @@ -175,6 +195,8 @@ Raniere Gaia Costa da Silva for bug report. Remy Roy for bug report. +Rob Schroeder for bug report. + Robbie Morrison for correcting the glpk manual. Robert Wood for example model in MathProg. diff --git a/resources/3rdparty/glpk-4.57/aclocal.m4 b/resources/3rdparty/glpk-4.65/aclocal.m4 similarity index 100% rename from resources/3rdparty/glpk-4.57/aclocal.m4 rename to resources/3rdparty/glpk-4.65/aclocal.m4 diff --git a/resources/3rdparty/glpk-4.65/autogen.sh b/resources/3rdparty/glpk-4.65/autogen.sh new file mode 100755 index 000000000..4dd02fbc1 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/autogen.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +######################################################################## +# Run this script on the top level of GLPK directory to regenerate the +# configure script and the Makefiles from templates. +# +# NOTE: You need to have GNU autotools installed. +######################################################################## + +set -e + +test -f configure.ac || { + echo "You should run this script on the top level of GLPK directory." + exit +} + +echo "Executing libtoolize..." +libtoolize -c -f +echo "Executing aclocal..." +aclocal -I m4 +echo "Executing autoconf..." +autoconf +echo "Executing automake..." +automake -c -a +echo "Done." + +echo "See file INSTALL for installation instructions." diff --git a/resources/3rdparty/glpk-4.57/config.guess b/resources/3rdparty/glpk-4.65/config.guess similarity index 100% rename from resources/3rdparty/glpk-4.57/config.guess rename to resources/3rdparty/glpk-4.65/config.guess diff --git a/resources/3rdparty/glpk-4.57/config.h.in b/resources/3rdparty/glpk-4.65/config.h.in similarity index 89% rename from resources/3rdparty/glpk-4.57/config.h.in rename to resources/3rdparty/glpk-4.65/config.h.in index 2849bf9c4..794e00c5d 100644 --- a/resources/3rdparty/glpk-4.57/config.h.in +++ b/resources/3rdparty/glpk-4.65/config.h.in @@ -24,4 +24,7 @@ #undef MYSQL_DLNAME /* MySQL shared library name if this feature is enabled */ +#undef TLS +/* thread local storage-class specifier for re-entrancy (if any) */ + /* eof */ diff --git a/resources/3rdparty/glpk-4.57/config.sub b/resources/3rdparty/glpk-4.65/config.sub similarity index 100% rename from resources/3rdparty/glpk-4.57/config.sub rename to resources/3rdparty/glpk-4.65/config.sub diff --git a/resources/3rdparty/glpk-4.57/configure b/resources/3rdparty/glpk-4.65/configure similarity index 99% rename from resources/3rdparty/glpk-4.57/configure rename to resources/3rdparty/glpk-4.65/configure index b6b02927c..c238f864f 100755 --- a/resources/3rdparty/glpk-4.57/configure +++ b/resources/3rdparty/glpk-4.65/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for GLPK 4.57. +# Generated by GNU Autoconf 2.69 for GLPK 4.65. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='GLPK' PACKAGE_TARNAME='glpk' -PACKAGE_VERSION='4.57' -PACKAGE_STRING='GLPK 4.57' +PACKAGE_VERSION='4.65' +PACKAGE_STRING='GLPK 4.65' PACKAGE_BUGREPORT='bug-glpk@gnu.org' PACKAGE_URL='' @@ -636,6 +636,7 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +NOUNDEFINED CPP OTOOL64 OTOOL @@ -751,6 +752,7 @@ with_gmp enable_dl enable_odbc enable_mysql +enable_reentrant enable_dependency_tracking enable_shared enable_static @@ -1309,7 +1311,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures GLPK 4.57 to adapt to many kinds of systems. +\`configure' configures GLPK 4.65 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1379,7 +1381,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of GLPK 4.57:";; + short | recursive ) echo "Configuration of GLPK 4.65:";; esac cat <<\_ACEOF @@ -1390,6 +1392,7 @@ Optional Features: --enable-dl enable shared library support [[default=no]] --enable-odbc enable MathProg ODBC support [[default=no]] --enable-mysql enable MathProg MySQL support [[default=no]] + --enable-reentrant enable reentrancy support [[default=yes]] --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking @@ -1486,7 +1489,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -GLPK configure 4.57 +GLPK configure 4.65 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1855,7 +1858,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by GLPK $as_me 4.57, which was +It was created by GLPK $as_me 4.65, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2684,7 +2687,7 @@ fi # Define the identity of the package. PACKAGE='glpk' - VERSION='4.57' + VERSION='4.65' cat >>confdefs.h <<_ACEOF @@ -2779,6 +2782,17 @@ else fi +# Check whether --enable-reentrant was given. +if test "${enable_reentrant+set}" = set; then : + enableval=$enable_reentrant; case $enableval in + yes | no) ;; + *) as_fn_error $? "invalid value \`$enableval' for --enable-reentrant" "$LINENO" 5;; + esac +else + enable_reentrant=yes +fi + + @@ -11470,6 +11484,63 @@ else $as_echo "no" >&6; } fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable reentrancy support" >&5 +$as_echo_n "checking whether to enable reentrancy support... " >&6; } +if test "$enable_reentrant" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread local storage (TLS) class specifier" >&5 +$as_echo_n "checking for thread local storage (TLS) class specifier... " >&6; } + keywords="_Thread_local __thread __declspec(thread)" + tls=none + for tls_keyword in $keywords; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + static void foo(void) + { static $tls_keyword int bar; + exit(1); + } +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + tls=$tls_keyword; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tls" >&5 +$as_echo "$tls" >&6; } + if test "$tls" != "none"; then + +cat >>confdefs.h <<_ACEOF +#define TLS $tls +_ACEOF + + else + as_fn_error $? "Reentrancy needs complier support for TLS" "$LINENO" 5 + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool needs -no-undefined flag to build shared libraries" >&5 +$as_echo_n "checking if libtool needs -no-undefined flag to build shared libraries... " >&6; } +case "${host}" in + *-*-cygwin* | *-*-mingw* | *-*-aix*) + ## Add in the -no-undefined flag to LDFLAGS for libtool. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + NOUNDEFINED=" -no-undefined" + ;; + *) + ## Don't add in anything. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; +esac + + ac_config_files="$ac_config_files src/Makefile examples/Makefile Makefile" cat >confcache <<\_ACEOF @@ -12002,7 +12073,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by GLPK $as_me 4.57, which was +This file was extended by GLPK $as_me 4.65, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12068,7 +12139,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -GLPK config.status 4.57 +GLPK config.status 4.65 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/resources/3rdparty/glpk-4.57/configure.ac b/resources/3rdparty/glpk-4.65/configure.ac similarity index 72% rename from resources/3rdparty/glpk-4.57/configure.ac rename to resources/3rdparty/glpk-4.65/configure.ac index e0e06cf49..96c4cc547 100644 --- a/resources/3rdparty/glpk-4.57/configure.ac +++ b/resources/3rdparty/glpk-4.65/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script -AC_INIT([GLPK], [4.57], [bug-glpk@gnu.org]) +AC_INIT([GLPK], [4.65], [bug-glpk@gnu.org]) AC_CONFIG_SRCDIR([src/glpk.h]) @@ -46,6 +46,16 @@ AC_HELP_STRING([--enable-mysql], esac], [enable_mysql=no]) +AC_ARG_ENABLE(reentrant, +AC_HELP_STRING([--enable-reentrant], + [enable reentrancy support [[default=yes]]]), + [case $enableval in + yes | no) ;; + *) AC_MSG_ERROR( + [invalid value `$enableval' for --enable-reentrant]);; + esac], + [enable_reentrant=yes]) + dnl Disable unnecessary libtool tests define([AC_LIBTOOL_LANG_CXX_CONFIG], [:]) define([AC_LIBTOOL_LANG_F77_CONFIG], [:]) @@ -141,6 +151,45 @@ else AC_MSG_RESULT([no]) fi +AC_MSG_CHECKING([whether to enable reentrancy support]) +if test "$enable_reentrant" = "yes"; then + AC_MSG_RESULT([yes]) + AC_MSG_CHECKING([for thread local storage (TLS) class specifier]) + keywords="_Thread_local __thread __declspec(thread)" + tls=none + for tls_keyword in $keywords; do + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ + #include + static void foo(void) + { static ] $tls_keyword [ int bar; + exit(1); + }])], [tls=$tls_keyword; break], []) + done + AC_MSG_RESULT($tls) + if test "$tls" != "none"; then + AC_DEFINE_UNQUOTED([TLS], $tls, [N/A]) + else + AC_MSG_ERROR([Reentrancy needs complier support for TLS]) + fi +else + AC_MSG_RESULT([no]) +fi + +AC_MSG_CHECKING( + [if libtool needs -no-undefined flag to build shared libraries]) +case "${host}" in + *-*-cygwin* | *-*-mingw* | *-*-aix*) + ## Add in the -no-undefined flag to LDFLAGS for libtool. + AC_MSG_RESULT([yes]) + NOUNDEFINED=" -no-undefined" + ;; + *) + ## Don't add in anything. + AC_MSG_RESULT([no]) + ;; +esac +AC_SUBST([NOUNDEFINED]) + AC_CONFIG_FILES( [src/Makefile examples/Makefile Makefile]) AC_OUTPUT diff --git a/resources/3rdparty/glpk-4.57/depcomp b/resources/3rdparty/glpk-4.65/depcomp similarity index 100% rename from resources/3rdparty/glpk-4.57/depcomp rename to resources/3rdparty/glpk-4.65/depcomp diff --git a/resources/3rdparty/glpk-4.57/doc/cnfsat.pdf b/resources/3rdparty/glpk-4.65/doc/cnfsat.pdf similarity index 100% rename from resources/3rdparty/glpk-4.57/doc/cnfsat.pdf rename to resources/3rdparty/glpk-4.65/doc/cnfsat.pdf diff --git a/resources/3rdparty/glpk-4.57/doc/cnfsat.tex b/resources/3rdparty/glpk-4.65/doc/cnfsat.tex similarity index 100% rename from resources/3rdparty/glpk-4.57/doc/cnfsat.tex rename to resources/3rdparty/glpk-4.65/doc/cnfsat.tex diff --git a/resources/3rdparty/glpk-4.65/doc/glpk.pdf b/resources/3rdparty/glpk-4.65/doc/glpk.pdf new file mode 100644 index 000000000..34edcb198 Binary files /dev/null and b/resources/3rdparty/glpk-4.65/doc/glpk.pdf differ diff --git a/resources/3rdparty/glpk-4.57/doc/glpk.tex b/resources/3rdparty/glpk-4.65/doc/glpk.tex similarity index 78% rename from resources/3rdparty/glpk-4.57/doc/glpk.tex rename to resources/3rdparty/glpk-4.65/doc/glpk.tex index b5f88c023..e3a8db495 100644 --- a/resources/3rdparty/glpk-4.57/doc/glpk.tex +++ b/resources/3rdparty/glpk-4.65/doc/glpk.tex @@ -4,9 +4,9 @@ % This code is part of GLPK (GNU Linear Programming Kit). % % Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -% 2009, 2010, 2011, 2013, 2014, 2015 Andrew Makhorin, Department for -% Applied Informatics, Moscow Aviation Institute, Moscow, Russia. All -% rights reserved. E-mail: . +% 2009, 2010, 2011, 2013, 2014, 2015, 2016, 2017 Andrew Makhorin, +% Department for Applied Informatics, Moscow Aviation Institute, +% Moscow, Russia. All rights reserved. E-mail: . % % GLPK is free software: you can redistribute it and/or modify it % under the terms of the GNU General Public License as published by @@ -22,30 +22,38 @@ % along with GLPK. If not, see . %*********************************************************************** +% To produce glpk.pdf from glpk.tex run the following two commands: +% latex glpk.tex +% dvipdfm -p letter glpk.dvi +% Note: You need TeX Live 2010 or later version. + \documentclass[11pt]{report} \usepackage{amssymb} \usepackage[dvipdfm,linktocpage,colorlinks,linkcolor=blue, urlcolor=blue]{hyperref} \usepackage{indentfirst} \usepackage{lscape} +\usepackage{niceframe} \usepackage[all]{xy} +% US Letter = 8.5 x 11 in \setlength{\textwidth}{6.5in} -\setlength{\textheight}{8.5in} +\setlength{\textheight}{9in} \setlength{\oddsidemargin}{0in} \setlength{\topmargin}{0in} \setlength{\headheight}{0in} \setlength{\headsep}{0in} -\setlength{\footskip}{0.5in} +%\setlength{\footskip}{0.5in} \setlength{\parindent}{16pt} \setlength{\parskip}{5pt} \setlength{\topsep}{0pt} \setlength{\partopsep}{0pt} -\setlength{\itemsep}{\parskip} -\setlength{\parsep}{0pt} -\setlength{\leftmargini}{\parindent} -\renewcommand{\labelitemi}{---} +%\setlength{\itemsep}{\parskip} +%\setlength{\parsep}{0pt} +%\setlength{\leftmargini}{\parindent} +%\renewcommand{\labelitemi}{---} +\newcommand{\Item}[1]{\parbox[t]{\parindent}{#1}} \def\para#1{\noindent{\bf#1}} \def\synopsis{\para{Synopsis}} \def\description{\para{Description}} @@ -67,6 +75,8 @@ urlcolor=blue]{hyperref} \thispagestyle{empty} +\artdecoframe{ + \begin{center} \vspace*{1.5in} @@ -84,15 +94,18 @@ urlcolor=blue]{hyperref} \vspace{0.5in} \begin{LARGE} -\sf for GLPK Version 4.57 +\sf for GLPK Version 4.64 \end{LARGE} \vspace{0.5in} \begin{Large} -\sf (DRAFT, November 2015) +\sf (DRAFT, November 2017) \end{Large} \end{center} +\vspace*{3.8in} +} + \newpage \vspace*{1in} @@ -105,9 +118,9 @@ GNU. \noindent Copyright \copyright{} 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -2008, 2009, 2010, 2011, 2013, 2014, 2015 Andrew Makhorin, Department -for Applied Informatics, Moscow Aviation Institute, Moscow, Russia. All -rights reserved. +2008, 2009, 2010, 2011, 2013, 2014, 2015, 2016, 2017 Andrew Makhorin, +Department for Applied Informatics, Moscow Aviation Institute, Moscow, +Russia. All rights reserved. \noindent Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA @@ -133,9 +146,7 @@ versions. \newpage -{\setlength{\parskip}{0pt} -\tableofcontents -} +{\setlength{\parskip}{0pt}\tableofcontents} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/resources/3rdparty/glpk-4.57/doc/glpk01.tex b/resources/3rdparty/glpk-4.65/doc/glpk01.tex similarity index 96% rename from resources/3rdparty/glpk-4.57/doc/glpk01.tex rename to resources/3rdparty/glpk-4.65/doc/glpk01.tex index 29ed67cce..3ffc587e6 100644 --- a/resources/3rdparty/glpk-4.57/doc/glpk01.tex +++ b/resources/3rdparty/glpk-4.65/doc/glpk01.tex @@ -11,10 +11,10 @@ intended for solving linear programming (LP), mixed integer programming \section{LP problem} \label{seclp} -GLPK assumes the following formulation of {\it linear programming (LP)} -problem: +GLPK assumes the following formulation of the {\it linear programming +(LP)} problem: -\medskip\noindent +\noindent \hspace{.5in} minimize (or maximize) $$z = c_1x_{m+1} + c_2x_{m+2} + \dots + c_nx_{m+n} + c_0 \eqno (1.1)$$ \hspace{.5in} subject to linear constraints @@ -36,8 +36,6 @@ l_2&\leq&x_2&\leq&u_2 \\ l_{m+n}&\leq&x_{m+n}&\leq&u_{m+n} \\ \end{array} \eqno (1.3) $$ - -\medskip\noindent where: $x_1, x_2, \dots, x_m$ are auxiliary variables; $x_{m+1}, x_{m+2}, \dots, x_{m+n}$ are structural variables; $z$ is the objective function; @@ -76,16 +74,16 @@ structural as well as to auxiliary variables. To solve the LP problem (1.1)---(1.3) is to find such values of all structural and auxiliary variables, which: -\vspace*{-10pt} +%\vspace*{-10pt} -\begin{itemize}\setlength{\itemsep}{0pt} -\item satisfy to all the linear constraints (1.2), and +%\begin{itemize}\setlength{\itemsep}{0pt} +\Item{---}satisfy to all the linear constraints (1.2), and -\item are within their bounds (1.3), and +\Item{---}are within their bounds (1.3), and -\item provide smallest (in case of minimization) or largest (in case of -maximization) value of the objective function (1.1). -\end{itemize} +\Item{---}provide smallest (in case of minimization) or largest (in +case of maximization) value of the objective function (1.1). +%\end{itemize} \section{MIP problem} @@ -107,8 +105,6 @@ structural variables to be of integer kind.) In order to understand what GLPK is from the user's standpoint, consider the following simple LP problem: -\medskip - \noindent \hspace{.5in} maximize $$z = 10 x_1 + 6 x_2 + 4 x_3$$ @@ -128,8 +124,6 @@ At first, this LP problem should be transformed to the standard form variables, by one for each original inequality constraint. Thus, the problem can be reformulated as follows: -\medskip - \noindent \hspace{.5in} maximize $$z = 10 x_1 + 6 x_2 + 4 x_3$$ @@ -149,9 +143,6 @@ $$ \nonumber -\infty < r \leq 300 && 0 \leq x_3 < +\infty \\ \end{array} $$ - -\medskip - where $p, q, r$ are auxiliary variables (rows), and $x_1, x_2, x_3$ are structural variables (columns). @@ -268,6 +259,8 @@ optimal basic solution found by the solver. The statement \verb|s36| writes the optimal solution to the standard output. The printout may look like follows: +\newpage + \begin{footnotesize} \begin{verbatim} * 0: objval = 0.000000000e+00 infeas = 0.000000000e+00 (0) diff --git a/resources/3rdparty/glpk-4.57/doc/glpk02.tex b/resources/3rdparty/glpk-4.65/doc/glpk02.tex similarity index 95% rename from resources/3rdparty/glpk-4.57/doc/glpk02.tex rename to resources/3rdparty/glpk-4.65/doc/glpk02.tex index 3fa6ef7f7..f49ae75f0 100644 --- a/resources/3rdparty/glpk-4.57/doc/glpk02.tex +++ b/resources/3rdparty/glpk-4.65/doc/glpk02.tex @@ -87,17 +87,17 @@ structure directly and should deal only with pointers to these objects The problem object consists of the following segments: -\vspace*{-8pt} +%\vspace*{-8pt} -\begin{itemize}\setlength{\itemsep}{0pt} -\item problem segment, +%\begin{itemize}\setlength{\itemsep}{0pt} +\Item{---}problem segment, -\item basis segment, +\Item{---}basis segment, -\item interior-point segment, and +\Item{---}interior-point segment, and -\item MIP segment. -\end{itemize} +\Item{---}MIP segment. +%\end{itemize} \subsection{Problem segment} @@ -106,37 +106,37 @@ corresponds to the problem formulation (1.1)---(1.3) (see Section \ref{seclp}, page \pageref{seclp}). This segment includes the following components: -\vspace*{-8pt} +%\vspace*{-8pt} -\begin{itemize}\setlength{\itemsep}{0pt} -\item rows (auxiliary variables), +%\begin{itemize}\setlength{\itemsep}{0pt} +\Item{---}rows (auxiliary variables), -\item columns (structural variables), +\Item{---}columns (structural variables), -\item objective function, and +\Item{---}objective function, and -\item constraint matrix. -\end{itemize} +\Item{---}constraint matrix. +%\end{itemize} -\vspace*{-7pt} +%\vspace*{-7pt} Rows and columns have the same set of the following attributes: -\vspace*{-7pt} +%\vspace*{-7pt} -\begin{itemize}\setlength{\itemsep}{0pt} -\item ordinal number, +%\begin{itemize}\setlength{\itemsep}{0pt} +\Item{---}ordinal number, -\item symbolic name (1 up to 255 arbitrary graphic characters), +\Item{---}symbolic name (1 up to 255 arbitrary graphic characters), -\item type (free, lower bound, upper bound, double bound, fixed), +\Item{---}type (free, lower bound, upper bound, double bound, fixed), -\item numerical values of lower and upper bounds, +\Item{---}numerical values of lower and upper bounds, -\item scale factor. -\end{itemize} +\Item{---}scale factor. +%\end{itemize} -\vspace*{-7pt} +%\vspace*{-7pt} {\it Ordinal numbers} are intended for referencing rows and columns. Row ordinal numbers are integers $1, 2, \dots, m$, and column ordinal @@ -173,19 +173,19 @@ order. The {\it basis segment} of the problem object keeps information related to the current basic solution. It includes: -\vspace*{-8pt} +%\vspace*{-8pt} -\begin{itemize}\setlength{\itemsep}{0pt} -\item row and column statuses, +%\begin{itemize}\setlength{\itemsep}{0pt} +\Item{---}row and column statuses, -\item basic solution statuses, +\Item{---}basic solution statuses, -\item factorization of the current basis matrix, and +\Item{---}factorization of the current basis matrix, and -\item basic solution components. -\end{itemize} +\Item{---}basic solution components. +%\end{itemize} -\vspace*{-8pt} +%\vspace*{-8pt} The {\it row and column statuses} define which rows and columns are basic and which are non-basic. These statuses may be assigned either by @@ -223,17 +223,17 @@ values of all auxiliary and structural variables. The {\it MIP segment} is used only for MIP problems. This segment includes: -\vspace*{-8pt} +%\vspace*{-8pt} -\begin{itemize}\setlength{\itemsep}{0pt} -\item column kinds, +%\begin{itemize}\setlength{\itemsep}{0pt} +\Item{---}column kinds, -\item MIP solution status, and +\Item{---}MIP solution status, and -\item MIP solution components. -\end{itemize} +\Item{---}MIP solution components. +%\end{itemize} -\vspace*{-8pt} +%\vspace*{-8pt} The {\it column kinds} define which columns (i.e. structural variables) are integer and which are continuous. @@ -332,8 +332,7 @@ by the parameter \verb|dir|: \verb|GLP_MAX| means maximization. -\noindent -(Note that by default the problem is minimization.) +Note that by default the problem is minimization. \subsection{glp\_add\_rows --- add new rows to problem object} @@ -513,7 +512,7 @@ while the parameter \verb|ub| is ignored. Being added to the problem object each column is initially fixed at zero, i.e. its type is \verb|GLP_FX| and both bounds are 0. -\newpage +%\newpage \subsection{glp\_set\_obj\_coef --- set (change) objective coefficient or constant term} @@ -533,6 +532,8 @@ the objective coefficient is specified by the parameter \verb|coef|. If the parameter \verb|j| is 0, the routine sets (changes) the constant term (``shift'') of the objective function. +\newpage + \subsection{glp\_set\_mat\_row --- set (replace) row of the constraint matrix} @@ -597,6 +598,8 @@ If the parameter \verb|len| is 0, the parameters \verb|ind| and/or If the basis factorization exists, changing the column corresponding to a basic structural variable invalidates it. +\newpage + \subsection{glp\_load\_matrix --- load (replace) the whole constraint matrix} @@ -710,7 +713,7 @@ remaining rows $a$, $c$, $e$ are assigned new oridinal numbers 1, 2, 3. If the basis factorization exists, deleting active (binding) rows, i.e. whose auxiliary variables are marked as non-basic, invalidates it. -\newpage +%\newpage \subsection{glp\_del\_cols --- delete columns from problem object} @@ -772,7 +775,7 @@ problem object would be deleted with the routine \verb|glp_delete_prob| and then created anew with the routine \verb|glp_create_prob|, with the only exception that the pointer to the problem object remains valid. -\newpage +%\newpage \subsection{glp\_delete\_prob --- delete problem object} @@ -854,6 +857,8 @@ flag (i.e. ``sense'' of the objective function): The routine \verb|glp_get_num_rows| returns the current number of rows in the specified problem object. +\newpage + \subsection{glp\_get\_num\_cols --- retrieve number of columns} \synopsis @@ -1061,7 +1066,7 @@ number of elements in $i$-th row, $n$ is the number of columns. The parameter \verb|ind| and/or \verb|val| can be specified as \verb|NULL|, in which case corresponding information is not stored. -\newpage +%\newpage \returns @@ -1116,28 +1121,28 @@ object. It is important to note that: -1. On creating the problem object with the routine +\Item{1.}On creating the problem object with the routine \verb|glp_create_prob| the name index is {\it not} created. -2. The name index can be created (destroyed) at any time with the +\Item{2.}The name index can be created (destroyed) at any time with the routine \verb|glp_create_index| (\verb|glp_delete_index|). Having been created the name index becomes part of the corresponding problem object. -3. The time taken to create the name index is $O[(m+n)\log_2(m+n)]$, -so it is recommended to create the index only once, for example, just -after the problem object was created. +\Item{3.}The time taken to create the name index is +$O[(m+n)\log_2(m+n)]$, so it is recommended to create the index only +once, for example, just after the problem object was created. -4. If the name index exists, it is automatically updated every time -the name of a row/column is assigned/changed. The update operation +\Item{4.}If the name index exists, it is automatically updated every +time the name of a row/column is assigned/changed. The update operation takes logarithmic time. -5. If the name index does not exist, the application should not call -the routines \verb|glp_find_row| and \verb|glp_find_col|. Otherwise, -an error message will be issued and abnormal program termination will -occur. +\Item{5.}If the name index does not exist, the application should not +call the routines \verb|glp_find_row| and \verb|glp_find_col|. +Otherwise, an error message will be issued and abnormal program +termination will occur. -6. On destroying the problem object with the routine +\Item{6.}On destroying the problem object with the routine \verb|glp_delete_prob|, the name index, if exists, is automatically destroyed. @@ -1267,6 +1272,8 @@ for $i$-th row of the specified problem object. The routine \verb|glp_set_sjj| sets (changes) the scale factor $s_{jj}$ for $j$-th column of the specified problem object. +\newpage + \subsection{glp\_get\_rii --- retrieve row scale factor} \synopsis @@ -1385,7 +1392,7 @@ Another way to construct an initial basis is to use API routines like {\it crashing}.\footnote{This term is from early linear programming systems and means a heuristic to construct a valid initial basis.} Note that on normal exit the simplex solver remains the basis valid, so in -case of reoptimization there is no need to construct an initial basis +case of re-optimization there is no need to construct an initial basis from scratch. \subsection{glp\_set\_row\_stat --- set (change) row status} @@ -1653,9 +1660,7 @@ solver failure.\\ \verb|GLP_EOBJLL| & The search was prematurely terminated, because the objective function being maximized has reached its lower limit and continues decreasing (the dual simplex only).\\ -\end{retlist} -\begin{retlist} \verb|GLP_EOBJUL| & The search was prematurely terminated, because the objective function being minimized has reached its upper limit and continues increasing (the dual simplex only).\\ @@ -1665,7 +1670,9 @@ simplex iteration limit has been exceeded.\\ \verb|GLP_ETMLIM| & The search was prematurely terminated, because the time limit has been exceeded.\\ +\end{retlist} +\begin{retlist} \verb|GLP_ENOPFS| & The LP problem instance has no primal feasible solution (only if the LP presolver is used).\\ @@ -1710,7 +1717,7 @@ reports some information about the current basic solution, which is sent to the terminal. This information has the following format: \begin{verbatim} - nnn: obj = xxx infeas = yyy (ddd) + nnn: obj = xxx infeas = yyy (num) cnt \end{verbatim} \noindent @@ -1718,8 +1725,9 @@ where: `\verb|nnn|' is the iteration number, `\verb|xxx|' is the current value of the objective function (it is unscaled and has correct sign); `\verb|yyy|' is the current sum of primal or dual infeasibilities (it is scaled and therefore may be used only for visual -estimating), `\verb|ddd|' is the current number of fixed basic -variables. +estimating), `\verb|num|' is the current number of primal or dual +infeasibilities (phase I) or non-optimalities (phase II), `\verb|cnt|' +is the number of basis factorizations since the last terminal output. The symbol preceding the iteration number indicates which phase of the simplex method is in effect: @@ -1731,8 +1739,10 @@ the dual simplex; {\it Asterisk} (\verb|*|) means that the solver is searching for optimal solution using the primal simplex; -{\it Vertical dash} (\verb/|/) means that the solver is searching for -optimal solution using the dual simplex. +{\it Hash} (\verb|#|) means that the solver is searching for optimal +solution using the dual simplex. + +\newpage \para{Control parameters} @@ -1795,7 +1805,8 @@ Tolerance used to check if the basic solution is primal feasible. (Do not change this parameter without detailed understanding its purpose.) -\newpage +%\newpage +\bigskip {\tt double tol\_dj} (default: {\tt 1e-7}) @@ -1811,7 +1822,8 @@ Tolerance used to choose eligble pivotal elements of the simplex table. (Do not change this parameter without detailed understanding its purpose.) -\bigskip +%\bigskip +\newpage {\tt double obj\_ll} (default: {\tt -DBL\_MAX}) @@ -1903,28 +1915,25 @@ Below here is shown the terminal output from this example program. \begin{footnotesize} \begin{verbatim} -Reading problem data from `25fv47.mps'... +Reading problem data from '25fv47.mps'... Problem: 25FV47 Objective: R0000 822 rows, 1571 columns, 11127 non-zeros 6919 records were read -Crashing... -Size of triangular part = 799 - 0: obj = 1.627307307e+04 infeas = 5.194e+04 (23) - 200: obj = 1.474901610e+04 infeas = 1.233e+04 (19) - 400: obj = 1.343909995e+04 infeas = 3.648e+03 (13) - 600: obj = 1.756052217e+04 infeas = 4.179e+02 (7) -* 775: obj = 1.789251591e+04 infeas = 4.982e-14 (1) -* 800: obj = 1.663354510e+04 infeas = 2.857e-14 (1) -* 1000: obj = 1.024935068e+04 infeas = 1.958e-12 (1) -* 1200: obj = 7.860174791e+03 infeas = 2.810e-29 (1) -* 1400: obj = 6.642378184e+03 infeas = 2.036e-16 (1) -* 1600: obj = 6.037014568e+03 infeas = 0.000e+00 (1) -* 1800: obj = 5.662171307e+03 infeas = 6.447e-15 (1) -* 2000: obj = 5.528146165e+03 infeas = 9.764e-13 (1) -* 2125: obj = 5.501845888e+03 infeas = 0.000e+00 (1) -OPTIMAL SOLUTION FOUND -Writing basic solution to `25fv47.txt'... +One free row was removed +Constructing initial basis... +Size of triangular part is 812 +GLPK Simplex Optimizer, v4.57 +821 rows, 1571 columns, 10400 non-zeros + 0: obj = 7.131703290e+03 inf = 2.145e+05 (204) + 500: obj = 1.886711682e+04 inf = 8.273e+02 (36) 4 + 741: obj = 1.846047936e+04 inf = 5.575e-14 (0) 2 +* 1000: obj = 9.220063473e+03 inf = 2.423e-14 (432) 2 +* 1500: obj = 6.187659664e+03 inf = 1.019e-13 (368) 4 +* 2000: obj = 5.503442062e+03 inf = 0.000e+00 (33) 5 +* 2052: obj = 5.501845888e+03 inf = 0.000e+00 (0) +OPTIMAL LP SOLUTION FOUND +Writing basic solution to '25fv47.txt'... \end{verbatim} \end{footnotesize} @@ -1965,31 +1974,24 @@ Below here is shown the terminal output from this example program. \begin{footnotesize} \begin{verbatim} -Reading problem data from `25fv47.mps'... +Reading problem data from '25fv47.mps'... Problem: 25FV47 Objective: R0000 822 rows, 1571 columns, 11127 non-zeros 6919 records were read - 0: infeas = 1.223e+03 (516) - 200: infeas = 7.000e+00 (471) - 240: infeas = 1.106e-14 (461) -| 400: obj = -5.394267152e+03 infeas = 5.571e-16 (391) -| 600: obj = -4.586395752e+03 infeas = 1.389e-15 (340) -| 800: obj = -4.158268146e+03 infeas = 1.640e-15 (264) -| 1000: obj = -3.725320045e+03 infeas = 5.181e-15 (245) -| 1200: obj = -3.104802163e+03 infeas = 1.019e-14 (210) -| 1400: obj = -2.584190499e+03 infeas = 8.865e-15 (178) -| 1600: obj = -2.073852927e+03 infeas = 7.867e-15 (142) -| 1800: obj = -1.164037407e+03 infeas = 8.792e-15 (109) -| 2000: obj = -4.370590250e+02 infeas = 2.591e-14 (85) -| 2200: obj = 1.068240144e+03 infeas = 1.025e-13 (70) -| 2400: obj = 1.607481126e+03 infeas = 3.272e-14 (67) -| 2600: obj = 3.038230551e+03 infeas = 4.850e-14 (52) -| 2800: obj = 4.316238187e+03 infeas = 2.622e-14 (36) -| 3000: obj = 5.443842629e+03 infeas = 3.976e-15 (11) -| 3060: obj = 5.501845888e+03 infeas = 8.806e-15 (2) -OPTIMAL SOLUTION FOUND -Writing basic solution to `25fv47.txt'... +One free row was removed +GLPK Simplex Optimizer, v4.57 +821 rows, 1571 columns, 10400 non-zeros + 0: inf = 1.223e+02 (41) + 258: inf = 3.091e-16 (0) 2 +# 500: obj = -5.071287080e+03 inf = 2.947e-15 (292) 2 +# 1000: obj = -1.352843873e+03 inf = 8.452e-15 (302) 5 +# 1500: obj = 7.985859737e+02 inf = 1.127e-14 (263) 5 +# 2000: obj = 3.059023029e+03 inf = 6.290e-11 (197) 4 +# 2500: obj = 5.354770966e+03 inf = 7.172e-13 (130) 5 +# 2673: obj = 5.501845888e+03 inf = 3.802e-16 (0) 2 +OPTIMAL LP SOLUTION FOUND +Writing basic solution to '25fv47.txt'... \end{verbatim} \end{footnotesize} @@ -2012,9 +2014,9 @@ internal computations it uses arithmetic of rational numbers, which is exact in mathematical sense, i.e. free of round-off errors unlike floating-point arithmetic. -Note that the routine \verb|glp_exact| uses only two control parameters -passed in the structure \verb|glp_smcp|, namely, \verb|it_lim| and -\verb|tm_lim|. +Note that the routine \verb|glp_exact| uses only three control +parameters passed in the structure \verb|glp_smcp|, namely, +\verb|msg_lev|, \verb|it_lim|, and \verb|tm_lim|. \returns @@ -2182,7 +2184,7 @@ the auxiliary variable associated with \verb|i|-th row as follows: \verb|GLP_NS| --- non-basic fixed variable. -\newpage +%\newpage \subsection{glp\_get\_row\_prim --- retrieve row primal value} @@ -2246,7 +2248,7 @@ the structural variable associated with \verb|j|-th column as follows: The routine \verb|glp_get_col_prim| returns primal value of the structural variable associated with \verb|j|-th column. -\newpage +%\newpage \subsection{glp\_get\_col\_dual --- retrieve column dual value} @@ -2261,6 +2263,8 @@ structural variable associated with \verb|j|-th column. The routine \verb|glp_get_col_dual| returns dual value (i.e. reduced cost) of the structural variable associated with \verb|j|-th column. +\newpage + \subsection{glp\_get\_unbnd\_ray --- determine variable causing unboundedness} @@ -2433,22 +2437,22 @@ interior point method. SIAM J. on Optim., 2(4), pp. 575-601, 1992.} Note that currently the GLPK interior-point solver does not include many important features, in particular: -\vspace*{-8pt} +%\vspace*{-8pt} -\begin{itemize} -\item it is not able to process dense columns. Thus, if the constraint -matrix of the LP problem has dense columns, the solving process may be -inefficient; +%\begin{itemize} +\Item{---}it is not able to process dense columns. Thus, if the +constraint matrix of the LP problem has dense columns, the solving +process may be inefficient; -\item it has no features against numerical instability. For some LP +\Item{---}it has no features against numerical instability. For some LP problems premature termination may happen if the matrix $ADA^T$ becomes singular or ill-conditioned; -\item it is not able to identify the optimal basis, which corresponds -to the interior-point solution found. -\end{itemize} +\Item{---}it is not able to identify the optimal basis, which +corresponds to the interior-point solution found. +%\end{itemize} -\vspace*{-8pt} +%\vspace*{-8pt} \para{Terminal output} @@ -3207,6 +3211,8 @@ by the solver). The routine \verb|glp_mip_obj_val| returns value of the objective function for MIP solution. +\newpage + \subsection{glp\_mip\_row\_val --- retrieve row value} \synopsis @@ -3305,6 +3311,8 @@ and variables with numbers $m+1$ to $m+n$ correspond to columns. If the error reported is exact zero, corresponding row, column or variable number is set to zero. +\newpage + \para{Background} \def\arraystretch{1.5} @@ -3359,6 +3367,8 @@ correspond to largest absolute and relative errors: $${\tt ae\_max}=\max_{1\leq k \leq m+n}|h_k|,$$ $${\tt re\_max}=\max_{1\leq k \leq m+n}\frac{|h_k|}{1+|x_k|}.$$ +\newpage + The third condition checked by the routine is: $${\rm grad}\;Z = c = (\tilde{A})^T \pi + d,$$ where $Z$ is the objective function, $c$ is the vector of objective diff --git a/resources/3rdparty/glpk-4.57/doc/glpk03.tex b/resources/3rdparty/glpk-4.65/doc/glpk03.tex similarity index 62% rename from resources/3rdparty/glpk-4.57/doc/glpk03.tex rename to resources/3rdparty/glpk-4.65/doc/glpk03.tex index 82848a14b..6086c54c1 100644 --- a/resources/3rdparty/glpk-4.57/doc/glpk03.tex +++ b/resources/3rdparty/glpk-4.65/doc/glpk03.tex @@ -168,7 +168,7 @@ If the operation was successful, the routine \verb|glp_read_prob| returns zero. Otherwise, it prints an error message and returns non-zero. -\newpage +%\newpage \para{GLPK LP/MIP format} @@ -182,6 +182,8 @@ end-of-line character. Fields in each line are separated by at least one blank space. Each line begins with a one-character designator to identify the line type. +\newpage + The first line of the data file must be the problem line (except optional comment lines, which may precede the problem line). The last line of the data file must be the end line. Other lines may follow in @@ -553,45 +555,46 @@ an internal code and then interprets (executes) this code. The processing of a model written in GNU MathProg includes several steps, which should be performed in the following order: -\vspace*{-8pt} +%\vspace*{-8pt} -\begin{enumerate} -\item{\it Allocating the workspace.} +%\begin{enumerate} +\Item{1.}{\it Allocating the workspace.} The translator allocates the workspace, an internal data structure used on all subsequent steps. -\item{\it Reading model section.} The translator reads model section -and, optionally, data section from a specified text file and translates -them into the internal code. If necessary, on this step data section -may be ignored. +\Item{2.}{\it Reading model section.} The translator reads model +section and, optionally, data section from a specified text file and +translates them into the internal code. If necessary, on this step data +section may be ignored. -\item{\it Reading data section(s).} The translator reads one or more -data sections from specified text file(s) and translates them into the -internal code. +\Item{3.}{\it Reading data section(s).} The translator reads one or +more data sections from specified text file(s) and translates them into +the internal code. -\item{\it Generating the model.} The translator executes the internal -code to evaluate the content of the model objects such as sets, +\Item{4.}{\it Generating the model.} The translator executes the +internal code to evaluate the content of the model objects such as sets, parameters, variables, constraints, and objectives. On this step the execution is suspended at the solve statement. -\item {\it Building the problem object.} The translator obtains all +\Item{5.}{\it Building the problem object.} The translator obtains all necessary information from the workspace and builds the standard problem object (that is, the program object of type \verb|glp_prob|). -\item{\it Solving the problem.} On this step the problem object built -on the previous step is passed to a solver, which solves the problem -instance and stores its solution back to the problem object. +\Item{6.}{\it Solving the problem.} On this step the problem object +built on the previous step is passed to a solver, which solves the +problem instance and stores its solution back to the problem object. -\item{\it Postsolving the model.} The translator copies the solution -from the problem object to the workspace and then executes the internal -code from the solve statement to the end of the model. (If model has -no solve statement, the translator does nothing on this step.) +\Item{7.}{\it Postsolving the model.} The translator copies the +solution from the problem object to the workspace and then executes the +internal code from the solve statement to the end of the model. +(If model has no solve statement, the translator does nothing on this +step.) -\item{\it Freeing the workspace.} The translator frees all the memory -allocated to the workspace. -\end{enumerate} +\Item{8.}{\it Freeing the workspace.} The translator frees all the +memory allocated to the workspace. +%\end{enumerate} -\vspace*{-8pt} +%\vspace*{-8pt} Note that the MathProg translator performs no error correction, so if any of steps 2 to 7 fails (due to errors in the model), the application @@ -725,6 +728,26 @@ allocated, if necessary.) The routine returns a pointer to the workspace, which should be used in all subsequent operations. +\subsection{glp\_mpl\_init\_rand --- initialize pseudo-random number +generator} + +\synopsis + +\begin{verbatim} + void glp_mpl_init_rand(glp_tran *tran, int seed); +\end{verbatim} + +\description + +The routine \verb|glp_mpl_init_rand| initializes a pseudo-random number +generator used by the MathProg translator, where the parameter +\verb|seed| may be any integer number. + +A call to the routine \verb|glp_mpl_init_rand| should immediately +follow the call to the routine \verb|glp_mpl_alloc_wksp|. However, +using of this routine is optional. If it is not called, the effect is +the same as if it were called with \verb|seed| equal to 1. + \subsection{glp\_mpl\_read\_model --- read and translate model section} \synopsis @@ -751,6 +774,8 @@ allows reading data section(s) from other file(s). If the operation is successful, the routine returns zero. Otherwise the routine prints an error message and returns non-zero. +\newpage + \subsection{glp\_mpl\_read\_data --- read and translate data section} \synopsis @@ -771,8 +796,6 @@ workspace. If necessary, this routine may be called more than once. If the operation is successful, the routine returns zero. Otherwise the routine prints an error message and returns non-zero. -\newpage - \subsection{glp\_mpl\_generate --- generate the model} \synopsis @@ -816,7 +839,7 @@ from the translator work\-space and stores it in the specified problem object \verb|P|. Note that before building the current content of the problem object is erased with the routine \verb|glp_erase_prob|. -\vspace*{-6pt} +\newpage \subsection{glp\_mpl\_postsolve --- postsolve the model} @@ -878,7 +901,7 @@ format} \description -The routine \verb|glp_print_sol writes| the current basic solution of +The routine \verb|glp_print_sol writes| the current basic solution to an LP problem, which is specified by the pointer \verb|P|, to a text file, whose name is the character string \verb|fname|, in printable format. @@ -891,7 +914,7 @@ mainly for visual analysis. If no errors occurred, the routine returns zero. Otherwise the routine prints an error message and returns non-zero. -\subsection{glp\_read\_sol --- read basic solution from text file} +\subsection{glp\_read\_sol --- read basic solution in GLPK format} \synopsis @@ -902,95 +925,217 @@ prints an error message and returns non-zero. \description The routine \verb|glp_read_sol| reads basic solution from a text file -whose name is specified by the parameter \verb|fname| into the problem -object. +in the GLPK format. (For description of the format see below.) -For the file format see description of the routine -\verb|glp_write_sol|. +The character string \verb|fname| specifies the name of the text file +to be read in. (If the file name ends with suffix `\verb|.gz|', the +file is assumed to be compressed, in which case the routine +\verb|glp_read_sol| decompresses it "on the fly".) \returns -On success the routine returns zero, otherwise non-zero. +If the operation was successful, the routine \verb|glp_read_sol| +returns zero. Otherwise, it prints an error message and returns +non-zero. -\subsection{glp\_write\_sol --- write basic solution to text file} +\para{GLPK basic solution format} -\synopsis +The GLPK basic solution format is a DIMACS-like format.\footnote{The +DIMACS formats were developed by the Center for Discrete Mathematics +and Theoretical Computer Science (DIMACS) to facilitate exchange of +problem data. +For details see: {\tt }. } +The file in this format is a plain ASCII text file containing lines of +several types described below. A line is terminated with the +end-of-line character. Fields in each line are separated by at least +one blank space. Each line begins with a one-character designator to +identify the line type. + +The first line of the solution file must be the solution line (except +optional comment lines, which may precede the problem line). The last +line of the data file must be the end line. Other lines may follow in +arbitrary order, however, duplicate lines are not allowed. + +\newpage + +\para{Comment lines.} Comment lines give human-readable information +about the solution file and are ignored by GLPK routines. Comment lines +can appear anywhere in the data file. Each comment line begins with the +lower-case character \verb|c|. \begin{verbatim} - int glp_write_sol(glp_prob *P, const char *fname); + c This is an example of comment line \end{verbatim} -\description +\para{Solution line.} There must be exactly one solution line in the +solution file. This line must appear before any other lines except +comment lines and has the following format: -The routine \verb|glp_write_sol| writes the current basic solution to -a text file whose name is specified by the parameter \verb|fname|. This -file can be read back with the routine \verb|glp_read_sol|. +\begin{verbatim} + s bas ROWS COLS PST DST OBJ +\end{verbatim} -\returns +The lower-case letter \verb|s| specifies that this is the solution +line. -On success the routine returns zero, otherwise non-zero. +The three-character solution designator \verb|bas| identifies the file +as containing a basic solution to the LP problem instance. -\newpage +The \verb|ROWS| and \verb|COLS| fields contain non-negative integer +values that specify the number of rows (constraints) and columns +(variables), resp., in the LP problem instance. + +The \verb|PST| and \verb|DST| fields contain lower-case letters that +specify the primal and dual solution status, resp., as follows: + +\verb|u| --- solution is undefined; + +\verb|f| --- solution is feasible; -\para{File format} +\verb|i| --- solution is infeasible; -The file created by the routine \verb|glp_write_sol| is a plain text -file, which contains the following information: +\verb|n| --- no feasible solution exists. + +The \verb|OBJ| field contains a floating-point number that specifies +the objective function value in the basic solution. + +\para{Row solution descriptors.} There must be exactly one row solution +descriptor line in the solution file for each row (constraint). This +line has the following format: \begin{verbatim} - m n - p_stat d_stat obj_val - r_stat[1] r_prim[1] r_dual[1] - . . . - r_stat[m] r_prim[m] r_dual[m] - c_stat[1] c_prim[1] c_dual[1] - . . . - c_stat[n] c_prim[n] c_dual[n] + i ROW ST PRIM DUAL \end{verbatim} -\noindent -where: +The lower-case letter \verb|i| specifies that this is the row solution +descriptor line. -\noindent -$m$ is the number of rows (auxiliary variables); +The \verb|ROW| field specifies the row ordinal number, an integer +between 1 and $m$, where $m$ is the number of rows in the problem +instance. -\noindent -$n$ is the number of columns (structural variables); +The \verb|ST| field contains one of the following lower-case letters +that specifies the row status in the basic solution:\footnote{The row +status is the status of the associated auxiliary variable.} -\noindent -\verb|p_stat| is the primal status of the basic solution\\ -(\verb|GLP_UNDEF| = 1, \verb|GLP_FEAS| = 2, \verb|GLP_INFEAS| = 3, or -\verb|GLP_NOFEAS| = 4); +\verb|b| --- inactive constraint; -\noindent -\verb|d_stat| is the dual status of the basic solution\\ -(\verb|GLP_UNDEF| = 1, \verb|GLP_FEAS| = 2, \verb|GLP_INFEAS| = 3, or -\verb|GLP_NOFEAS| = 4); +\verb|l| --- inequality constraint active on its lower bound; -\noindent -\verb|obj_val| is the objective value; +\verb|u| --- inequality constraint active on its upper bound; -\noindent -\verb|r_stat[i]|, $i=1,\dots,m$, is the status of $i$-th row\\ -(\verb|GLP_BS| = 1, \verb|GLP_NL| = 2, \verb|GLP_NU| = 3, -\verb|GLP_NF| = 4, or \verb|GLP_NS| = 5); +\verb|f| --- active free (unounded) row; -\noindent -\verb|r_prim[i]|, $i=1,\dots,m$, is the primal value of $i$-th row; +\verb|s| --- active equality constraint. -\noindent -\verb|r_dual[i]|, $i=1,\dots,m$, is the dual value of $i$-th row; +The \verb|PRIM| field contains a floating-point number that specifies +the row primal value (the value of the corresponding linear form). -\noindent -\verb|c_stat[j]|, $j=1,\dots,n$, is the status of $j$-th column\\ -(\verb|GLP_BS| = 1, \verb|GLP_NL| = 2, \verb|GLP_NU| = 3, -\verb|GLP_NF| = 4, or \verb|GLP_NS| = 5); +The \verb|DUAL| field contains a floating-point number that specifies +the row dual value (the Lagrangian multiplier for active bound). -\noindent -\verb|c_prim[j]|, $j=1,\dots,n$, is the primal value of $j$-th column; +\para{Column solution descriptors.} There must be exactly one column +solution descriptor line in the solution file for each column +(variable). This line has the following format: -\noindent -\verb|c_dual[j]|, $j=1,\dots,n$, is the dual value of $j$-th column. +\begin{verbatim} + j COL ST PRIM DUAL +\end{verbatim} + +The lower-case letter \verb|j| specifies that this is the column +solution descriptor line. + +The \verb|COL| field specifies the column ordinal number, an integer +between 1 and $n$, where $n$ is the number of columns in the problem +instance. + +The \verb|ST| field contains one of the following lower-case letters +that specifies the column status in the basic solution: + +\verb|b| --- basic variable; + +\verb|l| --- non-basic variable having its lower bound active; + +\verb|u| --- non-basic variable having its upper bound active; + +\verb|f| --- non-basic free (unounded) variable; + +\verb|s| --- non-basic fixed variable. + +The \verb|PRIM| field contains a floating-point number that specifies +the column primal value. + +The \verb|DUAL| field contains a floating-point number that specifies +the column dual value (the Lagrangian multiplier for active bound). + +\para{End line.} There must be exactly one end line in the solution +file. This line must appear last in the file and has the following +format: + +\begin{verbatim} + e +\end{verbatim} + +The lower-case letter \verb|e| specifies that this is the end line. +Anything that follows the end line is ignored by GLPK routines. + +\para{Example of solution file in GLPK basic solution format} + +The following example of a solution file in GLPK basic solution format +specifies the optimal basic solution to the LP problem instance from +Subsection ``Example of MPS file''. + +\bigskip + +\begin{center} +\footnotesize\tt +\begin{tabular}{l@{\hspace*{50pt}}} +s bas 7 7 f f 296.216606498195 \\ +i 1 s 2000 -0.0135956678700369 \\ +i 2 u 60 -2.56823104693141 \\ +i 3 b 83.9675090252707 0 \\ +i 4 u 40 -0.544404332129962 \\ +i 5 b 19.9602888086643 0 \\ +i 6 l 1500 0.251985559566788 \\ +i 7 l 250 0.48519855595668 \\ +\end{tabular} +\begin{tabular}{|@{\hspace*{50pt}}l} +j 1 l 0 0.253624548736462 \\ +j 2 b 665.342960288809 0 \\ +j 3 b 490.252707581226 0 \\ +j 4 b 424.187725631769 0 \\ +j 5 l 0 0.0145559566787004 \\ +j 6 b 299.638989169676 0 \\ +j 7 b 120.57761732852 0 \\ +e o f \\ +\end{tabular} +\end{center} + +\newpage + +\subsection{glp\_write\_sol --- write basic solution in GLPK format} + +\synopsis + +\begin{verbatim} + int glp_write_sol(glp_prob *P, const char *fname); +\end{verbatim} + +\description + +The routine \verb|glp_write_sol| writes the current basic solution to +a text file in the GLPK format. (For description of the GLPK basic +solution format see Subsection ``Read basic solution in GLPK format.'') + +The character string \verb|fname| specifies the name of the text file +to be written. (If the file name ends with suffix `\verb|.gz|', the +routine \verb|glp_write_sol| compresses it "on the fly".) + +\returns + +If the operation was successful, the routine \verb|glp_write_sol| +returns zero. Otherwise, it prints an error message and returns +non-zero. \subsection{glp\_print\_ipt --- write interior-point solution in printable format} @@ -1004,22 +1149,20 @@ printable format} \description The routine \verb|glp_print_ipt| writes the current interior point -solution of an LP problem, which the parameter \verb|P| points to, to +solution to an LP problem, which the parameter \verb|P| points to, to a text file, whose name is the character string \verb|fname|, in printable format. Information reported by the routine \verb|glp_print_ipt| is intended mainly for visual analysis. -\newpage - \returns If no errors occurred, the routine returns zero. Otherwise the routine prints an error message and returns non-zero. -\subsection{glp\_read\_ipt --- read interior-point solution from text -file} +\subsection{glp\_read\_ipt --- read interior-point solution in GLPK +format} \synopsis @@ -1030,79 +1173,193 @@ file} \description The routine \verb|glp_read_ipt| reads interior-point solution from -a text file whose name is specified by the parameter \verb|fname| into -the problem object. +a text file in the GLPK format. (For description of the format see +below.) + +The character string \verb|fname| specifies the name of the text file +to be read in. (If the file name ends with suffix `\verb|.gz|', the +file is assumed to be compressed, in which case the routine +\verb|glp_read_ipt| decompresses it "on the fly".) -For the file format see description of the routine -\verb|glp_write_ipt|. +%\newpage \returns -On success the routine returns zero, otherwise non-zero. +If the operation was successful, the routine \verb|glp_read_ipt| +returns zero. Otherwise, it prints an error message and returns +non-zero. -\subsection{glp\_write\_ipt --- write interior-point solution to text -file} +\para{GLPK interior-point solution format} -\synopsis +The GLPK interior-point solution format is a DIMACS-like +format.\footnote{The DIMACS formats were developed by the Center for +Discrete Mathematics and Theoretical Computer Science (DIMACS) to +facilitate exchange of problem data. For details see: +{\tt }. } +The file in this format is a plain ASCII text file containing lines of +several types described below. A line is terminated with the +end-of-line character. Fields in each line are separated by at least +one blank space. Each line begins with a one-character designator to +identify the line type. + +The first line of the solution file must be the solution line (except +optional comment lines, which may precede the problem line). The last +line of the data file must be the end line. Other lines may follow in +arbitrary order, however, duplicate lines are not allowed. + +\para{Comment lines.} Comment lines give human-readable information +about the solution file and are ignored by GLPK routines. Comment lines +can appear anywhere in the data file. Each comment line begins with the +lower-case character \verb|c|. \begin{verbatim} - int glp_write_ipt(glp_prob *P, const char *fname); + c This is an example of comment line \end{verbatim} -\description +\para{Solution line.} There must be exactly one solution line in the +solution file. This line must appear before any other lines except +comment lines and has the following format: -The routine \verb|glp_write_ipt| writes the current interior-point -solution to a text file whose name is specified by the parameter -\verb|fname|. This file can be read back with the routine -\verb|glp_read_ipt|. +\begin{verbatim} + s ipt ROWS COLS SST OBJ +\end{verbatim} -\returns +The lower-case letter \verb|s| specifies that this is the solution +line. + +The three-character solution designator \verb|ipt| identifies the file +as containing an interior-point solution to the LP problem instance. + +The \verb|ROWS| and \verb|COLS| fields contain non-negative integer +values that specify the number of rows (constraints) and columns +(variables), resp., in the LP problem instance. -On success the routine returns zero, otherwise non-zero. +The \verb|SST| field contains one of the following lower-case letters +that specifies the solution status: -\para{File format} +\verb|o| --- solution is optimal; -The file created by the routine \verb|glp_write_ipt| is a plain text -file, which contains the following information: +\verb|i| --- solution is infeasible; + +\verb|n| --- no feasible solution exists; + +\verb|u| --- solution is undefined. + +The \verb|OBJ| field contains a floating-point number that specifies +the objective function value in the interior-point solution. + +\para{Row solution descriptors.} There must be exactly one row solution +descriptor line in the solution file for each row (constraint). This +line has the following format: \begin{verbatim} - m n - stat obj_val - r_prim[1] r_dual[1] - . . . - r_prim[m] r_dual[m] - c_prim[1] c_dual[1] - . . . - c_prim[n] c_dual[n] + i ROW PRIM DUAL \end{verbatim} -\noindent -where: +The lower-case letter \verb|i| specifies that this is the row solution +descriptor line. -\noindent -$m$ is the number of rows (auxiliary variables); +%\newpage -\noindent -$n$ is the number of columns (structural variables); +The \verb|ROW| field specifies the row ordinal number, an integer +between 1 and $m$, where $m$ is the number of rows in the problem +instance. -\noindent -\verb|stat| is the solution status (\verb|GLP_UNDEF| = 1 or -\verb|GLP_OPT| = 5); +The \verb|PRIM| field contains a floating-point number that specifies +the row primal value (the value of the corresponding linear form). -\noindent -\verb|obj_val| is the objective value; +The \verb|DUAL| field contains a floating-point number that specifies +the row dual value (the Lagrangian multiplier for active bound). -\noindent -\verb|r_prim[i]|, $i=1,\dots,m$, is the primal value of $i$-th row; +\para{Column solution descriptors.} There must be exactly one column +solution descriptor line in the solution file for each column +(variable). This line has the following format: -\noindent -\verb|r_dual[i]|, $i=1,\dots,m$, is the dual value of $i$-th row; +\begin{verbatim} + j COL PRIM DUAL +\end{verbatim} -\noindent -\verb|c_prim[j]|, $j=1,\dots,n$, is the primal value of $j$-th column; +The lower-case letter \verb|j| specifies that this is the column +solution descriptor line. -\noindent -\verb|c_dual[j]|, $j=1,\dots,n$, is the dual value of $j$-th column. +The \verb|COL| field specifies the column ordinal number, an integer +between 1 and $n$, where $n$ is the number of columns in the problem +instance. + +The \verb|PRIM| field contains a floating-point number that specifies +the column primal value. + +The \verb|DUAL| field contains a floating-point number that specifies +the column dual value (the Lagrangian multiplier for active bound). + +\para{End line.} There must be exactly one end line in the solution +file. This line must appear last in the file and has the following +format: + +\begin{verbatim} + e +\end{verbatim} + +The lower-case letter \verb|e| specifies that this is the end line. +Anything that follows the end line is ignored by GLPK routines. + +\para{Example of solution file in GLPK interior-point solution format} + +The following example of a solution file in GLPK interior-point +solution format specifies the optimal interior-point solution to the LP +problem instance from Subsection ``Example of MPS file''. + +\bigskip + +\begin{center} +\footnotesize\tt +\begin{tabular}{l@{\hspace*{10pt}}} +s ipt 7 7 o 296.216606851403 \\ +i 1 2000.00000290369 -0.0135956757623443 \\ +i 2 60.0000001302903 -2.568231024875 \\ +i 3 83.9675094251819 -8.85591445202383e-10 \\ +i 4 39.9999999985064 -0.544404310443766 \\ +i 5 19.9602886941262 -2.24817803513554e-09 \\ +i 6 1500.00000199013 0.251985567257828 \\ +i 7 250.000000244896 0.48519856304979 \\ +\end{tabular} +\begin{tabular}{|@{\hspace*{10pt}}l} +j 1 3.3482079213784e-07 0.253624547432525 \\ +j 2 665.342955760768 6.04613825351601e-11 \\ +j 3 490.25271366802 5.8488360240978e-10 \\ +j 4 424.187729774275 -2.54144550490434e-11 \\ +j 5 1.46067738492801e-06 0.0145559574770786 \\ +j 6 299.638985053112 1.49359074902927e-10 \\ +j 7 120.577616852015 3.50297708781545e-10 \\ +e o f +\end{tabular} +\end{center} + +\subsection{glp\_write\_ipt --- write interior-point solution in GLPK +format} + +\synopsis + +\begin{verbatim} + int glp_write_ipt(glp_prob *P, const char *fname); +\end{verbatim} + +\description + +The routine \verb|glp_write_ipt| writes the current interior-point +solution to a text file in the GLPK format. (For description of the +GLPK interior-point solution format see Subsection ``Read +interior-point solution in GLPK format.'') + +The character string \verb|fname| specifies the name of the text file +to be written. (If the file name ends with suffix `\verb|.gz|', the +routine \verb|glp_write_ipt| compresses it "on the fly".) + +\returns + +If the operation was successful, the routine \verb|glp_write_ipt| +returns zero. Otherwise, it prints an error message and returns +non-zero. \subsection{glp\_print\_mip --- write MIP solution in printable format} @@ -1114,10 +1371,9 @@ $n$ is the number of columns (structural variables); \description -The routine \verb|glp_print_mip| writes a best known integer solution -of a MIP problem, which is specified by the pointer \verb|P|, to -a text file, whose name is the character string \verb|fname|, in -printable format. +The routine \verb|glp_print_mip| writes the current solution to a MIP +problem, which is specified by the pointer \verb|P|, to a text file, +whose name is the character string \verb|fname|, in printable format. Information reported by the routine \verb|glp_print_mip| is intended mainly for visual analysis. @@ -1127,7 +1383,7 @@ mainly for visual analysis. If no errors occurred, the routine returns zero. Otherwise the routine prints an error message and returns non-zero. -\subsection{glp\_read\_mip --- read MIP solution from text file} +\subsection{glp\_read\_mip --- read MIP solution in GLPK format} \synopsis @@ -1137,74 +1393,182 @@ prints an error message and returns non-zero. \description -The routine \verb|glp_read_mip| reads MIP solution from a text file -whose name is specified by the parameter \verb|fname| into the problem -object. +The routine \verb|glp_read_mip| reads MIP solution from a text file in +the GLPK format. (For description of the format see below.) -For the file format see description of the routine -\verb|glp_write_mip|. +The character string \verb|fname| specifies the name of the text file +to be read in. (If the file name ends with suffix `\verb|.gz|', the +file is assumed to be compressed, in which case the routine +\verb|glp_read_mip| decompresses it "on the fly".) \returns -On success the routine returns zero, otherwise non-zero. +If the operation was successful, the routine \verb|glp_read_mip| +returns zero. Otherwise, it prints an error message and returns +non-zero. -\newpage +\para{GLPK MIP solution format} -\subsection{glp\_write\_mip --- write MIP solution to text file} +The GLPK MIP solution format is a DIMACS-like format.\footnote{The +DIMACS formats were developed by the Center for Discrete Mathematics +and Theoretical Computer Science (DIMACS) to facilitate exchange of +problem data. For details see: +{\tt }. } +The file in this format is a plain ASCII text file containing lines of +several types described below. A line is terminated with the +end-of-line character. Fields in each line are separated by at least +one blank space. Each line begins with a one-character designator to +identify the line type. -\synopsis +The first line of the solution file must be the solution line (except +optional comment lines, which may precede the problem line). The last +line of the data file must be the end line. Other lines may follow in +arbitrary order, however, duplicate lines are not allowed. + +\para{Comment lines.} Comment lines give human-readable information +about the solution file and are ignored by GLPK routines. Comment lines +can appear anywhere in the data file. Each comment line begins with the +lower-case character \verb|c|. \begin{verbatim} - int glp_write_mip(glp_prob *P, const char *fname); + c This is an example of comment line \end{verbatim} -\description +\para{Solution line.} There must be exactly one solution line in the +solution file. This line must appear before any other lines except +comment lines and has the following format: -The routine \verb|glp_write_mip| writes the current MIP solution to -a text file whose name is specified by the parameter \verb|fname|. This -file can be read back with the routine \verb|glp_read_mip|. +\begin{verbatim} + s mip ROWS COLS SST OBJ +\end{verbatim} -\returns +The lower-case letter \verb|s| specifies that this is the solution +line. + +The three-character solution designator \verb|mip| identifies the file +as containing a solution to the MIP problem instance. + +The \verb|ROWS| and \verb|COLS| fields contain non-negative integer +values that specify the number of rows (constraints) and columns +(variables), resp., in the LP problem instance. + +The \verb|SST| field contains one of the following lower-case letters +that specifies the solution status: + +\verb|o| --- solution is integer optimal; -On success the routine returns zero, otherwise non-zero. +\verb|f| --- solution is integer feasible (non-optimal); -\para{File format} +\verb|n| --- no integer feasible solution exists; -The file created by the routine \verb|glp_write_sol| is a plain text -file, which contains the following information: +\verb|u| --- solution is undefined. + +The \verb|OBJ| field contains a floating-point number that specifies +the objective function value in the MIP solution. + +\para{Row solution descriptors.} There must be exactly one row solution +descriptor line in the solution file for each row (constraint). This +line has the following format: \begin{verbatim} - m n - stat obj_val - r_val[1] - . . . - r_val[m] - c_val[1] - . . . - c_val[n] + i ROW VAL \end{verbatim} -\noindent -where: +The lower-case letter \verb|i| specifies that this is the row solution +descriptor line. -\noindent -$m$ is the number of rows (auxiliary variables); +The \verb|ROW| field specifies the row ordinal number, an integer +between 1 and $m$, where $m$ is the number of rows in the problem +instance. -\noindent -$n$ is the number of columns (structural variables); +The \verb|VAL| field contains a floating-point number that specifies +the row value (the value of the corresponding linear form). -\noindent -\verb|stat| is the solution status\\(\verb|GLP_UNDEF| = 1, -\verb|GLP_FEAS| = 2, \verb|GLP_NOFEAS| = 4, or \verb|GLP_OPT| = 5); +\para{Column solution descriptors.} There must be exactly one column +solution descriptor line in the solution file for each column +(variable). This line has the following format: -\noindent -\verb|obj_val| is the objective value; +\begin{verbatim} + j COL VAL +\end{verbatim} -\noindent -\verb|r_val[i]|, $i=1,\dots,m$, is the value of $i$-th row; +The lower-case letter \verb|j| specifies that this is the column +solution descriptor line. -\noindent -\verb|c_val[j]|, $j=1,\dots,n$, is the value of $j$-th column. +The \verb|COL| field specifies the column ordinal number, an integer +between 1 and $n$, where $n$ is the number of columns in the problem +instance. + +The \verb|VAL| field contains a floating-point number that specifies +the column value. + +\para{End line.} There must be exactly one end line in the solution +file. This line must appear last in the file and has the following +format: + +\begin{verbatim} + e +\end{verbatim} + +The lower-case letter \verb|e| specifies that this is the end line. +Anything that follows the end line is ignored by GLPK routines. + +\para{Example of solution file in GLPK MIP solution format} + +The following example of a solution file in GLPK MIP solution format +specifies an optimal solution to a MIP problem instance. + +\bigskip + +\begin{center} +\footnotesize\tt +\begin{tabular}{l@{\hspace*{50pt}}} +s mip 8 8 o 1201500 \\ +i 1 60 \\ +i 2 8400 \\ +i 3 -1200 \\ +i 4 0 \\ +i 5 9000 \\ +i 6 -600 \\ +i 7 0 \\ +i 8 8000 \\ +\end{tabular} +\begin{tabular}{|@{\hspace*{80pt}}l} +j 1 60 \\ +j 2 6 \\ +j 3 0 \\ +j 4 60 \\ +j 5 6 \\ +j 6 600 \\ +j 7 60 \\ +j 8 16 \\ +e o f \\ +\end{tabular} +\end{center} + +\subsection{glp\_write\_mip --- write MIP solution in GLPK format} + +\synopsis + +\begin{verbatim} + int glp_write_mip(glp_prob *P, const char *fname); +\end{verbatim} + +\description + +The routine \verb|glp_write_mip| writes the current MIP solution to +a text file in the GLPK format. (For description of the GLPK MIP +solution format see Subsection ``Read MIP solution in GLPK format.'') + +The character string \verb|fname| specifies the name of the text file +to be written. (If the file name ends with suffix `\verb|.gz|', the +routine \verb|glp_write_mip| compresses it "on the fly".) + +\returns + +If the operation was successful, the routine \verb|glp_write_mip| +returns zero. Otherwise, it prints an error message and returns +non-zero. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1282,37 +1646,37 @@ between rows and columns. \begin{landscape} \begin{footnotesize} \begin{verbatim} -GLPK 4.42 - SENSITIVITY ANALYSIS REPORT Page 1 + GLPK 4.42 - SENSITIVITY ANALYSIS REPORT Page 1 -Problem: PLAN -Objective: VALUE = 296.2166065 (MINimum) + Problem: PLAN + Objective: VALUE = 296.2166065 (MINimum) - No. Row name St Activity Slack Lower bound Activity Obj coef Obj value at Limiting - Marginal Upper bound range range break point variable ------- ------------ -- ------------- ------------- ------------- ------------- ------------- ------------- ------------ - 1 VALUE BS 296.21661 -296.21661 -Inf 299.25255 -1.00000 . MN - . +Inf 296.21661 +Inf +Inf + No. Row name St Activity Slack Lower bound Activity Obj coef Obj value at Limiting + Marginal Upper bound range range break point variable + ------ ------------ -- ------------- ------------- ------------- ------------- ------------- ------------- ------------ + 1 VALUE BS 296.21661 -296.21661 -Inf 299.25255 -1.00000 . MN + . +Inf 296.21661 +Inf +Inf - 2 YIELD NS 2000.00000 . 2000.00000 1995.06864 -Inf 296.28365 BIN3 - -.01360 2000.00000 2014.03479 +Inf 296.02579 CU + 2 YIELD NS 2000.00000 . 2000.00000 1995.06864 -Inf 296.28365 BIN3 + -.01360 2000.00000 2014.03479 +Inf 296.02579 CU - 3 FE NU 60.00000 . -Inf 55.89016 -Inf 306.77162 BIN4 - -2.56823 60.00000 62.69978 2.56823 289.28294 BIN3 + 3 FE NU 60.00000 . -Inf 55.89016 -Inf 306.77162 BIN4 + -2.56823 60.00000 62.69978 2.56823 289.28294 BIN3 - 4 CU BS 83.96751 16.03249 -Inf 93.88467 -.30613 270.51157 MN - . 100.00000 79.98213 .21474 314.24798 BIN5 + 4 CU BS 83.96751 16.03249 -Inf 93.88467 -.30613 270.51157 MN + . 100.00000 79.98213 .21474 314.24798 BIN5 - 5 MN NU 40.00000 . -Inf 34.42336 -Inf 299.25255 BIN4 - -.54440 40.00000 41.68691 .54440 295.29825 BIN3 + 5 MN NU 40.00000 . -Inf 34.42336 -Inf 299.25255 BIN4 + -.54440 40.00000 41.68691 .54440 295.29825 BIN3 - 6 MG BS 19.96029 10.03971 -Inf 24.74427 -1.79618 260.36433 BIN1 - . 30.00000 9.40292 .28757 301.95652 MN + 6 MG BS 19.96029 10.03971 -Inf 24.74427 -1.79618 260.36433 BIN1 + . 30.00000 9.40292 .28757 301.95652 MN - 7 AL NL 1500.00000 . 1500.00000 1485.78425 -.25199 292.63444 CU - .25199 +Inf 1504.92126 +Inf 297.45669 BIN3 + 7 AL NL 1500.00000 . 1500.00000 1485.78425 -.25199 292.63444 CU + .25199 +Inf 1504.92126 +Inf 297.45669 BIN3 - 8 SI NL 250.00000 50.00000 250.00000 235.32871 -.48520 289.09812 CU - .48520 300.00000 255.06073 +Inf 298.67206 BIN3 + 8 SI NL 250.00000 50.00000 250.00000 235.32871 -.48520 289.09812 CU + .48520 300.00000 255.06073 +Inf 298.67206 BIN3 \end{verbatim} \end{footnotesize} \end{landscape} @@ -1322,36 +1686,36 @@ Objective: VALUE = 296.2166065 (MINimum) \begin{landscape} \begin{footnotesize} \begin{verbatim} -GLPK 4.42 - SENSITIVITY ANALYSIS REPORT Page 2 + GLPK 4.42 - SENSITIVITY ANALYSIS REPORT Page 2 -Problem: PLAN -Objective: VALUE = 296.2166065 (MINimum) + Problem: PLAN + Objective: VALUE = 296.2166065 (MINimum) - No. Column name St Activity Obj coef Lower bound Activity Obj coef Obj value at Limiting - Marginal Upper bound range range break point variable ------- ------------ -- ------------- ------------- ------------- ------------- ------------- ------------- ------------ - 1 BIN1 NL . .03000 . -28.82475 -.22362 288.90594 BIN4 - .25362 200.00000 33.88040 +Inf 304.80951 BIN4 + No. Column name St Activity Obj coef Lower bound Activity Obj coef Obj value at Limiting + Marginal Upper bound range range break point variable + ------ ------------ -- ------------- ------------- ------------- ------------- ------------- ------------- ------------ + 1 BIN1 NL . .03000 . -28.82475 -.22362 288.90594 BIN4 + .25362 200.00000 33.88040 +Inf 304.80951 BIN4 - 2 BIN2 BS 665.34296 .08000 . 802.22222 .01722 254.44822 BIN1 - . 2500.00000 313.43066 .08863 301.95652 MN + 2 BIN2 BS 665.34296 .08000 . 802.22222 .01722 254.44822 BIN1 + . 2500.00000 313.43066 .08863 301.95652 MN - 3 BIN3 BS 490.25271 .17000 400.00000 788.61314 .15982 291.22807 MN - . 800.00000 -347.42857 .17948 300.86548 BIN5 + 3 BIN3 BS 490.25271 .17000 400.00000 788.61314 .15982 291.22807 MN + . 800.00000 -347.42857 .17948 300.86548 BIN5 - 4 BIN4 BS 424.18773 .12000 100.00000 710.52632 .10899 291.54745 MN - . 700.00000 -256.15524 .14651 307.46010 BIN1 + 4 BIN4 BS 424.18773 .12000 100.00000 710.52632 .10899 291.54745 MN + . 700.00000 -256.15524 .14651 307.46010 BIN1 - 5 BIN5 NL . .15000 . -201.78739 .13544 293.27940 BIN3 - .01456 1500.00000 58.79586 +Inf 297.07244 BIN3 + 5 BIN5 NL . .15000 . -201.78739 .13544 293.27940 BIN3 + .01456 1500.00000 58.79586 +Inf 297.07244 BIN3 - 6 ALUM BS 299.63899 .21000 . 358.26772 .18885 289.87879 AL - . +Inf 112.40876 .22622 301.07527 MN + 6 ALUM BS 299.63899 .21000 . 358.26772 .18885 289.87879 AL + . +Inf 112.40876 .22622 301.07527 MN - 7 SILICON BS 120.57762 .38000 . 124.27093 .14828 268.27586 BIN5 - . +Inf 85.54745 .46667 306.66667 MN + 7 SILICON BS 120.57762 .38000 . 124.27093 .14828 268.27586 BIN5 + . +Inf 85.54745 .46667 306.66667 MN -End of report + End of report \end{verbatim} \end{footnotesize} \end{landscape} @@ -1491,13 +1855,13 @@ thus, minimal value of the objective coefficient, on which the current basis still remains optimal, is $0.15-0.01456=0.13644$, that is indicated in the field `\verb|Obj coef range|'. -\newpage +%\newpage -{\parskip=0pt +%{\parskip=0pt \noindent {\it Sensitivity analysis of objective coefficients at basic variables} -\medskip +%\medskip To perform sensitivity analysis for every auxiliary (row) or structural (column) variable the routine starts changing its objective coefficient @@ -1567,6 +1931,6 @@ Note that if the basis does not change, the objective function depends on the objective coefficient at the basic variable linearly, and the per-unit change of the objective function is the value of the basic variable. -} +%} %* eof *% diff --git a/resources/3rdparty/glpk-4.57/doc/glpk04.tex b/resources/3rdparty/glpk-4.65/doc/glpk04.tex similarity index 98% rename from resources/3rdparty/glpk-4.57/doc/glpk04.tex rename to resources/3rdparty/glpk-4.65/doc/glpk04.tex index 2367db573..0a981befe 100644 --- a/resources/3rdparty/glpk-4.57/doc/glpk04.tex +++ b/resources/3rdparty/glpk-4.65/doc/glpk04.tex @@ -51,6 +51,8 @@ auxiliary and structural variables. This allows combining all these variables into one vector that leads to the following problem statement: +\newpage + \noindent \hspace{.5in} minimize (or maximize) $$z=(0\ |\ c)^Tx+c_0\eqno(3.4)$$ @@ -113,7 +115,7 @@ $$(I\ |-\!A)\Pi^T\Pi x=0\ \ \ \Rightarrow\ \ \ (B\ |\ N) where $$(B\ |\ N)=(I\ |-\!A)\Pi^T.\eqno(3.9)$$ -\newpage +%\newpage Matrix $B$ is a square non-singular $m\times m$-matrix, which is composed from columns of the augmented constraint matrix corresponding @@ -166,14 +168,17 @@ $$\lambda_l\leq 0,\ \ \lambda_u\geq 0\ \ \mbox{(maximization)} $$(\lambda_l)_k(x_k-l_k)=0,\ \ (\lambda_u)_k(x_k-u_k)=0,\ \ k=1,2,\dots, m+n\eqno(3.19)$$ where: -$\pi=(\pi_1,\pi_2,\dots,\pi_m)$ is a $m$-vector of Lagrange + +$\pi=(\pi_1,\dots,\pi_m)$ is a $m$-vector of Lagrange multipliers for equality constraints (3.5); -$\lambda_l=[(\lambda_l)_1,(\lambda_l)_2,\dots,(\lambda_l)_n]$ is a -$n$-vector of Lagrange multipliers for lower bound constraints (3.6); -$\lambda_u=[(\lambda_u)_1,(\lambda_u)_2,\dots,(\lambda_u)_n]$ is a -$n$-vector of Lagrange multipliers for upper bound constraints (3.6). -\newpage +$\lambda_l=[(\lambda_l)_1,\dots,(\lambda_l)_n]$ is a $n$-vector of +Lagrange multipliers for lower bound constraints (3.6); + +$\lambda_u=[(\lambda_u)_1,\dots,(\lambda_u)_n]$ is a $n$-vector of +Lagrange multipliers for upper bound constraints (3.6). + +%\newpage Condition (3.14) is the {\it primal} (original) system of equality constraints (3.5). @@ -196,11 +201,11 @@ the corresponding Lagrange multiplier ($(\lambda_l)_k$ or $(\lambda_u)_k$) must be active. In GLPK two multipliers $(\lambda_l)_k$ and $(\lambda_u)_k$ for each -primal (original) variable $x_k$, $k=1,2,\dots,\linebreak m+n$, are -combined into one multiplier: +primal variable $x_k$, $k=1,\dots,m+n$, are combined into one +multiplier: $$\lambda_k=(\lambda_l)_k+(\lambda_u)_k,\eqno(3.20)$$ which is called a {\it dual variable} for $x_k$. This {\it cannot} lead -to the ambiguity, because both lower and upper bounds of $x_k$ cannot be +to an ambiguity, because both lower and upper bounds of $x_k$ cannot be active at the same time,\footnote{If $x_k$ is a fixed variable, we can think it as double-bounded variable $l_k\leq x_k\leq u_k$, where $l_k=u_k.$} so at least one of $(\lambda_l)_k$ and $(\lambda_u)_k$ must @@ -258,10 +263,6 @@ any basic solution $\lambda_B=0$. Corresponding values of dual variables $\lambda_N$ for non-basic variables $x_N$ can be determined in the following way. From the dual system (3.15) we have: $$(I\ |-\!A)^T\pi+\lambda=(0\ |\ c)^T,\eqno(3.22)$$ - -\newpage - -\noindent so multiplying both sides of (3.22) by matrix $\Pi$ gives: $$\Pi(I\ |-\!A)^T\pi+\Pi\lambda=\Pi(0\ |\ c)^T.\eqno(3.23)$$ From (3.9) it follows that @@ -402,7 +403,7 @@ routine, which uses the basis factorization, the application program must make sure (using the routine \verb|glp_bf_exists|) that the factorization exists and therefore available for computations. -\newpage +%\newpage \subsection{glp\_factorize --- compute the basis factorization} @@ -560,6 +561,8 @@ glp_set_bfcp(lp, &parm); \end{verbatim} \end{footnotesize} +\newpage + \para{Control parameters} This paragraph describes all basis factorization control parameters @@ -622,7 +625,7 @@ on choosing a pivot element, \verb|piv_lim| $\geq$ 1. If \verb|piv_lim| candidates have been considered, the pivoting routine prematurely terminates the search with the best candidate found. -\newpage +\medskip {\tt int suhl} (default: {\tt GLP\_ON}) @@ -1014,6 +1017,8 @@ simplex table column $\Xi_j=(\xi_{ij})$ and uses the permutation matrix $\Pi$ to convert row indices $i$ to original ordinal numbers of auxiliary and structural variables. +\newpage + \subsection{glp\_transform\_row --- transform explicitly specified row} \synopsis diff --git a/resources/3rdparty/glpk-4.57/doc/glpk05.tex b/resources/3rdparty/glpk-4.65/doc/glpk05.tex similarity index 99% rename from resources/3rdparty/glpk-4.57/doc/glpk05.tex rename to resources/3rdparty/glpk-4.65/doc/glpk05.tex index d15123e3f..66e3c40a7 100644 --- a/resources/3rdparty/glpk-4.57/doc/glpk05.tex +++ b/resources/3rdparty/glpk-4.65/doc/glpk05.tex @@ -103,7 +103,7 @@ If $L=\varnothing$ then GO TO 9. Select $P\in L$, i.e. make active subproblem $P$ current. -\newpage +%\newpage {\it 3. Solving LP relaxation} @@ -231,23 +231,23 @@ Fig. 1. An example of the search tree. In GLPK each node may have one of the following four statuses: -\vspace*{-8pt} +%\vspace*{-8pt} -\begin{itemize} -\item {\it current node} is the active node currently being +%\begin{itemize} +\Item{---}{\it current node} is the active node currently being processed; -\item {\it active node} is a leaf node, which still has to be +\Item{---}{\it active node} is a leaf node, which still has to be processed; -\item {\it non-active node} is a node, which has been processed, +\Item{---}{\it non-active node} is a node, which has been processed, but not fathomed; -\item {\it fathomed node} is a node, which has been processed and +\Item{---}{\it fathomed node} is a node, which has been processed and fathomed. -\end{itemize} +%\end{itemize} -\vspace*{-8pt} +%\vspace*{-8pt} In the data structure representing the search tree GLPK keeps only current, active, and non-active nodes. Once a node has been fathomed, @@ -571,6 +571,8 @@ where \verb|best_mip| is the best integer feasible solution found so far, \verb|best_bnd| is the best (global) bound. If no integer feasible solution has been found yet, \verb|gap| is set to \verb|DBL_MAX|. +\newpage + \returns The routine \verb|glp_ios_mip_gap| returns the relative MIP gap. @@ -713,6 +715,8 @@ The parameter \verb|sel| is a flag that indicates which branch \verb|GLP_NO_BRNCH| --- use general selection technique. +\newpage + \para{Comments} On branching the solver removes the current active subproblem from the @@ -885,6 +889,8 @@ subproblem is the level of its parent plus one.) The routine \verb|glp_ios_node_bound| returns the local bound for (active or inactive) subproblem, whose reference number is $p$. +\newpage + \para{Comments} The local bound for subproblem $p$ is an lower (minimization) or upper @@ -992,6 +998,8 @@ The parameter \verb|type| specifies the constraint type as follows: \verb|GLP_UP| means inequality constraint $\Sigma a_jx_j\leq b$; +\newpage + The parameter \verb|rhs| specifies the right-hand side $b$. All cutting plane constraints in the cut pool are identified by their diff --git a/resources/3rdparty/glpk-4.57/doc/glpk06.tex b/resources/3rdparty/glpk-4.65/doc/glpk06.tex similarity index 99% rename from resources/3rdparty/glpk-4.57/doc/glpk06.tex rename to resources/3rdparty/glpk-4.65/doc/glpk06.tex index dad96c578..51bec189b 100644 --- a/resources/3rdparty/glpk-4.57/doc/glpk06.tex +++ b/resources/3rdparty/glpk-4.65/doc/glpk06.tex @@ -388,6 +388,8 @@ The routine \verb|glp_realloc| returns a pointer to the memory block reallocated. To free this block the routine \verb|glp_free| (not the standard C function \verb|free|!) should be used. +\newpage + \subsection{glp\_free --- free memory block} \synopsis diff --git a/resources/3rdparty/glpk-4.57/doc/glpk07.tex b/resources/3rdparty/glpk-4.65/doc/glpk07.tex similarity index 100% rename from resources/3rdparty/glpk-4.57/doc/glpk07.tex rename to resources/3rdparty/glpk-4.65/doc/glpk07.tex diff --git a/resources/3rdparty/glpk-4.57/doc/glpk08.tex b/resources/3rdparty/glpk-4.65/doc/glpk08.tex similarity index 96% rename from resources/3rdparty/glpk-4.57/doc/glpk08.tex rename to resources/3rdparty/glpk-4.65/doc/glpk08.tex index e56a8e892..2636cb3c8 100644 --- a/resources/3rdparty/glpk-4.57/doc/glpk08.tex +++ b/resources/3rdparty/glpk-4.65/doc/glpk08.tex @@ -28,7 +28,7 @@ fixed fields: \begin{center} \begin{tabular}{lcccccc} -& Field 1 & Field 2 & Field 3 & Field 4 & Field 5 & Feld 6 \\ +& Field 1 & Field 2 & Field 3 & Field 4 & Field 5 & Field 6 \\ \hline Columns & 2---3 & 5---12 & 15---22 & 25---36 & 40---47 & 50---61 \\ Contents & Code & Name & Name & Number & Name & Number \\ @@ -55,7 +55,7 @@ characters. If the sign $s$ is omitted, the plus sign is assumed. The exponent part is optional. If a number contains spaces, the spaces are ignored. -\newpage +%\newpage If a card has the asterisk `\verb|*|' in the column 1, this card is considered as a comment and ignored. Besides, if the first character in @@ -64,37 +64,37 @@ dollar sign to the end of card are considered as a comment and ignored. MPS file should contain cards in the following order: -\vspace*{-8pt} +%\vspace*{-8pt} -\begin{itemize} -\item NAME indicator card; +%\begin{itemize} +\Item{---}NAME indicator card; -\item ROWS indicator card; +\Item{---}ROWS indicator card; -\item data cards specifying rows (constraints); +\Item{---}data cards specifying rows (constraints); -\item COLUMNS indicator card; +\Item{---}COLUMNS indicator card; -\item data cards specifying columns (structural variables) and +\Item{---}data cards specifying columns (structural variables) and constraint coefficients; -\item RHS indicator card; +\Item{---}RHS indicator card; -\item data cards specifying right-hand sides of constraints; +\Item{---}data cards specifying right-hand sides of constraints; -\item RANGES indicator card; +\Item{---}RANGES indicator card; -\item data cards specifying ranges for double-bounded constraints; +\Item{---}data cards specifying ranges for double-bounded constraints; -\item BOUNDS indicator card; +\Item{---}BOUNDS indicator card; -\item data cards specifying types and bounds of structural +\Item{---}data cards specifying types and bounds of structural variables; -\item ENDATA indicator card. -\end{itemize} +\Item{---}ENDATA indicator card. +%\end{itemize} -\vspace*{-8pt} +%\vspace*{-8pt} {\it Section} is a group of cards consisting of an indicator card and data cards succeeding this indicator card. For example, the ROWS section @@ -120,7 +120,7 @@ position, except position 1, which must be blank, and must be separated from each other by one or more blanks. However, the fields must appear in the same order as in fixed MPS format. -\newpage +%\newpage Symbolic names in fields 2, 3, and 5 may be longer than 8 characters\footnote{GLPK allows symbolic names having up to 255 @@ -136,6 +136,8 @@ If the first character of any field (not necessarily fields 3 and 5) is the dollar sign (\$), all characters from the dollar sign to the end of record are considered as a comment and ignored. +\newpage + \section{NAME indicator card} The NAME indicator card should be the first card in the MPS file @@ -178,7 +180,7 @@ can be considered as bounds of such auxiliary variable. The filed 2 specifies a row name (which is considered as the name of the corresponding auxiliary variable). -\newpage +%\newpage The fields 3, 4, 5, and 6 are not used and should be empty. @@ -236,7 +238,7 @@ vectors in the same MPS file. However, before solving the problem a particular RHS vector should be chosen.}. If this field is empty, the RHS vector name from the immediately preceeding data card is assumed. -\newpage +%\newpage The field 3 specifies a row name defined in the ROWS section. @@ -260,6 +262,8 @@ Right-hand sides not specified in the RHS section are considered as zeros. Therefore zero right-hand sides may be omitted, although it is allowed to explicitly specify them. +\newpage + \section{RANGES section} The RANGES section should start with the indicator card, which contains @@ -297,7 +301,7 @@ section. For each double-side constraint specified in the RANGES section its lower and upper bounds are determined as follows: -\newpage +%\newpage \begin{center} \begin{tabular}{cccc} @@ -366,7 +370,7 @@ have zero lower bound and no upper bound. Lower ($l_j$) and upper following way, where $s_j$ is a corresponding bound value explicitly specified in the BOUNDS section: -\newpage +%\newpage \verb|LO| sets $l_j$ to $s_j$; @@ -430,9 +434,6 @@ SI &= .02\ bin_1 + .06\ bin_2 + .08\ bin_3 + .12\ bin_4 + .02\ bin_5 + .01\ al + .97\ si \\ \end{array} $$ - -\newpage - \noindent\hspace{.5in}and bounds of (auxiliary and structural) variables $$ @@ -452,7 +453,7 @@ $$ A complete MPS file which specifies data for this example is shown below (the first two comment lines show card positions). -\bigskip +\newpage \begin{footnotesize} \begin{verbatim} @@ -513,11 +514,11 @@ ENDATA \end{verbatim} \end{footnotesize} -\vspace*{-6pt} +%\vspace*{-6pt} \section{MIP features} -\vspace*{-4pt} +%\vspace*{-4pt} The MPS format provides two ways for introducing integer variables into the problem. @@ -590,9 +591,9 @@ $$ \end{array} $$ -The corresponding MPS file may look like the following: +The corresponding MPS file may look like follows: -\medskip +\newpage \begin{footnotesize} \begin{verbatim} @@ -628,13 +629,14 @@ ENDATA \end{verbatim} \end{footnotesize} -\newpage +%\newpage +\vspace{-3pt} The same example may be coded without INTORG/INTEND markers using the bound type UI for the variable $x_2$ and the bound type BV for the variable $x_3$: -\medskip +%\medskip \begin{footnotesize} \begin{verbatim} diff --git a/resources/3rdparty/glpk-4.57/doc/glpk09.tex b/resources/3rdparty/glpk-4.65/doc/glpk09.tex similarity index 93% rename from resources/3rdparty/glpk-4.57/doc/glpk09.tex rename to resources/3rdparty/glpk-4.65/doc/glpk09.tex index d04865d9d..a78e9878e 100644 --- a/resources/3rdparty/glpk-4.57/doc/glpk09.tex +++ b/resources/3rdparty/glpk-4.65/doc/glpk09.tex @@ -93,24 +93,24 @@ improve readability of the LP file. Besides, blanks should be used to separate elements from each other if there is no other way to do that (for example, to separate a keyword from a following symbolic name). -The order of an LP file is: +The order of an LP file is the following: -\vspace*{-8pt} +%\vspace*{-8pt} -\begin{itemize} -\item objective function definition; +%\begin{itemize} +\Item{---}objective function definition; -\item constraints section; +\Item{---}constraints section; -\item bounds section; +\Item{---}bounds section; -\item general, integer, and binary sections (can appear in arbitrary -order); +\Item{---}general, integer, and binary sections (can appear in +arbitrary order); -\item end keyword. -\end{itemize} +\Item{---}end keyword. +%\end{itemize} -\vspace*{-8pt} +%\vspace*{-8pt} These components are discussed in following sections. @@ -126,7 +126,7 @@ $$ \begin{array}{@{}c@{}} {\tt minimize} \\ {\tt maximize} \end{array} -\right\}\ f\ {\tt :}\ s\ c\ x\ s\ c\ x\ \dots\ s\ c\ x +\right\}\ f\ {\tt :}\ s\ c\ x\ \dots\ s\ c\ x $$ where $f$ is a symbolic name of the objective function, $s$ is a sign \verb|+| or \verb|-|, $c$ is a numeric constant that denotes an @@ -165,7 +165,6 @@ The constraint section has the following form: \begin{tabular}{l} \verb|subject to| \\ {\it constraint}$_1$ \\ -{\it constraint}$_2$ \\ \hspace{20pt}\dots \\ {\it constraint}$_m$ \\ \end{tabular} @@ -181,7 +180,7 @@ line as the keyword `\verb|subject to|'. Constraint definitions have the following form: $$ -r\ {\tt:}\ s\ c\ x\ s\ c\ x\ \dots\ s\ c\ x +r\ {\tt:}\ s\ c\ x\ \dots\ s\ c\ x \ \left\{ \begin{array}{@{}c@{}} \mbox{\tt<=} \\ \mbox{\tt>=} \\ \mbox{\tt=} @@ -194,13 +193,13 @@ coefficient, $x$ is a symbolic name of a variable, $b$ is a right-hand side. The name $r$ of a constraint (which is the name of the corresponding -auxiliary variable) is optional and may be omitted (together with the -semicolon that follows it). In this case the default names like +auxiliary variable) is optional and may be omitted together with the +semicolon that follows it. In the latter case the default names like `\verb|r.nnn|' are assigned to unnamed constraints. -The linear form $s\ c\ x\ s\ c\ x\ \dots\ s\ c\ x$ in the left-hand -side of a constraint definition has exactly the same meaning as in the -case of the objective function definition (see above). +The linear form $s\ c\ x\ \dots\ s\ c\ x$ in the left-hand side of +a constraint definition has exactly the same meaning as in the case of +the objective function definition (see above). After the linear form one of the following delimiters that indicates the constraint sense must be specified: @@ -251,7 +250,6 @@ The bounds section has the following form: \begin{tabular}{l} \verb|bounds| \\ {\it definition}$_1$ \\ -{\it definition}$_2$ \\ \hspace{20pt}\dots \\ {\it definition}$_p$ \\ \end{tabular} @@ -266,7 +264,7 @@ implementation allows several bound definitions to be placed on the same line.} except the very first bound definition which can begin on the same line as the keyword `\verb|bounds|'. -\newpage +%\newpage Syntactically constraint definitions can have one of the following six forms: @@ -285,8 +283,8 @@ $x$ \verb|free| &specifies free variable \noindent where $x$ is a symbolic name of a variable, $l$ is a numeric constant with an optional sign that defines a lower bound of the variable or -\verb|-inf| that means that the variable has no lower bound, $u$ is a -numeric constant with an optional sign that defines an upper bound of +\verb|-inf| that means that the variable has no lower bound, $u$ is +a~numeric constant with an optional sign that defines an upper bound of the variable or \verb|+inf| that means that the variable has no upper bound, $t$ is a numeric constant with an optional sign that defines a fixed value of the variable. @@ -329,7 +327,6 @@ $ \right\} $ \\ \hspace{10pt}$x_1$ \\ -\hspace{10pt}$x_2$ \\ \hspace{10pt}\dots \\ \hspace{10pt}$x_q$ \\ \end{tabular} @@ -344,7 +341,7 @@ line.} except the very first symbolic name which can begin on the same line as the keyword `\verb|general|', `\verb|integer|', or `\verb|binary|'. -\newpage +%\newpage If a variable appears in the general or the integer section, it is assumed to be general integer variable. If a variable appears in the @@ -363,6 +360,8 @@ Here is an example of the integer section: z35 \end{verbatim} +\newpage + \section{End keyword} The keyword `\verb|end|' is intended to end the LP file. It must begin diff --git a/resources/3rdparty/glpk-4.57/doc/glpk10.tex b/resources/3rdparty/glpk-4.65/doc/glpk10.tex similarity index 99% rename from resources/3rdparty/glpk-4.57/doc/glpk10.tex rename to resources/3rdparty/glpk-4.65/doc/glpk10.tex index 01c4f35d4..1943ef02e 100644 --- a/resources/3rdparty/glpk-4.57/doc/glpk10.tex +++ b/resources/3rdparty/glpk-4.65/doc/glpk10.tex @@ -138,11 +138,6 @@ the problem, and write its solution to an output text file. --mipgap tol set relative mip gap tolerance to tol --minisat translate integer feasibility problem to CNF-SAT and solve it with MiniSat solver -\end{verbatim} - -\newpage - -\begin{verbatim} --objbnd bound add inequality obj <= bound (minimization) or obj >= bound (maximization) to integer feasibility problem (assumes --minisat) diff --git a/resources/3rdparty/glpk-4.57/doc/glpk11.tex b/resources/3rdparty/glpk-4.65/doc/glpk11.tex similarity index 96% rename from resources/3rdparty/glpk-4.57/doc/glpk11.tex rename to resources/3rdparty/glpk-4.65/doc/glpk11.tex index d45ab3d29..ff731fb56 100644 --- a/resources/3rdparty/glpk-4.57/doc/glpk11.tex +++ b/resources/3rdparty/glpk-4.65/doc/glpk11.tex @@ -1,10 +1,10 @@ %* glpk11.tex *% -\chapter{External Software Modules Used In GLPK} +\chapter{External Software Used In GLPK} -In the GLPK package there are used some external software modules -listed in this Appendix. Note that these modules are {\it not} part of -GLPK, but are used with GLPK and included in the distribution. +In the GLPK package there are used some external software listed in +this Appendix. Note that these software are {\it not} part of GLPK, but +are used with GLPK and included in the distribution. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -117,6 +117,8 @@ details. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\newpage + \section{MiniSat} \noindent @@ -128,6 +130,8 @@ MiniSat is a minimalistic implementation of a Chaff-like SAT solver based on the two-literal watch scheme for fast BCP and clause learning by conflict analysis. +\newpage + \para{License} Permission is hereby granted, free of charge, to any person obtaining a diff --git a/resources/3rdparty/glpk-4.57/doc/glpk12.tex b/resources/3rdparty/glpk-4.65/doc/glpk12.tex similarity index 96% rename from resources/3rdparty/glpk-4.57/doc/glpk12.tex rename to resources/3rdparty/glpk-4.65/doc/glpk12.tex index 2c2b1b7a6..ea69587a0 100644 --- a/resources/3rdparty/glpk-4.57/doc/glpk12.tex +++ b/resources/3rdparty/glpk-4.65/doc/glpk12.tex @@ -21,7 +21,7 @@ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. \end{quotation} -\section*{Preamble} +\medskip\para{\normalsize Preamble} The GNU General Public License is a free, copyleft license for software and other kinds of works. @@ -84,9 +84,11 @@ patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. -\section*{TERMS AND CONDITIONS} +\newpage + +\medskip\para{\normalsize TERMS AND CONDITIONS} -\subsubsection*{0. Definitions.} +\medskip\para{\normalsize 0. Definitions.} ``This License'' refers to version 3 of the GNU General Public License. @@ -126,7 +128,7 @@ work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. -\subsubsection*{1. Source Code.} +\medskip\para{\normalsize 1. Source Code.} The ``source code'' for a work means the preferred form of the work for making modifications to it. ``Object code'' means any non-source @@ -168,7 +170,7 @@ Source. The Corresponding Source for a work in source code form is that same work. -\subsubsection*{2. Basic Permissions.} +\medskip\para{\normalsize 2. Basic Permissions.} All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated @@ -193,7 +195,7 @@ your copyrighted material outside their relationship with you. the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. -\subsubsection*{3. Protecting Users' Legal Rights From +\medskip\para{\normalsize 3. Protecting Users' Legal Rights From Anti-Circumvention Law.} No covered work shall be deemed part of an effective technological @@ -210,7 +212,7 @@ modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. -\subsubsection*{4. Conveying Verbatim Copies.} +\medskip\para{\normalsize 4. Conveying Verbatim Copies.} You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and @@ -223,7 +225,7 @@ recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. -\subsubsection*{5. Conveying Modified Source Versions.} +\medskip\para{\normalsize 5. Conveying Modified Source Versions.} You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the @@ -260,7 +262,7 @@ beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. -\subsubsection*{6. Conveying Non-Source Forms.} +\medskip\para{\normalsize 6. Conveying Non-Source Forms.} You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the @@ -359,10 +361,10 @@ documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. -\subsubsection*{7. Additional Terms.} +\medskip\para{\normalsize 7. Additional Terms.} - ``Additional permissions'' are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. + ``Additional permissions'' are terms that supplement the terms of +this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions @@ -423,7 +425,7 @@ where to find the applicable terms. form of a separately written license, or stated as exceptions; the above requirements apply either way. -\subsubsection*{8. Termination.} +\medskip\para{\normalsize 8. Termination.} You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or @@ -451,7 +453,7 @@ this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. -\subsubsection*{9. Acceptance Not Required for Having Copies.} +\medskip\para{\normalsize 9. Acceptance Not Required for Having Copies.} You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work @@ -462,7 +464,7 @@ modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. -\subsubsection*{10. Automatic Licensing of Downstream Recipients.} +\medskip\para{\normalsize 10. Automatic Licensing of Downstream Recipients.} Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and @@ -487,7 +489,7 @@ rights granted under this License, and you may not initiate litigation any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. -\subsubsection*{11. Patents.} +\medskip\para{\normalsize 11. Patents.} A ``contributor'' is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The @@ -556,7 +558,7 @@ or that patent license was granted, prior to 28 March 2007. any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. -\subsubsection*{12. No Surrender of Others' Freedom.} +\medskip\para{\normalsize 12. No Surrender of Others' Freedom.} If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not @@ -569,7 +571,8 @@ whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. -\subsubsection*{13. Use with the GNU Affero General Public License.} +\medskip\para{\normalsize 13. Use with the GNU Affero General Public +License.} Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed @@ -580,7 +583,7 @@ but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. -\subsubsection*{14. Revised Versions of this License.} +\medskip\para{\normalsize 14. Revised Versions of this License.} The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions @@ -606,7 +609,7 @@ permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. -\subsubsection*{15. Disclaimer of Warranty.} +\medskip\para{\normalsize 15. Disclaimer of Warranty.} THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT @@ -617,7 +620,7 @@ PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. -\subsubsection*{16. Limitation of Liability.} +\medskip\para{\normalsize 16. Limitation of Liability.} IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR @@ -629,7 +632,7 @@ SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -\subsubsection*{17. Interpretation of Sections 15 and 16.} +\medskip\para{\normalsize 17. Interpretation of Sections 15 and 16.} If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, @@ -638,11 +641,11 @@ an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. -\section*{END OF TERMS AND CONDITIONS} +\medskip\para{\normalsize END OF TERMS AND CONDITIONS} \newpage -\section*{How to Apply These Terms to Your New Programs} +\medskip\para{\normalsize How to Apply These Terms to Your New Programs} If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it diff --git a/resources/3rdparty/glpk-4.57/doc/gmpl.pdf b/resources/3rdparty/glpk-4.65/doc/gmpl.pdf similarity index 62% rename from resources/3rdparty/glpk-4.57/doc/gmpl.pdf rename to resources/3rdparty/glpk-4.65/doc/gmpl.pdf index 0f6833f68..110b92455 100644 Binary files a/resources/3rdparty/glpk-4.57/doc/gmpl.pdf and b/resources/3rdparty/glpk-4.65/doc/gmpl.pdf differ diff --git a/resources/3rdparty/glpk-4.57/doc/gmpl.tex b/resources/3rdparty/glpk-4.65/doc/gmpl.tex similarity index 99% rename from resources/3rdparty/glpk-4.57/doc/gmpl.tex rename to resources/3rdparty/glpk-4.65/doc/gmpl.tex index 6c468603d..41e92e913 100644 --- a/resources/3rdparty/glpk-4.57/doc/gmpl.tex +++ b/resources/3rdparty/glpk-4.65/doc/gmpl.tex @@ -4,9 +4,9 @@ % This code is part of GLPK (GNU Linear Programming Kit). % % Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -% 2009, 2010, 2011, 2013, 2014, 2015 Andrew Makhorin, Department for -% Applied Informatics, Moscow Aviation Institute, Moscow, Russia. All -% rights reserved. E-mail: . +% 2009, 2010, 2011, 2013, 2014, 2015, 2016 Andrew Makhorin, Department +% for Applied Informatics, Moscow Aviation Institute, Moscow, Russia. +% All rights reserved. E-mail: . % % GLPK is free software: you can redistribute it and/or modify it % under the terms of the GNU General Public License as published by @@ -22,6 +22,11 @@ % along with GLPK. If not, see . %*********************************************************************** +% To produce gmpl.pdf from gmpl.tex run the following two commands: +% latex gmpl.tex +% dvipdfm -p letter gmpl.dvi +% Note: You need TeX Live 2010 or later version. + \documentclass[11pt]{report} \usepackage{amssymb} \usepackage[dvipdfm,linktocpage,colorlinks,linkcolor=blue, @@ -71,12 +76,12 @@ urlcolor=blue]{hyperref} \vspace{0.5in} \begin{LARGE} -\sf for GLPK Version 4.57 +\sf for GLPK Version 4.58 \end{LARGE} \vspace{0.5in} \begin{Large} -\sf (DRAFT, October 2015) +\sf (DRAFT, February 2016) \end{Large} \end{center} @@ -93,9 +98,9 @@ GNU. \noindent Copyright \copyright{} 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -2008, 2009, 2010, 2011, 2013, 2014, 2015 Andrew Makhorin, Department -for Applied Informatics, Moscow Aviation Institute, Moscow, Russia. All -rights reserved. +2008, 2009, 2010, 2011, 2013, 2014, 2015, 2016 Andrew Makhorin, +Department for Applied Informatics, Moscow Aviation Institute, Moscow, +Russia. All rights reserved. \noindent Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, @@ -614,6 +619,7 @@ digits\\ {\tt str2time(}$s${\tt,} $f${\tt)}&converting character string $s$ to calendar time (for details see Section \ref{str2time}, page \pageref{str2time})\\ +{\tt tan(}$x${\tt)}&$\tan x$, tangent of $x$ (in radians)\\ {\tt trunc(}$x${\tt)}&truncating $x$ to nearest integer\\ {\tt trunc(}$x${\tt,} $n${\tt)}&truncating $x$ to $n$ fractional decimal digits\\ diff --git a/resources/3rdparty/glpk-4.65/doc/gmpl_es.pdf b/resources/3rdparty/glpk-4.65/doc/gmpl_es.pdf new file mode 100644 index 000000000..126f9e876 Binary files /dev/null and b/resources/3rdparty/glpk-4.65/doc/gmpl_es.pdf differ diff --git a/resources/3rdparty/glpk-4.57/doc/gmpl_es.tex b/resources/3rdparty/glpk-4.65/doc/gmpl_es.tex similarity index 99% rename from resources/3rdparty/glpk-4.57/doc/gmpl_es.tex rename to resources/3rdparty/glpk-4.65/doc/gmpl_es.tex index 76a64485b..7a61125a2 100644 --- a/resources/3rdparty/glpk-4.57/doc/gmpl_es.tex +++ b/resources/3rdparty/glpk-4.65/doc/gmpl_es.tex @@ -4,9 +4,9 @@ % This code is part of GLPK (GNU Linear Programming Kit). % % Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -% 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied -% Informatics, Moscow Aviation Institute, Moscow, Russia. All rights -% reserved. E-mail: . +% 2009, 2010, 2011, 2013, 2014, 2015 Andrew Makhorin, Department for +% Applied Informatics, Moscow Aviation Institute, Moscow, Russia. All +% rights reserved. E-mail: . % % GLPK is free software: you can redistribute it and/or modify it % under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ \documentclass[11pt,spanish]{report} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} +\usepackage{lmodern} \usepackage{amssymb} \usepackage[dvipdfm,linktocpage,colorlinks,linkcolor=blue, urlcolor=blue]{hyperref} @@ -73,12 +74,12 @@ urlcolor=blue]{hyperref} \vspace{0.5in} \begin{LARGE} -\sf para GLPK Versión 4.50 +\sf para GLPK Versión 4.57 \end{LARGE} \vspace{0.5in} \begin{Large} -\sf (BORRADOR, Mayo del 2013) +\sf (BORRADOR, octubre del 2015) \end{Large} \end{center} @@ -93,10 +94,7 @@ urlcolor=blue]{hyperref} El paquete GLPK es parte del Proyecto GNU distribuido bajo la égida de GNU \noindent -Copyright \copyright{} 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -2008, 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied -Informatics, Moscow Aviation Institute, Moscow, Russia. Todos los derechos -reservados. +Copyright \copyright{} 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013, 2014, 2015 Andrew Makhorin, Department for Applied Informatics, Moscow Aviation Institute, Moscow, Russia. Todos los derechos reservados. \noindent Título original en inglés: Modeling Language GNU MathProg - Language Reference for GLPK Version 4.50 @@ -105,7 +103,7 @@ Título original en inglés: Modeling Language GNU MathProg - Language Reference Traducción: Pablo Yapura, Facultad de Ciencias Agrarias y Forestales, Universidad Nacional de La Plata, La Plata, Argentina. \noindent -Copyright \copyright{} 2013 Pablo Yapura, para esta traducción. Todos los derechos reservados. +Copyright \copyright{} 2013, 2014, 2015 Pablo Yapura, para esta traducción. Todos los derechos reservados. \noindent Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, @@ -1534,7 +1532,7 @@ El atributo de valor fijo ({\tt=}) especifica una expresión numérica para calc s.t. r: x + y + z, >= 0, <= 1; limite{t in 1..T}: sum{j in producto} elaborar[j,t] <= max_producto; subject to balance{i in insumo, t in 1..T}: - almacenar[i,t+1] - almacenar[i,t] - + almacenar[i,t+1] = almacenar[i,t] - sum{j in producto} unidades[i,j] * elaborar[j,t]; subject to ltn 'limite tiempo normal' {t in tiempo}: sum{p in producto} pt[p] * rprd[p,t] <= 1.3 * dpp[t] * brigadas[t]; @@ -3075,7 +3073,7 @@ Abajo hay un ejemplo completo de la descripción de un modelo escrito en el leng \begin{verbatim} # UN PROBLEMA DE TRANSPORTE # -# Este problema encuentra la logística de costo mínimo de flete +# Este problema determina la logística de costo mínimo de flete # que cumple los requerimientos en los mercados y en las fábricas # de suministro. # diff --git a/resources/3rdparty/glpk-4.65/doc/gmpl_pt-BR.pdf b/resources/3rdparty/glpk-4.65/doc/gmpl_pt-BR.pdf new file mode 100644 index 000000000..a2f25cb6d Binary files /dev/null and b/resources/3rdparty/glpk-4.65/doc/gmpl_pt-BR.pdf differ diff --git a/resources/3rdparty/glpk-4.65/doc/gmpl_pt-BR.tex b/resources/3rdparty/glpk-4.65/doc/gmpl_pt-BR.tex new file mode 100644 index 000000000..ee5723b71 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/doc/gmpl_pt-BR.tex @@ -0,0 +1,7893 @@ +%* gmpl.tex *% + +%*********************************************************************** +% This code is part of GLPK (GNU Linear Programming Kit). +% +% Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +% 2009, 2010, 2011, 2013, 2014, 2015 Andrew Makhorin, Department for +% Applied Informatics, Moscow Aviation Institute, Moscow, Russia. All +% rights reserved. E-mail: . +% +% GLPK is free software: you can redistribute it and/or modify it +% under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% GLPK is distributed in the hope that it will be useful, but WITHOUT +% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +% License for more details. +% +% You should have received a copy of the GNU General Public License +% along with GLPK. If not, see . +%*********************************************************************** + +\documentclass[11pt, brazil]{report} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{amssymb} +\usepackage[dvipdfm,linktocpage,colorlinks,linkcolor=blue, +urlcolor=blue]{hyperref} +\usepackage{indentfirst} + +\setlength{\textwidth}{6.5in} +\setlength{\textheight}{8.5in} +\setlength{\oddsidemargin}{0in} +\setlength{\topmargin}{0in} +\setlength{\headheight}{0in} +\setlength{\headsep}{0in} +\setlength{\footskip}{0.5in} +\setlength{\parindent}{16pt} +\setlength{\parskip}{5pt} +\setlength{\topsep}{0pt} +\setlength{\partopsep}{0pt} +\setlength{\itemsep}{\parskip} +\setlength{\parsep}{0pt} +\setlength{\leftmargini}{\parindent} +\renewcommand{\labelitemi}{---} + +\def\para#1{\noindent{\bf#1}} + +\renewcommand\contentsname{\sf\bfseries Conteúdo} +\renewcommand\chaptername{\sf\bfseries Capítulo} +\renewcommand\appendixname{\sf\bfseries Apêndice} + +% \renewcommand\contentsname{\sf\bfseries Contents} +% \renewcommand\chaptername{\sf\bfseries Chapter} +% \renewcommand\appendixname{\sf\bfseries Appendix} + +\begin{document} + +\thispagestyle{empty} + +\begin{center} + +\vspace*{1.5in} + +\begin{huge} +\sf\bfseries Linguagem de Modelagem GNU MathProg +\end{huge} + +\vspace{0.5in} + +\begin{LARGE} +\sf Linguagem de Referência % Language Reference +\end{LARGE} + +\vspace{0.5in} + +\begin{LARGE} +\sf para o GLPK Versão 4.57 +\end{LARGE} + +\vspace{0.5in} +\begin{Large} +\sf (RASCUNHO, Fevereiro 2016) +\end{Large} + +\end{center} + +\newpage + +\vspace*{1in} + +\vfill + +\noindent +% The GLPK package is part of the GNU Project released under the aegis of GNU. +O pacote GLPK é parte do Projeto GNU distribuído sob a égide do GNU. + +\noindent +Copyright \copyright{} 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, +2008, 2009, 2010, 2011, 2013, 2014, 2015, 2016 Andrew Makhorin, Department +for Applied Informatics, Moscow Aviation Institute, Moscow, Russia. +% All rights reserved. +Todos os direitos reservados. + +\noindent +Título original: Modeling Language GNU MathProg - Language Reference for GLPK Version 4.57 + +\noindent +Tradução: João Flávio de Freitas Almeida, Departamento de Engenharia de Produção, Universidade Federal de Minas Gerais, +Minas Gerais, Brasil. + +\noindent +Copyright \copyright{} 2015 João Flávio de Freitas Almeida, para esta tradução. Todos os direitos reservados. + +\noindent +Free Software Foundation, Inc., Rua Franklin, 51, 5$^{o}$ andar, Boston, +MA 02110-1301, USA. + +\noindent +É permitido realizar e distribuir cópias textuais deste manual +mantendo o aviso de copyright e preservando este aviso de permissão +em todas as cópias. +% Permission is granted to make and distribute verbatim copies of this +% manual provided the copyright notice and this permission notice are +% preserved on all copies. + +\noindent +É concedida a permissão para copiar e distribuir versões modificadas deste manual sob +as condições de cópias textuais, desde que o resultado completo derivado +do trabalho resultante seja distribuído sob os termos de uma notificação +de permissão idêntica a esta. + +% Permission is granted to copy and distribute modified versions of this +% manual under the conditions for verbatim copying, provided also that +% the entire resulting derived work is distributed under the terms of +% a permission notice identical to this one. + +\noindent +É concedida a permissão para copiar e distribuir traduções deste manual +em outra linguagem, sob as condições acima para as versões modificadas. + +% Permission is granted to copy and distribute translations of this +% manual into another language, under the above conditions for modified +% versions. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newpage + +{\setlength{\parskip}{0pt} +\tableofcontents +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Introdução} + +{\it GNU MathProg} é uma linguagem de modelagem projetada para descrever +modelos lineares de programação matemática. +\footnote{A linguagem GNU MathProg é um subconjunto da linguagem AMPL. +A implementação do GLPK é \linebreak principalmente baseada no artigo: +{\it Robert Fourer}, {\it David M. Gay}, and +{\it Brian W. Kernighan}, ``A Modeling Language for Mathematical +Programming.'' {\it Management Science} 36 (1990), pp.~519-54.} + +% {\it GNU MathProg} is a modeling language intended for describing +% linear mathematical programming models.\footnote{The GNU MathProg +% language is a subset of the AMPL language. Its GLPK implementation is +% mainly based on the paper: {\it Robert Fourer}, {\it David M. Gay}, and +% {\it Brian W. Kernighan}, ``A Modeling Language for Mathematical +% Programming.'' {\it Management Science} 36 (1990), pp.~519-54.} + +A descrição de um modelo escrito na linguagem GNU MathProg consiste +em um conjunto de sentenças e blocos de dados construído pelo +usuário a partir dos elementos de linguagem descritos neste documento. + + +% Model descriptions written in the GNU MathProg language consist of +% a set of statements and data blocks constructed by the user from the +% language elements described in this document. + +Em um processo denominado {\it tradução}, um programa denominado +{\it tradutor do modelo} analisa a descrição do modelo e o traduz +para uma estrutura de dados interna, que pode ser usado tanto para gerar +instância de um problema de programação matemática ou obter diretamente +a solução numérica do problema por meio de um programa chamado {\it solver}. + +% In a process called {\it translation}, a program called the {\it model +% translator} analyzes the model description and translates it into +% internal data structures, which may be then used either for generating +% mathematical programming problem instance or directly by a program +% called the {\it solver} to obtain numeric solution of the problem. + +\section{Problema de programação linear} +\label{problem} + +Em MathProg o problema de programação linear (PL) é expresso da seguinte forma: + +% In MathProg the linear programming (LP) problem is stated as follows: + +\medskip + +\noindent\hspace{1in}minimizar (ou maximizar) +$$z=c_1x_1+c_2x_2+\dots+c_nx_n+c_0\eqno(1.1)$$ +\noindent\hspace{1in}subjeito às restrições lineares +$$ +\begin{array}{l@{\ }c@{\ }r@{\ }c@{\ }r@{\ }c@{\ }r@{\ }c@{\ }l} +L_1&\leq&a_{11}x_1&+&a_{12}x_2&+\dots+&a_{1n}x_n&\leq&U_1\\ +L_2&\leq&a_{21}x_1&+&a_{22}x_2&+\dots+&a_{2n}x_n&\leq&U_2\\ +\multicolumn{9}{c}{.\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .}\\ +L_m&\leq&a_{m1}x_1&+&a_{m2}x_2&+\dots+&a_{mn}x_n&\leq&U_m\\ +\end{array}\eqno(1.2) +$$ +\noindent\hspace{1in}e os limites das variáveis +$$ +\begin{array}{l@{\ }c@{\ }c@{\ }c@{\ }l} +l_1&\leq&x_1&\leq&u_1\\ +l_2&\leq&x_2&\leq&u_2\\ +\multicolumn{5}{c}{.\ \ .\ \ .\ \ .\ \ .}\\ +l_n&\leq&x_n&\leq&u_n\\ +\end{array}\eqno(1.3) +$$ + +% \newpage + +\noindent +onde $x_1$, $x_2$, \dots, $x_n$ são variáveis; $z$ é a função objetivo +; $c_1$, $c_2$, \dots, $c_n$ são coeficientes da função objetivo; $c_0$ +é o termo constante da função objetivo; $a_{11}$, +$a_{12}$, \dots, $a_{mn}$ são coeficientes das restrições; $L_1$, $L_2$, +\dots, $L_m$ são limites inferiores das restrições; $U_1$, $U_2$, \dots, $U_m$ +são limites superiores das restrições; $l_1$, $l_2$, \dots, $l_n$ são limites +inferiores das variáveis; $u_1$, $u_2$, \dots, $u_n$ são limites superiores das +variáveis. + +Os limites das variáveis e das restrições podem ser tanto finitos quanto +infinitos. Além disso, os limites inferiores podem ser igual aos limites +superiores correspondentes. Logo, os seguintes tipos de variáveis e +restrições são permitidos: + + +% where $x_1$, $x_2$, \dots, $x_n$ are variables; $z$ is the objective +% function; $c_1$, $c_2$, \dots, $c_n$ are objective coefficients; $c_0$ +% is the constant term (``shift'') of the objective function; $a_{11}$, +% $a_{12}$, \dots, $a_{mn}$ are constraint coefficients; $L_1$, $L_2$, +% \dots, $L_m$ are lower constraint bounds; $U_1$, $U_2$, \dots, $U_m$ +% are upper constraint bounds; $l_1$, $l_2$, \dots, $l_n$ are lower +% bounds of variables; $u_1$, $u_2$, \dots, $u_n$ are upper bounds of +% variables. +% +% Bounds of variables and constraint bounds can be finite as well as +% infinite. Besides, lower bounds can be equal to corresponding upper +% bounds. Thus, the following types of variables and constraints are +% allowed: + +\medskip + +{\def\arraystretch{1.4} +\noindent\hspace{54pt} +\begin{tabular}{@{}r@{\ }c@{\ }c@{\ }c@{\ }l@{\hspace*{39.5pt}}l} +$-\infty$&$<$&$x$&$<$&$+\infty$&Variável livre (ilimitada)\\ +$l$&$\leq$&$x$&$<$&$+\infty$&Variável com limite inferior\\ +$-\infty$&$<$&$x$&$\leq$&$u$&Variável com limite superior\\ +$l$&$\leq$&$x$&$\leq$&$u$&Variável duplamente limitada\\ +$l$&$=$&$x$&=&$u$&Variável fixa\\ +\end{tabular} +% \begin{tabular}{@{}r@{\ }c@{\ }c@{\ }c@{\ }l@{\hspace*{39.5pt}}l} +% $-\infty$&$<$&$x$&$<$&$+\infty$&Free (unbounded) variable\\ +% $l$&$\leq$&$x$&$<$&$+\infty$&Variable with lower bound\\ +% $-\infty$&$<$&$x$&$\leq$&$u$&Variable with upper bound\\ +% $l$&$\leq$&$x$&$\leq$&$u$&Double-bounded variable\\ +% $l$&$=$&$x$&=&$u$&Fixed variable\\ +% \end{tabular} + +\noindent\hfil +\begin{tabular}{@{}r@{\ }c@{\ }c@{\ }c@{\ }ll} +$-\infty$&$<$&$\sum a_jx_j$&$<$&$+\infty$&Forma linear livre (ilimitada)\\ +$L$&$\leq$&$\sum a_jx_j$&$<$&$+\infty$&Restrição de desigualdade ``maior ou igual a''\\ +$-\infty$&$<$&$\sum a_jx_j$&$\leq$&$U$&Restrição de desigualdade ``menor ou igual a''\\ +$L$&$\leq$&$\sum a_jx_j$&$\leq$&$U$&Restrição de desigualdade duplamente limitada\\ +$L$&$=$&$\sum a_jx_j$&=&$U$&Restrição de igualdade\\ +\end{tabular} +% \begin{tabular}{@{}r@{\ }c@{\ }c@{\ }c@{\ }ll} +% $-\infty$&$<$&$\sum a_jx_j$&$<$&$+\infty$&Free (unbounded) linear +% form\\ +% $L$&$\leq$&$\sum a_jx_j$&$<$&$+\infty$&Inequality constraint ``greater +% than or equal to''\\ +% $-\infty$&$<$&$\sum a_jx_j$&$\leq$&$U$&Inequality constraint ``less +% than or equal to''\\ +% $L$&$\leq$&$\sum a_jx_j$&$\leq$&$U$&Double-bounded inequality +% constraint\\ +% $L$&$=$&$\sum a_jx_j$&=&$U$&Equality constraint\\ +% \end{tabular} +} + +\medskip + +Além de problemas puramente PL, MathProg também permite +problemas de programação inteira mista (PIM), onde algumas ou +todas as variáveis são restritas a serem inteiras ou binárias. + +% In addition to pure LP problems MathProg also allows mixed integer +% linear programming (MIP) problems, where some or all variables are +% restricted to be integer or binary. + +\section{Objetos do modelo} + +Em MathProg o modelo é descrito em termos de conjuntos, parâmetros, +variáveis, restrições e objetivos, que se denominam {\it objetos +do modelo}. + +O usuário introduz objetos particulares do modelo usando as sentenças +da linguagem. Cada objeto do modelo possui um nome simbólico que o identifica +de maneira única sendo projetado para propósitos de referenciação. + +% In MathProg the model is described in terms of sets, parameters, +% variables, constraints, and objectives, which are called {\it model +% objects}. +% +% The user introduces particular model objects using the language +% statements. Each model object is provided with a symbolic name which +% uniquely identifies the object and is intended for referencing +% purposes. + +Objetos do modelo, incluindo conjuntos, podem ser matrizes multidimensionais +construídos sobre conjuntos indexantes. Formalmente, uma matriz $n$-dimensional $A$ +é o mapeamento: +% Model objects, including sets, can be multidimensional arrays built +% over indexing sets. Formally, $n$-dimensional array $A$ is the mapping: +$$A:\Delta\rightarrow\Xi,\eqno(1.4)$$ +onde $\Delta\subseteq S_1\times\dots\times S_n$ é um subconjunto do +produto Cartesiano de conjuntos indexantes, $\Xi$ é um conjunto dos +membros da matriz. Em MathProg o conjunto $\Delta$ é chamado o {\it domínio do subíndice}. % REVISAR +Seus membros são $n$-tuplas $(i_1,\dots,i_n)$, onde $i_1\in S_1$, \dots, +$i_n\in S_n$. +% where $\Delta\subseteq S_1\times\dots\times S_n$ is a subset of the +% Cartesian product of indexing sets, $\Xi$ is a set of array members. +% In MathProg the set $\Delta$ is called the {\it subscript domain}. Its +% members are $n$-tuples $(i_1,\dots,i_n)$, where $i_1\in S_1$, \dots, +% $i_n\in S_n$. + +Se $n=0$, o produto Cartesiano acima possui exatamente um membro (denominado +0-tupla), portanto, é conveniente pensar nos objetos escalares como sendo +matrizes 0-dimensionais que \linebreak possuem apenas um membro. +% If $n=0$, the Cartesian product above has exactly one member (namely, +% 0-tuple), so it is convenient to think scalar objects as 0-dimensional +% arrays having one member. + +% \newpage + +O tipo dos membros da matriz é determinado pelo tipo de objeto do modelo +correspondente, como segue: +% The type of array members is determined by the type of corresponding +% model object as follows: + +\medskip + +\noindent\hfil +\begin{tabular}{@{}ll@{}} +Objeto do modelo&Membro da matriz\\ +\hline +Conjunto&Conjunto plano elementar\\ +Parâmetro&Número ou símbolo\\ +Variável&Variável elementar\\ +Restrição&Restrição elementar\\ +Objetivo&Objetivo elementar\\ +\end{tabular} +% \begin{tabular}{@{}ll@{}} +% Model object&Array member\\ +% \hline +% Set&Elemental plain set\\ +% Parameter&Number or symbol\\ +% Variable&Elemental variable\\ +% Constraint&Elemental constraint\\ +% Objective&Elemental objective\\ +% \end{tabular} + +\medskip + +Para referir a um membro particular de um objeto, este deve possuir +{\it subíndices}. Por exemplo, se $a$ é um parâmetro 2-dimensional +definido sobre $I\times J$, uma referência a seus membros particulares +pode ser escrito como $a[i,j]$, onde $i\in I$ e $j\in J$. Entende-se +que objetos escalares não necessitam de subíndices por serem 0-dimensionais. + +% In order to refer to a particular object member the object should be +% provided with {\it subscripts}. For example, if $a$ is a 2-dimensional +% parameter defined over $I\times J$, a reference to its particular +% member can be written as $a[i,j]$, where $i\in I$ and $j\in J$. It is +% understood that scalar objects being 0-dimensional need no subscripts. + +\section{Estrutura da descrição do modelo} + +Às vezes é desejável escrever um modelo que, por diferentes motivos, +tenha que requerer diferentes dados para resolver cada instância do problema +usando o mesmo modelo. +Por esta razão, em MathProg a descrição do modelo consiste em duas partes: +a {\it seção de modelo} e a {\it seção de dados}. + +% It is sometimes desirable to write a model which, at various points, +% may require different data for each problem instance to be solved using +% that model. For this reason in MathProg the model description consists +% of two parts: the {\it model section} and the {\it data section}. + +A seção de modelo é a principal parte da descrição do modelo, pois ela contém +as declarações dos objetos do modelo. Ela também é comum a todos os problemas +baseados no modelo correspondente. + +% The model section is a main part of the model description that contains +% declarations of model objects and is common for all problems based on +% the corresponding model. + +A seção de dados é uma parte opcional da descrição do modelo que +contém dados específicos para uma instância particular do problema. + +% The data section is an optional part of the model description that +% contains data specific for a particular problem instance. + +Dependendo do que seja mais conveniente, as seções de modelo e de dados +podem ser dispostas em um arquivo único ou em dois arquivos separados. +Esta última funcionalidade permite que se tenha um quantidade arbitrária +de seções de dados diferentes a serem usadas com a mesma seção de modelo. + +% Depending on what is more convenient the model and data sections can be +% placed either in one file or in two separate files. The latter feature +% allows having arbitrary number of different data sections to be used +% with the same model section. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Codificação da descrição do modelo} +\label{coding} + +A descrição do modelo é codificada em um formato de arquivo plano de +texto usando o conjunto de caracteres ASCII. +Os caracteres válidos na descrição do modelo são os seguintes: + +% The model description is coded in a plain text format using ASCII +% character set. Characters valid in the model description are the +% following: + +\begin{itemize} +\item Caracteres alfabéticos:\\ +\verb|A B C D E F G H I J K L M N O P Q R S T U V W X Y Z|\\ +\verb|a b c d e f g h i j k l m n o p q r s t u v w x y z _| +\item caracteres numéricos:\\ +\verb|0 1 2 3 4 5 6 7 8 9| +\item caracteres especiais:\\ +\verb?! " # & ' ( ) * + , - . / : ; < = > [ ] ^ { | } ~? +\item caracteres de espaço em branco:\\ +\verb|SP HT CR NL VT FF| +\end{itemize} + +Dentro de literais de cadeia e comentários quaisquer +caracteres ASCII (exceto caracteres de controle) são válidos. + +% Within string literals and comments any ASCII characters (except +% control characters) are valid. + + +Caracteres de espaço-em-branco não são significativos. Eles podem ser +usados livremente entre unidades léxicas para melhorar a legibilidade da +descrição do modelo. Eles também são usados para separar unidades léxicas +entre si, no caso de não existir outra forma de fazê-lo. + +% White-space characters are non-significant. They can be used freely +% between lexical units to improve readability of the model description. +% They are also used to separate lexical units from each other if there +% is no other way to do that. + +Sintaticamente a descrição do modelo é uma sequência de unidades léxicas +nas seguintes \linebreak categorias: + +% Syntactically model description is a sequence of lexical units in the +% following categories: + +\begin{itemize} +\item nomes simbólicos; +\item literais numéricos; +\item literais de cadeia; +\item palavras-chave; +\item delimitadores; +\item comentários. +\end{itemize} + +% \begin{itemize} +% \item symbolic names; +% \item numeric literals; +% \item string literals; +% \item keywords; +% \item delimiters; +% \item comments. +% \end{itemize} + +As unidades léxicas da linguagem são discutidas abaixo. + +% \newpage + +\section{Nomes simbólicos} + +Um {\it nome simbólico} consiste de caracteres alfabéticos e numéricos, +em que o primeiro deste deve ser alfabético. Todos os nomes simbólicos +devem ser distintos (sensibilidade às maiúsculas: case-sensitive). + +% A {\it symbolic name} consists of alphabetic and numeric characters, +% the first of which should be alphabetic. All symbolic names are +% distinct (case sensitive). + +\para{Exemplos} + +\begin{verbatim} +alfa123 +Este_eh_um_nome +_P123_abc_321 +\end{verbatim} + +Nomes simbólicos são usados para identificar objetos do modelo +(conjuntos, parâmetros, \linebreak variáveis, restrições, objetivos) +e os índices. + +% Symbolic names are used to identify model objects (sets, parameters, +% variables, constraints, objectives) and dummy indices. + +Todos os nomes simbólicos (exceto os nomes dos índices) devem ser únicos, +i.e., a descrição do modelo não pode ter objetos com nomes idênticos. +Nomes simbólicos de índices devem ser únicos dentro do escopo em que são válidos. + +% All symbolic names (except names of dummy indices) should be unique, +% i.e. the model description should have no objects with identical names. +% Symbolic names of dummy indices should be unique within the scope, +% where they are valid. + +\section{Literais numéricos} + +Um {\it literal numérico} possui a forma {\it xx}{\tt E}{\it syy}, onde +{\it xx} é um número com ponto decimal opcional, {\it s} é o sinal +{\tt+} ou {\tt-}, {\it yy} é um expoente decimal. A letra {\tt E} é +insensível à maiúsculas (case-insensitive) e pode ser codificada como {\tt e}. + +% A {\it numeric literal} has the form {\it xx}{\tt E}{\it syy}, where +% {\it xx} is a number with optional decimal point, {\it s} is the sign +% {\tt+} or {\tt-}, {\it yy} is a decimal exponent. The letter {\tt E} is +% case insensitive and can be coded as {\tt e}. + +\para{Exemplos} + +\begin{verbatim} +123 +3.14159 +56.E+5 +.78 +123.456e-7 +\end{verbatim} + +Literais numéricos são usados para representar quantidades numéricas. Eles +possuem significado fixo óbvio. + +% Numeric literals are used to represent numeric quantities. They have +% obvious fixed meaning. + +\section{Literais de cadeia} + +Uma {\it literal de cadeia} é uma sequência arbitrária de caracteres cercada +por aspas tanto simples como duplas. Ambas formas são equivalentes. + +% A {\it string literal} is a sequence of arbitrary characters enclosed +% either in single quotes or in double quotes. Both these forms are +% equivalent. + +Se uma aspa simples é parte de uma literal de cadeia cercada por +aspas simples, ela deve ser codificada duas vezes. De forma análoga, +se uma aspa dupla é parte de um literal de cadeia cercada por aspas duplas, +ela deve ser codificada duas vezes. + +% If a single quote is part of a string literal enclosed in single +% quotes, it should be coded twice. Analogously, if a double quote is +% part of a string literal enclosed in double quotes, it should be coded +% twice. + +\para{Exemplos} + +\begin{verbatim} +'Esta eh uma string' +"Esta eh outra string" +'Copo d''agua' +"""Beleza"" disse o capitao." +\end{verbatim} + +Literais de cadeia são usadas para representar quantidades simbólicas. +% String literals are used to represent symbolic quantities. + +\section{Palavras-chave} + +Uma {\it palavra-chave} é uma sequência de caracteres alfabéticos e +possivelmente alguns caracteres especiais. + +% A {\it keyword} is a sequence of alphabetic characters and possibly +% some special characters. + +Todas as palavras-chave caem em algumas das duas categorias: +{\it palavras-chave reservadas}, que não podem ser usadas como nomes simbólicos, +e {\it palavras-chave não-reservadas}, que são reconhecidas pelo contexto, +portanto, podem ser usadas como nomes simbólicos. + + +As palavras-chave reservadas são as seguintes: + +% All keywords fall into two categories: {\it reserved keywords}, which +% cannot be used as symbolic names, and {\it non-reserved keywords}, +% which are recognized by context and therefore can be used as symbolic +% names. +% +% The reserved keywords are the following: + +\noindent\hfil +\begin{tabular}{@{}p{.7in}p{.7in}p{.7in}p{.7in}@{}} +{\tt and}&{\tt else}&{\tt mod}&{\tt union}\\ +{\tt by}&{\tt if}&{\tt not}&{\tt within}\\ +{\tt cross}&{\tt in}&{\tt or}\\ +{\tt diff}&{\tt inter}&{\tt symdiff}\\ +{\tt div}&{\tt less}&{\tt then}\\ +\end{tabular} + +Palavras-chave não-reservadas são descritas nas seções posteriores. + +Todas as palavras-chave possuem um significado fixo, a ser +explicado nas discussões das \linebreak construções sintáticas correspondentes, +onde as palavras-chave são usadas. + +% Non-reserved keywords are described in following sections. +% +% All the keywords have fixed meaning, which will be explained on +% discussion of corresponding syntactic constructions, where the keywords +% are used. + +\section{Delimitadores} + +Um {\it delimitador} é tanto um caractere especial único quanto uma sequência +de dois caracteres especiais, como segue: + +% A {\it delimiter} is either a single special character or a sequence of +% two special characters as follows: + +\noindent\hfil +\begin{tabular}{@{}p{.3in}p{.3in}p{.3in}p{.3in}p{.3in}p{.3in}p{.3in} +p{.3in}p{.3in}@{}} +{\tt+}&{\tt**}&{\tt<=}&{\tt>}&{\tt\&\&}&{\tt:}&{\tt|}&{\tt[}& +{\tt>>}\\ +{\tt-}&{\tt\textasciicircum}&{\tt=}&{\tt<>}&{\tt||}&{\tt;}& +{\tt\char126}&{\tt]}&{\tt<-}\\ +{\tt*}&{\tt\&}&{\tt==}&{\tt!=}&{\tt.}&{\tt:=}&{\tt(}&{\tt\{}\\ +{\tt/}&{\tt<}&{\tt>=}&{\tt!}&{\tt,}&{\tt..}&{\tt)}&{\tt\}}\\ +\end{tabular} + +Se um delimitador consiste de dois caracteres, não deve haver espaços +entre os eles. + +Todos os delimitadores possuem um significado fixo, a ser +explicado nas discussões das \linebreak construções sintáticas correspondentes, +onde os delimitadores são usados. + +% If the delimiter consists of two characters, there should be no spaces +% between the characters. +% +% All the delimiters have fixed meaning, which will be explained on +% discussion corresponding syntactic constructions, where the delimiters +% are used. + +\section{Comentários} + +Com propósitos de documentação, a descrição do modelo pode conter +{\it comentários}, que podem ter duas formas diferentes. A primeira forma é +um {\it comentário de linha-única}, que começa com o caractere {\tt\#} +e se estende até o final da linha. A segunda forma é uma {\it sequência de +comentários}, que é uma sequência de quaisquer caracteres cercados por +{\tt/*} e {\tt*/}. + +% For documenting purposes the model description can be provided with +% {\it comments}, which may have two different forms. The first form is +% a {\it single-line comment}, which begins with the character {\tt\#} +% and extends until end of line. The second form is a {\it comment +% sequence}, which is a sequence of any characters enclosed within +% {\tt/*} and {\tt*/}. + +\para{Exemplos} + +\begin{verbatim} +param n := 10; # Este é um comentario +/* Este é outro comentário */ +\end{verbatim} + +Comentários e caracteres de espaço-em-branco são ignorados pelo tradutor +do modelo e podem aparecer em qualquer local da descrição do modelo. + +% Comments are ignored by the model translator and can appear anywhere in +% the model description, where white-space characters are allowed. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newpage + +\chapter{Expressões} + +Uma {\it expressão} é uma regra para calcular um valor. Na descrição +de um modelo, expressões são usadas como constituintes de certas sentenças. + +No geral, expressões são constituídas de operandos e operadores. + +Dependendo do tipo de valor resultante, todas expressões se enquadram nas +seguintes categorias: + +% An {\it expression} is a rule for computing a value. In model +% description expressions are used as constituents of certain statements. +% +% In general case expressions consist of operands and operators. +% +% Depending on the type of the resultant value all expressions fall into +% the following categories: + +\vspace*{-8pt} + +\begin{itemize} +\item expressões numéricas; +\item expressões simbólicas; +\item expressões indexantes; +\item expressões de conjuntos; +\item expressões lógicas; +\item expressões lineares. +\end{itemize} + +% \begin{itemize} +% \item numeric expressions; +% \item symbolic expressions; +% \item indexing expressions; +% \item set expressions; +% \item logical expressions; +% \item linear expressions. +% \end{itemize} + +\vspace*{-8pt} + +\section{Expressões numéricas} + +Uma {\it expressão numérica} é uma regra para calcular um valor numérico individual +representado como um número de ponto-flutuante. + +A expressão numérica primária pode ser um literal numérico, um índice, +um parâmetro não-indexado, um parâmetro indexado, uma função interna de +referência, uma expressão numérica iterada, uma expressão numérica condicional +ou outra expressão cercada por parênteses. + +% A {\it numeric expression} is a rule for computing a single numeric +% value represented as a floating-point number. +% +% The primary numeric expression may be a numeric literal, dummy index, +% unsubscripted parameter, subscripted parameter, built-in function +% reference, iterated numeric expression, conditional numeric expression, +% or another numeric expression enclosed in parentheses. + +\para{Exemplos} + +\noindent +\begin{tabular}{@{}ll@{}} +\verb|1.23 |&(literal numérico)\\ +\verb|j|&(índice)\\ +\verb|time|&(parâmetro não-indexado)\\ +\verb|a['May 2003',j+1]|&(parâmetro indexado)\\ +\verb|abs(b[i,j])|&(função de referência)\\ +\end{tabular} + +% \begin{tabular}{@{}ll@{}} +% \verb|1.23 |&(numeric literal)\\ +% \verb|j|&(dummy index)\\ +% \verb|time|&(unsubscripted parameter)\\ +% \verb|a['May 2003',j+1]|&(subscripted parameter)\\ +% \verb|abs(b[i,j])|&(function reference)\\ +% \end{tabular} + +\newpage + +\noindent +\begin{tabular}{@{}ll@{}} +\verb|sum{i in S diff T} alpha[i] * b[i,j]|&(expressão iterada)\\ +\verb|if i in I then 2 * p else q[i+1]|&(expressão condicional)\\ +\verb|(b[i,j] + .5 * c)|&(expressão entre parênteses)\\ +\end{tabular} + +% \begin{tabular}{@{}ll@{}} +% \verb|sum{i in S diff T} alpha[i] * b[i,j]|&(iterated expression)\\ +% \verb|if i in I then 2 * p else q[i+1]|&(conditional expression)\\ +% \verb|(b[i,j] + .5 * c)|&(parenthesized expression)\\ +% \end{tabular} + +Expressões numéricas mais genéricas, contendo duas ou mais +expressões numéricas primárias, podem ser construídas usando +determinados operadores aritméticos. + +% More general numeric expressions containing two or more primary numeric +% expressions may be constructed by using certain arithmetic operators. + +\para{Exemplos} + +\begin{verbatim} +j+1 +2 * a[i-1,j+1] - b[i,j] +sum{j in J} a[i,j] * x[j] + sum{k in K} b[i,k] * x[k] +(if i in I and p >= 1 then 2 * p else q[i+1]) / (a[i,j] + 1.5) +\end{verbatim} + +\subsection{Literais numéricos} + +Se a expressão numérica primária é um literal numérico, +o valor resultante é óbvio. + +% If the primary numeric expression is a numeric literal, the resultant +% value is obvious. + +\subsection{Índices} + +Se a expressão numérica primária é um índice, +o valor resultante é o valor corrente atribuído àquele índice. + +% If the primary numeric expression is a dummy index, the resultant value +% is current value assigned to that dummy index. + +\subsection{Parâmetros não-indexados} + +Se a expressão numérica primária é um parâmetro não-indexado +(que deve ser 0-dimensional), o valor resultante é o valor +do parâmetro. + +% If the primary numeric expression is an unsubscripted parameter (which +% should be 0-dimen\-sional), the resultant value is the value of that +% parameter. + +\subsection{Parâmetros indexados} + +A expressão numérica primária, que se refere ao parâmetro indexado, +possui a seguinte forma sintática: +% The primary numeric expression, which refers to a subscripted +% parameter, has the following syntactic form: +$$ +\mbox{{\it nome}{\tt[}$i_1${\tt,} $i_2${\tt,} \dots{\tt,} $i_n${\tt]}} +$$ +onde {\it nome} é o nome simbólico do parâmetro e $i_1$, $i_2$, +\dots, $i_n$ são subíndices. + +Cada subíndice deve ser uma expressão numérica ou simbólica. O número +de subíndices na lista de subíndices deve ser o mesmo da dimensão +do parâmetro com o qual a lista de subíndices está associada. + +Os valores reais das expressões de subíndice são usadas para identificar +um membro particular do parâmetro que determina o valor resultante +da expressão primária. + +% where {\it name} is the symbolic name of the parameter, $i_1$, $i_2$, +% \dots, $i_n$ are subscripts. +% +% Each subscript should be a numeric or symbolic expression. The number +% of subscripts in the subscript list should be the same as the dimension +% of the parameter with which the subscript list is associated. +% +% Actual values of subscript expressions are used to identify +% a particular member of the parameter that determines the resultant +% value of the primary expression. + +\newpage + +\subsection{Funções de referência} + +Em MathProg existem as seguintes funções internas, que podem ser +usadas como expressões numéricas: + +% In MathProg there exist the following built-in functions which may be +% used in numeric expressions: + +\begin{tabular}{@{}p{112pt}p{328pt}@{}} +{\tt abs(}$x${\tt)}&$|x|$, valor absoluto de $x$\\ +{\tt atan(}$x${\tt)}&$\arctan x$, valor principal do arco tangente de +$x$ (em radianos)\\ +{\tt atan(}$y${\tt,} $x${\tt)}&$\arctan y/x$, valor principal do +arco tangente de $y/x$ (em radianos). Neste caso, os sinais de ambos +argumentos $y$ e $x$ são usados para determinar o quadrante do valor +resultante\\ +{\tt card(}$X${\tt)}&$|X|$, cardinalidade (o número de elementos) do +conjunto $X$\\ +{\tt ceil(}$x${\tt)}&$\lceil x\rceil$, menor inteiro não menor que +$x$ (``teto de $x$'')\\ +{\tt cos(}$x${\tt)}&$\cos x$, cosseno de $x$ (em radianos)\\ +{\tt exp(}$x${\tt)}&$e^x$, exponencial de $x$ na base-$e$\\ +{\tt floor(}$x${\tt)}&$\lfloor x\rfloor$, maior inteiro não maior +que $x$ (``piso de $x$'')\\ +{\tt gmtime()}&o número de segundos decorridos deste 00:00:00 de~01~de~Jan de 1970, +Tempo Universal Coordenado (detalhes na Seção \ref{gmtime}, +página \pageref{gmtime})\\ +{\tt length(}$s${\tt)}&$|s|$, comprimento da cadeia de caracteres $s$\\ +{\tt log(}$x${\tt)}&$\log x$, logaritmo natural de $x$\\ +{\tt log10(}$x${\tt)}&$\log_{10}x$, logaritmo comum (decimal) de $x$\\ +{\tt max(}$x_1${\tt,} $x_2${\tt,} \dots{\tt,} $x_n${\tt)}&o maior +dos valores $x_1$, $x_2$, \dots, $x_n$\\ +{\tt min(}$x_1${\tt,} $x_2${\tt,} \dots{\tt,} $x_n${\tt)}&o menor +dos valores $x_1$, $x_2$, \dots, $x_n$\\ +{\tt round(}$x${\tt)}&arrendondamento de $x$ ao inteiro mais próximo\\ +{\tt round(}$x${\tt,} $n${\tt)}&arrendondamento de $x$ a $n$ dígitos decimais\\ +{\tt sin(}$x${\tt)}&$\sin x$, seno de $x$ (em radianos)\\ +{\tt sqrt(}$x${\tt)}&$\sqrt{x}$, raiz quadrada não-negativa de $x$\\ +{\tt str2time(}$s${\tt,} $f${\tt)}&conversão de uma cadeia de caracteres $s$ ao +tempo calendário (detalhes na Seção \ref{str2time}, página +\pageref{str2time})\\ +{\tt trunc(}$x${\tt)}&truncado de $x$ ao inteiro mais próximo\\ +{\tt trunc(}$x${\tt,} $n${\tt)}&truncado de $x$ a $n$ dígitos decimais\\ +{\tt Irand224()}&gera inteiro pseudo-aleatório uniformemente distribuído +em $[0,2^{24})$\\ +{\tt Uniform01()}&gera número pseudo-aleatório uniformemente distribuído +em $[0,1)$\\ +{\tt Uniform(}$a${\tt,} $b${\tt)}&gera número pseudo-aleatório uniformemente +distribuído em $[a,b)$\\ +{\tt Normal01()}&gera variável Gaussiana pseudo-aleatória com +$\mu=0$ e $\sigma=1$\\ +{\tt Normal(}$\mu${\tt,} $\sigma${\tt)}&gera variável Gaussiana pseudo-aleatória +com $\mu$ e $\sigma$ dados\\ +\end{tabular} + +% \begin{tabular}{@{}p{112pt}p{328pt}@{}} +% {\tt abs(}$x${\tt)}&$|x|$, absolute value of $x$\\ +% {\tt atan(}$x${\tt)}&$\arctan x$, principal value of the arc tangent of +% $x$ (in radians)\\ +% {\tt atan(}$y${\tt,} $x${\tt)}&$\arctan y/x$, principal value of the +% arc tangent of $y/x$ (in radians). In this case the signs of both +% arguments $y$ and $x$ are used to determine the quadrant of the +% resultant value\\ +% {\tt card(}$X${\tt)}&$|X|$, cardinality (the number of elements) of +% set $X$\\ +% {\tt ceil(}$x${\tt)}&$\lceil x\rceil$, smallest integer not less than +% $x$ (``ceiling of $x$'')\\ +% {\tt cos(}$x${\tt)}&$\cos x$, cosine of $x$ (in radians)\\ +% {\tt exp(}$x${\tt)}&$e^x$, base-$e$ exponential of $x$\\ +% {\tt floor(}$x${\tt)}&$\lfloor x\rfloor$, largest integer not greater +% than $x$ (``floor of $x$'')\\ +% {\tt gmtime()}&the number of seconds elapsed since 00:00:00~Jan~1, 1970, +% Coordinated Universal Time (for details see Section \ref{gmtime}, +% page \pageref{gmtime})\\ +% {\tt length(}$s${\tt)}&$|s|$, length of character string $s$\\ +% {\tt log(}$x${\tt)}&$\log x$, natural logarithm of $x$\\ +% {\tt log10(}$x${\tt)}&$\log_{10}x$, common (decimal) logarithm of $x$\\ +% {\tt max(}$x_1${\tt,} $x_2${\tt,} \dots{\tt,} $x_n${\tt)}&the largest +% of values $x_1$, $x_2$, \dots, $x_n$\\ +% {\tt min(}$x_1${\tt,} $x_2${\tt,} \dots{\tt,} $x_n${\tt)}&the smallest +% of values $x_1$, $x_2$, \dots, $x_n$\\ +% {\tt round(}$x${\tt)}&rounding $x$ to nearest integer\\ +% {\tt round(}$x${\tt,} $n${\tt)}&rounding $x$ to $n$ fractional decimal +% digits\\ +% {\tt sin(}$x${\tt)}&$\sin x$, sine of $x$ (in radians)\\ +% {\tt sqrt(}$x${\tt)}&$\sqrt{x}$, non-negative square root of $x$\\ +% {\tt str2time(}$s${\tt,} $f${\tt)}&converting character string $s$ to +% calendar time (for details see Section \ref{str2time}, page +% \pageref{str2time})\\ +% {\tt trunc(}$x${\tt)}&truncating $x$ to nearest integer\\ +% {\tt trunc(}$x${\tt,} $n${\tt)}&truncating $x$ to $n$ fractional +% decimal digits\\ +% {\tt Irand224()}&generating pseudo-random integer uniformly distributed +% in $[0,2^{24})$\\ +% {\tt Uniform01()}&generating pseudo-random number uniformly distributed +% in $[0,1)$\\ +% {\tt Uniform(}$a${\tt,} $b${\tt)}&generating pseudo-random number +% uniformly distributed in $[a,b)$\\ +% {\tt Normal01()}&generating Gaussian pseudo-random variate with +% $\mu=0$ and $\sigma=1$\\ +% {\tt Normal(}$\mu${\tt,} $\sigma${\tt)}&generating Gaussian +% pseudo-random variate with given $\mu$ and $\sigma$\\ +% \end{tabular} + +Os argumentos de todas as funções internas, exceto {\tt card}, {\tt length}, +e {\tt str2time}, devem ser \linebreak expressões numéricas. O argumento de +{\tt card} deve ser uma expressão de conjunto. O argumento de {\tt length} e +ambos argumentos de {\tt str2time} devem ser expressões simbólicas. + +O valor resultante da expressão numérica, que é uma função de referência, +é o resultado da aplicação da função ao(s) seu(s) argumento(s). + +Note que cada função geradora de números pseudo-aleatórios possui um argumento +latente (i.e., algum estado interno), que é alterado sempre que função é aplicada. +Assim, se a função é aplicada repetidamente mesmos aos argumentos idênticos, +devido ao efeito secundário, sempre se produzirão valores resultantes diferentes. + +% Arguments of all built-in functions, except {\tt card}, {\tt length}, +% and {\tt str2time}, should be numeric expressions. The argument of +% {\tt card} should be a set expression. The argument of {\tt length} and +% both arguments of {\tt str2time} should be symbolic expressions. +% +% The resultant value of the numeric expression, which is a function +% reference, is the result of applying the function to its argument(s). +% +% Note that each pseudo-random generator function has a latent argument +% (i.e. some internal state), which is changed whenever the function has +% been applied. Thus, if the function is applied repeatedly even to +% identical arguments, due to the side effect different resultant values +% are always produced. +\newpage + +\subsection{Expressões iteradas} +\label{itexpr} + +Uma {\it expressão numérica iterada} é uma expressão numérica primária, +que possui a seguinte forma sintática: +$$\mbox{\it operador-iterado expressão-indexada integrando}$$ +onde o {\it operador-iterado} é o nome simbólico do operador de iteração +a ser executado (veja abaixo), {\it expressão-indexada} é uma +expressão indexada que introduz índices e controla a iteração e +{\it integrando} é uma expressão numérica que participa da operação. + +\noindent +Em MathProg existem quatro operadores iterados, que podem ser usados +em expressões numéricas: + +% An {\it iterated numeric expression} is a primary numeric expression, +% which has the following syntactic form: +% $$\mbox{\it iterated-operator indexing-expression integrand}$$ +% where {\it iterated-operator} is the symbolic name of the iterated +% operator to be performed (see below), {\it indexing-expression} is an +% indexing expression which introduces dummy indices and controls +% iterating, {\it integrand} is a numeric expression that participates in +% the operation. +% +% In MathProg there exist four iterated operators, which may be used in +% numeric expressions: + +{\def\arraystretch{2} +\noindent\hfil +\begin{tabular}{@{}lll@{}} +{\tt sum}&somatório&$\displaystyle\sum_{(i_1,\dots,i_n)\in\Delta} +f(i_1,\dots,i_n)$\\ +{\tt prod}&produtório&$\displaystyle\prod_{(i_1,\dots,i_n)\in\Delta} +f(i_1,\dots,i_n)$\\ +{\tt min}&mínimo&$\displaystyle\min_{(i_1,\dots,i_n)\in\Delta} +f(i_1,\dots,i_n)$\\ +{\tt max}&máximo&$\displaystyle\max_{(i_1,\dots,i_n)\in\Delta} +f(i_1,\dots,i_n)$\\ +\end{tabular} +} + +% {\def\arraystretch{2} +% \noindent\hfil +% \begin{tabular}{@{}lll@{}} +% {\tt sum}&summation&$\displaystyle\sum_{(i_1,\dots,i_n)\in\Delta} +% f(i_1,\dots,i_n)$\\ +% {\tt prod}&production&$\displaystyle\prod_{(i_1,\dots,i_n)\in\Delta} +% f(i_1,\dots,i_n)$\\ +% {\tt min}&minimum&$\displaystyle\min_{(i_1,\dots,i_n)\in\Delta} +% f(i_1,\dots,i_n)$\\ +% {\tt max}&maximum&$\displaystyle\max_{(i_1,\dots,i_n)\in\Delta} +% f(i_1,\dots,i_n)$\\ +% \end{tabular} +% } + +\noindent onde $i_1$, \dots, $i_n$ são índices introduzidos nas +expressões indexadas, $\Delta$ é o domínio, um conjunto de $n$-tuplas +especificado pela expressão indexada que define valores particulares +atribuído aos índices ao executar a operação iterada e +$f(i_1,\dots,i_n)$ é o integrando, uma expressão numérica cujo valor +resultante depende dos índices. + +O valor resultante de uma expressão numérica iterada é o resultado da aplicação +do operador iterado ao seu integrando por todas as $n$-tuplas +contidas no domínio. + +% \noindent where $i_1$, \dots, $i_n$ are dummy indices introduced in +% the indexing expression, $\Delta$ is the domain, a set of $n$-tuples +% specified by the indexing expression which defines particular values +% assigned to the dummy indices on performing the iterated operation, +% $f(i_1,\dots,i_n)$ is the integrand, a numeric expression whose +% resultant value depends on the dummy indices. +% +% The resultant value of an iterated numeric expression is the result of +% applying of the iterated operator to its integrand over all $n$-tuples +% contained in the domain. + +\subsection{Expressões condicionais} +\label{ifthen} + +Uma {\it expressão numérica condicional} é uma expressão numérica primária +que possui uma das seguintes formas sintáticas: +% A {\it conditional numeric expression} is a primary numeric expression, +% which has one of the following two syntactic forms: +$$ +{\def\arraystretch{1.4} +\begin{array}{l} +\mbox{{\tt if} $b$ {\tt then} $x$ {\tt else} $y$}\\ +\mbox{{\tt if} $b$ {\tt then} $x$}\\ +\end{array} +} +$$ +onde $b$ é uma expressão lógica, enquanto que $x$ e $y$ são expressões numéricas. + +% where $b$ is an logical expression, $x$ and $y$ are numeric +% expressions. + + +O valor resultante da expressão condicional depende do valor da +expressão lógica que segue a palavra-chave {\tt if}. Se ela recebe +o valor {\it verdadeiro}, o valor da expressão condicional é o valor +da expressão que segue a palavra-chave {\tt then}. +Caso contrário, se a expressão lógica recebe o valor {\it falso}, +o valor da expressão condicional é o valor da expressão que segue +a palavra-chave {\it else}. Se ocorre a segunda forma sintática +da expressão condicional, a reduzida, e a expressão lógica recebe o valor +{\it falso}, então o valor resultante da expressão condicional é zero. + +% The resultant value of the conditional expression depends on the value +% of the logical expression that follows the keyword {\tt if}. If it +% takes on the value {\it true}, the value of the conditional expression +% is the value of the expression that follows the keyword {\tt then}. +% Otherwise, if the logical expression takes on the value {\it false}, +% the value of the conditional expression is the value of the expression +% that follows the keyword {\it else}. If the second, reduced form of the +% conditional expression is used and the logical expression takes on the +% value {\it false}, the resultant value of the conditional expression is +% zero. + +\newpage + +\subsection{Expressões parentizadas} + +Qualquer expressão numérica pode ser cercada por parênteses, o que as +torna sintaticamente uma expressão numérica primária. + +Parênteses podem ser usados em expressões numéricas, como em álgebra, para +especificar a ordem desejada na qual as operações devem ser realizadas. +Quando se usam parênteses, a expressão entre parênteses é avaliada +antes e seu o valor resultante é usado. + +O valor resultante de uma expressão parentizada é o mesmo +valor de uma expressão cercada entre parênteses. + +% Any numeric expression may be enclosed in parentheses that +% syntactically makes it a primary numeric expression. +% +% Parentheses may be used in numeric expressions, as in algebra, to +% specify the desired order in which operations are to be performed. +% Where parentheses are used, the expression within the parentheses is +% evaluated before the resultant value is used. +% +% The resultant value of the parenthesized expression is the same as the +% value of the expression enclosed within parentheses. + +\subsection{Operadores aritméticos} + +Em MathProg exitem os seguintes operadores aritméticos, que podem ser +usados em expressões numéricas: + +% In MathProg there exist the following arithmetic operators, which may +% be used in numeric expressions: + +\begin{tabular}{@{}ll@{}} +{\tt +} $x$&mais unário\\ +{\tt -} $x$&menos unário\\ +$x$ {\tt +} $y$&adição\\ +$x$ {\tt -} $y$&subtração\\ +$x$ {\tt less} $y$&diferença positiva (se $x1$, a segunda forma deve ser usada. + +% The number of indices in the indexing entry should be the same as the +% dimension of the basic set $S$, i.e. if $S$ consists of 1-tuples, the +% first form should be used, and if $S$ consists of $n$-tuples, where +% $n>1$, the second form should be used. + +Se a primeira forma da entrada indexante é usada, o índice $i$ pode ser +apenas um índice (veja mais adiante). Se a segunda forma é utilizada, os índices +$i_1$, $i_2$, \dots, $i_n$ podem ser tanto índices como alguma expressão numérica +ou simbólica, em que pelo menos um dos índices deve ser um índice. +Na terceira, a forma reduzida da entrada indexante possui o mesmo efeito +se houver $i$ (se $S$ é 1-dimensional) ou +$i_1$, $i_2$, \dots, $i_n$ (se $S$ é $n$-dimensional) onde todos são especificados +como índices. + +% If the first form of the indexing entry is used, the index $i$ can be +% a dummy index only (see below). If the second form is used, the indices +% $i_1$, $i_2$, \dots, $i_n$ can be either dummy indices or some numeric +% or symbolic expressions, where at least one index should be a dummy +% index. The third, reduced form of the indexing entry has the same +% effect as if there were $i$ (if $S$ is 1-dimensional) or +% $i_1$, $i_2$, \dots, $i_n$ (if $S$ is $n$-dimensional) all specified as +% dummy indices. + +Um {\it índice} é um objeto auxiliar do modelo, que atua como uma +variável individual. Os valores atribuídos aos índices são componentes +das $n$-tuplas dos conjuntos básicos, i.e., algumas quantidades +numéricas e simbólicas. + +% A {\it dummy index} is an auxiliary model object, which acts like an +% individual variable. Values assigned to dummy indices are components of +% $n$-tuples from basic sets, i.e. some numeric and symbolic quantities. + +Com propósitos de referência, índices podem ter nomes simbólicos. +No entanto, diferentemente de outros objetos de modelo (conjuntos, +parâmetros, etc.) índices não precisam ser \linebreak explicitamente declarados. +Cada nome simbólico {\it não-declarado} usado na posição indexante de +uma entrada indexante é reconhecida como o nome simbólico do índice +correspondente. + +% For referencing purposes dummy indices can be provided with symbolic +% names. However, unlike other model objects (sets, parameters, etc.) +% dummy indices need not be explicitly declared. Each {\it undeclared} +% symbolic name being used in the indexing position of an indexing entry +% is recognized as the symbolic name of corresponding dummy index. + +Os nomes simbólicos dos índices são válidos somente dentro do escopo +da expressão indexante, onde o índice foi inserido. Além do escopo, +os índices são completamente inacessíveis, de modo que os mesmos +nomes simbólicos podem ser usados para outros propósitos, em particular, +para representar índices em outras expressões indexantes. + +% Symbolic names of dummy indices are valid only within the scope of the +% indexing expression, where the dummy indices were introduced. Beyond +% the scope the dummy indices are completely inaccessible, so the same +% symbolic names may be used for other purposes, in particular, to +% represent dummy indices in other indexing expressions. + +O escopo da expressão indexante, em que declarações implícitas de índices +são válidas, depende do contexto em que a expressão indexante é usada: + +% The scope of indexing expression, where implicit declarations of dummy +% indices are valid, depends on the context, in which the indexing +% expression is used: + +\vspace*{-8pt} + +\begin{itemize} +\item Se a expressão indexante é usada em um operador-iterado, seu +escopo se estende até o final do integrando. +\item Se a expressão indexante é usada como uma expressão de conjunto +primária, seu escopo de estende até o final desta expressão indexante. +\item Se a expressão indexante é usada para definir o domínio do subíndice +na declaração de alguns objetos de modelo, seu escopo se estende até o +final da declaração correspondente. +\end{itemize} + +% \begin{itemize} +% \item If the indexing expression is used in iterated operator, its +% scope extends until the end of the integrand. +% \item If the indexing expression is used as a primary set expression, +% its scope extends until the end of that indexing expression. +% \item If the indexing expression is used to define the subscript domain +% in declarations of some model objects, its scope extends until the end +% of the corresponding statement. +% \end{itemize} + +\vspace*{-8pt} + +O mecanismo de indexação implementado para indexar expressões é melhor +explicado por alguns exemplos discutidos abaixo. + +Sejam três conjuntos: +% The indexing mechanism implemented by means of indexing expressions is +% best explained by some examples discussed below. +% +% Let there be given three sets: +$$ +{\def\arraystretch{1.4} +\begin{array}{l} +A=\{4,7,9\},\\ +B=\{(1,Jan),(1,Fev),(2,Mar),(2,Abr),(3,Mai),(3,Jun)\},\\ +C=\{a,b,c\},\\ +\end{array} +} +$$ +% $$ +% {\def\arraystretch{1.4} +% \begin{array}{l} +% A=\{4,7,9\},\\ +% B=\{(1,Jan),(1,Feb),(2,Mar),(2,Apr),(3,May),(3,Jun)\},\\ +% C=\{a,b,c\},\\ +% \end{array} +% } +% $$ +onde $A$ e $C$ consistem de 1-tuplas (singletos), $B$ consiste de +2-tuplas (dobletes). Considere a seguinte expressão indexante: +$$\mbox{{\tt\{i in A, (j,k) in B, l in C\}}}$$ +onde {\tt i}, {\tt j}, {\tt k}, e {\tt l} são índices. + +% where $A$ and $C$ consist of 1-tuples (singlets), $B$ consists of +% 2-tuples (doublets). Consider the following indexing expression: +% $$\mbox{{\tt\{i in A, (j,k) in B, l in C\}}}$$ +% where {\tt i}, {\tt j}, {\tt k}, and {\tt l} are dummy indices. + +\newpage + +Embora MathProg não seja uma linguagem procedural, para qualquer +expressão indexante uma descrição algorítmica equivalente pode ser dada. +Em particular, a descrição algorítmica da expressão indexante acima +poderia ser vista como segue: + +% Although MathProg is not a procedural language, for any indexing +% expression an equivalent algorithmic description can be given. In +% particular, the algorithmic description of the indexing expression +% above could look like follows: + +\noindent\hfil +\begin{tabular}{@{}l@{}} +{\bf para todo} $i\in A$ {\bf faça}\\ +\hspace{16pt}{\bf para todo} $(j,k)\in B$ {\bf faça}\\ +\hspace{32pt}{\bf para todo} $l\in C$ {\bf faça}\\ +\hspace{48pt}{\it ação};\\ +\end{tabular} + +% \noindent\hfil +% \begin{tabular}{@{}l@{}} +% {\bf for all} $i\in A$ {\bf do}\\ +% \hspace{16pt}{\bf for all} $(j,k)\in B$ {\bf do}\\ +% \hspace{32pt}{\bf for all} $l\in C$ {\bf do}\\ +% \hspace{48pt}{\it action};\\ +% \end{tabular} + +\noindent onde os índices $i$, $j$, $k$, $l$ são consecutivamente +atribuídos aos componentes correspondentes das $n$-tuplas dos conjuntos +básicos $A$, $B$, $C$, e {\it ação} é alguma ação que dependa do contexto +no qual a expressão indexante é usada. Por exemplo, se a ação fosse +imprimir os valores atuais dos índices, a impressão seria vista como segue: + +% \noindent where the dummy indices $i$, $j$, $k$, $l$ are consecutively +% assigned corresponding components of $n$-tuples from the basic sets $A$, +% $B$, $C$, and {\it action} is some action that depends on the context, +% where the indexing expression is used. For example, if the action were +% printing current values of dummy indices, the printout would look like +% follows: + +\noindent\hfil +\begin{tabular}{@{}llll@{}} +$i=4$&$j=1$&$k=Jan$&$l=a$\\ +$i=4$&$j=1$&$k=Jan$&$l=b$\\ +$i=4$&$j=1$&$k=Jan$&$l=c$\\ +$i=4$&$j=1$&$k=Fev$&$l=a$\\ +$i=4$&$j=1$&$k=Fev$&$l=b$\\ +\multicolumn{4}{c}{.\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .}\\ +$i=9$&$j=3$&$k=Jun$&$l=b$\\ +$i=9$&$j=3$&$k=Jun$&$l=c$\\ +\end{tabular} + +% \noindent\hfil +% \begin{tabular}{@{}llll@{}} +% $i=4$&$j=1$&$k=Jan$&$l=a$\\ +% $i=4$&$j=1$&$k=Jan$&$l=b$\\ +% $i=4$&$j=1$&$k=Jan$&$l=c$\\ +% $i=4$&$j=1$&$k=Feb$&$l=a$\\ +% $i=4$&$j=1$&$k=Feb$&$l=b$\\ +% \multicolumn{4}{c}{.\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .}\\ +% $i=9$&$j=3$&$k=Jun$&$l=b$\\ +% $i=9$&$j=3$&$k=Jun$&$l=c$\\ +% \end{tabular} + +Seja o exemplo da expressão indexante usado na seguinte +operação iterada: +$$\mbox{{\tt sum\{i in A, (j,k) in B, l in C\} p[i,j,k,l]}}$$ +onde {\tt p} é uma parâmetro numérico 4-dimensional ou alguma +expressão numérica cujo valor resultante dependa de +{\tt i}, {\tt j}, {\tt k} e {\tt l}. Neste caso, a ação é o somatório, +de forma que o valor resultante da expressão numérica primária é: +$$\sum_{i\in A,(j,k)\in B,l\in C}(p_{ijkl}).$$ + +% Let the example indexing expression be used in the following iterated +% operation: +% $$\mbox{{\tt sum\{i in A, (j,k) in B, l in C\} p[i,j,k,l]}}$$ +% where {\tt p} is a 4-dimensional numeric parameter or some numeric +% expression whose resultant value depends on {\tt i}, {\tt j}, {\tt k}, +% and {\tt l}. In this case the action is summation, so the resultant +% value of the primary numeric expression is: +% $$\sum_{i\in A,(j,k)\in B,l\in C}(p_{ijkl}).$$ + +Agora seja a expressão indexante do exemplo usada como uma expressão +de conjunto primária. Neste caso, a ação é reunir todas as 4-tuplas +(quádruplas) da forma $(i,j,k,l)$ em um conjunto, de forma que o +valor resultante de tal operação é simplesmente o produto +Cartesiano dos conjuntos básicos: +$$A\times B\times C=\{(i,j,k,l):i\in A,(j,k)\in B,l\in C\}.$$ +Note que neste caso, a mesma expressão indexante pode ser escrita +na forma reduzida: +$$\mbox{{\tt\{A, B, C\}}}$$ +pois os índices $i$, $j$, $k$ e $l$ não são referenciados, portanto, +seus nomes simbólicos não precisam ser especificados. + +% Now let the example indexing expression be used as a primary set +% expression. In this case the action is gathering all 4-tuples +% (quadruplets) of the form $(i,j,k,l)$ in one set, so the resultant +% value of such operation is simply the Cartesian product of the basic +% sets: +% $$A\times B\times C=\{(i,j,k,l):i\in A,(j,k)\in B,l\in C\}.$$ +% Note that in this case the same indexing expression might be written in +% the reduced form: +% $$\mbox{{\tt\{A, B, C\}}}$$ +% because the dummy indices $i$, $j$, $k$, and $l$ are not referenced and +% therefore their symbolic names need not be specified. + +\newpage + +Finalmente, seja a expressão indexante do exemplo usada como o domínio do +subíndice na declaração de um objeto de modelo 4-dimensional, por exemplo, +um parâmetro numérico: +% Finally, let the example indexing expression be used as the subscript +% domain in the declaration of a 4-dimensional model object, say, +% a numeric parameter: +$$\mbox{{\tt param p\{i in A, (j,k) in B, l in C\}} \dots {\tt;}}$$ + +\noindent Neste caso, a ação é gerar os membros do parâmetro, +onde cada membro possui a forma $p[i,j,k,l]$. + +% \noindent In this case the action is generating the parameter members, +% where each member has the form $p[i,j,k,l]$. + +Como mencionado anteriormente, alguns índices da segunda forma das entradas +indexantes podem ser expressões numéricas ou simbólicas, não apenas índices. +Neste caso, os valores resultantes destas expressões desempenham o papel +de algumas condições lógicas para selecionar apenas aquelas $n$-tuplas +do produto Cartesiano dos conjuntos básicos que satisfaçam estas +condições. + +% As was said above, some indices in the second form of indexing entries +% may be numeric or symbolic expressions, not only dummy indices. In this +% case resultant values of such expressions play role of some logical +% conditions to select only that $n$-tuples from the Cartesian product of +% basic sets that satisfy these conditions. + +Considere, por exemplo, a seguinte expressão indexante: +$$\mbox{{\tt\{i in A, (i-1,k) in B, l in C\}}}$$ +onde {\tt i}, {\tt k} e {\tt l} são índices, e {\tt i-1} é uma +expressão numérica. A descrição algorítmica desta expressão +indexante é a seguinte: + +% Consider, for example, the following indexing expression: +% $$\mbox{{\tt\{i in A, (i-1,k) in B, l in C\}}}$$ +% where {\tt i}, {\tt k}, {\tt l} are dummy indices, and {\tt i-1} is +% a numeric expression. The algorithmic decsription of this indexing +% expression is the following: + +\noindent\hfil +\begin{tabular}{@{}l@{}} +{\bf para todo} $i\in A$ {\bf faça}\\ +\hspace{16pt}{\bf para todo} $(j,k)\in B$ {\bf e} $j=i-1$ {\bf faça}\\ +\hspace{32pt}{\bf para todo} $l\in C$ {\bf faça}\\ +\hspace{48pt}{\it ação};\\ +\end{tabular} + +% \noindent\hfil +% \begin{tabular}{@{}l@{}} +% {\bf for all} $i\in A$ {\bf do}\\ +% \hspace{16pt}{\bf for all} $(j,k)\in B$ {\bf and} $j=i-1$ {\bf do}\\ +% \hspace{32pt}{\bf for all} $l\in C$ {\bf do}\\ +% \hspace{48pt}{\it action};\\ +% \end{tabular} + +\noindent Assim, se esta expressão indexante fosse usada como uma expressão de conjunto +primária, o conjunto resultante seira o seguinte: +$$\{(4,Mai,a),(4,Mai,b),(4,Mai,c),(4,Jun,a),(4,Jun,b),(4,Jun,c)\}.$$ +Deve-se notar que neste caso o conjunto resultante consiste em 3-tuplas, +e não de 4-tuplas, porque na expressão indexante não há índice que +corresponda ao primeiro componente das 2-tuplas do conjunto $B$. + +% \noindent Thus, if this indexing expression were used as a primary set +% expression, the resultant set would be the following: +% $$\{(4,May,a),(4,May,b),(4,May,c),(4,Jun,a),(4,Jun,b),(4,Jun,c)\}.$$ +% Should note that in this case the resultant set consists of 3-tuples, +% not of 4-tuples, because in the indexing expression there is no dummy +% index that corresponds to the first component of 2-tuples from the set +% $B$. + +A regra geral é: o número de componentes de $n$-tuplas definido por +uma expressão indexante é o mesmo do número de índices naquela expressão, +onde a correspondência entre índices e componentes nas $n$-tuplas no +conjunto resultante é posicional, i.e., o primeiro índice corresponde +ao primeiro componente, o segundo índice corresponde ao segundo +componente, etc. + +% The general rule is: the number of components of $n$-tuples defined by +% an indexing expression is the same as the number of dummy indices in +% that expression, where the correspondence between dummy indices and +% components on $n$-tuples in the resultant set is positional, i.e. the +% first dummy index corresponds to the first component, the second dummy +% index corresponds to the second component, etc. + +Em alguns casos é necessário selecionar um subconjunto do produto +Cartesiano de alguns \linebreak conjuntos. Isto pode ser alcançado mediante o +emprego de um predicado lógico opcional, que é especificado na +expressão indexante. + +% In some cases it is needed to select a subset from the Cartesian +% product of some sets. This may be attained by using an optional logical +% predicate, which is specified in the indexing expression. + +Considere, por exemplo, a seguinte expressão indexante: +$$\mbox{{\tt\{i in A, (j,k) in B, l in C: i <= 5 and k <> 'Mar'\}}}$$ +onde a expressão lógica após os dois pontos é um predicado. A +descrição algorítmica desta expressão indexante é a seguinte: + +% Consider, for example, the following indexing expression: +% $$\mbox{{\tt\{i in A, (j,k) in B, l in C: i <= 5 and k <> 'Mar'\}}}$$ +% where the logical expression following the colon is a predicate. The +% algorithmic description of this indexing expression is the following: + +\noindent\hfil +\begin{tabular}{@{}l@{}} +{\bf para todo} $i\in A$ {\bf faça}\\ +\hspace{16pt}{\bf para todo} $(j,k)\in B$ {\bf faça}\\ +\hspace{32pt}{\bf para todo} $l\in C$ {\bf faça}\\ +\hspace{48pt}{\bf se} $i\leq 5$ {\bf e} $k\neq`Mar'$ {\bf então}\\ +\hspace{64pt}{\it ação};\\ +\end{tabular} + +% \noindent\hfil +% \begin{tabular}{@{}l@{}} +% {\bf for all} $i\in A$ {\bf do}\\ +% \hspace{16pt}{\bf for all} $(j,k)\in B$ {\bf do}\\ +% \hspace{32pt}{\bf for all} $l\in C$ {\bf do}\\ +% \hspace{48pt}{\bf if} $i\leq 5$ {\bf and} $k\neq`Mar'$ {\bf then}\\ +% \hspace{64pt}{\it action};\\ +% \end{tabular} + +\noindent Assim, se a expressão indexante fosse usada como uma +expressão de conjunto primária, o conjunto resultante seria o seguinte: +$$\{(4,1,Jan,a),(4,1,Fev,a),(4,2,Abr,a),\dots,(4,3,Jun,c)\}.$$ + +Se o predicado não é especificado na expressão indexante assume-se um, +que recebe o valor {\it verdadeiro}. + +% \noindent Thus, if this indexing expression were used as a primary set +% expression, the resultant set would be the following: +% $$\{(4,1,Jan,a),(4,1,Feb,a),(4,2,Apr,a),\dots,(4,3,Jun,c)\}.$$ +% +% If no predicate is specified in the indexing expression, one, which +% takes on the value {\it true}, is assumed. + +\section{Expressões de conjunto} + +Uma {\it expressão de conjunto} é uma regra para calcular um conjunto +elementar, i.e., uma coleção de $n$-tuplas, onde os componentes das +$n$-tuplas são quantidades numéricas e simbólicas. + +% A {\it set expression} is a rule for computing an elemental set, i.e. +% a collection of $n$-tuples, where components of $n$-tuples are numeric +% and symbolic quantities. + +A expressão de conjunto primária pode ser um conjunto de literais, um conjunto +não-indexado, um conjunto indexado, um conjunto ``aritmético'', uma expressão +indexante, uma expressão de \linebreak conjunto iterada, uma expressão de conjunto +condicional ou outra expressão cercada por \linebreak parênteses. + +\para{Exemplos} + +% The primary set expression may be a literal set, unsubscripted set, +% subscripted set, ``arithmetic'' set, indexing expression, iterated set +% expression, conditional set expression, or another set expression +% enclosed in parentheses. +% +% \para{Examples} + +\noindent +\begin{tabular}{@{}ll@{}} +\verb|{(123,'aaa'), (i+1,'bbb'), (j-1,'ccc')}| &(conjunto de literais)\\ +\verb|I| &(conjunto não-indexado)\\ +\verb|S[i-1,j+1]| &(conjunto indexado)\\ +\verb|1..t-1 by 2| &(conjunto ``aritmético'')\\ +\verb|{t in 1..T, (t+1,j) in S: (t,j) in F}| &(expressão indexante)\\ +\verb|setof{i in I, j in J}(i+1,j-1)| &(expressão de conjunto iterado)\\ +\verb|if i < j then S[i,j] else F diff S[i,j]| &(expressão de conjunto +condicional)\\ +\verb|(1..10 union 21..30)| &(expressão de conjunto parentizado)\\ +\end{tabular} + +% \noindent +% \begin{tabular}{@{}ll@{}} +% \verb|{(123,'aaa'), (i+1,'bbb'), (j-1,'ccc')}| &(literal set)\\ +% \verb|I| &(unsubscripted set)\\ +% \verb|S[i-1,j+1]| &(subscripted set)\\ +% \verb|1..t-1 by 2| &(``arithmetic'' set)\\ +% \verb|{t in 1..T, (t+1,j) in S: (t,j) in F}| &(indexing expression)\\ +% \verb|setof{i in I, j in J}(i+1,j-1)| &(iterated set expression)\\ +% \verb|if i < j then S[i,j] else F diff S[i,j]| &(conditional set +% expression)\\ +% \verb|(1..10 union 21..30)| &(parenthesized set expression)\\ +% \end{tabular} + +Expressões de conjuntos mais genéricas contendo duas ou mais expressões +de conjunto primárias podem ser construídas usando operadores +específicos de conjunto . + +\para{Exemplos} + +% More general set expressions containing two or more primary set +% expressions may be constructed by using certain set operators. +% +% \para{Examples} + +\begin{verbatim} +(A union B) inter (I cross J) +1..10 cross (if i < j then {'a', 'b', 'c'} else {'d', 'e', 'f'}) +\end{verbatim} + +\subsection{Conjuntos de literais} + +Um {\it conjunto de literais} é uma expressão de conjunto primária +que possui as duas formas \linebreak sintáticas seguintes: +% A {\it literal set} is a primary set expression, which has the +% following two syntactic forms: +$$ +{\def\arraystretch{1.4} +\begin{array}{l} +\mbox{{\tt\{}$e_1${\tt,} $e_2${\tt,} \dots{\tt,} $e_m${\tt\}}}\\ +\mbox{{\tt\{(}$e_{11}${\tt,} \dots{\tt,} $e_{1n}${\tt),} +{\tt(}$e_{21}${\tt,} \dots{\tt,} $e_{2n}${\tt),} \dots{\tt,} +{\tt(}$e_{m1}${\tt,} \dots{\tt,} $e_{mn}${\tt)\}}}\\ +\end{array} +} +$$ +% $$ +% {\def\arraystretch{1.4} +% \begin{array}{l} +% \mbox{{\tt\{}$e_1${\tt,} $e_2${\tt,} \dots{\tt,} $e_m${\tt\}}}\\ +% \mbox{{\tt\{(}$e_{11}${\tt,} \dots{\tt,} $e_{1n}${\tt),} +% {\tt(}$e_{21}${\tt,} \dots{\tt,} $e_{2n}${\tt),} \dots{\tt,} +% {\tt(}$e_{m1}${\tt,} \dots{\tt,} $e_{mn}${\tt)\}}}\\ +% \end{array} +% } +% $$ +onde $e_1$, \dots, $e_m$, $e_{11}$, \dots, $e_{mn}$ são expressões +numéricas ou simbólicas. + +Se a primeira forma é adotada, o conjunto resultante consiste +de 1-tuplas (singletos) enumerados entre as chaves. +É permitido especificar um conjunto vazio como {\tt\{\ \}}, +que não possui 1-tuplas. Se a segunda forma é adotada, +o conjunto resultante consiste de $n$-tuplas enumeradas entre as chaves, +onde uma $n$-tupla particular consiste nos componentes correspondentes +enumerados entre parênteses. Todas as $n$-tuplas devem ter o mesmo +número de componentes. + +% where $e_1$, \dots, $e_m$, $e_{11}$, \dots, $e_{mn}$ are numeric or +% symbolic expressions. +% +% If the first form is used, the resultant set consists of 1-tuples +% (singlets) enumerated within the curly braces. It is allowed to specify +% an empty set as {\tt\{\ \}}, which has no 1-tuples. If the second form +% is used, the resultant set consists of $n$-tuples enumerated within the +% curly braces, where a particular $n$-tuple consists of corresponding +% components enumerated within the parentheses. All $n$-tuples should +% have the same number of components. + +\subsection{Conjuntos não-indexados} + +Se a expressão de conjunto primária é um conjunto não-indexado +(que deve ser 0-dimensional), o conjunto resultante é um conjunto +elementar associado com o objeto conjunto correspondente. + +% If the primary set expression is an unsubscripted set (which should be +% 0-dimen\-sional), the resultant set is an elemental set associated with +% the corresponding set object. + +\subsection{Conjuntos indexados} + +A expressão de conjunto primária, que se refere a um conjunto indexado, +tem a seguinte forma sintática: +$$\mbox{{\it nome}{\tt[}$i_1${\tt,} $i_2${\tt,} \dots{\tt,} +$i_n${\tt]}}$$ +onde {\it nome} é o nome simbólico do objeto conjunto e $i_1$, $i_2$, +\dots, $i_n$ são subíndices. + +% The primary set expression, which refers to a subscripted set, has the +% following syntactic form: +% $$\mbox{{\it name}{\tt[}$i_1${\tt,} $i_2${\tt,} \dots{\tt,} +% $i_n${\tt]}}$$ +% where {\it name} is the symbolic name of the set object, $i_1$, $i_2$, +% \dots, $i_n$ are subscripts. + +Cada subíndice deve ser uma expressão numérica ou simbólica. O número de +subíndices nas lista de subíndices deve ser o mesmo da dimensão do objeto +conjunto com o qual as lista de subíndice está associada. + +Os valores correntes das expressões de subíndices são usados para identificar +um membro \linebreak particular do objeto conjunto que determina o conjunto resultante. + +% Each subscript should be a numeric or symbolic expression. The number +% of subscripts in the subscript list should be the same as the dimension +% of the set object with which the subscript list is associated. +% +% Actual values of subscript expressions are used to identify a +% particular member of the set object that determines the resultant set. + +\subsection{Conjuntos ``aritméticos''} + +A expressão de conjunto primária que constitui um conjunto ``aritmético'', +possui as duas formas sintáticas seguintes: +% The primary set expression, which is an ``arithmetic'' set, has the +% following two syntactic forms: +$$ +{\def\arraystretch{1.4} +\begin{array}{l} +\mbox{$t_0$ {\tt..} $t_1$ {\tt by} $\delta t$}\\ +\mbox{$t_0$ {\tt..} $t_1$}\\ +\end{array} +} +$$ +onde $t_0$, $t_1$, e $\delta t$ são expressões numéricas (o valor de +$\delta t$ não deve ser zero). A segunda forma é equivalente a primeira +forma, onde $\delta t=1$. + +Se $\delta t>0$, o conjunto resultante é determinado como segue: +$$\{t:\exists k\in{\cal Z}(t=t_0+k\delta t,\ t_0\leq t\leq t_1)\}.$$ +Caso contrário, se $\delta t<0$, o conjunto resultante é determinado como segue: +$$\{t:\exists k\in{\cal Z}(t=t_0+k\delta t,\ t_1\leq t\leq t_0)\}.$$ +% $$ +% {\def\arraystretch{1.4} +% \begin{array}{l} +% \mbox{$t_0$ {\tt..} $t_1$ {\tt by} $\delta t$}\\ +% \mbox{$t_0$ {\tt..} $t_1$}\\ +% \end{array} +% } +% $$ +% where $t_0$, $t_1$, and $\delta t$ are numeric expressions (the value +% of $\delta t$ should not be zero). The second form is equivalent to the +% first form, where $\delta t=1$. +% +% If $\delta t>0$, the resultant set is determined as follows: +% $$\{t:\exists k\in{\cal Z}(t=t_0+k\delta t,\ t_0\leq t\leq t_1)\}.$$ +% Otherwise, if $\delta t<0$, the resultant set is determined as follows: +% $$\{t:\exists k\in{\cal Z}(t=t_0+k\delta t,\ t_1\leq t\leq t_0)\}.$$ + +\subsection{Expressões indexantes} + +Se a expressão primária é uma expressão indexante, o conjunto resultante +é determinado como descrito anteriormente, na Seção \ref{indexing}, página +\pageref{indexing}. + +% If the primary set expression is an indexing expression, the resultant +% set is determined as described above in Section \ref{indexing}, page +% \pageref{indexing}. + +\newpage + +\subsection{Expressões iteradas} + +Uma {\it expressão de conjunto iterada} é uma expressão de conjunto +primária, que possui a seguinte forma sintática: +$$\mbox{{\tt setof} {\it expressão-indexante} {\it integrando}}$$ +onde {\it expressão-indexante} é uma expressão indexante, que +introduz índices e controla a iteração, {\it integrando} é +tanto uma expressão numérica ou simbólica individual, como uma +lista de expressões numéricas ou simbólicas separadas por vírgula +e cercadas entre parênteses. + +% An {\it iterated set expression} is a primary set expression, which has +% the following syntactic form: +% $$\mbox{{\tt setof} {\it indexing-expression} {\it integrand}}$$ +% where {\it indexing-expression} is an indexing expression, which +% introduces dummy indices and controls iterating, {\it integrand} is +% either a single numeric or symbolic expression or a list of numeric and +% symbolic expressions separated by commae and enclosed in parentheses. + +Se o integrando é uma expressão numérica ou simbólica individual, o +conjunto resultante consiste de 1-tuplas, sendo determinado como segue: +$$\{x:(i_1,\dots,i_n)\in\Delta\},$$ +\noindent onde $x$ é um valor do integrando, $i_1$, \dots, $i_n$ +são índices introduzidos na expressão indexante, $\Delta$ é +o domínio, um conjunto de $n$-tuplas especificado pela expressão +indexante que define valores particulares atribuídos aos índices ao +realizar a operação de iteração. + +% If the integrand is a single numeric or symbolic expression, the +% resultant set consists of 1-tuples and is determined as follows: +% $$\{x:(i_1,\dots,i_n)\in\Delta\},$$ +% \noindent where $x$ is a value of the integrand, $i_1$, \dots, $i_n$ +% are dummy indices introduced in the indexing expression, $\Delta$ is +% the domain, a set of $n$-tuples specified by the indexing expression, +% which defines particular values assigned to the dummy indices on +% performing the iterated operation. + +Se o integrando é uma lista contendo $m$ expressões numéricas e simbólicas, +o conjunto resultante consiste de $m$-tuplas, sendo determinado +como segue: +$$\{(x_1,\dots,x_m):(i_1,\dots,i_n)\in\Delta\},$$ +onde $x_1$, \dots, $x_m$ são valores das expressões na lista +de integrandos, $i_1$, \dots, $i_n$ e $\Delta$ possuem o mesmo significado +anterior. + +% If the integrand is a list containing $m$ numeric and symbolic +% expressions, the resultant set consists of $m$-tuples and is determined +% as follows: +% $$\{(x_1,\dots,x_m):(i_1,\dots,i_n)\in\Delta\},$$ +% where $x_1$, \dots, $x_m$ are values of the expressions in the +% integrand list, $i_1$, \dots, $i_n$ and $\Delta$ have the same meaning +% as above. + +\subsection{Expressões condicionais} + +Uma {\it expressão de conjunto condicional} é uma expressão de conjunto +primária que possui a seguinte forma sintática: +$$\mbox{{\tt if} $b$ {\tt then} $X$ {\tt else} $Y$}$$ +onde $b$ é uma expressão lógica, $X$ e $Y$ são expressões de conjunto, +que devem definir conjuntos da mesma dimensão. + +% A {\it conditional set expression} is a primary set expression that has +% the following syntactic form: +% $$\mbox{{\tt if} $b$ {\tt then} $X$ {\tt else} $Y$}$$ +% where $b$ is an logical expression, $X$ and $Y$ are set expressions, +% which should define sets of the same dimension. + +O valor resultante da expressão condicional depende do valor da +expressão lógica que segue a palavra-chave {\tt if}. Se ela recebe +o valor {\it verdadeiro}, o conjunto resultante é o valor da expressão +que segue a palavra-chave {\tt then}. Caso contrário, se a +expressão lógica recebe o valor {\it falso}, o conjunto resultante é +o valor da expressão que segue a palavra-chave {\tt else}. + +% The resultant value of the conditional expression depends on the value +% of the logical expression that follows the keyword {\tt if}. If it +% takes on the value {\it true}, the resultant set is the value of the +% expression that follows the keyword {\tt then}. Otherwise, if the +% logical expression takes on the value {\it false}, the resultant set is +% the value of the expression that follows the keyword {\tt else}. + +\subsection{Expressões parentizadas} + +Qualquer expressão de conjunto pode ser cercada entre parênteses, o que as tornam +\linebreak sintaticamente uma expressão de conjunto primária. +Parênteses podem ser usados em expressões de conjunto, como em álgebra, para +especificar a ordem desejada nas quais as operações devem ser executadas. +Quando se usam parênteses, a expressão entre parênteses é avaliada +antes que o valor resultante seja usado. +O valor resultante de uma expressão parentizada é idêntico ao valor da expressão +cercada entre parênteses. + +% Any set expression may be enclosed in parentheses that syntactically +% makes it a primary set expression. +% +% Parentheses may be used in set expressions, as in algebra, to specify +% the desired order in which operations are to be performed. Where +% parentheses are used, the expression within the parentheses is +% evaluated before the resultant value is used. +% +% The resultant value of the parenthesized expression is the same as the +% value of the expression enclosed within parentheses. + +\newpage + +\subsection{Operadores de conjunto} + +Em MathProg existem os seguintes operadores de conjunto, que podem ser +usados em expressões de conjunto: + +% In MathProg there exist the following set operators, which may be used +% in set expressions: + +\begin{tabular}{@{}ll@{}} +$X$ {\tt union} $Y$&união $X\cup Y$\\ +$X$ {\tt diff} $Y$&diferença $X\backslash Y$\\ +$X$ {\tt symdiff} $Y$&diferença simétrica +$X\oplus Y=(X\backslash Y)\cup(Y\backslash X)$\\ +$X$ {\tt inter} $Y$&interseção $X\cap Y$\\ +$X$ {\tt cross} $Y$&produto Cartesiano (cruzado) $X\times Y$\\ +\end{tabular} + +% \begin{tabular}{@{}ll@{}} +% $X$ {\tt union} $Y$&union $X\cup Y$\\ +% $X$ {\tt diff} $Y$&difference $X\backslash Y$\\ +% $X$ {\tt symdiff} $Y$&symmetric difference +% $X\oplus Y=(X\backslash Y)\cup(Y\backslash X)$\\ +% $X$ {\tt inter} $Y$&intersection $X\cap Y$\\ +% $X$ {\tt cross} $Y$&cross (Cartesian) product $X\times Y$\\ +% \end{tabular} + +\noindent onde $X$ e Y são expressões de conjunto, que devem definir conjuntos +de dimensões idênticas (exceto o produto Cartesiano). + +Se a expressão inclui mais de um operador de conjunto, todos operadores +são executados da esquerda para a direita de acordo com a hierarquia das +operações (veja adiante). + +O valor resultante da expressão, que contém operadores de conjunto, é +o resultado da aplicação dos operadores aos seus operandos. + +A dimensão do conjunto resultante, i.e., a dimensão das $n$-tuplas, +dos quais consistem o conjunto resultante, é a mesma da dimensão dos +operandos, exceto o produto Cartesiano, onde a dimensão do conjunto +resultante é a soma das dimensões dos seus operandos. + +% \noindent where $X$ and Y are set expressions, which should define sets +% of identical dimension (except the Cartesian product). +% +% If the expression includes more than one set operator, all operators +% are performed from left to right according to the hierarchy of +% operations (see below). +% +% The resultant value of the expression, which contains set operators, is +% the result of applying the operators to their operands. +% +% The dimension of the resultant set, i.e. the dimension of $n$-tuples, +% of which the resultant set consists of, is the same as the dimension of +% the operands, except the Cartesian product, where the dimension of the +% resultant set is the sum of the dimensions of its operands. + +\subsection{Hierarquia das operações} + +A lista seguinte mostra a hierarquia das operações em expressões de conjunto: + +% The following list shows the hierarchy of operations in set +% expressions: + +\noindent\hfil +\begin{tabular}{@{}ll@{}} +Operação&Hierarquia\\ +\hline +Avaliação de operações numéricas& +1{\textsuperscript{\b{a}}}-7{\textsuperscript{\b{a}}}\\ +Avaliação de operações simbólicas& +8{\textsuperscript{\b{a}}}-9{\textsuperscript{\b{a}}}\\ +Avaliação de conjuntos iterados ou ``aritméticos'' ({\tt setof}, {\tt..})& +10{\textsuperscript{\b{a}}}\\ +Produto Cartesiano ({\tt cross})& +11{\textsuperscript{\b{a}}}\\ +Interseção ({\tt inter})& +12{\textsuperscript{\b{a}}}\\ +União e diferença ({\tt union}, {\tt diff}, {\tt symdiff})& +13{\textsuperscript{\b{a}}}\\ +Avaliação condicional ({\tt if} \dots {\tt then} \dots {\tt else})& +14{\textsuperscript{\b{a}}}\\ +\end{tabular} + +% \noindent\hfil +% \begin{tabular}{@{}ll@{}} +% Operation&Hierarchy\\ +% \hline +% Evaluation of numeric operations&1st-7th\\ +% Evaluation of symbolic operations&8th-9th\\ +% Evaluation of iterated or ``arithmetic'' set ({\tt setof}, {\tt..})& +% 10th\\ +% Cartesian product ({\tt cross})&11th\\ +% Intersection ({\tt inter})&12th\\ +% Union and difference ({\tt union}, {\tt diff}, {\tt symdiff})&13th\\ +% Conditional evaluation ({\tt if} \dots {\tt then} \dots {\tt else})& +% 14th\\ +% \end{tabular} + +Esta hierarquia possui o mesmo significado como explicado anteriormente +para expressões \linebreak numéricas (ver Subseção \ref{hierarchy}, página \pageref{hierarchy}). + +% This hierarchy has the same meaning as was explained above for numeric +% expressions (see Subsection \ref{hierarchy}, page \pageref{hierarchy}). + +\newpage + +\section{Expressões lógicas} + +Uma {\it expressão lógica} é uma regra para calcular um valor lógico +individual, que pode ser {\it verdadeiro} ou {\it falso}. + +A expressão lógica primária pode ser uma expressão numérica, +uma expressão relacional, uma expressão lógica iterada ou +outra expressão lógica cercada entre parênteses. + +\para{Exemplos} + +% A {\it logical expression} is a rule for computing a single logical +% value, which can be either {\it true} or {\it false}. +% +% The primary logical expression may be a numeric expression, relational +% expression, iterated logical expression, or another logical expression +% enclosed in parentheses. +% +% \para{Examples} + +\noindent +\begin{tabular}{@{}ll@{}} +\verb|i+1| &(expressão numérica)\\ +\verb|a[i,j] < 1.5| &(expressão relacional)\\ +\verb|s[i+1,j-1] <> 'Mar' & year | &(expressão relacional)\\ +\verb|(i+1,'Jan') not in I cross J| &(expressão relacional)\\ +\verb|S union T within A[i] inter B[j]| &(expressão relacional)\\ +\verb|forall{i in I, j in J} a[i,j] < .5 * b[i]| &(expressão lógica iterada)\\ +\verb|(a[i,j] < 1.5 or b[i] >= a[i,j])| &(expressão lógica parentizada)\\ +\end{tabular} + +% \noindent +% \begin{tabular}{@{}ll@{}} +% \verb|i+1| &(numeric expression)\\ +% \verb|a[i,j] < 1.5| &(relational expression)\\ +% \verb|s[i+1,j-1] <> 'Mar' & year | &(relational expression)\\ +% \verb|(i+1,'Jan') not in I cross J| &(relational expression)\\ +% \verb|S union T within A[i] inter B[j]| &(relational expression)\\ +% \verb|forall{i in I, j in J} a[i,j] < .5 * b[i]| &(iterated logical +% expression)\\ +% \verb|(a[i,j] < 1.5 or b[i] >= a[i,j])| &(parenthesized logical +% expression)\\ +% \end{tabular} + +Expressões lógicas mais genéricas, contendo duas ou mais +expressões lógicas primárias, podem ser construídas usando +determinados operadores lógicos. + +\para{Exemplos} + +\begin{verbatim} +not (a[i,j] < 1.5 or b[i] >= a[i,j]) and (i,j) in S +(i,j) in S or (i,j) not in T diff U +\end{verbatim} + +% More general logical expressions containing two or more primary logical +% expressions may be constructed by using certain logical operators. +% +% \para{Examples} +% +% \begin{verbatim} +% not (a[i,j] < 1.5 or b[i] >= a[i,j]) and (i,j) in S +% (i,j) in S or (i,j) not in T diff U +% \end{verbatim} +\vspace*{-8pt} + +\subsection{Expressões numéricas} + +O valor resultante da expressão lógica primária, que é uma +expressão numérica, é {\it verdadeiro}, se o valor resultante da +expressão numérica é diferente de zero. Caso contrário o valor resultante +da expressão lógica é {\it falso}. + +% The resultant value of the primary logical expression, which is a +% numeric expression, is {\it true}, if the resultant value of the +% numeric expression is non-zero. Otherwise the resultant value of the +% logical expression is {\it false}. + +\vspace*{-8pt} + +\subsection{Operadores relacionais} + +Em MathProg existem os seguintes operadores relacionais, que podem +ser usados em expressões lógicas: + +% In MathProg there exist the following relational operators, which may +% be used in logical expressions: + +\begin{tabular}{@{}ll@{}} +$x$ {\tt<} $y$&verifica se $x=} $y$&verifica se $x\geq y$\\ +$x$ {\tt>} $y$&verifica se $x>y$\\ +$x$ {\tt<>} $y$, $x$ {\tt!=} $y$&verifica se $x\neq y$\\ +$x$ {\tt in} $Y$&verifica se $x\in Y$\\ +{\tt(}$x_1${\tt,}\dots{\tt,}$x_n${\tt)} {\tt in} $Y$&verifica se +$(x_1,\dots,x_n)\in Y$\\ +$x$ {\tt not} {\tt in} $Y$, $x$ {\tt!in} $Y$&verifica se $x\not\in Y$\\ +{\tt(}$x_1${\tt,}\dots{\tt,}$x_n${\tt)} {\tt not} {\tt in} $Y$, +{\tt(}$x_1${\tt,}\dots{\tt,}$x_n${\tt)} {\tt !in} $Y$&verifica se +$(x_1,\dots,x_n)\not\in Y$\\ +$X$ {\tt within} $Y$&verifica se $X\subseteq Y$\\ +$X$ {\tt not} {\tt within} $Y$, $X$ {\tt !within} $Y$&verifica se +$X\not\subseteq Y$\\ +\end{tabular} + +% \begin{tabular}{@{}ll@{}} +% $x$ {\tt<} $y$&test on $x=} $y$&test on $x\geq y$\\ +% $x$ {\tt>} $y$&test on $x>y$\\ +% $x$ {\tt<>} $y$, $x$ {\tt!=} $y$&test on $x\neq y$\\ +% $x$ {\tt in} $Y$&test on $x\in Y$\\ +% {\tt(}$x_1${\tt,}\dots{\tt,}$x_n${\tt)} {\tt in} $Y$&test on +% $(x_1,\dots,x_n)\in Y$\\ +% $x$ {\tt not} {\tt in} $Y$, $x$ {\tt!in} $Y$&test on $x\not\in Y$\\ +% {\tt(}$x_1${\tt,}\dots{\tt,}$x_n${\tt)} {\tt not} {\tt in} $Y$, +% {\tt(}$x_1${\tt,}\dots{\tt,}$x_n${\tt)} {\tt !in} $Y$&test on +% $(x_1,\dots,x_n)\not\in Y$\\ +% $X$ {\tt within} $Y$&test on $X\subseteq Y$\\ +% $X$ {\tt not} {\tt within} $Y$, $X$ {\tt !within} $Y$&test on +% $X\not\subseteq Y$\\ +% \end{tabular} + +\noindent onde $x$, $x_1$, \dots, $x_n$, $y$ são expressões numéricas ou +simbólicas, $X$ e $Y$ são expressões de conjunto. + +% \noindent where $x$, $x_1$, \dots, $x_n$, $y$ are numeric or symbolic +% expressions, $X$ and $Y$ are set expression. + +\newpage + +1. Nas operações {\tt in}, {\tt not in} e {\tt !in} o número +de componentes nos primeiros operandos deve ser igual a +dimensão do segundo operando. + +2. Nas operações {\tt within}, {\tt not within} e {\tt !within} +ambos operandos devem ter a mesma dimensão. + +Todos operadores relacionais listados acima têm seus significados +matemáticos convencionais. O valor resultante é {\it verdadeiro}, se +a relação correspondente é satisfeita para seus operandos, caso contrário +é {\it falso}. (Note que valores simbólicos são ordenados de forma +lexicográfica e qualquer valor numérico precede qualquer valor simbólico.) + +% 1. In the operations {\tt in}, {\tt not in}, and {\tt !in} the +% number of components in the first operands should be the same as the +% dimension of the second operand. +% +% 2. In the operations {\tt within}, {\tt not within}, and {\tt !within} +% both operands should have identical dimension. +% +% All the relational operators listed above have their conventional +% mathematical meaning. The resultant value is {\it true}, if +% corresponding relation is satisfied for its operands, otherwise +% {\it false}. (Note that symbolic values are ordered lexicographically, +% and any numeric value precedes any symbolic value.) + +\subsection{Expressões iteradas} + +Uma {\it expressão lógica iterada} é uma expressão lógica primária +com a seguinte forma sintática: +$$\mbox{{\it operador-iterado} {\it expressão-indexante} +{\it integrando}}$$ +onde {\it operador-iterado} é o nome simbólico do operador iterado +a ser executado (veja adiante), {\it expressão-indexante} é uma +expressão indexante que introduz índices e controla a iteração, \linebreak +{\it integrando} é uma expressão numérica que participa da operação. + +Em MathProg existem dois operadores iterados que podem ser usados +em expressões lógicas: + +% An {\it iterated logical expression} is a primary logical expression, +% which has the following syntactic form: +% $$\mbox{{\it iterated-operator} {\it indexing-expression} +% {\it integrand}}$$ +% where {\it iterated-operator} is the symbolic name of the iterated +% operator to be performed (see below), {\it indexing-expression} is an +% indexing expression which introduces dummy indices and controls +% iterating, {\it integrand} is a numeric expression that participates in +% the operation. +% +% In MathProg there exist two iterated operators, which may be used in +% logical expressions: + +{\def\arraystretch{1.4} +\noindent\hfil +\begin{tabular}{@{}lll@{}} +{\tt forall}&quantificador-$\forall$&$\displaystyle +\forall(i_1,\dots,i_n)\in\Delta[f(i_1,\dots,i_n)],$\\ +{\tt exists}&quantificador-$\exists$&$\displaystyle +\exists(i_1,\dots,i_n)\in\Delta[f(i_1,\dots,i_n)],$\\ +\end{tabular} +} + +% {\def\arraystretch{1.4} +% \noindent\hfil +% \begin{tabular}{@{}lll@{}} +% {\tt forall}&$\forall$-quantification&$\displaystyle +% \forall(i_1,\dots,i_n)\in\Delta[f(i_1,\dots,i_n)],$\\ +% {\tt exists}&$\exists$-quantification&$\displaystyle +% \exists(i_1,\dots,i_n)\in\Delta[f(i_1,\dots,i_n)],$\\ +% \end{tabular} +% } + +\noindent onde $i_1$, \dots, $i_n$ são índices introduzidos na +expressão indexante, $\Delta$ é o domínio, um conjunto de $n$-tuplas +especificado pela expressão indexante que define valores específicos +atribuídos aos índices ao executar a operação iterada, e +$f(i_1,\dots,i_n)$ é o integrando, uma expressão lógica cujo +valor resultante depende dos índices. + +Para o quantificador $\forall$, o valor resultante da expressão +lógica iterada é {\it verdadeiro}, se o valor do integrando é +{\it verdadeiro} para todas as $n$-tuplas contidas no domínio, +caso contrário, é {\it falso}. + +Para o quantificador $\exists$ o valor resultante da expressão +lógica iterada é {\it falso}, se o valor do integrando é +{\it falso} para todas as $n$-tuplas contidas no domínio, +caso contrário, é {\it verdadeiro}. + +% \noindent where $i_1$, \dots, $i_n$ are dummy indices introduced in +% the indexing expression, $\Delta$ is the domain, a set of $n$-tuples +% specified by the indexing expression which defines particular values +% assigned to the dummy indices on performing the iterated operation, +% $f(i_1,\dots,i_n)$ is the integrand, a logical expression whose +% resultant value depends on the dummy indices. +% +% For $\forall$-quantification the resultant value of the iterated +% logical expression is {\it true}, if the value of the integrand is +% {\it true} for all $n$-tuples contained in the domain, otherwise +% {\it false}. +% +% For $\exists$-quantification the resultant value of the iterated +% logical expression is {\it false}, if the value of the integrand is +% {\it false} for all $n$-tuples contained in the domain, otherwise +% {\it true}. + +\subsection{Expressões parentizadas} + +Qualquer expressão lógica pode ser cercada entre parênteses, o que a +converte sintaticamente em uma expressão lógica primária. + +Parênteses podem ser usados em expressões lógicas, como em álgebra, para +especificar a ordem desejada na qual as operações devem ser executadas. +Quando se usam parênteses, a expressão entre parênteses é avaliada antes +que o valor resultante seja usado. + +O valor resultante da expressão parentizada é idêntico ao valor da expressão +cercada entre parênteses. + +% Any logical expression may be enclosed in parentheses that +% syntactically makes it a primary logical expression. +% +% Parentheses may be used in logical expressions, as in algebra, to +% specify the desired order in which operations are to be performed. +% Where parentheses are used, the expression within the parentheses is +% evaluated before the resultant value is used. +% +% The resultant value of the parenthesized expression is the same as the +% value of the expression enclosed within parentheses. + +\newpage + +\subsection{Operadores lógicos} + +Em MathProg existem os seguintes operadores lógicos, que podem ser usados em +expressões lógicas: + +% In MathProg there exist the following logical operators, which may be +% used in logical expressions: + +\begin{tabular}{@{}ll@{}} +{\tt not} $x$, {\tt!}$x$&negação $\neg\ x$\\ +$x$ {\tt and} $y$, $x$ {\tt\&\&} $y$&conjunção (``e'' lógico) +$x\;\&\;y$\\ +$x$ {\tt or} $y$, $x$ {\tt||} $y$&disjunção (``ou'' lógico) +$x\vee y$\\ +\end{tabular} + +% \begin{tabular}{@{}ll@{}} +% {\tt not} $x$, {\tt!}$x$&negation $\neg\ x$\\ +% $x$ {\tt and} $y$, $x$ {\tt\&\&} $y$&conjunction (logical ``and'') +% $x\;\&\;y$\\ +% $x$ {\tt or} $y$, $x$ {\tt||} $y$&disjunction (logical ``or'') +% $x\vee y$\\ +% \end{tabular} + +\noindent onde $x$ e $y$ são expressões lógicas. + +Se a expressão inclui mais de um operador lógico, todos operadores +são executados da esquerda para a direita de acordo com a hierarquia +das operações (veja adiante). O valor resultante da \linebreak expressão +que contém operadores lógicos é o resultado da aplicação dos +operadores aos seus \linebreak operandos. + +% \noindent where $x$ and $y$ are logical expressions. +% +% If the expression includes more than one logical operator, all +% operators are performed from left to right according to the hierarchy +% of the operations (see below). The resultant value of the expression, +% which contains logical operators, is the result of applying the +% operators to their operands. + +\subsection{Hierarquia das operações} + +A lista seguinte mostra a hierarquia das operações em expressões +lógicas: + +% The following list shows the hierarchy of operations in logical +% expressions: + +\noindent\hfil +\begin{tabular}{@{}ll@{}} +Operation&Hierarchy\\ +\hline +Avaliação de operações numéricas& +1{\textsuperscript{\b{a}}}-7{\textsuperscript{\b{a}}}\\ +Avaliação de operações simbólicas& +8{\textsuperscript{\b{a}}}-9{\textsuperscript{\b{a}}}\\ +Avaliação de operações de conjunto& +10{\textsuperscript{\b{a}}}-14{\textsuperscript{\b{a}}}\\ +Operações relacionais ({\tt<}, {\tt<=}, etc.)& +15{\textsuperscript{\b{a}}}\\ +negação ({\tt not}, {\tt!})& +16{\textsuperscript{\b{a}}}\\ +Conjunção({\tt and}, {\tt\&\&})& +17{\textsuperscript{\b{a}}}\\ +Quantificação-$\forall$ e -$\exists$ ({\tt forall}, {\tt exists})& +18{\textsuperscript{\b{a}}}\\ +Disjunção ({\tt or}, {\tt||})& +19{\textsuperscript{\b{a}}}\\ +\end{tabular} + +% \noindent\hfil +% \begin{tabular}{@{}ll@{}} +% Operation&Hierarchy\\ +% \hline +% Evaluation of numeric operations&1st-7th\\ +% Evaluation of symbolic operations&8th-9th\\ +% Evaluation of set operations&10th-14th\\ +% Relational operations ({\tt<}, {\tt<=}, etc.)&15th\\ +% Negation ({\tt not}, {\tt!})&16th\\ +% Conjunction ({\tt and}, {\tt\&\&})&17th\\ +% $\forall$- and $\exists$-quantification ({\tt forall}, {\tt exists})& +% 18th\\ +% Disjunction ({\tt or}, {\tt||})&19th\\ +% \end{tabular} + +Esta hierarquia possui o mesmo significado como explicado anteriormente +para expressões \linebreak numéricas (ver Subseção \ref{hierarchy}, página \pageref{hierarchy}). + +% This hierarchy has the same meaning as was explained above for numeric +% expressions (see Subsection \ref{hierarchy}, page \pageref{hierarchy}). + +\newpage + +\section{Expressões lineares} + +Uma {\it expressão linear} é uma regra para calcular a chamada +{\it forma linear} ou simplesmente {\it fórmula}, que é uma função linear (ou +afim) de variáveis elementares. + +A expressão linear primária pode ser uma variável não-indexada, uma +variável indexada, uma expressão linear iterada, uma expressão linear condicional +ou outra expressão linear cercada entre parênteses. + +Também e permitido usar uma expressão numérica como a expressão linear +primária, neste caso, o valor resultante da expressão numérica +é automaticamente convertido para uma fórmula que inclui o +termo constante apenas. + +\para{Exemplos} + +% A {\it linear expression} is a rule for computing so called +% a {\it linear form} or simply a {\it formula}, which is a linear (or +% affine) function of elemental variables. +% +% The primary linear expression may be an unsubscripted variable, +% subscripted variable, iterated linear expression, conditional linear +% expression, or another linear expression enclosed in parentheses. +% +% It is also allowed to use a numeric expression as the primary linear +% expression, in which case the resultant value of the numeric expression +% is automatically converted to a formula that includes the constant term +% only. +% +% \para{Examples} + +\noindent +\begin{tabular}{@{}ll@{}} +\verb|z| &(variável não-indexada)\\ +\verb|x[i,j]| &(variável indexada)\\ +\verb|sum{j in J} (a[i,j] * x[i,j] + 3 * y[i-1])| & +(expressão linear iterada)\\ +\verb|if i in I then x[i,j] else 1.5 * z + 3.25| & +(expressão linear condicional)\\ +\verb|(a[i,j] * x[i,j] + y[i-1] + .1)| & +(expressão linear parentizada)\\ +\end{tabular} + +% \noindent +% \begin{tabular}{@{}ll@{}} +% \verb|z| &(unsubscripted variable)\\ +% \verb|x[i,j]| &(subscripted variable)\\ +% \verb|sum{j in J} (a[i,j] * x[i,j] + 3 * y[i-1])| & +% (iterated linear expression)\\ +% \verb|if i in I then x[i,j] else 1.5 * z + 3.25| & +% (conditional linear expression)\\ +% \verb|(a[i,j] * x[i,j] + y[i-1] + .1)| & +% (parenthesized linear expression)\\ +% \end{tabular} + +Expressões lineares mais genéricas, contendo duas ou mais +expressões lineares primárias, podem ser construídas usando +determinados operadores aritméticos. + +\para{Exemplos} + +% More general linear expressions containing two or more primary linear +% expressions may be constructed by using certain arithmetic operators. +% +% \para{Examples} + +\begin{verbatim} +2 * x[i-1,j+1] + 3.5 * y[k] + .5 * z +(- x[i,j] + 3.5 * y[k]) / sum{t in T} abs(d[i,j,t]) +\end{verbatim} + +\vspace*{-5pt} + +\subsection{Variáveis não-indexadas} + +Se a expressão linear primária é uma variável não-indexada (que deve +se 0-dimensional), a fórmula resultante formula é aquela variável +não-indexada. + +% If the primary linear expression is an unsubscripted variable (which +% should be 0-dimensional), the resultant formula is that unsubscripted +% variable. + +\vspace*{-5pt} + +\subsection{Variáveis indexadas} + +A expressão linear primária que se refere a uma variável indexada possui +a seguinte forma sintática: +$$\mbox{{\it nome}{\tt[}$i_1${\tt,} $i_2${\tt,} \dots{\tt,} +$i_n${\tt]}}$$ +onde {\it nome} é o nome simbólico da variável do modelo, $i_1$, +$i_2$, \dots, $i_n$ são subíndices. + +Cada subíndice deve ser uma expressão numérica ou simbólica. O número +de subíndices na lista de subíndices deve ser igual ao da dimensão da +variável do modelo com a qual está associada a lista de subíndices. + +Os valores correntes das expressões dos subíndices são usados para identificar +um membro \linebreak particular da variável do modelo que determina a fórmula resultante, +que é uma variável elementar associada com o membro correspondente. + +% The primary linear expression, which refers to a subscripted variable, +% has the following syntactic form: +% $$\mbox{{\it name}{\tt[}$i_1${\tt,} $i_2${\tt,} \dots{\tt,} +% $i_n${\tt]}}$$ +% where {\it name} is the symbolic name of the model variable, $i_1$, +% $i_2$, \dots, $i_n$ are subscripts. +% +% Each subscript should be a numeric or symbolic expression. The number +% of subscripts in the subscript list should be the same as the dimension +% of the model variable with which the subscript list is associated. +% +% Actual values of the subscript expressions are used to identify a +% particular member of the model variable that determines the resultant +% formula, which is an elemental variable associated with corresponding +% member. + +\vspace*{-5pt} + +\subsection{Expressões iteradas} + +Uma {\it expressão linear iterada} é uma expressão linear primária, +que tem a seguinte forma sintática: +$$\mbox{{\tt sum} {\it expressão-indexante} {\it integrando}}$$ +onde {\it expressão-indexante} é uma expressão indexante, que +introduz índices e controla iterações, {\it integrando} é +uma expressão linear que participa da operação. + +A expressão linear iterada é avaliada exatamente da mesma forma que a +expressão numérica iterada (ver Subseção \ref{itexpr}, página +\pageref{itexpr}), exceto que o integrando participante do +somatório é uma fórmula e não um valor numérico. + +% An {\it iterated linear expression} is a primary linear expression, +% which has the following syntactic form: +% $$\mbox{{\tt sum} {\it indexing-expression} {\it integrand}}$$ +% where {\it indexing-expression} is an indexing expression, which +% introduces dummy indices and controls iterating, {\it integrand} is +% a linear expression that participates in the operation. +% +% The iterated linear expression is evaluated exactly in the same way as +% the iterated numeric expression (see Subection \ref{itexpr}, page +% \pageref{itexpr}) with exception that the integrand participated in the +% summation is a formula, not a numeric value. + +\vspace*{-5pt} + +\subsection{Expressões condicionais} + +Uma {\it expressão linear condicional} é uma expressão linear primária, +que possui uma das duas formas sintáticas seguintes: +$$ +{\def\arraystretch{1.4} +\begin{array}{l} +\mbox{{\tt if} $b$ {\tt then} $f$ {\tt else} $g$}\\ +\mbox{{\tt if} $b$ {\tt then} $f$}\\ +\end{array} +} +$$ +onde $b$ é uma expressão lógica, $f$ e $g$ são expressões lineares. + + +% A {\it conditional linear expression} is a primary linear expression, +% which has one of the following two syntactic forms: +% $$ +% {\def\arraystretch{1.4} +% \begin{array}{l} +% \mbox{{\tt if} $b$ {\tt then} $f$ {\tt else} $g$}\\ +% \mbox{{\tt if} $b$ {\tt then} $f$}\\ +% \end{array} +% } +% $$ +% where $b$ is an logical expression, $f$ and $g$ are linear expressions. + +% \newpage + +A expressão linear condicional é avaliada exatamente da mesma forma +que a expressão \linebreak condicional numérica (ver Subseção \ref{ifthen}, +página \pageref{ifthen}), exceto que os operandos que participam da operação +são fórmulas e não valores numéricos. + +% The conditional linear expression is evaluated exactly in the same way +% as the conditional numeric expression (see Subsection \ref{ifthen}, +% page \pageref{ifthen}) with exception that operands participated in the +% operation are formulae, not numeric values. + +\subsection{Expressões parentizadas} + +Qualquer expressão linear pode ser cercada entre parênteses, o que a +converte sintaticamente em uma expressão linear primária. + +Parênteses podem ser usados em expressões lineares, como em álgebra, para +especificar a ordem desejada na qual as operações devem ser executadas. +Quando se usam parênteses, a expressão entre parênteses é avaliada antes +que a fórmula resultante seja usada. + +O valor resultante da expressão parentizada é idêntico ao valor da +expressão cercada entre parênteses. + +% Any linear expression may be enclosed in parentheses that syntactically +% makes it a primary linear expression. +% +% Parentheses may be used in linear expressions, as in algebra, to +% specify the desired order in which operations are to be performed. +% Where parentheses are used, the expression within the parentheses is +% evaluated before the resultant formula is used. +% +% The resultant value of the parenthesized expression is the same as the +% value of the expression enclosed within parentheses. + +\subsection{Operadores aritméticos} + +Em MathProg existem os seguintes operadores aritméticos, que podem ser +usados em expressões lineares: + +% In MathProg there exists the following arithmetic operators, which may +% be used in linear expressions: + +\begin{tabular}{@{}ll@{}} +{\tt+} $f$&mais unário\\ +{\tt-} $f$&menos unário\\ +$f$ {\tt+} $g$&adição\\ +$f$ {\tt-} $g$&subtração\\ +$x$ {\tt*} $f$, $f$ {\tt*} $x$&multiplicação\\ +$f$ {\tt/} $x$&divisão +\end{tabular} + +% \begin{tabular}{@{}ll@{}} +% {\tt+} $f$&unary plus\\ +% {\tt-} $f$&unary minus\\ +% $f$ {\tt+} $g$&addition\\ +% $f$ {\tt-} $g$&subtraction\\ +% $x$ {\tt*} $f$, $f$ {\tt*} $x$&multiplication\\ +% $f$ {\tt/} $x$&division +% \end{tabular} + +\noindent onde $f$ e $g$ são expressões lineares, $x$ é uma expressão +numérica (mais precisamente, uma expressão linear contendo apenas o termo +constante). + +Se a expressão inclui mais de um operador aritmético, todos +operadores são executados da esquerda para a direita de acordo com a hierarquia +das operações (veja adiante). O valor resultante da expressão, que +contém operadores aritméticos, é o resultado de aplicar os operadores aos +seus operandos. + +% \noindent where $f$ and $g$ are linear expressions, $x$ is a numeric +% expression (more precisely, a linear expression containing only the +% constant term). +% +% If the expression includes more than one arithmetic operator, all +% operators are performed from left to right according to the hierarchy +% of operations (see below). The resultant value of the expression, which +% contains arithmetic operators, is the result of applying the operators +% to their operands. + +\subsection{Hierarquia das operações} + +A hierarquia de operações aritméticas usada em expressões lineares é a mesma +para expressões numéricas (ver Subseção \ref{hierarchy}, página \pageref{hierarchy}). + +% The hierarchy of arithmetic operations used in linear expressions is +% the same as for numeric expressions (see Subsection \ref{hierarchy}, +% page \pageref{hierarchy}). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Sentenças} + +{\it Sentenças} são unidades básicas da descrição do modelo. Em MathProg +todas as sentenças são divididas em duas categorias: sentenças de declaração +e sentenças funcionais. + +{\it Sentenças de declaração} (sentença {\it set}, sentença {\it parameter}, +sentença {\it variable}, sentença \linebreak {\it constraint}, sentença {\it objective}) são +usados para declarar objetos de certo tipo do modelo e definir certas propriedades +de tais objetos. + +{\it Sentenças funcionais} (sentença {\it solve}, sentença {\it check}, +sentença {\it display}, sentença {\it printf}, sentença {\it loop}, sentença +{\it table}) são projetadas para executar ações específicas. + +Note que sentenças de declaração podem seguir em qualquer ordem arbitrária, +o que não afeta o resultado da tradução. Entretanto, qualquer objeto de modelo +deve ser declarado antes de ser referenciado por outras sentenças. + +% {\it Statements} are basic units of the model description. In MathProg +% all statements are divided into two categories: declaration statements +% and functional statements. +% +% {\it Declaration statements} (set statement, parameter statement, +% variable statement, constraint statement, objective statement) are used +% to declare model objects of certain kinds and define certain properties +% of such objects. +% +% {\it Functional statements} (solve statement, check statement, display +% statement, printf statement, loop statement, table statement) are +% intended for performing some specific actions. +% +% Note that declaration statements may follow in arbitrary order, which +% does not affect the result of translation. However, any model object +% should be declared before it is referenced in other statements. + +\section{Sentença set} + +\noindent +\framebox[468pt][l]{ +\parbox[c][24pt]{468pt}{ +\hspace{6pt} {\tt set} {\it nome} {\it alias} {\it domínio} {\tt,} +{\it atributo} {\tt,} \dots {\tt,} {\it atributo} {\tt;} +}} + +% \noindent +% \framebox[468pt][l]{ +% \parbox[c][24pt]{468pt}{ +% \hspace{6pt} {\tt set} {\it name} {\it alias} {\it domain} {\tt,} +% {\it attrib} {\tt,} \dots {\tt,} {\it attrib} {\tt;} +% }} + +\medskip + +\noindent +{\it nome} é um nome simbólico do conjunto; + +\noindent +{\it alias} é um literal de cadeia opcional que especifica um pseudônimo +para o conjunto; + +\noindent +{\it domínio} é uma expressão indexante opcional que especifica o domínio +do subíndice do conjunto; + +\noindent +{\it atributo}, \dots, {\it atributo} são atributos opcionais do conjunto +(as vírgulas que precedem os atributos podem ser omitidas.) + +\para{Atributos opcionais} + +% \noindent +% {\it name} is a symbolic name of the set; +% +% \noindent +% {\it alias} is an optional string literal, which specifies an alias of +% the set; +% +% \noindent +% {\it domain} is an optional indexing expression, which specifies +% a subscript domain of the set; +% +% \noindent +% {\it attrib}, \dots, {\it attrib} are optional attributes of the set. +% (Commae preceding attributes may be omitted.) +% +% \para{Optional attributes} + +\vspace*{-8pt} + +\begin{description} +\item[{\tt dimen} $n$]\hspace*{0pt}\\ +especifica a dimensão de $n$-tuplas das quais o conjunto é consistido; +\item[{\tt within} {\it expressão}]\hspace*{0pt}\\ +especifica um superconjunto que restringe ao conjunto ou a todos seus +membros (conjuntos elementares) a estarem incluídos naquele superconjunto; +\item[{\tt:=} {\it expressão}]\hspace*{0pt}\\ +especifica um conjunto elementar atribuído ao conjunto ou aos seus membros; +\item[{\tt default} {\it expressão}]\hspace*{0pt}\\ +especifica um conjunto elementar atribuído ao conjunto ou aos seus membros +sempre que não há dados apropriados disponíveis na seção de dados. +\end{description} + +% \begin{description} +% \item[{\tt dimen} $n$]\hspace*{0pt}\\ +% specifies the dimension of $n$-tuples which the set consists of; +% \item[{\tt within} {\it expression}]\hspace*{0pt}\\ +% specifies a superset which restricts the set or all its members +% (elemental sets) to be within that superset; +% \item[{\tt:=} {\it expression}]\hspace*{0pt}\\ +% specifies an elemental set assigned to the set or its members; +% \item[{\tt default} {\it expression}]\hspace*{0pt}\\ +% specifies an elemental set assigned to the set or its members whenever +% no appropriate data are available in the data section. +% \end{description} + +\vspace*{-8pt} + +\para{Exemplos} + +% \para{Examples} + +\begin{verbatim} +set nos; +set arcos within nos cross nos; +set passo{s in 1..maxiter} dimen 2 := if s = 1 then arcos else passo[s-1] + union setof{k in nos, (i,k) in passo[s-1], (k,j) in passo[s-1]}(i,j); +set A{i in I, j in J}, within B[i+1] cross C[j-1], within D diff E, + default {('abc',123), (321,'cba')}; +\end{verbatim} + +% \begin{verbatim} +% set nodes; +% set arcs within nodes cross nodes; +% set step{s in 1..maxiter} dimen 2 := if s = 1 then arcs else step[s-1] +% union setof{k in nodes, (i,k) in step[s-1], (k,j) in step[s-1]}(i,j); +% set A{i in I, j in J}, within B[i+1] cross C[j-1], within D diff E, +% default {('abc',123), (321,'cba')}; +% \end{verbatim} + +A sentença set declara um conjunto. Se o domínio do subíndice não é +especificado, o conjunto é um conjunto simples, caso contrário será +uma matriz de conjuntos elementares. + +O atributo {\tt dimen} especifica a dimensão de $n$-tuplas da qual é +consistida o conjunto (se o conjunto é simples) ou seus membros +(se o conjunto é uma matriz de conjuntos elementares), +em que $n$ deve ser um inteiro de 1 a 20. Pode-se especificar +no máximo um atributo {\tt dimen}. Se o atributo {\tt dimen} não é +especificado, a dimensão das $n$-tuplas é implicitamente determinada +por outros atributos (por exemplo, se há uma expressão que segue +{\tt:=} ou a palavra-chave {\tt default}, usa-se a dimensão das $n$-tuplas +do conjunto elementar correspondente). +Se nenhuma informação de dimensão é fornecida, assume-se +{\tt dimen 1}. + +O atributo {\tt within} especifica uma expressão de conjunto cujo +valor resultante é um superconjunto usado para restringir o conjunto +(se o conjunto é simples) ou seus membros (se o conjunto é uma matriz +de conjuntos elementares) a estar incluído naquele superconjunto. +Um número arbitrário de atributos {\tt within} podem ser especificados +na mesma sentença set. + +O atributo de atribuição ({\tt:=}) especifica uma expressão de conjunto +usada para avaliar conjunto(s) \linebreak elementar(es) atribuído(s) ao conjunto +(se o conjunto é simples) ou seus membros (se o conjunto é uma matriz +de conjuntos elementares). Se o atributo de atribuição é especificado, +o conjunto é {\it calculável}, portanto, não há a necessidade de fornecer +dados na seção de dados. Se o atributo de atribuição não é especificado, +deve-se fornecer os dados na seção de dados. Pode-se especificar no +máximo um atributo de atribuição ou {\tt default} para o mesmo conjunto. + +O atributo {\tt default} especifica uma expressão de conjunto usado para +avaliar conjunto(s) \linebreak elementar(es) atribuído(s) ao conjunto +(se o conjunto é simples) ou seus membros (se o conjunto é uma matriz +de conjuntos elementares) sempre que não houver dados apropriados +disponíveis na seção de dados. Se não se especifica nem o atributo de +atribuição nem o atributo {\tt default}, a falta de dados causará um erro. + +% The set statement declares a set. If the subscript domain is not +% specified, the set is a simple set, otherwise it is an array of +% elemental sets. +% +% The {\tt dimen} attribute specifies the dimension of $n$-tuples, which +% the set (if it is a simple set) or its members (if the set is an array +% of elemental sets) consist of, where $n$ should be an unsigned integer +% from 1 to 20. At most one {\tt dimen} attribute can be specified. If +% the {\tt dimen} attribute is not specified, the dimension of $n$-tuples +% is implicitly determined by other attributes (for example, if there is +% a set expression that follows {\tt:=} or the keyword {\tt default}, the +% dimension of $n$-tuples of corresponding elemental set is used). +% If no dimension information is available, {\tt dimen 1} is assumed. +% +% The {\tt within} attribute specifies a set expression whose resultant +% value is a superset used to restrict the set (if it is a simple set) or +% its members (if the set is an array of elemental sets) to be within +% that superset. Arbitrary number of {\tt within} attributes may be +% specified in the same set statement. +% +% The assign ({\tt:=}) attribute specifies a set expression used to +% evaluate elemental set(s) assigned to the set (if it is a simple set) +% or its members (if the set is an array of elemental sets). If the +% assign attribute is specified, the set is {\it computable} and +% therefore needs no data to be provided in the data section. If the +% assign attribute is not specified, the set should be provided with data +% in the data section. At most one assign or default attribute can be +% specified for the same set. +% +% The {\tt default} attribute specifies a set expression used to evaluate +% elemental set(s) assigned to the set (if it is a simple set) or its +% members (if the set is an array of elemental sets) whenever +% no appropriate data are available in the data section. If neither +% assign nor default attribute is specified, missing data will cause an +% error. + +\newpage + +\section{Sentença parameter} + +\noindent +\framebox[468pt][l]{ +\parbox[c][24pt]{468pt}{ +\hspace{6pt} {\tt param} {\it nome} {\it alias} {\it domínio} {\tt,} +{\it attrib} {\tt,} \dots {\tt,} {\it attrib} {\tt;} +}} + +% \noindent +% \framebox[468pt][l]{ +% \parbox[c][24pt]{468pt}{ +% \hspace{6pt} {\tt param} {\it name} {\it alias} {\it domain} {\tt,} +% {\it attrib} {\tt,} \dots {\tt,} {\it attrib} {\tt;} +% }} + +\medskip + +\noindent +{\it nome} é um nome simbólico do parâmetro; + +\noindent +{\it alias} é um literal de cadeia opcional que especifica um pseudônimo +para o parâmetro; + +\noindent +{\it domínio} é uma expressão indexante opcional que especifica o domínio +do subíndice do parâmetro; + +\noindent +{\it atributo}, \dots, {\it atributo} são atributos opcionais do parâmetro +(as vírgulas que precedem os atributos podem ser omitidas.) + +\para{Atributos opcionais} + +% \noindent +% {\it name} is a symbolic name of the parameter; +% +% \noindent +% {\it alias} is an optional string literal, which specifies an alias of +% the parameter; +% +% \noindent +% {\it domain} is an optional indexing expression, which specifies +% a subscript domain of the parameter; +% +% \noindent +% {\it attrib}, \dots, {\it attrib} are optional attributes of the +% parameter. (Commae preceding attributes may be omitted.) +% +% \para{Optional attributes} + +\vspace*{-8pt} + +\begin{description} +\item[{\tt integer}]\hspace*{0pt}\\ +especifica que o parâmetro é inteiro; +\item[{\tt binary}]\hspace*{0pt}\\ +especifica que o parâmetro é binário; +\item[{\tt symbolic}]\hspace*{0pt}\\ +especifica que o parâmetro é simbólico; +\item[{\it expressão de relação}]\hspace*{0pt}\\ +(onde {\it relação} é algum de: {\tt<}, {\tt<=}, {\tt=}, {\tt==}, +{\tt>=}, {\tt>}, {\tt<>}, {\tt!=})\\ +especifica uma condição que restringe o parâmetro ou seus membros a +satisfazer aquela condição; +\item[{\tt in} {\it expressão}]\hspace*{0pt}\\ +especifica um superconjunto que restringe o parâmetro ou seus membros +a estarem inseridos naquele superconjunto; +\item[{\tt:=} {\it expressão}]\hspace*{0pt}\\ +especifica um valor atribuído ao parâmetro ou a seus membros; +\item[{\tt default} {\it expressão}]\hspace*{0pt}\\ +especifica um valor atribuído ao parâmetro ou aos seus membros sempre +que não houverem dados disponíveis na seção de dados. +\end{description} + +% \begin{description} +% \item[{\tt integer}]\hspace*{0pt}\\ +% specifies that the parameter is integer; +% \item[{\tt binary}]\hspace*{0pt}\\ +% specifies that the parameter is binary; +% \item[{\tt symbolic}]\hspace*{0pt}\\ +% specifies that the parameter is symbolic; +% \item[{\it relation expression}]\hspace*{0pt}\\ +% (where {\it relation} is one of: {\tt<}, {\tt<=}, {\tt=}, {\tt==}, +% {\tt>=}, {\tt>}, {\tt<>}, {\tt!=})\\ +% specifies a condition that restricts the parameter or its members to +% satisfy that condition; +% \item[{\tt in} {\it expression}]\hspace*{0pt}\\ +% specifies a superset that restricts the parameter or its members to be +% in that superset; +% \item[{\tt:=} {\it expression}]\hspace*{0pt}\\ +% specifies a value assigned to the parameter or its members; +% \item[{\tt default} {\it expression}]\hspace*{0pt}\\ +% specifies a value assigned to the parameter or its members whenever +% no appropriate data are available in the data section. +% \end{description} + +\vspace*{-8pt} + +\para{Exemplos} + +% \para{Examples} + +\begin{verbatim} +param unidades{insumo, produto} >= 0; +param lucro{produto, 1..T+1}; +param N := 20 integer >= 0 <= 100; +param combinacao 'n escolhe k' {n in 0..N, k in 0..n} := + if k = 0 or k = n then 1 else combinacao[n-1,k-1] + combinacao[n-1,k]; +param p{i in I, j in J}, integer, >= 0, <= i+j, in A[i] symdiff B[j], + in C[i,j], default 0.5 * (i + j); +param mes symbolic default 'Mai' in {'Mar', 'Abr', 'Mai'}; +\end{verbatim} + +% \begin{verbatim} +% param units{raw, prd} >= 0; +% param profit{prd, 1..T+1}; +% param N := 20 integer >= 0 <= 100; +% param comb 'n choose k' {n in 0..N, k in 0..n} := +% if k = 0 or k = n then 1 else comb[n-1,k-1] + comb[n-1,k]; +% param p{i in I, j in J}, integer, >= 0, <= i+j, in A[i] symdiff B[j], +% in C[i,j], default 0.5 * (i + j); +% param month symbolic default 'May' in {'Mar', 'Apr', 'May'}; +% \end{verbatim} + +A sentença parameter declara um parâmetro. Se o domínio de subíndice não +é especificado, o parâmetro é simples (escalar), caso contrário, +é uma matriz $n$-dimensional. + +Os atributos de tipo {\tt integer}, {\tt binary} e {\tt symbolic} +qualificam os tipos de valores que podem ser atribuídos ao parâmetro, conforme +demonstrado: + +% The parameter statement declares a parameter. If a subscript domain is +% not specified, the parameter is a simple (scalar) parameter, otherwise +% it is a $n$-dimensional array. +% +% The type attributes {\tt integer}, {\tt binary}, and {\tt symbolic} +% qualify the type of values that can be assigned to the parameter as +% shown below: + +\noindent\hfil +\begin{tabular}{@{}ll@{}} +Tipo de atributo&Valores atribuídos\\ +\hline +(não especificado)&Qualquer valor numérico\\ +{\tt integer}&Apenas valores numéricos inteiros\\ +{\tt binary}&Tanto 0 quanto 1\\ +{\tt symbolic}&Qualquer valor numérico e simbólico\\ +\end{tabular} + +% \noindent\hfil +% \begin{tabular}{@{}ll@{}} +% Type attribute&Assigned values\\ +% \hline +% (not specified)&Any numeric values\\ +% {\tt integer}&Only integer numeric values\\ +% {\tt binary}&Either 0 or 1\\ +% {\tt symbolic}&Any numeric and symbolic values\\ +% \end{tabular} + +O atributo {\tt symbolic} não pode ser especificado juntamente com outros tipos +de atributos. Uma vez especificado, ele deve preceder todos os outros atributos. + +O atributo de condição especifica uma condição opcional que restringe +os valores atribuídos ao parâmetro para satisfazer aquela condição. +Este atributo tem as seguintes formas sintáticas: + +% The {\tt symbolic} attribute cannot be specified along with other type +% attributes. Being specified it should precede all other attributes. +% +% The condition attribute specifies an optional condition that restricts +% values assigned to the parameter to satisfy that condition. This +% attribute has the following syntactic forms: + +\begin{tabular}{@{}ll@{}} +{\tt<} $v$&verifica se $x=} $v$&verifica se $x\geq v$\\ +{\tt>} $v$&verifica se $x\geq v$\\ +{\tt<>} $v$, {\tt!=} $v$&verifica se $x\neq v$\\ +\end{tabular} + +% \begin{tabular}{@{}ll@{}} +% {\tt<} $v$&check for $x=} $v$&check for $x\geq v$\\ +% {\tt>} $v$&check for $x\geq v$\\ +% {\tt<>} $v$, {\tt!=} $v$&check for $x\neq v$\\ +% \end{tabular} + +\noindent onde $x$ é um valor atribuído ao parâmetro, $v$ é o +valor resultante de uma expressão numérica ou simbólica especificado +no atributo de condição. Um número arbitrário de atributos de condição +pode ser especificado para o mesmo parâmetro. Se, durante a avaliação do +modelo, um valor atribuído ao parâmetro viola pelo menos uma das +condições especificadas, ocorrerá um erro. (Note que valores simbólicos +são ordenados de forma lexicográfica e qualquer valor numérico precede +qualquer valor simbólico.) + +O atributo {\tt in} é similar ao atributo de condição e especifica +uma expressão de conjunto cujo valor resultante é um superconjunto usado +para restringir valores numéricos ou simbólicos atribuídos ao parâmetro +a estarem incluídos naquele superconjunto. Pode-se especificar um número +arbitrário de atributos {\tt in} para o mesmo parâmetro. Se, durante a avaliação do +modelo, o valor atribuído ao parâmetro não pertence a pelo menos um dos +superconjuntos especificados, ocorrerá um erro. + +O atributo de atribuição ({\tt:=}) especifica uma expressão numérica +ou simbólica usada para \linebreak computar um valor atribuído ao parâmetro +(se é um parâmetro simples) ou seus membros (se o parâmetro é uma matriz). +Se o atributo de atribuição é especificado, +o parâmetro é {\it calculável}, \linebreak portanto, não há a necessidade de fornecer +dados na seção de dados. Se o atributo de atribuição não é especificado, +deve-se fornecer os dados para o parâmetro na seção de dados. Pode-se especificar no +máximo um atributo de atribuição ou {\tt default} para o mesmo parâmetro. + +O atributo {\tt default} especifica uma expressão numérica ou simbólica +usada para computar um valor atribuído ao parâmetro ou seus membros +sempre que não houver dados apropriados disponíveis na seção de dados. +Se não se especifica nem o atributo de atribuição nem o atributo +{\tt default}, a falta de dados causará um erro. + +% \noindent where $x$ is a value assigned to the parameter, $v$ is the +% resultant value of a numeric or symbolic expression specified in the +% condition attribute. Arbitrary number of condition attributes can be +% specified for the same parameter. If a value being assigned to the +% parameter during model evaluation violates at least one of specified +% conditions, an error is raised. (Note that symbolic values are ordered +% lexicographically, and any numeric value precedes any symbolic value.) +% +% The {\tt in} attribute is similar to the condition attribute and +% specifies a set expression whose resultant value is a superset used to +% restrict numeric or symbolic values assigned to the parameter to be in +% that superset. Arbitrary number of the {\tt in} attributes can be +% specified for the same parameter. If a value being assigned to the +% parameter during model evaluation is not in at least one of specified +% supersets, an error is raised. +% +% The assign ({\tt:=}) attribute specifies a numeric or symbolic +% expression used to compute a value assigned to the parameter (if it is +% a simple parameter) or its member (if the parameter is an array). If +% the assign attribute is specified, the parameter is {\it computable} +% and therefore needs no data to be provided in the data section. If the +% assign attribute is not specified, the parameter should be provided +% with data in the data section. At most one assign or {\tt default} +% attribute can be specified for the same parameter. +% +% The {\tt default} attribute specifies a numeric or symbolic expression +% used to compute a value assigned to the parameter or its member +% whenever no appropriate data are available in the data section. If +% neither assign nor {\tt default} attribute is specified, missing data +% will cause an error. + +\newpage + +\section{Sentença variable} + +\noindent +\framebox[468pt][l]{ +\parbox[c][24pt]{468pt}{ +\hspace{6pt} {\tt var} {\it nome} {\it alias} {\it domínio} {\tt,} +{\it atrib} {\tt,} \dots {\tt,} {\it atrib} {\tt;} +}} + +\medskip + +\noindent +{\it nome} é um nome simbólico da variável; + +\noindent +{\it alias} é um literal de cadeia opcional que especifica um pseudônimo +para a variável; + +\noindent +{\it domínio} é uma expressão indexante opcional que especifica o domínio +do subíndice da variável; + +\noindent +{\it atrib}, \dots, {\it atrib} são atributos opcionais da variável +(as vírgulas que precedem os atributos podem ser omitidas.) + +\para{Atributos opcionais} + +\vspace*{-8pt} + +\begin{description} +\item[{\tt integer}]\hspace*{0pt}\\ +restringe a variável a ser inteira; +\item[{\tt binary}]\hspace*{0pt}\\ +restringe a variável a ser binária; +\item[{\tt>=} {\it expressão}]\hspace*{0pt}\\ +especifica um limite inferior para a variável; +\item[{\tt<=} {\it expressão}]\hspace*{0pt}\\ +especifica um limite superior para a variável; +\item[{\tt=} {\it expressão}]\hspace*{0pt}\\ +especifica um valor fixo para a variável; +\end{description} + + +% \noindent +% \framebox[468pt][l]{ +% \parbox[c][24pt]{468pt}{ +% \hspace{6pt} {\tt var} {\it name} {\it alias} {\it domain} {\tt,} +% {\it attrib} {\tt,} \dots {\tt,} {\it attrib} {\tt;} +% }} +% +% \medskip +% +% \noindent +% {\it name} is a symbolic name of the variable; +% +% \noindent +% {\it alias} is an optional string literal, which specifies an alias of +% the variable; +% +% \noindent +% {\it domain} is an optional indexing expression, which specifies +% a subscript domain of the variable; +% +% \noindent +% {\it attrib}, \dots, {\it attrib} are optional attributes of the +% variable. (Commae preceding attributes may be omitted.) +% +% \para{Optional attributes} +% +% \vspace*{-8pt} +% +% \begin{description} +% \item[{\tt integer}]\hspace*{0pt}\\ +% restricts the variable to be integer; +% \item[{\tt binary}]\hspace*{0pt}\\ +% restricts the variable to be binary; +% \item[{\tt>=} {\it expression}]\hspace*{0pt}\\ +% specifies an lower bound of the variable; +% \item[{\tt<=} {\it expression}]\hspace*{0pt}\\ +% specifies an upper bound of the variable; +% \item[{\tt=} {\it expression}]\hspace*{0pt}\\ +% specifies a fixed value of the variable; +% \end{description} + +\vspace*{-8pt} + +\para{Exemplos} + +% \para{Examples} + +\begin{verbatim} +var x >= 0; +var y{I,J}; +var produzir{p in prod}, integer, >= comprometido[p], <= mercado[p]; +var armazenar{insumo, 1..T+1} >= 0; +var z{i in I, j in J} >= i+j; +\end{verbatim} + +% \begin{verbatim} +% var x >= 0; +% var y{I,J}; +% var make{p in prd}, integer, >= commit[p], <= market[p]; +% var store{raw, 1..T+1} >= 0; +% var z{i in I, j in J} >= i+j; +% \end{verbatim} + +A sentença variable declara uma variável. Se não se especifica o +domínio do subíndice, a variável e uma variável simples (escalar), +caso contrário é uma matriz $n$-dimensional de variáveis elementares. + +As variáveis elementares associadas com a variável do modelo +(se é uma variável simples) ou seus membros (se é uma matriz) corresponde +às variáveis na formulação do problema PL/PIM (ver Seção \ref{problem}, +página \pageref{problem}). Note que somente variáveis elementares +realmente referenciadas em algumas restrições e/ou objetivos serão +incluídas na instância do problema PL/PIM a ser gerado. + +Os atributos de tipo {\tt integer} e {\tt binary} restringem a variável +a ser inteira ou binária, \linebreak respectivamente. Se nenhum atributo de tipo +é especificado, a variável é contínua. Se todas as variáveis no modelo +são contínuas, o problema correspondente é da classe PL. Se há pelo +menos uma variável inteira ou binária, o problema é da classe PIM. + +\newpage + +O atributo de limite inferior ({\tt>=}) especifica uma expressão numérica +para calcular um limite inferior da variável. No máximo um limite inferior +pode ser especificado. Por padrão, todas as variáveis (exceto as binárias) +não tem limite inferior, assim, se há a necessidade de uma variável ser +não-negativa, seu limite inferior zero deve ser explicitamente especificado. + +O atributo de limite superior ({\tt<=}) especifica uma expressão numérica +para calcular um limite superior da variável. No máximo um limite superior +pode ser especificado. + +O atributo de valor fixo ({\tt=}) especifica uma expressão numérica para +calcular um valor no qual a variável é fixada. Este atributo não pode +ser especificado junto com os atributos de limite. + + +% The variable statement declares a variable. If a subscript domain is +% not specified, the variable is a simple (scalar) variable, otherwise it +% is a $n$-dimensional array of elemental variables. +% +% Elemental variable(s) associated with the model variable (if it is a +% simple variable) or its members (if it is an array) correspond to the +% variables in the LP/MIP problem formulation (see Section \ref{problem}, +% page \pageref{problem}). Note that only elemental variables actually +% referenced in some constraints and/or objectives are included in the +% LP/MIP problem instance to be generated. +% +% The type attributes {\tt integer} and {\tt binary} restrict the +% variable to be integer or binary, respectively. If no type attribute is +% specified, the variable is continuous. If all variables in the model +% are continuous, the corresponding problem is of LP class. If there is +% at least one integer or binary variable, the problem is of MIP class. +% +% The lower bound ({\tt>=}) attribute specifies a numeric expression for +% computing an lower bound of the variable. At most one lower bound can +% be specified. By default all variables (except binary ones) have no +% lower bound, so if a variable is required to be non-negative, its zero +% lower bound should be explicitly specified. +% +% The upper bound ({\tt<=}) attribute specifies a numeric expression for +% computing an upper bound of the variable. At most one upper bound +% attribute can be specified. +% +% The fixed value ({\tt=}) attribute specifies a numeric expression for +% computing a value, at which the variable is fixed. This attribute +% cannot be specified along with the bound attributes. + + +\section{Sentença constraint} + +\noindent +\framebox[468pt][l]{ +\parbox[c][106pt]{468pt}{ +\hspace{6pt} {\tt s.t.} {\it nome} {\it alias} {\it domínio} {\tt:} +{\it expressão} {\tt,} {\tt=} {\it expressão} {\tt;} + +\medskip + +\hspace{6pt} {\tt s.t.} {\it nome} {\it alias} {\it domínio} {\tt:} +{\it expressão} {\tt,} {\tt<=} {\it expressão} {\tt;} + +\medskip + +\hspace{6pt} {\tt s.t.} {\it nome} {\it alias} {\it domínio} {\tt:} +{\it expressão} {\tt,} {\tt>=} {\it expressão} {\tt;} + +\medskip + +\hspace{6pt} {\tt s.t.} {\it nome} {\it alias} {\it domínio} {\tt:} +{\it expressão} {\tt,} {\tt<=} {\it expressão} {\tt,} {\tt<=} +{\it expressão} {\tt;} + +\medskip + +\hspace{6pt} {\tt s.t.} {\it nome} {\it alias} {\it domínio} {\tt:} +{\it expressão} {\tt,} {\tt>=} {\it expressão} {\tt,} {\tt>=} +{\it expressão} {\tt;} +}} + +\medskip + +\noindent +{\it nome} é um nome simbólico da restrição; + +\noindent +{\it alias} é um literal de cadeia opcional que especifica um pseudônimo +da restrição; + +\noindent +{\it domínio} é uma expressão indexante opcional, que especifica +o domínio do subíndice da restrição; + +\noindent +{\it expressão} é uma expressão linear usada para calcular um componente +da restrição (as vírgulas que precedem os atributos podem ser omitidas). + +\noindent +(A palavra-chave {\tt s.t.} pode ser escrita como {\tt subject to}, como +{\tt subj to} ou pode ser omitido por completo). + + +% \noindent +% \framebox[468pt][l]{ +% \parbox[c][106pt]{468pt}{ +% \hspace{6pt} {\tt s.t.} {\it name} {\it alias} {\it domain} {\tt:} +% {\it expression} {\tt,} {\tt=} {\it expression} {\tt;} +% +% \medskip +% +% \hspace{6pt} {\tt s.t.} {\it name} {\it alias} {\it domain} {\tt:} +% {\it expression} {\tt,} {\tt<=} {\it expression} {\tt;} +% +% \medskip +% +% \hspace{6pt} {\tt s.t.} {\it name} {\it alias} {\it domain} {\tt:} +% {\it expression} {\tt,} {\tt>=} {\it expression} {\tt;} +% +% \medskip +% +% \hspace{6pt} {\tt s.t.} {\it name} {\it alias} {\it domain} {\tt:} +% {\it expression} {\tt,} {\tt<=} {\it expression} {\tt,} {\tt<=} +% {\it expression} {\tt;} +% +% \medskip +% +% \hspace{6pt} {\tt s.t.} {\it name} {\it alias} {\it domain} {\tt:} +% {\it expression} {\tt,} {\tt>=} {\it expression} {\tt,} {\tt>=} +% {\it expression} {\tt;} +% }} +% +% \medskip +% +% \noindent +% {\it name} is a symbolic name of the constraint; +% +% \noindent +% {\it alias} is an optional string literal, which specifies an alias of +% the constraint; +% +% \noindent +% {\it domain} is an optional indexing expression, which specifies +% a subscript domain of the constraint; +% +% \noindent +% {\it expression} is a linear expression used to compute a component of +% the constraint. (Commae following expressions may be omitted.) +% +% \noindent +% (The keyword {\tt s.t.} may be written as {\tt subject to} or as +% {\tt subj to}, or may be omitted at all.) + + +\para{Exemplos} + +% \para{Examples} + +\begin{verbatim} +s.t. r: x + y + z, >= 0, <= 1; +limite{t in 1..T}: sum{j in produto} produzir[j,t] <= max_prod; +subject to balanco{i in insumo, t in 1..T}: + estoque[i,t+1] = estoque[i,t] - sum{j in produto} unidades[i,j] * produzir[j,t]; +subject to rlim 'limite tempo-regular' {t in tempo}: + sum{p in produto} pt[p] * rprod[p,t] <= 1.3 * dpp[t] * equipes[t]; +\end{verbatim} + +% \begin{verbatim} +% s.t. r: x + y + z, >= 0, <= 1; +% limit{t in 1..T}: sum{j in prd} make[j,t] <= max_prd; +% subject to balance{i in raw, t in 1..T}: +% store[i,t+1] = store[i,t] - sum{j in prd} units[i,j] * make[j,t]; +% subject to rlim 'regular-time limit' {t in time}: +% sum{p in prd} pt[p] * rprd[p,t] <= 1.3 * dpp[t] * crews[t]; +% \end{verbatim} + +A sentença de restrição declara uma restrição. Se o domínio do subíndice +não é especificado, a restrição é uma restrição simples (escalar), +caso contrário, é uma matriz $n$-dimensional de restrições elementares. + +Restrições elementares associadas com a restrição do modelo (se é +uma restrição simples) ou seus membros (se é uma matriz) correspondem +a restrições lineares na formulação do problema de PL/PIM (ver +Seção \ref{problem}, página \pageref{problem}). + +Se a restrição possui a forma de igualdade ou desigualdade simples, i.e., +inclui duas expressões, uma segue depois dos dois pontos e a outra +segue depois do sinal de relação {\tt=}, {\tt<=} ou {\tt>=}, \linebreak ambas +expressões na sentença podem ser expressões lineares. Se a restrição +possui a forma de uma \linebreak desigualdade dupla, i.e., inclui três expressões, +a expressão do meio pode ser uma expressão linear, enquanto a da +esquerda e a da direita podem ser apenas expressões numéricas. + +Gerar o modelo é, a grosso modo, gerar suas restrições, que são sempre +avaliadas para todo domínio do subíndice. Avaliar as restrições, +por sua vez, leva a avaliação de outros objetos de modelo tais como +conjuntos, parâmetros e variáveis. + +A construção de uma restrição linear incluída na instância do problema, +que corresponde a uma restrição elementar particular, é realizada +como segue. + + +% The constraint statement declares a constraint. If a subscript domain +% is not specified, the\linebreak constraint is a simple (scalar) +% constraint, otherwise it is a $n$-dimensional array of elemental +% constraints. +% +% Elemental constraint(s) associated with the model constraint (if it is +% a simple constraint) or its members (if it is an array) correspond to +% the linear constraints in the LP/MIP problem formulation (see +% Section \ref{problem}, page \pageref{problem}). +% +% If the constraint has the form of equality or single inequality, i.e. +% includes two expressions, one of which follows the colon and other +% follows the relation sign {\tt=}, {\tt<=}, or {\tt>=}, both expressions +% in the statement can be linear expressions. If the constraint has the +% form of double inequality,\linebreak i.e. includes three expressions, +% the middle expression can be a linear expression while the leftmost and +% rightmost ones can be only numeric expressions. +% +% Generating the model is, roughly speaking, generating its constraints, +% which are always evaluated for the entire subscript domain. Evaluation +% of the constraints leads, in turn, to evaluation of other model objects +% such as sets, parameters, and variables. +% +% Constructing an actual linear constraint included in the problem +% instance, which (constraint) corresponds to a particular elemental +% constraint, is performed as follows. + + +Se a restrição possui a forma de igualdade ou desigualdade simples, +a avaliação de ambas \linebreak expressões lineares resultam em duas formas lineares: +$$\begin{array}{r@{\ }c@{\ }r@{\ }c@{\ }r@{\ }c@{\ }r@{\ }c@{\ }r} +f&=&a_1x_1&+&a_2x_2&+\dots+&a_nx_n&+&a_0,\\ +g&=&b_1x_1&+&b_2x_2&+\dots+&b_nx_n&+&b_0,\\ +\end{array}$$ +onde $x_1$, $x_2$, \dots, $x_n$ são variáveis elementares; $a_1$, $a_2$, +\dots, $a_n$, $b_1$, $b_2$, \dots, $b_n$ são coeficientes numéricos; +$a_0$ e $b_0$ são termos constantes. Em seguida, todos os termos lineares +de $f$ e $g$ são levados ao lado esquerdo, enquanto que os termos constantes +são levados ao lado direito, resultando na restrição elementar +final na forma padrão: +$$(a_1-b_1)x_1+(a_2-b_2)x_2+\dots+(a_n-b_n)x_n\left\{ +\begin{array}{@{}c@{}}=\\\leq\\\geq\\\end{array}\right\}b_0-a_0.$$ + +Se a restrição possui a forma de desigualdade dupla, a avaliação da +expressão linear do meio resulta na seguinte forma linear: +$$f=a_1x_1+a_2x_2+\dots+a_nx_n+a_0,$$ +e a avaliação das expressões numéricas da esquerda e da direita dão +dois valores numéricos $l$ e $u$, respectivamente. Logo, +o termo constante da forma linear é levado tanto à esquerda como +à direita para gerar a restrição elementar final na forma padrão: +$$l-a_0\leq a_1x_1+a_2x_2+\dots+a_nx_n\leq u-a_0.$$ + + +% If the constraint has the form of equality or single inequality, +% evaluation of both linear expressions gives two resultant linear forms: +% $$\begin{array}{r@{\ }c@{\ }r@{\ }c@{\ }r@{\ }c@{\ }r@{\ }c@{\ }r} +% f&=&a_1x_1&+&a_2x_2&+\dots+&a_nx_n&+&a_0,\\ +% g&=&b_1x_1&+&a_2x_2&+\dots+&a_nx_n&+&b_0,\\ +% \end{array}$$ +% where $x_1$, $x_2$, \dots, $x_n$ are elemental variables; $a_1$, $a_2$, +% \dots, $a_n$, $b_1$, $b_2$, \dots, $b_n$ are numeric coefficients; +% $a_0$ and $b_0$ are constant terms. Then all linear terms of $f$ and +% $g$ are carried to the left-hand side, and the constant terms are +% carried to the right-hand side, that gives the final elemental +% constraint in the standard form: +% $$(a_1-b_1)x_1+(a_2-b_2)x_2+\dots+(a_n-b_n)x_n\left\{ +% \begin{array}{@{}c@{}}=\\\leq\\\geq\\\end{array}\right\}b_0-a_0.$$ +% +% If the constraint has the form of double inequality, evaluation of the +% middle linear expression gives the resultant linear form: +% $$f=a_1x_1+a_2x_2+\dots+a_nx_n+a_0,$$ +% and evaluation of the leftmost and rightmost numeric expressions gives +% two numeric values $l$ and $u$, respectively. Then the constant term of +% the linear form is carried to both left-hand and right-handsides that +% gives the final elemental constraint in the standard form: +% $$l-a_0\leq a_1x_1+a_2x_2+\dots+a_nx_n\leq u-a_0.$$ + + +\section{Sentença objective} + +\noindent +\framebox[468pt][l]{ +\parbox[c][44pt]{468pt}{ +\hspace{6pt} {\tt minimize} {\it nome} {\it alias} {\it domínio} {\tt:} +{\it expressão} {\tt;} + +\medskip + +\hspace{6pt} {\tt maximize} {\it nome} {\it alias} {\it domínio} {\tt:} +{\it expressão} {\tt;} +}} + +\medskip + +\noindent +{\it nome} é um nome simbólico do objetivo; + +\noindent +{\it alias} é uma literal de cadeia opcional que especifica um +pseudônimo do objetivo; + +\noindent +{\it domínio} é uma expressão indexante opcional que especifica +um domínio do subíndice do objetivo; + +\noindent +{\it expressão} é uma expressão linear usada pra calcular a forma +linear do objetivo. + + +% \noindent +% \framebox[468pt][l]{ +% \parbox[c][44pt]{468pt}{ +% \hspace{6pt} {\tt minimize} {\it name} {\it alias} {\it domain} {\tt:} +% {\it expression} {\tt;} +% +% \medskip +% +% \hspace{6pt} {\tt maximize} {\it name} {\it alias} {\it domain} {\tt:} +% {\it expression} {\tt;} +% }} +% +% \medskip +% +% \noindent +% {\it name} is a symbolic name of the objective; +% +% \noindent +% {\it alias} is an optional string literal, which specifies an alias of +% the objective; +% +% \noindent +% {\it domain} is an optional indexing expression, which specifies +% a subscript domain of the objective; +% +% \noindent +% {\it expression} is a linear expression used to compute the linear form +% of the objective. + +\newpage + +\para{Exemplos} + +% \para{Examples} + +\begin{verbatim} +minimize obj: x + 1.5 * (y + z); +maximize lucro_total: sum{p in produto} lucro[p] * produzir[p]; +\end{verbatim} + +% \begin{verbatim} +% minimize obj: x + 1.5 * (y + z); +% maximize total_profit: sum{p in prd} profit[p] * make[p]; +% \end{verbatim} + +A sentença objective declara um objetivo. Se o domínio do subíndice +não é especificado, o objetivo é um objetivo simples (escalar). Caso contrário, +é uma matriz $n$-dimensional de objetivos elementares. + +Objetivos elementares associados com o objetivo do modelo (se é um +objetivo simples) ou seus membros (se é uma matriz) correspondem +a restrições lineares genéricas na formulação do problema PL/PIM +(ver Seção \ref{problem}, página \pageref{problem}). No entanto, +diferentemente das restrições, estas formas lineares são livres +(ilimitadas). + +A construção de uma forma linear incluída na instância do problema, +a qual corresponde a uma restrição elementar particular, +é realizada como segue. A expressão linear especificada da na +sentença objective é avaliada para resultar na seguinte forma linear: +$$f=a_1x_1+a_2x_2+\dots+a_nx_n+a_0,$$ +onde $x_1$, $x_2$, \dots, $x_n$ são variáveis elementares; $a_1$, $a_2$, +\dots, $a_n$ são coeficientes numéricos; $a_0$ é o termo constante. Logo, +a forma linear é usada para construir a restrição final elementar na +forma padrão: +$$-\infty= 0 and y >= 0; +check sum{i in ORIG} suprimento[i] = sum{j in DEST} demanda[j]; +check{i in I, j in 1..10}: S[i,j] in U[i] union V[j]; +\end{verbatim} + +A sentença check permite a verificação do valor resultante +de uma expressão lógica especificada na sentença. Se o valor +é {\it falso}, um erro é reportado. + +Se o domínio do subíndice não é especificado, a verificação é realizada +apenas uma vez. \linebreak Especificar o domínio do subíndice +permite a execução de verificações múltiplas para cada $n$-tupla +no conjunto domínio. Neste último caso, a expressão lógica pode +incluir índices introduzidos na expressão indexante correspondente. + + +% \noindent +% \framebox[468pt][l]{ +% \parbox[c][24pt]{468pt}{ +% \hspace{6pt} {\tt check} {\it domain} {\tt:} {\it expression} {\tt;} +% }} +% +% \medskip +% +% \noindent +% {\it domain} is an optional indexing expression, which specifies +% a subscript domain of the check statement; +% +% \noindent +% {\it expression} is an logical expression which specifies the logical +% condition to be checked. (The colon preceding {\it expression} may be +% omitted.) +% +% \para{Examples} +% +% \begin{verbatim} +% check: x + y <= 1 and x >= 0 and y >= 0; +% check sum{i in ORIG} supply[i] = sum{j in DEST} demand[j]; +% check{i in I, j in 1..10}: S[i,j] in U[i] union V[j]; +% \end{verbatim} +% +% The check statement allows checking the resultant value of an logical +% expression specified in the statement. If the value is {\it false}, an +% error is reported. +% +% If the subscript domain is not specified, the check is performed only +% once. Specifying the subscript domain allows performing multiple check +% for every $n$-tuple in the domain set. In the latter case the logical +% expression may include dummy indices introduced in corresponding +% indexing expression. + +\section{Sentença display} + +\noindent +\framebox[468pt][l]{ +\parbox[c][24pt]{468pt}{ +\hspace{6pt} {\tt display} {\it domínio} {\tt:} {\it item} {\tt,} +\dots {\tt,} {\it item} {\tt;} +}} + +\medskip + +\noindent +{\it domínio} é uma expressão indexante opcional que especifica +um domínio do subíndice da sentença display; + +\noindent +{\it item}, \dots, {\it item} são itens a serem mostrados (os dois pontos +que precedem o primeiro item podem ser omitidos). + +\para{Exemplos} + +\begin{verbatim} +display: 'x =', x, 'y =', y, 'z =', z; +display sqrt(x ** 2 + y ** 2 + z ** 2); +display{i in I, j in J}: i, j, a[i,j], b[i,j]; +\end{verbatim} + +A sentença display avalia todos itens especificados na sentença +e escreve seus valores em saída padrão (terminal) em formato de +texto plano. + +Se um domínio de subíndice não é especificado, os itens são avaliados e +mostrados apenas uma vez. Ao especificar o domínio do subíndice, itens +são avaliados e mostrados para cada $n$-tupla no conjunto do domínio. No +último caso, os itens podem incluir índices introduzidos na expressão +indexante correspondente. + +Um item a ser mostrado pode ser um objeto de modelo (conjunto, parâmetro, +variável, restrição, objetivo) ou uma expressão. + +Se um item é um objeto calculável (i.e., um conjunto ou parâmetro com +o atributo de atribuição), o objeto é avaliado por todo domínio +e em seguida, seu conteúdo (i.e., o conteúdo da matriz de objetos) é +mostrado. Caso contrário, se o item não é um objeto calculável, somente seu +seu conteúdo corrente (i.e., os membros realmente gerados durante a +avaliação do modelo) é mostrado. + +Se o item é uma expressão, a expressão é avaliada e seu valor +resultante é mostrado. + + +% \noindent +% \framebox[468pt][l]{ +% \parbox[c][24pt]{468pt}{ +% \hspace{6pt} {\tt display} {\it domain} {\tt:} {\it item} {\tt,} +% \dots {\tt,} {\it item} {\tt;} +% }} +% +% \medskip +% +% \noindent +% {\it domain} is an optional indexing expression, which specifies +% a subscript domain of the display statement; +% +% \noindent +% {\it item}, \dots, {\it item} are items to be displayed. (The colon +% preceding the first item may be omitted.) +% +% \para{Examples} +% +% \begin{verbatim} +% display: 'x =', x, 'y =', y, 'z =', z; +% display sqrt(x ** 2 + y ** 2 + z ** 2); +% display{i in I, j in J}: i, j, a[i,j], b[i,j]; +% \end{verbatim} +% +% The display statement evaluates all items specified in the statement +% and writes their values on the standard output (terminal) in plain text +% format. +% +% If a subscript domain is not specified, items are evaluated and then +% displayed only once. Specifying the subscript domain causes items to be +% evaluated and displayed for every $n$-tuple in the domain set. In the +% latter case items may include dummy indices introduced in corresponding +% indexing expression. +% +% An item to be displayed can be a model object (set, parameter, +% variable, constraint, objective) or an expression. +% +% If the item is a computable object (i.e. a set or parameter provided +% with the assign attribute), the object is evaluated over the entire +% domain and then its content (i.e. the content of the object array) is +% displayed. Otherwise, if the item is not a computable object, only its +% current content (i.e. members actually generated during the model +% evaluation) is displayed. +% +% If the item is an expression, the expression is evaluated and its +% resultant value is displayed. + +\section{Sentença printf} + +\noindent +\framebox[468pt][l]{ +\parbox[c][64pt]{468pt}{ +\hspace{6pt} {\tt printf} {\it domínio} {\tt:} {\it formato} {\tt,} +{\it expressão} {\tt,} \dots {\tt,} {\it expressão} {\tt;} + +\medskip + +\hspace{6pt} {\tt printf} {\it domínio} {\tt:} {\it formato} {\tt,} +{\it expressão} {\tt,} \dots {\tt,} {\it expressão} {\tt>} +{\it nome-do-arquivo} {\tt;} + +\medskip + +\hspace{6pt} {\tt printf} {\it domínio} {\tt:} {\it formato} {\tt,} +{\it expressão} {\tt,} \dots {\tt,} {\it expressão} {\tt>>} +{\it nome-do-arquivo} {\tt;} +}} + +\medskip + +\noindent +{\it domínio} é uma expressão indexante opcional que especifica o domínio +do subíndice da sentença printf; + +\noindent +{\it formato} é uma expressão simbólica cujo valor especifica uma cadeia de +controle de formato (os dois pontos que precedem a expressão de formato +podem ser omitidos). + +\noindent +{\it expressão}, \dots, {\it expressão} são zero ou mais expressões +cujos valores devem ser formatados e impressos. Cada expressão deve +ser de tipo numérico, simbólico ou lógico. + +\noindent +{\it nome-do-arquivo} é uma expressão simbólica cujo valor especifica um nome +de um arquivo de texto para onde a saída é redirecionada. O sinal {\tt>} +significa criar um novo aquivo vazio, enquanto o sinal {\tt>>} significa +acrescentar a saída a um arquivo existente. Se o nome do arquivo não é especificado, +a saída é escrita na saída padrão (terminal). + +\para{Exemplos} + +\begin{verbatim} +printf 'Ola, mundo!\n'; +printf: "x = %.3f; y = %.3f; z = %.3f\n", x, y, z > "resultado.txt"; +printf{i in I, j in J}: "fluxo de %s para %s eh %d\n", i, j, x[i,j] + >> arquivo_resultado & ".txt"; +printf{i in I} 'fluxo total de %s eh %g\n', i, sum{j in J} x[i,j]; +printf{k in K} "x[%s] = " & (if x[k] < 0 then "?" else "%g"), + k, x[k]; +\end{verbatim} + +A sentença printf é similar a sentença display, no entanto, ela +permite formatar os dados a serem escritos. + +Se um domínio do subíndice não é especificado, a sentença printf +é executada apenas uma vez. Especificar um domínio do subíndice gera +a execução da sentença printf para cada $n$-tupla no conjunto do domínio. +No último caso, o formato e a expressão podem incluir índices introduzidos +nas expressões indexantes correspondentes. + +A cadeia de controle de formato é valor da expressão simbólica +{\it formato} especificada na sentença printf. Ela é composta de zero +ou mais diretivas, como segue: tanto caracteres ordinários (exceto {\tt\%}), que +são copiados sem modificação ao fluxo de saída, quanto especificações de conversão, +provocam a avaliação da expressão correspondente especificada na sentença +printf, do seu formato e da escrita do valor resultante no fluxo de saída. + +As especificações de conversão que podem ser usadas na cadeia de controle +de formato são as seguintes: {\tt d}, {\tt i}, {\tt f}, {\tt F}, +{\tt e}, {\tt E}, {\tt g}, {\tt G} e {\tt s}. Estas especificações +possuem a mesma sintaxe e semântica que na linguagem de programação C. + + +% \noindent +% \framebox[468pt][l]{ +% \parbox[c][64pt]{468pt}{ +% \hspace{6pt} {\tt printf} {\it domain} {\tt:} {\it format} {\tt,} +% {\it expression} {\tt,} \dots {\tt,} {\it expression} {\tt;} +% +% \medskip +% +% \hspace{6pt} {\tt printf} {\it domain} {\tt:} {\it format} {\tt,} +% {\it expression} {\tt,} \dots {\tt,} {\it expression} {\tt>} +% {\it filename} {\tt;} +% +% \medskip +% +% \hspace{6pt} {\tt printf} {\it domain} {\tt:} {\it format} {\tt,} +% {\it expression} {\tt,} \dots {\tt,} {\it expression} {\tt>>} +% {\it filename} {\tt;} +% }} +% +% \medskip +% +% \noindent +% {\it domain} is an optional indexing expression, which specifies +% a subscript domain of the printf statement; +% +% \noindent +% {\it format} is a symbolic expression whose value specifies a format +% control string. (The colon preceding the format expression may be +% omitted.) +% +% \noindent +% {\it expression}, \dots, {\it expression} are zero or more expressions +% whose values have to be formatted and printed. Each expression should +% be of numeric, symbolic, or logical type. +% +% \noindent +% {\it filename} is a symbolic expression whose value specifies a name +% of a text file, to which the output is redirected. The flag {\tt>} +% means creating a new empty file while the flag {\tt>>} means appending +% the output to an existing file. If no file name is specified, the +% output is written on the standard output (terminal). +% +% \para{Examples} +% +% \begin{verbatim} +% printf 'Hello, world!\n'; +% printf: "x = %.3f; y = %.3f; z = %.3f\n", x, y, z > "result.txt"; +% printf{i in I, j in J}: "flow from %s to %s is %d\n", i, j, x[i,j] +% >> result_file & ".txt"; +% printf{i in I} 'total flow from %s is %g\n', i, sum{j in J} x[i,j]; +% printf{k in K} "x[%s] = " & (if x[k] < 0 then "?" else "%g"), +% k, x[k]; +% \end{verbatim} +% +% The printf statement is similar to the display statement, however, it +% allows formatting data to be written. +% +% If a subscript domain is not specified, the printf statement is +% executed only once. Specifying a subscript domain causes executing the +% printf statement for every $n$-tuple in the domain set. In the latter +% case the format and expression may include dummy indices introduced in +% corresponding indexing expression. +% +% The format control string is a value of the symbolic expression +% {\it format} specified in the printf statement. It is composed of zero +% or more directives as follows: ordinary characters (not {\tt\%}), which +% are copied unchanged to the output stream, and conversion +% specifications, each of which causes evaluating corresponding +% expression specified in the printf statement, formatting it, and +% writing its resultant value to the output stream. +% +% Conversion specifications that may be used in the format control string +% are the following:\linebreak {\tt d}, {\tt i}, {\tt f}, {\tt F}, +% {\tt e}, {\tt E}, {\tt g}, {\tt G}, and {\tt s}. These specifications +% have the same syntax and semantics as in the C programming language. + +\section{Sentença for} + +\noindent +\framebox[468pt][l]{ +\parbox[c][44pt]{468pt}{ +\hspace{6pt} {\tt for} {\it domínio} {\tt:} {\it sentença} {\tt;} + +\medskip + +\hspace{6pt} {\tt for} {\it domínio} {\tt:} {\tt\{} {\it sentença} +\dots {\it sentença} {\tt\}} {\tt;} +}} + +\medskip + +\noindent +{\it domínio} é uma expressão indexante que especifica um +domínio do subíndice da sentença for. (Os dois pontos que seguem a +expressão indexante podem ser omitidos). + +\noindent +{\it sentença} é uma sentença que deve ser executada sob o controle +da sentença for; + +\noindent +{\it sentença}, \dots, {\it sentença} é uma sequência de sentenças +(cercada entre chaves) que deve ser executada sob o controle da +sentença for. + +Apenas as sentenças seguintes podem ser usadas dentro da +sentença for: check, display, printf e outro for. + +\para{Exemplos} + +\begin{verbatim} +for {(i,j) in E: i != j} +{ printf "fluxo de %s para %s eh %g\n", i, j, x[i,j]; + check x[i,j] >= 0; +} +for {i in 1..n} +{ for {j in 1..n} printf " %s", if x[i,j] then "Q" else "."; + printf("\n"); +} +for {1..72} printf("*"); +\end{verbatim} + +A sentença for faz com que a sentença, ou uma sequência de sentenças +especificadas como parte da sentença for, seja executada para cada +$n$-tupla no conjunto do domínio. Assim, sentenças dentro da sentença for +podem incluir índices introduzidos na expressão indexante correspondente. + +% \noindent +% \framebox[468pt][l]{ +% \parbox[c][44pt]{468pt}{ +% \hspace{6pt} {\tt for} {\it domain} {\tt:} {\it statement} {\tt;} +% +% \medskip +% +% \hspace{6pt} {\tt for} {\it domain} {\tt:} {\tt\{} {\it statement} +% \dots {\it statement} {\tt\}} {\tt;} +% }} +% +% \medskip +% +% \noindent +% {\it domain} is an indexing expression which specifies a subscript +% domain of the for statement. (The colon following the indexing +% expression may be omitted.) +% +% \noindent +% {\it statement} is a statement, which should be executed under control +% of the for statement; +% +% \noindent +% {\it statement}, \dots, {\it statement} is a sequence of statements +% (enclosed in curly braces), which should be executed under control of +% the for statement. +% +% Only the following statements can be used within the for statement: +% check, display, printf, and another for. +% +% \para{Examples} +% +% \begin{verbatim} +% for {(i,j) in E: i != j} +% { printf "flow from %s to %s is %g\n", i, j, x[i,j]; +% check x[i,j] >= 0; +% } +% for {i in 1..n} +% { for {j in 1..n} printf " %s", if x[i,j] then "Q" else "."; +% printf("\n"); +% } +% for {1..72} printf("*"); +% \end{verbatim} +% +% The for statement causes a statement or a sequence of statements +% specified as part of the for statement to be executed for every +% $n$-tuple in the domain set. Thus, statements within the for statement +% may include dummy indices introduced in corresponding indexing +% expression. + +\newpage + +\section{Sentença table} + +\noindent +\framebox[468pt][l]{ +\parbox[c][80pt]{468pt}{ +\hspace{6pt} {\tt table} {\it nome} {\it alias} {\tt IN} {\it controlador} +{\it arg} \dots {\it arg} {\tt:} + +\hspace{6pt} {\tt\ \ \ \ \ } {\it conjunto} {\tt<-} {\tt[} {\it cmp} {\tt,} +\dots {\tt,} {\it cmp} {\tt]} {\tt,} {\it par} {\tt\textasciitilde} +{\it cmp} {\tt,} \dots {\tt,} {\it par} {\tt\textasciitilde} {\it cmp} +{\tt;} + +\medskip + +\hspace{6pt} {\tt table} {\it nome} {\it alias} {\it domínio} {\tt OUT} +{\it controlador} {\it arg} \dots {\it arg} {\tt:} + +\hspace{6pt} {\tt\ \ \ \ \ } {\it expr} {\tt\textasciitilde} {\it cmp} +{\tt,} \dots {\tt,} {\it expr} {\tt\textasciitilde} {\it cmp} {\tt;} +}} + +\medskip + +\noindent +{\it nome} é um nome simbólico da tabela; + +\noindent +{\it alias} é um literal de cadeia opcional que especifica um pseudônimo +da tabela; + +\noindent +{\it domínio} é uma expressão indexante que especifica o domínio do +subíndice da tabela (de saída); + +\noindent +{\tt IN} significa ler dados de uma tabela de entrada; + +\noindent +{\tt OUT} significa escrever dados em uma tabela de saída; + +\noindent +{\it controlador} é uma expressão simbólica que especifica o controlador +usado para acessar a tabela (para mais detalhes, ver Apêndice \ref{drivers}, +página \pageref{drivers}); + +\noindent +{\it arg} é uma expressão simbólica opcional, que é um argumento +passado ao controlador da tabela. Esta expressão simbólica não deveria +incluir índices especificados no domínio; + +\noindent +{\it conjunto} é o nome de um conjunto simples opcional chamado +{\it conjunto de controle}. Pode ser omitido junto com o delimitador {\tt<-}; + +\noindent +{\it cmp} é um nome de campo. Entre colchetes, pelo menos um campo deve ser +especificado. O nome do campo, que segue o nome do parâmetro ou de uma +expressão, é opcional e pode ser omitido juntamente com o +delimitador~{\tt\textasciitilde}. Neste caso o nome do objeto de modelo +correspondente é usado como nome de campo; + +\noindent +{\it par} é um nome simbólico de um parâmetro do modelo; + +\noindent +{\it expr} é uma expressão numérica ou simbólica. + +\para{Exemplos} + +\begin{verbatim} +table dados IN "CSV" "dados.csv": S <- [DE,PARA], d~DISTANCIA, + c~CUSTO; +table resultado{(d,p) in S} OUT "CSV" "resultado.csv": d~DE, p~PARA, + x[d,p]~FLUXO; +\end{verbatim} + +A sentença table permite a leitura de dados de uma tabela para objetos +de modelo como conjuntos e parâmetros (não-escalares) assim como escrever +dados do modelo para uma tabela. + + +% \noindent +% \framebox[468pt][l]{ +% \parbox[c][80pt]{468pt}{ +% \hspace{6pt} {\tt table} {\it name} {\it alias} {\tt IN} {\it driver} +% {\it arg} \dots {\it arg} {\tt:} +% +% \hspace{6pt} {\tt\ \ \ \ \ } {\it set} {\tt<-} {\tt[} {\it fld} {\tt,} +% \dots {\tt,} {\it fld} {\tt]} {\tt,} {\it par} {\tt\textasciitilde} +% {\it fld} {\tt,} \dots {\tt,} {\it par} {\tt\textasciitilde} {\it fld} +% {\tt;} +% +% \medskip +% +% \hspace{6pt} {\tt table} {\it name} {\it alias} {\it domain} {\tt OUT} +% {\it driver} {\it arg} \dots {\it arg} {\tt:} +% +% \hspace{6pt} {\tt\ \ \ \ \ } {\it expr} {\tt\textasciitilde} {\it fld} +% {\tt,} \dots {\tt,} {\it expr} {\tt\textasciitilde} {\it fld} {\tt;} +% }} +% +% \medskip +% +% \noindent +% {\it name} is a symbolic name of the table; +% +% \noindent +% {\it alias} is an optional string literal, which specifies an alias of +% the table; +% +% \noindent +% {\it domain} is an indexing expression, which specifies a subscript +% domain of the (output) table; +% +% \noindent +% {\tt IN} means reading data from the input table; +% +% \noindent +% {\tt OUT} means writing data to the output table; +% +% \noindent +% {\it driver} is a symbolic expression, which specifies the driver used +% to access the table (for details see Appendix \ref{drivers}, page +% \pageref{drivers}); +% +% \noindent +% {\it arg} is an optional symbolic expression, which is an argument +% pass\-ed to the table driver. This symbolic expression should not +% include dummy indices specified in the domain; +% +% \noindent +% {\it set} is the name of an optional simple set called {\it control +% set}. It can be omitted along with the delimiter {\tt<-}; +% +% \noindent +% {\it fld} is a field name. Within square brackets at least one field +% should be specified. The field name following a parameter name or +% expression is optional and can be omitted along with the +% delimiter~{\tt\textasciitilde}, in which case the name of corresponding +% model object is used as the field name; +% +% \noindent +% {\it par} is a symbolic name of a model parameter; +% +% \noindent +% {\it expr} is a numeric or symbolic expression. +% +% \para{Examples} +% +% \begin{verbatim} +% table data IN "CSV" "data.csv": S <- [FROM,TO], d~DISTANCE, +% c~COST; +% table result{(f,t) in S} OUT "CSV" "result.csv": f~FROM, t~TO, +% x[f,t]~FLOW; +% \end{verbatim} +% +% The table statement allows reading data from a table into model +% objects such as sets and (non-scalar) parameters as well as writing +% data from the model to a table. + +\newpage + +\subsection{Estrutura de tabelas} + +Uma {\it tabela de dados} é um conjunto (desordenado) de {\it registros}, onde cada +registro consiste do mesmo número de {\it campos} e cada campo possui um único +nome simbólico denominado o {\it nome do campo}. Por exemplo: + +\bigskip + +\begin{tabular}{@{\hspace*{42mm}}c@{\hspace*{11mm}}c@{\hspace*{10mm}}c +@{\hspace*{9mm}}c} +Primeiro&Segundo&&Último\\ +campo&campo&.\ \ .\ \ .&campo\\ +$\downarrow$&$\downarrow$&&$\downarrow$\\ +\end{tabular} + +\begin{tabular}{ll@{}} +Cabeçalho da tabela&$\rightarrow$\\ +Primeiro registro&$\rightarrow$\\ +Segundo registro&$\rightarrow$\\ +\\ +\hfil .\ \ .\ \ .\\ +\\ +Último registro&$\rightarrow$\\ +\end{tabular} +\begin{tabular}{|l|l|c|c|} +\hline +{\tt DE}&{\tt PARA}&{\tt DISTANCIA}&{\tt CUSTO}\\ +\hline +{\tt Seattle} &{\tt New-York}&{\tt 2.5}&{\tt 0.12}\\ +{\tt Seattle} &{\tt Chicago} &{\tt 1.7}&{\tt 0.08}\\ +{\tt Seattle} &{\tt Topeka} &{\tt 1.8}&{\tt 0.09}\\ +{\tt San-Diego}&{\tt New-York}&{\tt 2.5}&{\tt 0.15}\\ +{\tt San-Diego}&{\tt Chicago} &{\tt 1.8}&{\tt 0.10}\\ +{\tt San-Diego}&{\tt Topeka} &{\tt 1.4}&{\tt 0.07}\\ +\hline +\end{tabular} + + +% A {\it data table} is an (unordered) set of {\it records}, where each +% record consists of the same number of {\it fields}, and each field is +% provided with a unique symbolic name called the {\it field name}. For +% example: +% +% \bigskip +% +% \begin{tabular}{@{\hspace*{42mm}}c@{\hspace*{11mm}}c@{\hspace*{10mm}}c +% @{\hspace*{9mm}}c} +% First&Second&&Last\\ +% field&field&.\ \ .\ \ .&field\\ +% $\downarrow$&$\downarrow$&&$\downarrow$\\ +% \end{tabular} +% +% \begin{tabular}{ll@{}} +% Table header&$\rightarrow$\\ +% First record&$\rightarrow$\\ +% Second record&$\rightarrow$\\ +% \\ +% \hfil .\ \ .\ \ .\\ +% \\ +% Last record&$\rightarrow$\\ +% \end{tabular} +% \begin{tabular}{|l|l|c|c|} +% \hline +% {\tt FROM}&{\tt TO}&{\tt DISTANCE}&{\tt COST}\\ +% \hline +% {\tt Seattle} &{\tt New-York}&{\tt 2.5}&{\tt 0.12}\\ +% {\tt Seattle} &{\tt Chicago} &{\tt 1.7}&{\tt 0.08}\\ +% {\tt Seattle} &{\tt Topeka} &{\tt 1.8}&{\tt 0.09}\\ +% {\tt San-Diego}&{\tt New-York}&{\tt 2.5}&{\tt 0.15}\\ +% {\tt San-Diego}&{\tt Chicago} &{\tt 1.8}&{\tt 0.10}\\ +% {\tt San-Diego}&{\tt Topeka} &{\tt 1.4}&{\tt 0.07}\\ +% \hline +% \end{tabular} + +\subsection{Lendo dados de uma tabela de entrada} + +A sentença tabela de entrada faz a leitura de dados +da tabela especificada, registro por registro. + +Uma vez que o registro subsequente foi lido, valores numéricos ou simbólicos +dos campos, cujos nomes são cercados entre colchetes na sentença table, +são reunidos em um $n$-tuplo. Se o conjunto de controle é especificado +na sentença table, este $n$-tuplo é adicionado a ele. Além disso, um valor +numérico ou simbólico de cada campo associado com um parâmetro do modelo +é atribuído ao membro do parâmetro identificado por subíndices, que são +componentes da $n$-tupla que acabou de ser lida. + +Por exemplo, a seguinte sentença de tabela de entrada: + +\noindent\hfil +\verb|table dados IN "...": S <- [DE,PARA], d~DISTANCIA, c~CUSTO;| + +\noindent +faz a leitura de valores de quatro campos chamados {\tt DE}, {\tt PARA}, +{\tt DISTANCIA} e {\tt CUSTO} de cada registro da tabela especificada. +Os valores dos campos {\tt DE} e {\tt PARA} dão um par $(f,t)$, que é +adicionado ao conjunto de controle {\tt S}. O valor do campo {\tt DISTANCIA} é +atribuído ao membro do parâmetro ${\tt d}[f,t]$ enquanto que o valor do campo +{\tt CUSTO} é atribuído ao membro do parâmetro ${\tt c}[f,t]$. + +Note que a tabela de entrada pode conter campos adicionais cujos nomes +não sejam especificados na sentença tabela, neste caso, os valores destes +campos serão ignorados na leitura da tabela. + +% The input table statement causes reading data from the specified table +% record by record. +% +% Once a next record has been read, numeric or symbolic values of fields, +% whose names are enclosed in square brackets in the table statement, are +% gathered into $n$-tuple, and if the control set is specified in the +% table statement, this $n$-tuple is added to it. Besides, a numeric or +% symbolic value of each field associated with a model parameter is +% assigned to the parameter member identified by subscripts, which are +% components of the $n$-tuple just read. +% +% For example, the following input table statement: +% +% \noindent\hfil +% \verb|table data IN "...": S <- [FROM,TO], d~DISTANCE, c~COST;| +% +% \noindent +% causes reading values of four fields named {\tt FROM}, {\tt TO}, +% {\tt DISTANCE}, and {\tt COST} from each record of the specified table. +% Values of fields {\tt FROM} and {\tt TO} give a pair $(f,t)$, which is +% added to the control set {\tt S}. The value of field {\tt DISTANCE} is +% assigned to parameter member ${\tt d}[f,t]$, and the value of field +% {\tt COST} is assigned to parameter member ${\tt c}[f,t]$. +% +% Note that the input table may contain extra fields whose names are not +% specified in the table statement, in which case values of these fields +% on reading the table are ignored. + +\subsection{Escrevendo dados em uma tabela de saída} + +A sentença tabela de saída gera a escrita de dados na tabela especificada. +Note que alguns controladores (chamados CSV e xBASE) destroem a tabela de saída +antes de escrever os dados, i.e., deletam todos os registros existentes. + +Cada $n$-tupla no domínio do conjunto especificado gera um registro escrito na +tabela de saída. Os valores dos campos são valores numéricos ou simbólicos +das expressões correspondentes especificadas na sentença table. Estas +expressões são avaliadas para cada $n$-tupla no conjunto do domínio, +portanto, podem incluir índices introduzidos na expressão indexante correspondente. + +Por exemplo, a seguinte sentença da tabela de saída: + +\noindent\hfil +\verb|table resultado{(f,t) in S} OUT "...": f~DE, t~PARA, x[f,t]~FLUXO;| + +\noindent +gera a escrita de registros; um registro para cada par $(f,t)$ no conjunto +{\tt S} para a tabela de saída, onde cada registro consiste de três campos +chamados {\tt DE}, {\tt PARA} e {\tt FLUXO}. Os valores escritos nos campos +{\tt DE} e {\tt PARA} são os valores correntes dos índices {\tt f} e {\tt t}. +O valor escrito no campo {\tt FLUXO} é um valor do membro ${\tt x}[f,t]$ +do correspondente parâmetro ou variável indexada. + + +% The output table statement causes writing data to the specified table. +% Note that some drivers (namely, CSV and xBASE) destroy the output table +% before writing data, i.e. delete all its existing records. +% +% Each $n$-tuple in the specified domain set generates one record written +% to the output table. Values of fields are numeric or symbolic values of +% corresponding expressions specified in the table statement. These +% expressions are evaluated for each $n$-tuple in the domain set and, +% thus, may include dummy indices introduced in the corresponding indexing +% expression. +% +% For example, the following output table statement: +% +% \noindent\hfil +% \verb|table result{(f,t) in S} OUT "...": f~FROM, t~TO, x[f,t]~FLOW;| +% +% \noindent +% causes writing records, by one record for each pair $(f,t)$ in set +% {\tt S}, to the output table, where each record consists of three +% fields named {\tt FROM}, {\tt TO}, and {\tt FLOW}. The values written +% to fields {\tt FROM} and {\tt TO} are current values of dummy indices +% {\tt f} and {\tt t}, and the value written to field {\tt FLOW} is +% a value of member ${\tt x}[f,t]$ of corresponding subscripted parameter +% or variable. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Dados do modelo} + +Os {\it dados do modelo} includem conjuntos elementares, que são ``valores'' dos +conjuntos do modelo, e valores numéricos e simbólicos dos parâmetros do modelo. + +Em MathProg existem duas formas diferentes de fornecer valores aos conjuntos +e parâmetros do modelo. Uma forma é simplesmente prover os dados necessários +usando o atributo de atribuição. No entanto, em muitos casos é mais prático separar +o modelo próprio dos dados particulares necessários para o modelo. Para o último +caso, em MathProg há uma outra forma, em que a descrição do modelo é dividida +em duas partes: a seção de modelo e a seção de dados. + +A {\it seção de modelo} é a principal parte da descrição do modelo. Ela contém +todas as declarações de todos objetos do modelo, sendo comum a todos problemas +baseados naquele modelo. + +A {\it seção de dados} é uma parte opcional da descrição do modelo que contém +dados específicos para um problema particular. + +Em MathProg seções de modelo e de dados podem ser localizadas tanto em um arquivo +de texto ou em dois arquivos de texto separados. + +1. Se ambas seções de modelo e de dados estão localizados em um arquivo, +o arquivo é composto como segue: + + + +\bigskip + +\noindent\hfil +\framebox{\begin{tabular}{l} +{\it sentença}{\tt;}\\ +{\it sentença}{\tt;}\\ +\hfil.\ \ .\ \ .\\ +{\it sentença}{\tt;}\\ +{\tt data;}\\ +{\it bloco de dados}{\tt;}\\ +{\it bloco de dados}{\tt;}\\ +\hfil.\ \ .\ \ .\\ +{\it bloco de dados}{\tt;}\\ +{\tt end;} +\end{tabular}} + + + +% {\it Model data} include elemental sets, which are ``values'' of model +% sets, and numeric and symbolic values of model parameters. +% +% In MathProg there are two different ways to saturate model sets and +% parameters with data. One way is simply providing necessary data using +% the assign attribute. However, in many cases it is more practical to +% separate the model itself and particular data needed for the model. For +% the latter reason in MathProg there is another way, when the model +% description is divided into two parts: model section and data section. +% +% A {\it model section} is a main part of the model description that +% contains declarations of all model objects and is common for all +% problems based on that model. +% +% A {\it data section} is an optional part of the model description that +% contains model data specific for a particular problem. +% +% In MathProg model and data sections can be placed either in one text +% file or in two separate text files. +% +% 1. If both model and data sections are placed in one file, the file is +% composed as follows: +% +% \bigskip +% +% \noindent\hfil +% \framebox{\begin{tabular}{l} +% {\it statement}{\tt;}\\ +% {\it statement}{\tt;}\\ +% \hfil.\ \ .\ \ .\\ +% {\it statement}{\tt;}\\ +% {\tt data;}\\ +% {\it data block}{\tt;}\\ +% {\it data block}{\tt;}\\ +% \hfil.\ \ .\ \ .\\ +% {\it data block}{\tt;}\\ +% {\tt end;} +% \end{tabular}} + +% 2. Se a seção de modelo e dados são posicionados em dois arquivos separados, os +% arquivos são compostos como segue: + +\newpage + +2. Se a seção de modelo e dados são posicionados em dois arquivos separados, os +arquivos são compostos como segue: + +\bigskip + +\noindent\hfil +\begin{tabular}{@{}c@{}} +\framebox{\begin{tabular}{l} +{\it sentença}{\tt;}\\ +{\it sentença}{\tt;}\\ +\hfil.\ \ .\ \ .\\ +{\it sentença}{\tt;}\\ +{\tt end;}\\ +\end{tabular}}\\ +\\\\Arquivo de modelo\\ +\end{tabular} +\hspace{32pt} +\begin{tabular}{@{}c@{}} +\framebox{\begin{tabular}{l} +{\tt data;}\\ +{\it bloco de dados}{\tt;}\\ +{\it bloco de dados}{\tt;}\\ +\hfil.\ \ .\ \ .\\ +{\it bloco de dados}{\tt;}\\ +{\tt end;}\\ +\end{tabular}}\\ +\\Arquivo de dados\\ +\end{tabular} + +\bigskip + +Nota: Se a seção de dados é posicionada em um arquivo separado, a palavra-chave +{\tt data} é opcional e pode ser omitida juntamente como o ponto e vírgula que a segue. + + +% \bigskip +% +% \noindent\hfil +% \begin{tabular}{@{}c@{}} +% \framebox{\begin{tabular}{l} +% {\it statement}{\tt;}\\ +% {\it statement}{\tt;}\\ +% \hfil.\ \ .\ \ .\\ +% {\it statement}{\tt;}\\ +% {\tt end;}\\ +% \end{tabular}}\\ +% \\\\Model file\\ +% \end{tabular} +% \hspace{32pt} +% \begin{tabular}{@{}c@{}} +% \framebox{\begin{tabular}{l} +% {\tt data;}\\ +% {\it data block}{\tt;}\\ +% {\it data block}{\tt;}\\ +% \hfil.\ \ .\ \ .\\ +% {\it data block}{\tt;}\\ +% {\tt end;}\\ +% \end{tabular}}\\ +% \\Data file\\ +% \end{tabular} +% +% \bigskip +% +% Note: If the data section is placed in a separate file, the keyword +% {\tt data} is optional and may be omitted along with the semicolon that +% follows it. + + +\section{Programando a seção de dados} + +A {\it seção de dados} é uma sequência de blocos de dados em vários formatos +e são discutidos nas seções seguintes. A ordem na qual os blocos de dados +seguem na seção de dados pode ser arbitrária, portanto, não precisa ser +necessariamente a mesma ordem que seguem os elementos correspondentes +da seção de modelo. + +As regras para programar a seção de dados são comumente as mesmas que as regras +de \linebreak programar a descrição do modelo (ver Seção \ref{coding}, página +\pageref{coding}), i.e., blocos de dados são compostos com unidades léxicas +básicas, como nomes simbólicos, literais numéricos e de cadeia, +palavras-chave, \linebreak delimitadores e comentários. No entanto, por conveniência +e para melhorar legibilidade, há um desvio da regra comum: se um literal +de cadeia consiste unicamente de caracteres alfanuméricos (incluindo +o caractere sublinhado), os sinais {\tt+} e {\tt-} e/ou o ponto decimal, +ele pode ser programado sem aspas limitadoras (simples ou duplas). + +Todo material numérico e simbólico provido na seção de dados é programado +na forma de números e símbolos, i.e., diferentemente da seção de modelo, +não são permitidas expressões na seção de dados. Apesar disso, os sinais +{\tt+} e {\tt-} podem preceder literais numéricos para permitir a programação +de quantidades numéricas com sinais. Neste caso não deve haver caractere de +espaço em branco entre o sinal e o literal numérico seguinte (se houver +pelo menos uma espaço em branco, o sinal e o literal numérico seguinte são +reconhecidos como duas unidades léxicas diferentes). + + + +% The {\it data section} is a sequence of data blocks in various formats, +% which are discussed in following sections. The order, in which data +% blocks follow in the data section, may be arbitrary, not necessarily +% the same, in which corresponding model objects follow in the model +% section. +% +% The rules of coding the data section are commonly the same as the rules +% of coding the model description (see Section \ref{coding}, page +% \pageref{coding}), i.e. data blocks are composed from basic lexical +% units such as symbolic names, numeric and string literals, keywords, +% delimiters, and comments. However, for the sake of convenience and for +% improving readability there is one deviation from the common rule: if +% a string literal consists of only alphanumeric characters (including +% the underscore character), the signs {\tt+} and {\tt-}, and/or the +% decimal point, it may be coded without bordering by (single or double) +% quotes. +% +% All numeric and symbolic material provided in the data section is coded +% in the form of numbers and symbols, i.e. unlike the model section +% no expressions are allowed in the data section. Nevertheless, the signs +% {\tt+} and {\tt-} can precede numeric literals to allow coding signed +% numeric quantities, in which case there should be no white-space +% characters between the sign and following numeric literal (if there is +% at least one white-space, the sign and following numeric literal are +% recognized as two different lexical units). + +\newpage + +\section{Bloco de dados set} + +\noindent +\framebox[468pt][l]{ +\parbox[c][44pt]{468pt}{ +\hspace{6pt} {\tt set} {\it nome} {\tt,} {\it registro} {\tt,} \dots +{\tt,} {\it registro} {\tt;} + +\medskip + +\hspace{6pt} {\tt set} {\it nome} {\tt[} {\it símbolo} {\tt,} \dots +{\tt,} {\it símbolo} {\tt]} {\tt,} {\it registro} {\tt,} \dots {\tt,} +{\it registro} {\tt;} +}} + +\medskip + +\noindent +{\it nome} é um nome simbólico do conjunto; + +\noindent +{\it símbolo}, \dots, {\it símbolo} são subíndices que especificam +um membro particular do conjunto \linebreak(se o conjunto é uma matriz, i.e., +um conjunto de conjuntos); + +\noindent +{\it registro}, \dots, {\it registro} são registros. + +\noindent +As vírgulas que precedem os registros podem ser omitidas. + +\para{Registros} + +\vspace*{-8pt} + +\begin{description} +\item[{\tt :=}]\hspace*{0pt}\\ +é um elemento de atribuição de registro não-significativo que pode ser usado +livremente para melhorar a legibilidade; +\item[{\tt(} {\it fatia} {\tt)}]\hspace*{0pt}\\ +especifica uma fatia; +\item[{\it dados-simples}]\hspace*{0pt}\\ +especifica os dados do conjunto em formato simples; +\item[{\tt:} {\it dados matriciais}]\hspace*{0pt}\\ +especifica os dados do conjunto em formato de matriz; +\item[{\tt(tr)} {\tt:} {\it dados matriciais}]\hspace*{0pt}\\ +especifica os dados do conjunto em formato de matriz transposta. +(Neste caso, os dois pontos que seguem a palavra-chave {\tt(tr)} podem ser omitidos). +\end{description} + +\vspace*{-8pt} + +\para{Exemplos} + +\begin{verbatim} +set mes := Jan Fev Mar Abr Mai Jun; +set mes "Jan", "Fev", "Mar", "Abr", "Mai", "Jun"; +set A[3,Mar] := (1,2) (2,3) (4,2) (3,1) (2,2) (4,4) (3,4); +set A[3,'Mar'] := 1 2 2 3 4 2 3 1 2 2 4 4 3 4; +set A[3,'Mar'] : 1 2 3 4 := + 1 - + - - + 2 - + + - + 3 + - - + + 4 - + - + ; +set B := (1,2,3) (1,3,2) (2,3,1) (2,1,3) (1,2,2) (1,1,1) (2,1,1); +set B := (*,*,*) 1 2 3, 1 3 2, 2 3 1, 2 1 3, 1 2 2, 1 1 1, 2 1 1; +set B := (1,*,2) 3 2 (2,*,1) 3 1 (1,2,3) (2,1,3) (1,1,1); +set B := (1,*,*) : 1 2 3 := + 1 + - - + 2 - + + + 3 - + - + (2,*,*) : 1 2 3 := + 1 + - + + 2 - - - + 3 + - - ; +\end{verbatim} + +\noindent(Nestes exemplos {\tt mes} é um conjunto simples de singletos, +{\tt A} é uma matriz 2-dimensional de duplas e {\tt B} é um conjunto +simples de triplas. Os blocos de dados para o mesmo conjunto são equivalentes +no sentido que especificam os mesmos dados em formatos distintos.) + +O {\it bloco de dados do conjunto} é usado para especificar um conjunto elementar +completo que é atribuído a um conjunto (se é um conjunto simples) ou a um de +seus membros (se o conjunto é uma matriz de conjuntos).\footnote{Há uma outra forma +de especificar dados para um conjunto simples com dados para os parâmetros. +Esta questão é discutida na próxima seção.} + +Blocos de dados podem ser especificados somente para conjuntos não-calculáveis, +i.e., para \linebreak conjuntos que possuem o atributo de atribuição ({\tt:=}) +na sentença set correspondente. + +Se o conjunto é um conjunto simples, somente seus nomes simbólicos devem ser +especificados no cabeçalho do bloco de dados. Caso contrário, se o conjunto +é uma matriz $n$-dimensional, seus nomes simbólicos devem ser fornecidos com +uma lista completa de subíndices separados por vírgulas e cercados em colchetes +para especificar um membro particular da matriz de conjuntos. O número de +subíndices deve ser igual ao da dimensão da matriz de conjuntos, onde +cada subíndice deve ser um número ou um símbolo. + +Um conjunto elementar definido no bloco de dados é programado como uma sequência +de \linebreak registros descritos abaixo.\footnote{{\it Registro} é simplesmente +um termo técnico. Não significa que os mesmos possuem qualquer formato +especial.} + + +% \noindent +% \framebox[468pt][l]{ +% \parbox[c][44pt]{468pt}{ +% \hspace{6pt} {\tt set} {\it name} {\tt,} {\it record} {\tt,} \dots +% {\tt,} {\it record} {\tt;} +% +% \medskip +% +% \hspace{6pt} {\tt set} {\it name} {\tt[} {\it symbol} {\tt,} \dots +% {\tt,} {\it symbol} {\tt]} {\tt,} {\it record} {\tt,} \dots {\tt,} +% {\it record} {\tt;} +% }} +% +% \medskip +% +% \noindent +% {\it name} is a symbolic name of the set; +% +% \noindent +% {\it symbol}, \dots, {\it symbol} are subscripts, which specify +% a particular member of the set (if the set is an array, i.e. a set of +% sets); +% +% \noindent +% {\it record}, \dots, {\it record} are data records. +% +% \noindent +% Commae preceding data records may be omitted. +% +% \para{Data records} +% +% \vspace*{-8pt} +% +% \begin{description} +% \item[{\tt :=}]\hspace*{0pt}\\ +% is a non-significant data record, which may be used freely to improve +% readability; +% \item[{\tt(} {\it slice} {\tt)}]\hspace*{0pt}\\ +% specifies a slice; +% \item[{\it simple-data}]\hspace*{0pt}\\ +% specifies set data in the simple format; +% \item[{\tt:} {\it matrix-data}]\hspace*{0pt}\\ +% specifies set data in the matrix format; +% \item[{\tt(tr)} {\tt:} {\it matrix-data}]\hspace*{0pt}\\ +% specifies set data in the transposed matrix format. (In this case the +% colon following the keyword {\tt(tr)} may be omitted.) +% \end{description} +% +% \vspace*{-8pt} +% +% \para{Examples} +% +% \begin{verbatim} +% set month := Jan Feb Mar Apr May Jun; +% set month "Jan", "Feb", "Mar", "Apr", "May", "Jun"; +% set A[3,Mar] := (1,2) (2,3) (4,2) (3,1) (2,2) (4,4) (3,4); +% set A[3,'Mar'] := 1 2 2 3 4 2 3 1 2 2 4 4 3 4; +% set A[3,'Mar'] : 1 2 3 4 := +% 1 - + - - +% 2 - + + - +% 3 + - - + +% 4 - + - + ; +% set B := (1,2,3) (1,3,2) (2,3,1) (2,1,3) (1,2,2) (1,1,1) (2,1,1); +% set B := (*,*,*) 1 2 3, 1 3 2, 2 3 1, 2 1 3, 1 2 2, 1 1 1, 2 1 1; +% set B := (1,*,2) 3 2 (2,*,1) 3 1 (1,2,3) (2,1,3) (1,1,1); +% set B := (1,*,*) : 1 2 3 := +% 1 + - - +% 2 - + + +% 3 - + - +% (2,*,*) : 1 2 3 := +% 1 + - + +% 2 - - - +% 3 + - - ; +% \end{verbatim} +% +% \noindent(In these examples {\tt month} is a simple set of singlets, +% {\tt A} is a 2-dimensional array of doublets, and {\tt B} is a simple +% set of triplets. Data blocks for the same set are equivalent in the +% sense that they specify the same data in different formats.) +% +% The {\it set data block} is used to specify a complete elemental set, +% which is assigned to a set (if it is a simple set) or one of its +% members (if the set is an array of sets).\footnote{There is another way +% to specify data for a simple set along with data for parameters. This +% feature is discussed in the next section.} +% +% Data blocks can be specified only for non-computable sets, i.e. for +% sets, which have no assign attribute ({\tt:=}) in the corresponding set +% statements. +% +% If the set is a simple set, only its symbolic name should be specified +% in the header of the data block. Otherwise, if the set is a +% $n$-dimensional array, its symbolic name should be provided with a +% complete list of subscripts separated by commae and enclosed in square +% brackets to specify a particular member of the set array. The number of +% subscripts should be the same as the dimension of the set array, where +% each subscript should be a number or symbol. +% +% An elemental set defined in the set data block is coded as a sequence +% of data records described below.\footnote{{\it Data record} is simply a +% technical term. It does not mean that data records have any special +% formatting.} + + +\subsection{Registro de atribuição de dados} + +O {\it registro de atribuição de dados} ({\tt:=}) é um elemento não-significante. +Ele pode ser usado para melhorar a legibilidade de blocos de dados. + +% The {\it assign data record} ({\tt:=}) is a non-signficant element. +% It may be used for improving readability of data blocks. + +\subsection{Registro em fatia de dados} + +O {\it registro em fatia de dados} é um registro de controle que especifica +uma {\it fatia} do conjunto elementar definido no bloco de dados. Ele possui +a seguinte forma sintática: +$$\mbox{{\tt(} $s_1$ {\tt,} $s_2$ {\tt,} \dots {\tt,} $s_n$ {\tt)}}$$ +onde $s_1$, $s_2$, \dots, $s_n$ são componentes da fatia. + +Cada componente da fatia pode ser um número, símbolo ou asterisco +({\tt*}). O número de \linebreak componentes na fatia deve ser o mesmo da +dimensão $n$-tuplas do conjunto elementar a ser definido. Por exemplo, +se o conjunto elementar contém 4-tuplas (quádruplas), a fatia deve ter +quatro \linebreak componentes. O número de asteriscos na fatia denomina a +{\it dimensão da fatia}. + +O efeito de usar fatias é o seguinte: se uma fatia $m$-dimensional +(i.e., uma fatia contendo $m$ asteriscos) é especificada no bloco de dados, +todos registros subsequentes devem especificar tuplas de dimensão~$m$. +Sempre que uma $m$-tupla é encontrada, cada asterisco da fatia é substituído +pelos componentes correspondentes da $m$-tupla, o que resulta na +$n$-tupla, que é incluída no conjunto \linebreak elementar a ser definido. +Por exemplo, se a fatia $(a,*,1,2,*)$ está vigente e a dupla +$(3,b)$ é encontrada no registro subsequente, a 5-tupla resultante a ser incluída +no conjunto elementar é $(a,3,1,2,b)$. + +Se a fatia não possui asteriscos, ela própria define uma $n$-tupla completa +que é incluída no conjunto elementar. + +Uma vez especificada uma fatia, a mesma está vigente até que apareça uma nova +fatia ou até que se encontre o fim do bloco de dados. Note que se uma fatia +não é especificada no bloco de dados, assume-se uma cujos componentes são +asteriscos em todas as posições. + + +% The {\it slice data record} is a control record, which specifies a +% {\it slice} of the elemental set defined in the data block. It has the +% following syntactic form: +% $$\mbox{{\tt(} $s_1$ {\tt,} $s_2$ {\tt,} \dots {\tt,} $s_n$ {\tt)}}$$ +% where $s_1$, $s_2$, \dots, $s_n$ are components of the slice. +% +% Each component of the slice can be a number or symbol or the asterisk +% ({\tt*}). The number of components in the slice should be the same as +% the dimension of $n$-tuples in the elemental set to be defined. For +% instance, if the elemental set contains 4-tuples (quadruplets), the +% slice should have four components. The number of asterisks in the slice +% is called the {\it slice dimension}. +% +% The effect of using slices is the following. If a $m$-dimensional slice +% (i.e. a slice having $m$ asterisks) is specified in the data block, all +% subsequent data records should specify tuples of the dimension~$m$. +% Whenever a $m$-tuple is encountered, each asterisk in the slice is +% replaced by corresponding components of the $m$-tuple that gives the +% resultant $n$-tuple, which is included in the elemental set to be +% defined. For example, if the slice $(a,*,1,2,*)$ is in effect, and +% 2-tuple $(3,b)$ is encountered in a subsequent data record, the +% resultant 5-tuple included in the elemental set is $(a,3,1,2,b)$. +% +% The slice having no asterisks itself defines a complete $n$-tuple, +% which is included in the elemental set. +% +% Being once specified the slice effects until either a new slice or the +% end of data block is encountered. Note that if no slice is specified in +% the data block, one, components of which are all asterisks, is assumed. + +\subsection{Registro simples} + +O {\it registro simples} define uma $n$-tupla em um formato simples +e possui a seguinte forma sintática: +$$\mbox{$t_1$ {\tt,} $t_2$ {\tt,} \dots {\tt,} $t_n$}$$ +onde $t_1$, $t_2$, \dots, $t_n$ são componentes da $n$-tupla. Cada +componente pode ser um número ou um símbolo. As vírgulas entre os componentes +são opcionais e podem ser omitidas. + +% The {\it simple data record} defines one $n$-tuple in a simple format +% and has the following syntactic form: +% $$\mbox{$t_1$ {\tt,} $t_2$ {\tt,} \dots {\tt,} $t_n$}$$ +% where $t_1$, $t_2$, \dots, $t_n$ are components of the $n$-tuple. Each +% component can be a number or symbol. Commae between components are +% optional and may be omitted. + +\subsection{Registro de matriz} + +O {\it registro de matriz} define diversas 2-tuplas (duplas) em +um formato matricial e possui a seguinte forma sintática: +$$\begin{array}{cccccc} +\mbox{{\tt:}}&c_1&c_2&\dots&c_n&\mbox{{\tt:=}}\\ +r_1&a_{11}&a_{12}&\dots&a_{1n}&\\ +r_2&a_{21}&a_{22}&\dots&a_{2n}&\\ +\multicolumn{5}{c}{.\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .}&\\ +r_m&a_{m1}&a_{m2}&\dots&a_{mn}&\\ +\end{array}$$ +onde $r_1$, $r_2$, \dots, $r_m$ são números e/ou símbolos +que correspondem a linhas da matriz; $c_1$, $c_2$, \dots, $c_n$ são +números e/ou símbolos que correspondem a colunas da matriz, $a_{11}$, +$a_{12}$, \dots, $a_{mn}$ são elementos da matriz, que podem ser tanto +{\tt+} como {\tt-}. (Neste registro, o delimitador {\tt:} que precede a +lista de colunas e o delimitador {\tt:=} que segue após a lista de colunas, +não podem ser omitidos.) + +Cada elemento $a_{ij}$ do bloco de dados matricial (onde $1\leq i\leq m$, +$1\leq j\leq n$) correspondem a 2-tuplas $(r_i,c_j)$. Se $a_{ij}$ é o +sinal mais ({\tt+}), a 2-tupla correspondente (ou uma $n$-tupla maior, se uma +fatia é usada) é incluída no conjunto elementar. Caso contrário, se $a_{ij}$ é o +sinal menos ({\tt-}), aquela 2-tupla não é incluída no conjunto elementar. + +Uma vez que o registro de matriz define 2-tuplas, tanto o conjunto elementar +quanto a fatia vigente devem ser 2-dimensional. + +\newpage + +\subsection{Registro de matriz transposta} + +O {\it registro de matriz transposta} possui a seguinte forma sintática: +$$\begin{array}{cccccc} +\mbox{{\tt(tr) :}}&c_1&c_2&\dots&c_n&\mbox{{\tt:=}}\\ +r_1&a_{11}&a_{12}&\dots&a_{1n}&\\ +r_2&a_{21}&a_{22}&\dots&a_{2n}&\\ +\multicolumn{5}{c}{.\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .}&\\ +r_m&a_{m1}&a_{m2}&\dots&a_{mn}&\\ +\end{array}$$ +(Neste caso, o delimitador {\tt:} que segue a palavra-chave {\tt(tr)} é +opcional e pode ser omitido.) + +Este registro é completamente análogo ao registro de matriz (ver +anteriormente) com a única exceção de que neste caso, cada elemento $a_{ij}$ da +matriz passa a corresponder a 2-tupla $(c_j,r_i)$ ao invés de $(r_i,c_j)$. + +Uma vez especificado, o indicador {\tt(tr)} tem alcance em todos registros +subsequentes até que se encontre outra fatia ou o fim do bloco de dados. + + +% The {\it transposed matrix data record} has the following syntactic +% form: +% $$\begin{array}{cccccc} +% \mbox{{\tt(tr) :}}&c_1&c_2&\dots&c_n&\mbox{{\tt:=}}\\ +% r_1&a_{11}&a_{12}&\dots&a_{1n}&\\ +% r_2&a_{21}&a_{22}&\dots&a_{2n}&\\ +% \multicolumn{5}{c}{.\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .}&\\ +% r_m&a_{m1}&a_{m2}&\dots&a_{mn}&\\ +% \end{array}$$ +% (In this case the delimiter {\tt:} following the keyword {\tt(tr)} is +% optional and may be omitted.) +% +% This data record is completely analogous to the matrix data record (see +% above) with only exception that in this case each element $a_{ij}$ of +% the matrix corresponds to 2-tuple $(c_j,r_i)$ rather than $(r_i,c_j)$. +% +% Being once specified the {\tt(tr)} indicator affects all subsequent +% data records until either a slice or the end of data block is +% encountered. + +\section{Bloco de dados de parâmetro} + +\noindent +\framebox[468pt][l]{ +\parbox[c][88pt]{468pt}{ +\hspace{6pt} {\tt param} {\it nome} {\tt,} {\it registro} {\tt,} \dots +{\tt,} {\it registro} {\tt;} + +\medskip + +\hspace{6pt} {\tt param} {\it nome} {\tt default} {\it valor} {\tt,} +{\it registro} {\tt,} \dots {\tt,} {\it registro} {\tt;} + +\medskip + +\hspace{6pt} {\tt param} {\tt:} {\it dados-tabulação} {\tt;} + +\medskip + +\hspace{6pt} {\tt param} {\tt default} {\it valor} {\tt:} +{\it dados-tabulação} {\tt;} +}} + +\medskip + +\noindent +{\it nome} é um nome simbólico do parâmetro; + +\noindent +{\it valor} é um valor opcional padrão do parâmetro; + +\noindent +{\it registro}, \dots, {\it registro} são registros; + +\noindent +{\it dados-tabulação} especifica os dados do parâmetro em formato tabulação. + +\noindent +As vírgulas que precedem os registros podem ser omitidas. + +\para{Registros} + +\vspace*{-8pt} + +\begin{description} +\item[{\tt :=}]\hspace*{0pt}\\ +é um elemento de atribuição de registro não-significativo que pode ser usado +livremente para melhorar a legibilidade; +\item[{\tt[} {\it fatia} {\tt]}]\hspace*{0pt}\\ +especifica uma fatia; +\item[{\it dados-planos}]\hspace*{0pt}\\ +especifica os dados do parâmetro em formato simples; +\item[{\tt:} {\it dados-tabulares}]\hspace*{0pt}\\ +especifica dados do parâmetro em formato tabular; +\item[{\tt(tr)} {\tt:} {\it dados-tabulares}]\hspace*{0pt}\\ +especifica dados do parâmetro no formato tabular transposto. +(Neste caso, os dois pontos que seguem a palavra-chave {\tt(tr)} podem ser omitidos). +\end{description} + +\vspace*{-8pt} + +\para{Exemplos} + +\begin{verbatim} +param T := 4; +param mes := 1 Jan 2 Fev 3 Mar 4 Abr 5 Mai; +param mes := [1] 'Jan', [2] 'Fev', [3] 'Mar', [4] 'Abr', [5] 'Mai'; +param estoque_inicial := ferro 7.32 niquel 35.8; +param estoque_inicial [*] ferro 7.32, niquel 35.8; +param custo [ferro] .025 [niquel] .03; +param valor := ferro -.1, niquel .02; +param : estoque_inicial custo valor := + ferro 7.32 .025 -.1 + niquel 35.8 .03 .02 ; +param : insumo : estoque_inicial custo valor := + ferro 7.32 .025 -.1 + niquel 35.8 .03 .02 ; +param demanda default 0 (tr) + : FRA DET LAN WIN STL FRE LAF := + chapa 300 . 100 75 . 225 250 + bobina 500 750 400 250 . 850 500 + placa 100 . . 50 200 . 250 ; +param custo_transporte := + [*,*,chapa]: FRA DET LAN WIN STL FRE LAF := + GARY 30 10 8 10 11 71 6 + CLEV 22 7 10 7 21 82 13 + PITT 19 11 12 10 25 83 15 + [*,*,bobina]: FRA DET LAN WIN STL FRE LAF := + GARY 39 14 11 14 16 82 8 + CLEV 27 9 12 9 26 95 17 + PITT 24 14 17 13 28 99 20 + [*,*,placa]: FRA DET LAN WIN STL FRE LAF := + GARY 41 15 12 16 17 86 8 + CLEV 29 9 13 9 28 99 18 + PITT 26 14 17 13 31 104 20 ; +\end{verbatim} + +O {\it bloco de dados do parâmetro} é usado para especificar dados +completos para um parâmetro (ou parâmetros, se os dados são especificados +no formato tabulação). + +Os blocos de dados podem ser especificados apenas para parâmetros não-calculáveis, i.e., +para parâmetros que não possuem o atributo de atribuição ({\tt:=}) nas +sentenças parameter correspondentes. + +Os dados definidos no bloco de dados do parâmetro são programados como uma sequência +de registros descritos em seguida. Adicionalmente, o bloco de dados pode vir com +o atributo opcional {\tt default}, que especifica um valor numérico ou simbólico +padrão do parâmetro (ou parâmetros). Este valor padrão é atribuído ao parâmetro ou +a seus membros quando não se definem valores apropriados no bloco de dados do +parâmetro. O atributo {\tt default} não pode ser usado se ele já tiver sido +especificado na sentença parameter correspondente. + + +% \noindent +% \framebox[468pt][l]{ +% \parbox[c][88pt]{468pt}{ +% \hspace{6pt} {\tt param} {\it name} {\tt,} {\it record} {\tt,} \dots +% {\tt,} {\it record} {\tt;} +% +% \medskip +% +% \hspace{6pt} {\tt param} {\it name} {\tt default} {\it value} {\tt,} +% {\it record} {\tt,} \dots {\tt,} {\it record} {\tt;} +% +% \medskip +% +% \hspace{6pt} {\tt param} {\tt:} {\it tabbing-data} {\tt;} +% +% \medskip +% +% \hspace{6pt} {\tt param} {\tt default} {\it value} {\tt:} +% {\it tabbing-data} {\tt;} +% }} +% +% \medskip +% +% \noindent +% {\it name} is a symbolic name of the parameter; +% +% \noindent +% {\it value} is an optional default value of the parameter; +% +% \noindent +% {\it record}, \dots, {\it record} are data records; +% +% \noindent +% {\it tabbing-data} specifies parameter data in the tabbing format. +% +% \noindent +% Commae preceding data records may be omitted. +% +% \para{Data records} +% +% \vspace*{-8pt} +% +% \begin{description} +% \item[{\tt :=}]\hspace*{0pt}\\ +% is a non-significant data record, which may be used freely to improve +% readability; +% \item[{\tt[} {\it slice} {\tt]}]\hspace*{0pt}\\ +% specifies a slice; +% \item[{\it plain-data}]\hspace*{0pt}\\ +% specifies parameter data in the plain format; +% \item[{\tt:} {\it tabular-data}]\hspace*{0pt}\\ +% specifies parameter data in the tabular format; +% \item[{\tt(tr)} {\tt:} {\it tabular-data}]\hspace*{0pt}\\ +% specifies set data in the transposed tabular format. (In this case the +% colon following the keyword {\tt(tr)} may be omitted.) +% \end{description} +% +% \vspace*{-8pt} +% +% \para{Examples} +% +% \begin{verbatim} +% param T := 4; +% param month := 1 Jan 2 Feb 3 Mar 4 Apr 5 May; +% param month := [1] 'Jan', [2] 'Feb', [3] 'Mar', [4] 'Apr', [5] 'May'; +% param init_stock := iron 7.32 nickel 35.8; +% param init_stock [*] iron 7.32, nickel 35.8; +% param cost [iron] .025 [nickel] .03; +% param value := iron -.1, nickel .02; +% param : init_stock cost value := +% iron 7.32 .025 -.1 +% nickel 35.8 .03 .02 ; +% param : raw : init stock cost value := +% iron 7.32 .025 -.1 +% nickel 35.8 .03 .02 ; +% param demand default 0 (tr) +% : FRA DET LAN WIN STL FRE LAF := +% bands 300 . 100 75 . 225 250 +% coils 500 750 400 250 . 850 500 +% plate 100 . . 50 200 . 250 ; +% param trans_cost := +% [*,*,bands]: FRA DET LAN WIN STL FRE LAF := +% GARY 30 10 8 10 11 71 6 +% CLEV 22 7 10 7 21 82 13 +% PITT 19 11 12 10 25 83 15 +% [*,*,coils]: FRA DET LAN WIN STL FRE LAF := +% GARY 39 14 11 14 16 82 8 +% CLEV 27 9 12 9 26 95 17 +% PITT 24 14 17 13 28 99 20 +% [*,*,plate]: FRA DET LAN WIN STL FRE LAF := +% GARY 41 15 12 16 17 86 8 +% CLEV 29 9 13 9 28 99 18 +% PITT 26 14 17 13 31 104 20 ; +% \end{verbatim} +% +% The {\it parameter data block} is used to specify complete data for a +% parameter (or parameters, if data are specified in the tabbing format). +% +% Data blocks can be specified only for non-computable parameters, i.e. +% for parameters, which have no assign attribute ({\tt:=}) in the +% corresponding parameter statements. +% +% Data defined in the parameter data block are coded as a sequence of +% data records described below. Additionally the data block can be +% provided with the optional {\tt default} attribute, which specifies a +% default numeric or symbolic value of the parameter (parameters). This +% default value is assigned to the parameter or its members when +% no appropriate value is defined in the parameter data block. The +% {\tt default} attribute cannot be used, if it is already specified in +% the corresponding parameter statement. + +\subsection{Registro de atribuição} + +O {\it registro de atribuição} ({\tt:=}) é um elemento não-significativo. +Ele pode ser usado para melhorar a legibilidade dos blocos de dados; + +% The {\it assign data record} ({\tt:=}) is a non-signficant element. +% It may be used for improving readability of data blocks. + +\subsection{Registro em fatia} + +O {\it registro em fatia} é um registro de controle que especifica uma +{\it fatia} da matriz do parâmetro. Ele tem a seguinte forma sintática: +$$\mbox{{\tt[} $s_1$ {\tt,} $s_2$ {\tt,} \dots {\tt,} $s_n$ {\tt]}}$$ +onde $s_1$, $s_2$, \dots, $s_n$ são componentes da fatia. + +Cada componente da fatia pode ser um número, símbolo ou asterisco +({\tt*}). O número de componentes na fatia deve ser o mesmo da +dimensão $n$-tuplas do parâmetro. Por exemplo, +se o parâmetro é uma matriz 4-dimensional, a fatia deve ter +quatro componentes. O número de \linebreak asteriscos na fatia denomina a +{\it dimensão da fatia}. + +O efeito de usar fatias é o seguinte: se uma fatia $m$-dimensional +(i.e., uma fatia contendo $m$ asteriscos) é especificada no bloco de dados, +todos registros subsequentes devem especificar os subíndices do membros do +parâmetro, como se o parâmetro fosse $m$-dimensional, não $n$-dimensional. + +Sempre que $m$ subíndices são encontrados, cada asterisco da fatia é substituído +pelos \linebreak componentes correspondentes que dão $n$ subíndices, que definem o +membro corrente do parâmetro. +Por exemplo, se a fatia $(a,*,1,2,*)$ está vigente e os subíndices 3 e +$b$ são encontradas no \linebreak registro subsequente, a lista completa de subíndices +usada para escolher o membro do parâmetro é $(a,3,1,2,b)$. + + +É permitido especificar uma fatia que não tenha asteriscos. Tal fatia, em si +própria, define uma lista completa de subíndice, em cujo caso o próximo +registro deve definir apenas um único valor do membro correspondentes do parâmetro. + +Uma vez especificada uma fatia, a mesma está vigente até que apareça uma nova +fatia ou até que se encontre o fim do bloco de dados. Note que se uma fatia +não é especificada no bloco de dados, assume-se uma cujos componentes são +asteriscos em todas as posições. + + +\subsection{Registro plano} + +O {\it registro plano} define uma lista de subíndice e um valor individual +no formato plano. Este registro possui a seguinte forma sintática: +$$\mbox{$t_1$ {\tt,} $t_2$ {\tt,} \dots {\tt,} $t_n$ {\tt,} $v$}$$ +onde $t_1$, $t_2$, \dots, $t_n$ são subíndices e $v$ é um valor. +Cada subíndice, assim como o valor, pode ser um número ou um símbolo. As +vírgulas que seguem os subíndices são opcionais e podem ser omitidas. + +No caso de um parâmetro ou fatia 0-dimensional, o registro plano não possui +subíndice e consiste de um valor individual apenas. + + +% The {\it plain data record} defines a subscript list and a single value +% in the plain format. This record has the following syntactic form: +% $$\mbox{$t_1$ {\tt,} $t_2$ {\tt,} \dots {\tt,} $t_n$ {\tt,} $v$}$$ +% where $t_1$, $t_2$, \dots, $t_n$ are subscripts, and $v$ is a value. +% Each subscript as well as the value can be a number or symbol. Commae +% following subscripts are optional and may be omitted. +% +% In case of 0-dimensional parameter or slice the plain data record has +% no subscripts and consists of a single value only. + +\subsection{Registro tabular} + +O {\it registro tabular} define diversos valores onde cada valor é provido +de dois subíndices. Este registro possui a seguinte forma sintática: +$$\begin{array}{cccccc} +\mbox{{\tt:}}&c_1&c_2&\dots&c_n&\mbox{{\tt:=}}\\ +r_1&a_{11}&a_{12}&\dots&a_{1n}&\\ +r_2&a_{21}&a_{22}&\dots&a_{2n}&\\ +\multicolumn{5}{c}{.\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .}&\\ +r_m&a_{m1}&a_{m2}&\dots&a_{mn}&\\ +\end{array}$$ +onde $r_1$, $r_2$, \dots, $r_m$ são números e/ou símbolos +que correspondem a linhas da tabela; enquanto que $c_1$, $c_2$, \dots, $c_n$ são +são números e/ou símbolos que correspondem a colunas da tabela, $a_{11}$, +$a_{12}$, \dots, $a_{mn}$ são elementos da tabela. Cada elemento pode ser +um número, símbolo ou o ponto decimal ({\tt.}) individual. (neste registro, +o delimitador {\tt:} que precede a lista de colunas e o delimitador +{\tt:=} que segue após a lista de colunas, não podem ser omitidos). + +Cada elemento $a_{ij}$ do bloco de dados tabulares ($1\leq i\leq m$, +$1\leq j\leq n$) define dois subíndices, onde o primeiro subíndice é +$r_i$ e o segundo é $c_j$. Estes subíndices são usados juntamente com +a fatia vigente para formar a lista completa de subíndices que identifica +um membro particular da matriz de parâmetros. Se $a_{ij}$ +é um número ou um símbolo, este valor é atribuído ao membro do parâmetro. +No entanto, se $a_{ij}$ é um ponto decimal individual, o membro é atribuído +ao valor padrão especificado ou no bloco de dados do parâmetro +ou na sentença parameter, ou ainda, se nenhum valor padrão é especificado, +o membro permanece indefinido. + +Uma vez que o registro tabular fornece dois subíndices para cada valor, +tanto o parâmetro quanto a fatia vigente em uso devem ser 2-dimensional. + + +% The {\it tabular data record} defines several values, where each value +% is provided with two subscripts. This record has the following +% syntactic form: +% $$\begin{array}{cccccc} +% \mbox{{\tt:}}&c_1&c_2&\dots&c_n&\mbox{{\tt:=}}\\ +% r_1&a_{11}&a_{12}&\dots&a_{1n}&\\ +% r_2&a_{21}&a_{22}&\dots&a_{2n}&\\ +% \multicolumn{5}{c}{.\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .}&\\ +% r_m&a_{m1}&a_{m2}&\dots&a_{mn}&\\ +% \end{array}$$ +% where $r_1$, $r_2$, \dots, $r_m$ are numbers and/or symbols +% corresponding to rows of the table; $c_1$, $c_2$, \dots, $c_n$ are +% numbers and/or symbols corresponding to columns of the table, $a_{11}$, +% $a_{12}$, \dots, $a_{mn}$ are table elements. Each element can be a +% number or symbol or the single decimal point ({\tt.}). (In this data +% record the delimiter {\tt:} preceding the column list and the delimiter +% {\tt:=} following the column list cannot be omitted.) +% +% Each element $a_{ij}$ of the tabular data block ($1\leq i\leq m$, +% $1\leq j\leq n$) defines two subscripts, where the first subscript is +% $r_i$, and the second one is $c_j$. These subscripts are used in +% conjunction with the current slice to form the complete subscript list +% that identifies a particular member of the parameter array. If $a_{ij}$ +% is a number or symbol, this value is assigned to the parameter member. +% However, if $a_{ij}$ is the single decimal point, the member is +% assigned a default value specified either in the parameter data block +% or in the parameter statement, or, if no default value is specified, +% the member remains undefined. +% +% Since the tabular data record provides two subscripts for each value, +% either the parameter or the slice currently used should be +% 2-dimensional. + +\subsection{Registro tabular transposto} + +O {\it registro tabular transposto} possui a seguinte forma sintática: +$$\begin{array}{cccccc} +\mbox{{\tt(tr) :}}&c_1&c_2&\dots&c_n&\mbox{{\tt:=}}\\ +r_1&a_{11}&a_{12}&\dots&a_{1n}&\\ +r_2&a_{21}&a_{22}&\dots&a_{2n}&\\ +\multicolumn{5}{c}{.\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .}&\\ +r_m&a_{m1}&a_{m2}&\dots&a_{mn}&\\ +\end{array}$$ +(Neste caso, o delimitador {\tt:} que segue a palavra-chave {\tt(tr)} é +opcional e pode ser omitida.) + +Este registro é completamente análogo ao registro tabular +(ver anteriormente) com a única exceção que o primeiro subíndice definido +pelo elemento $a_{ij}$ é $c_j$ enquanto que o segundo é $r_i$. + +Uma vez especificado, o indicador {\tt(tr)} afeta todos registros subsequentes +até que se encontre outra fatia ou o fim do bloco de dados. + + +% The {\it transposed tabular data record} has the following syntactic +% form: +% $$\begin{array}{cccccc} +% \mbox{{\tt(tr) :}}&c_1&c_2&\dots&c_n&\mbox{{\tt:=}}\\ +% r_1&a_{11}&a_{12}&\dots&a_{1n}&\\ +% r_2&a_{21}&a_{22}&\dots&a_{2n}&\\ +% \multicolumn{5}{c}{.\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .\ \ .}&\\ +% r_m&a_{m1}&a_{m2}&\dots&a_{mn}&\\ +% \end{array}$$ +% (In this case the delimiter {\tt:} following the keyword {\tt(tr)} is +% optional and may be omitted.) +% +% This data record is completely analogous to the tabular data record +% (see above) with only exception that the first subscript defined by +% element $a_{ij}$ is $c_j$ while the second one is $r_i$. +% +% Being once specified the {\tt(tr)} indicator affects all subsequent +% data records until either a slice or the end of data block is +% encountered. + +% \newpage + +\subsection{Formato de dados em tabulação} + +O bloco de dados do parâmetro no {\it formato tabulação} possui a seguinte +forma sintática: +$$ +\begin{array}{*{8}{l}} +\multicolumn{4}{l} +{{\tt param}\ {\tt default}\ valor\ {\tt :}\ s\ {\tt :}}& +p_1\ \ \verb|,|&p_2\ \ \verb|,|&\dots\ \verb|,|&p_r\ \ \verb|:=|\\ +r_{11}\ \verb|,|& r_{12}\ \verb|,|& \dots\ \verb|,|& r_{1n}\ \verb|,|& +a_{11}\ \verb|,|& a_{12}\ \verb|,|& \dots\ \verb|,|& a_{1r}\ \verb|,|\\ +r_{21}\ \verb|,|& r_{22}\ \verb|,|& \dots\ \verb|,|& r_{2n}\ \verb|,|& +a_{21}\ \verb|,|& a_{22}\ \verb|,|& \dots\ \verb|,|& a_{2r}\ \verb|,|\\ +\dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots \\ +r_{m1}\ \verb|,|& r_{m2}\ \verb|,|& \dots\ \verb|,|& r_{mn}\ \verb|,|& +a_{m1}\ \verb|,|& a_{m2}\ \verb|,|& \dots\ \verb|,|& a_{mr}\ \verb|;|\\ +\end{array} +$$ + +1. A palavra-chave {\tt default} pode ser omitida juntamente +com o valor que a segue. + +2. O nome simbólico $s$ pode ser omitido juntamente com +os dois pontos que o segue. + +3. Todas as vírgulas são opcionais e podem ser omitidas. + +O bloco de dados no formato tabulação mostrado acima é exatamente +equivalente aos seguintes blocos de dados: + +\verb|set| $s$\ \verb|:=|\ $ +\verb|(|r_{11}\verb|,|r_{12}\verb|,|\dots\verb|,|r_{1n}\verb|) | +\verb|(|r_{21}\verb|,|r_{22}\verb|,|\dots\verb|,|r_{2n}\verb|) | +\dots +\verb| (|r_{m1}\verb|,|r_{m2}\verb|,|\dots\verb|,|r_{mn}\verb|);|$ + +\verb|param| $p_1$\ \verb|default|\ $valor$\ \verb|:=| + +$\verb| | +\verb|[|r_{11}\verb|,|r_{12}\verb|,|\dots\verb|,|r_{1n}\verb|] |a_{11} +\verb| [|r_{21}\verb|,|r_{22}\verb|,|\dots\verb|,|r_{2n}\verb|] |a_{21} +\verb| |\dots +\verb| [|r_{m1}\verb|,|r_{m2}\verb|,|\dots\verb|,|r_{mn}\verb|] |a_{m1} +\verb|;| +$ + +\verb|param| $p_2$\ \verb|default|\ $valor$\ \verb|:=| + +$\verb| | +\verb|[|r_{11}\verb|,|r_{12}\verb|,|\dots\verb|,|r_{1n}\verb|] |a_{12} +\verb| [|r_{21}\verb|,|r_{22}\verb|,|\dots\verb|,|r_{2n}\verb|] |a_{22} +\verb| |\dots +\verb| [|r_{m1}\verb|,|r_{m2}\verb|,|\dots\verb|,|r_{mn}\verb|] |a_{m2} +\verb|;| +$ + +\verb| |.\ \ \ .\ \ \ .\ \ \ .\ \ \ .\ \ \ .\ \ \ .\ \ \ .\ \ \ . + +\verb|param| $p_r$\ \verb|default|\ $valor$\ \verb|:=| + +$\verb| | +\verb|[|r_{11}\verb|,|r_{12}\verb|,|\dots\verb|,|r_{1n}\verb|] |a_{1r} +\verb| [|r_{21}\verb|,|r_{22}\verb|,|\dots\verb|,|r_{2n}\verb|] |a_{2r} +\verb| |\dots +\verb| [|r_{m1}\verb|,|r_{m2}\verb|,|\dots\verb|,|r_{mn}\verb|] |a_{mr} +\verb|;| +$ + + +% The parameter data block in the {\it tabbing format} has the following +% syntactic form: +% $$ +% \begin{array}{*{8}{l}} +% \multicolumn{4}{l} +% {{\tt param}\ {\tt default}\ value\ {\tt :}\ s\ {\tt :}}& +% p_1\ \ \verb|,|&p_2\ \ \verb|,|&\dots\ \verb|,|&p_r\ \ \verb|:=|\\ +% r_{11}\ \verb|,|& r_{12}\ \verb|,|& \dots\ \verb|,|& r_{1n}\ \verb|,|& +% a_{11}\ \verb|,|& a_{12}\ \verb|,|& \dots\ \verb|,|& a_{1r}\ \verb|,|\\ +% r_{21}\ \verb|,|& r_{22}\ \verb|,|& \dots\ \verb|,|& r_{2n}\ \verb|,|& +% a_{21}\ \verb|,|& a_{22}\ \verb|,|& \dots\ \verb|,|& a_{2r}\ \verb|,|\\ +% \dots & \dots & \dots & \dots & \dots & \dots & \dots & \dots \\ +% r_{m1}\ \verb|,|& r_{m2}\ \verb|,|& \dots\ \verb|,|& r_{mn}\ \verb|,|& +% a_{m1}\ \verb|,|& a_{m2}\ \verb|,|& \dots\ \verb|,|& a_{mr}\ \verb|;|\\ +% \end{array} +% $$ +% +% 1. The keyword {\tt default} may be omitted along with a value +% following it. +% +% 2. Symbolic name $s$ may be omitted along with the colon following it. +% +% 3. All commae are optional and may be omitted. +% +% The data block in the tabbing format shown above is exactly equivalent +% to the following data blocks: +% +% \verb|set| $s$\ \verb|:=|\ $ +% \verb|(|r_{11}\verb|,|r_{12}\verb|,|\dots\verb|,|r_{1n}\verb|) | +% \verb|(|r_{21}\verb|,|r_{22}\verb|,|\dots\verb|,|r_{2n}\verb|) | +% \dots +% \verb| (|r_{m1}\verb|,|r_{m2}\verb|,|\dots\verb|,|r_{mn}\verb|);|$ +% +% \verb|param| $p_1$\ \verb|default|\ $value$\ \verb|:=| +% +% $\verb| | +% \verb|[|r_{11}\verb|,|r_{12}\verb|,|\dots\verb|,|r_{1n}\verb|] |a_{11} +% \verb| [|r_{21}\verb|,|r_{22}\verb|,|\dots\verb|,|r_{2n}\verb|] |a_{21} +% \verb| |\dots +% \verb| [|r_{m1}\verb|,|r_{m2}\verb|,|\dots\verb|,|r_{mn}\verb|] |a_{m1} +% \verb|;| +% $ +% +% \verb|param| $p_2$\ \verb|default|\ $value$\ \verb|:=| +% +% $\verb| | +% \verb|[|r_{11}\verb|,|r_{12}\verb|,|\dots\verb|,|r_{1n}\verb|] |a_{12} +% \verb| [|r_{21}\verb|,|r_{22}\verb|,|\dots\verb|,|r_{2n}\verb|] |a_{22} +% \verb| |\dots +% \verb| [|r_{m1}\verb|,|r_{m2}\verb|,|\dots\verb|,|r_{mn}\verb|] |a_{m2} +% \verb|;| +% $ +% +% \verb| |.\ \ \ .\ \ \ .\ \ \ .\ \ \ .\ \ \ .\ \ \ .\ \ \ .\ \ \ . +% +% \verb|param| $p_r$\ \verb|default|\ $value$\ \verb|:=| +% +% $\verb| | +% \verb|[|r_{11}\verb|,|r_{12}\verb|,|\dots\verb|,|r_{1n}\verb|] |a_{1r} +% \verb| [|r_{21}\verb|,|r_{22}\verb|,|\dots\verb|,|r_{2n}\verb|] |a_{2r} +% \verb| |\dots +% \verb| [|r_{m1}\verb|,|r_{m2}\verb|,|\dots\verb|,|r_{mn}\verb|] |a_{mr} +% \verb|;| +% $ + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\appendix + +\chapter{Usando sufixos} + +\vspace*{-12pt} + +Sufixos podem ser usados para recuperar valores adicionais +associados com as variáveis, restrições e objetivos do modelo. + +Um {\it sufixo} consiste de um ponto ({\tt.}) seguido por uma palavra-chave +não-reservada. Por exemplo, se {\tt x} é uma variável bi-dimensional, +{\tt x[i,j].lb} é um valor numérico igual ao limite inferior da variável +elementar {\tt x[i,j]}, que (cujo valor) pode ser usado em expressões +como um parâmetro numérico. + +Para as variáveis do modelo, os sufixos possuem o seguinte significado: + +\begin{tabular}{@{}ll@{}} +{\tt.lb}&limite inferior (lower bound)\\ +{\tt.ub}&limite superior (upper bound)\\ +{\tt.status}&status na solução:\\ +&0 --- indefinida\\ +&1 --- básica\\ +&2 --- não-básica no limite inferior\\ +&3 --- não-básica no limite superior\\ +&4 --- variável não-básica livre (ilimitada)\\ +&5 --- variável não-básica fixa\\ +{\tt.val}&valor primal na solução\\ +{\tt.dual}&valor dual (custo reduzido) na solução\\ +\end{tabular} + +Para as restrições e objetivos do modelo, os sufixos têm os seguintes significados: + +\begin{tabular}{@{}ll@{}} +{\tt.lb}&limite inferior (lower bound) da forma linear\\ +{\tt.ub}&limite superior (upper bound) da forma linear\\ +{\tt.status}&status na solução:\\ +&0 --- indefinida\\ +&1 --- não-limitante\\ +&2 --- limitante no limite inferior\\ +&3 --- limitante no limite superior\\ +&4 --- linha limitante livre (ilimitada)\\ +&5 --- restrição de igualdade limitante\\ +{\tt.val}&valor primal da forma linear na solução\\ +{\tt.dual}&valor dual (custo reduzido) da forma linear na solução\\ +\end{tabular} + +Note que os sufixos {\tt.status}, {\tt.val} e {\tt.dual} podem ser usados +apenas abaixo da sentença solve. + + +% Suffixes can be used to retrieve additional values associated with +% model variables, constraints, and objectives. +% +% A {\it suffix} consists of a period ({\tt.}) followed by a non-reserved +% keyword. For example, if {\tt x} is a two-dimensional variable, +% {\tt x[i,j].lb} is a numeric value equal to the lower bound of +% elemental variable {\tt x[i,j]}, which (value) can be used everywhere +% in expressions like a numeric parameter. +% +% For model variables suffixes have the following meaning: +% +% \begin{tabular}{@{}ll@{}} +% {\tt.lb}&lower bound\\ +% {\tt.ub}&upper bound\\ +% {\tt.status}&status in the solution:\\ +% &0 --- undefined\\ +% &1 --- basic\\ +% &2 --- non-basic on lower bound\\ +% &3 --- non-basic on upper bound\\ +% &4 --- non-basic free (unbounded) variable\\ +% &5 --- non-basic fixed variable\\ +% {\tt.val}&primal value in the solution\\ +% {\tt.dual}&dual value (reduced cost) in the solution\\ +% \end{tabular} +% +% For model constraints and objectives suffixes have the following +% meaning: +% +% \begin{tabular}{@{}ll@{}} +% {\tt.lb}&lower bound of the linear form\\ +% {\tt.ub}&upper bound of the linear form\\ +% {\tt.status}&status in the solution:\\ +% &0 --- undefined\\ +% &1 --- non-active\\ +% &2 --- active on lower bound\\ +% &3 --- active on upper bound\\ +% &4 --- active free (unbounded) row\\ +% &5 --- active equality constraint\\ +% {\tt.val}&primal value of the linear form in the solution\\ +% {\tt.dual}&dual value (reduced cost) of the linear form in the +% solution\\ +% \end{tabular} +% +% Note that suffixes {\tt.status}, {\tt.val}, and {\tt.dual} can be used +% only below the solve statement. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Funções de data e hora} + +\noindent\hfil +\begin{tabular}{c} +por Andrew Makhorin \verb||\\ +e Heinrich Schuchardt \verb||\\ +\end{tabular} + +\section{Obtendo o tempo de calendário corrente} +\label{gmtime} + +Para obter o tempo de calendário corrente em MathProg existe a função +{\tt gmtime}. Ela não possui argumentos e retorna o número de segundos +transcorridos desde 00:00:00 de 1{\textsuperscript{\b{o}}} +de Janeiro de 1970, pelo +Tempo Universal Coordenado (UTC). Por exemplo: + +\begin{verbatim} + param utc := gmtime(); +\end{verbatim} + +MathProg não possui uma função para converter o tempo UTC retornado pela função +{\tt gmtime} para os tempos de calendário {\it local}. Assim, para +determinar o tempo de calendário local corrente, é preciso que adicione ao +tempo UTC retornado a diferença de horas, com respeito a UTC, expressa em +segundos. Por exemplo, a hora em Berlim durante o inverno é uma hora à frente +do UTC, que corresponde a uma diferença horária de +1~hora~= +3600~segundos, +assim, o tempo de calendário corrente no inverno em Berlim pode ser determinado +como segue: + +\begin{verbatim} + param now := gmtime() + 3600; +\end{verbatim} + +\noindent De forma análoga, o horário de verão em Chicago (Zona Horária Central-CDT) +é cinco horas atrás da UTC, de modo que o horário corrente do calendário local +pode ser determinado como segue: + +\begin{verbatim} + param now := gmtime() - 5 * 3600; +\end{verbatim} + +Note que o valor retornado por {\tt gmtime} é volátil, i.e., ao ser +chamada diversas vezes, esta função pode retornar diferentes valores. + +% \noindent\hfil +% \begin{tabular}{c} +% by Andrew Makhorin \verb||\\ +% and Heinrich Schuchardt \verb||\\ +% \end{tabular} +% +% \section{Obtaining current calendar time} +% \label{gmtime} +% +% To obtain the current calendar time in MathProg there exists the +% function {\tt gmtime}. It has no arguments and returns the number of +% seconds elapsed since 00:00:00 on January 1, 1970, Coordinated +% Universal Time (UTC). For example: +% +% \begin{verbatim} +% param utc := gmtime(); +% \end{verbatim} +% +% MathProg has no function to convert UTC time returned by the function +% {\tt gmtime} to {\it local} calendar times. Thus, if you need to +% determine the current local calendar time, you have to add to the UTC +% time returned the time offset from UTC expressed in seconds. For +% example, the time in Berlin during the winter is one hour ahead of UTC +% that corresponds to the time offset +1~hour~= +3600~secs, so the +% current winter calendar time in Berlin may be determined as follows: +% +% \begin{verbatim} +% param now := gmtime() + 3600; +% \end{verbatim} +% +% \noindent Similarly, the summer time in Chicago (Central Daylight Time) +% is five hours behind UTC, so the corresponding current local calendar +% time may be determined as follows: +% +% \begin{verbatim} +% param now := gmtime() - 5 * 3600; +% \end{verbatim} +% +% Note that the value returned by {\tt gmtime} is volatile, i.e. being +% called several times this function may return different values. + +\section{Convertendo cadeia de caracteres ao tempo de calendário} +\label{str2time} + +A função {\tt str2time(}{\it s}{\tt,} {\it f}{\tt)} converte uma +cadeia de caractere (impressão da data e hora) \linebreak especificada pelo seu +primeiro argumento {\it s}, que deve ser uma expressão simbólica, +para o tempo de calendário apropriado para cálculos aritméticos. +A conversão é controlada pela cadeia de formato especificado {\it f} +(o segundo argumento), que também deve ser uma expressão simbólica. + + +% The function {\tt str2time(}{\it s}{\tt,} {\it f}{\tt)} converts a +% character string (timestamp) specified by its first argument {\it s}, +% which should be a symbolic expression, to the calendar time suitable +% for arithmetic calculations. The conversion is controlled by the +% specified format string {\it f} (the second argument), which also +% should be a symbolic expression. + +% \newpage + + +A conversão resultante retornada por {\tt str2time} possui o mesmo significado +dos valores retornados pela função {\tt gmtime} (ver Subseção +\ref{gmtime}, página \pageref{gmtime}). Note que {\tt str2time} +{\tt não corrige} o tempo de calendário retornado para zona horária local, +i.e., ao se aplicar a 00:00:00 de 1{\textsuperscript{\b{o}}} +de Janeiro de 1970, ela sempre retorna 0. + +% The result of conversion returned by {\tt str2time} has the same +% meaning as values returned by the function {\tt gmtime} (see Subsection +% \ref{gmtime}, page \pageref{gmtime}). Note that {\tt str2time} does +% {\tt not} correct the calendar time returned for the local timezone, +% i.e. being applied to 00:00:00 on January 1, 1970 it always returns 0. + +Por exemplo, as sentenças de modelo: + +\begin{verbatim} + param s, symbolic, := "07/14/98 13:47"; + param t := str2time(s, "%m/%d/%y %H:%M"); + display t; +\end{verbatim} + +\noindent produz a seguinte saída: + +\begin{verbatim} + t = 900424020 +\end{verbatim} + +\noindent onde o tempo de calendário impresso corresponde a 13:47:00 em +14 de Julho de 1998. + +A cadeia de formato passada à função {\tt str2time} consiste de +especificadores de conversão e caracteres ordinários. Cada especificador de +conversão inicia com um caractere de porcentagem ({\tt\%}) seguido de +uma letra. + +Os seguintes especificadores de conversão podem ser usados na cadeia de formato: + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%b}&O nome do mês abreviado (insensível a maiúsculas). Pelo menos as três +primeiras letras do mês devem aparecer na cadeia de entrada.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%d}&O dia do mês como número decimal (de 1 até 31). +Se permite o zero como primeiro dígito, embora não seja necessário.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%h}&O mesmo que {\tt\%b}.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%H}&A hora como um número decimal, usando um relógio de 24-horas (de 0 +a 23). Se permite o zero como primeiro dígito, embora não seja necessário.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%m}&O mês como um número decimal (de 1 a 12). +Se permite o zero como primeiro dígito, embora não seja necessário.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%M}&O minuto como um número decimal (de 0 a 59). +Se permite o zero como primeiro dígito, embora não seja necessário.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%S}&O segundo como um número decimal (de 0 to 60). +Se permite o zero como primeiro dígito, embora não seja necessário.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%y}&O ano sem o século, como um número decimal (de 0 to 99). +Se permite o zero como primeiro dígito, embora não seja necessário. +Valores de entrada de 0 a 68 são considerados dos anos 2000 a 2068 +enquanto que os valores 69 até 99 como dos anos 1969 to 1999.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%z}&A diferença horária do GMT no formato ISO 8601.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%\%}&Um caractere {\tt\%} literal.\\ +\end{tabular} + +Todos os outros caracteres (ordinários) na cadeia de formato devem ter um +caractere \linebreak correspondente com a cadeia de entrada a ser convertida. Exceções +são espaços na cadeia de entrada, a qual pode coincidir com zero ou mais +caracteres de espaço na cadeia de formato. + +% For example, the model statements: +% +% \begin{verbatim} +% param s, symbolic, := "07/14/98 13:47"; +% param t := str2time(s, "%m/%d/%y %H:%M"); +% display t; +% \end{verbatim} +% +% \noindent produce the following printout: +% +% \begin{verbatim} +% t = 900424020 +% \end{verbatim} +% +% \noindent where the calendar time printed corresponds to 13:47:00 on +% July 14, 1998. +% +% The format string passed to the function {\tt str2time} consists of +% conversion specifiers and ordinary characters. Each conversion +% specifier begins with a percent ({\tt\%}) character followed by a +% letter. +% +% The following conversion specifiers may be used in the format string: +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%b}&The abbreviated month name (case insensitive). At least three +% first letters of the month name should appear in the input string.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%d}&The day of the month as a decimal number (range 1 to 31). +% Leading zero is permitted, but not required.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%h}&The same as {\tt\%b}.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%H}&The hour as a decimal number, using a 24-hour clock (range 0 +% to 23). Leading zero is permitted, but not required.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%m}&The month as a decimal number (range 1 to 12). Leading zero is +% permitted, but not required.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%M}&The minute as a decimal number (range 0 to 59). Leading zero +% is permitted, but not required.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%S}&The second as a decimal number (range 0 to 60). Leading zero +% is permitted, but not required.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%y}&The year without a century as a decimal number (range 0 to 99). +% Leading zero is permitted, but not required. Input values in the range +% 0 to 68 are considered as the years 2000 to 2068 while the values 69 to +% 99 as the years 1969 to 1999.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%z}&The offset from GMT in ISO 8601 format.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%\%}&A literal {\tt\%} character.\\ +% \end{tabular} +% +% All other (ordinary) characters in the format string should have a +% matching character in the input string to be converted. Exceptions are +% spaces in the input string which can match zero or more space +% characters in the format string. + +% \newpage + +Se algum componente de data e/ou hora estão ausentes no formato e, +portanto, na cadeia de entrada, a função {\tt str2time} usa seus valores +padrão correspondendo a 00:00:00 de 1{\textsuperscript{\b{o}}} +de Janeiro de 1970, ou seja, o valor padrão para o ano é 1970, o valor +padrão para o mês é Janeiro, etc. + +A função {\tt str2time} é aplicável a todos horários calendário desde +00:00:00 de 1{\textsuperscript{\b{o}}} de Janeiro de 0001 até 23:59:59 +de 31 de Dezembro de 4000 do calendário Gregoriano. + +% If some date and/or time component(s) are missing in the format and, +% therefore, in the input string, the function {\tt str2time} uses their +% default values corresponding to 00:00:00 on January 1, 1970, that is, +% the default value of the year is 1970, the default value of the month +% is January, etc. +% +% The function {\tt str2time} is applicable to all calendar times in the +% range 00:00:00 on January 1, 0001 to 23:59:59 on December 31, 4000 of +% the Gregorian calendar. + + + +\section{Convertendo tempo de calendário a uma cadeia de caracteres} +\label{time2str} + +A função {\tt time2str(}{\it t}{\tt,} {\it f}{\tt)} converte o tempo +de calendário especificado pelo seu primeiro \linebreak argumento {\it t}, que +deve ser uma expressão numérica, para uma cadeia de caracteres +(valor \linebreak simbólico). A conversão é controlada pela cadeia de formato +{\it f} (o segundo argumento), que deve ser uma expressão numérica. + +O tempo de calendário passado para {\tt time2str} possui o mesmo +significado dos valores retornados pela função {\tt gmtime} (ver Subseção +\ref{gmtime}, página \pageref{gmtime}). Note que {\tt time2str} +{\it não corrige} o tempo de calendário especificado para zona horária local, +i.e., o tempo de calendário 0 sempre corresponde a 00:00:00 de +1{\textsuperscript{\b{o}}} de Janeiro de 1970. + +Por exemplo, as sentenças de modelo: + +\begin{verbatim} + param s, symbolic, := time2str(gmtime(), "%FT%TZ"); + display s; +\end{verbatim} + +\noindent pode produzir a seguinte impressão: + +\begin{verbatim} + s = '2008-12-04T00:23:45Z' +\end{verbatim} + +\noindent que é a impressão da data e hora no formato ISO. + +A cadeia de formato passada para a função {\tt time2str} consiste de +especificadores de conversão e caracteres ordinários. Cada especificador +de conversão começa com um caractere de porcentagem ({\tt\%}) seguido +de uma letra. + +Os seguintes especificadores de conversão podem ser usados na cadeia de formato: + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%a}&O nome do dia da semana abreviado(2 caracteres).\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%A}&O nome do dia da semana completo.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%b}&O nome do dia do mês abreviado (3 caracteres).\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%B}&O nome do mês completo.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%C}&O século do ano, ou seja, o maior inteiro não maior que o +ano dividido por~100.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%d}&O dia do mês como um número decimal (de 01 até 31).\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%D}&A data usando o formato \verb|%m/%d/%y|.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%e}&O dia do mês, como em \verb|%d|, mas preenchido com espaço +em branco ao invés de zero.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%F}&A data usando o formato \verb|%Y-%m-%d|.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%g}&O ano correspondente ao número de semana ISO, mas sem o século +(de 00 até~99). Este possui o mesmo formato e valor que \verb|%y|, +exceto que se o número de semana ISO (ver \verb|%V|) pertence +ao ano anterior ou seguinte, se usa aquele ano em seu lugar.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%G}&O ano correspondente ao número de semana ISO. +Este possui o mesmo formato e valor que \verb|%Y|, +exceto que se o número de semana ISO (ver \verb|%V|) pertence +ao ano anterior ou seguinte, se usa aquele ano em seu lugar.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%h}&O mesmo que \verb|%b|.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%H}&A hora como um número decimal usando um relógio 24 horas (de 00 até 23).\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%I}&A hora como um número decimal usando um relógio 12 horas (de 01 até 12).\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%j}&O dia do ano como um número decimal (de 001 até 366).\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%k}&A hora como um número decimal usando um relógio 24 horas, como +\verb|%H|, mas preenchido com espaço em branco ao invés de zero.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%l}&A hora como um número decimal usando um relógio 12 horas, como +\verb|%I|, mas preenchido com espaço em branco ao invés de zero. +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%m}&O mês como um número decimal (de 01 até 12).\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%M}&O minuto como um número decimal (de 00 até 59).\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%p}&Tanto {\tt AM} como {\tt PM}, de acordo com o valor da hora fornecido. +Meia-noite é tratada como {\tt AM} e meio-dia, como {\tt PM}.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%P}&Tanto {\tt am} como {\tt pm}, de acordo com o valor da hora fornecido. +Meia-noite é tratada como {\tt am} e meio-dia, como {\tt pm}.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%R}&A hora e minuto em números decimais usando o formato +\verb|%H:%M|.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%S}&O segundo como um número decimal (de 00 até 59).\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%T}&A hora do dia em números decimais usando o formato +\verb|%H:%M:%S|.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%u}&O dia da semana como número decimal (de 1 até 7) em que Segunda +é 1.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%U}&O número da semana do ano corrente como um número decimal (de +00 até 53) iniciando com o primeiro Domingo como o primeiro dia da +primeira semana. Os dias que precedem o primeiro Domingo do ano são +considerados parte da semana 00. +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%V}&O número da semana ISO como um número decimal (de 01 até 53). +Semanas ISO iniciam com Segunda e finalizam com Domingo. +A semana 01 de um ano é a primeira semana que possui a maioria de +seus dias naquele ano. Isto é equivalente à semana contendo 4 de +Janeiro. A semana 01 de um ano pode conter dias do ano anterior. +A semana anterior à semana 01 de um ano é a última semana +(52 ou 53) do ano anterior, mesmo se ela contém dias do novo ano. +Em outras palavras, se 1{\textsuperscript{\b{o}}} de Janeiro +é Segunda, Terça, Quarta ou Quinta, ele está na semana 01; +Se 1{\textsuperscript{\b{o}}} de Janeiro é Sexta, +Sábado ou Domingo, ele está na semana 52 ou 53 do ano anterior.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%w}&O dia da semana como um número decimal (de 0 até 6) em que Domingo +é 0.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%W}&O número da semana do ano corrente como um número decimal (de +00 até 53), iniciando com a primeira Segunda como o primeiro dia da primeira +semana. Dias que precedem a primeira Segunda do ano são considerados parte +da semana 00.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%y}&O ano sem o século como um número decimal (de 00 até +99), ou seja, o ano \verb|mod|~100.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%Y}&O ano como um número decimal, usando o calendário Gregoriano.\\ +\end{tabular} + +\begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +{\tt\%\%}&Um caractere \verb|%| literal.\\ +\end{tabular} + +Todos os outros caracteres (ordinários) na cadeia de formato são simplesmente copiados +à cadeia resultante. + +O primeiro argumento (tempo do calendário) passado para a função {\tt time2str} +deve estar entre $-62135596800$ até $+64092211199$, o que corresponde ao período +de 00:00:00 de 1{\textsuperscript{\b{o}}} de Janeiro de 0001 até 23:59:59 +de 31 de Dezembro de 4000 do calendário Gregoriano. + + +% The function {\tt time2str(}{\it t}{\tt,} {\it f}{\tt)} converts the +% calendar time specified by its first argument {\it t}, which should be +% a numeric expression, to a character string (symbolic value). The +% conversion is controlled by the specified format string {\it f} (the +% second argument), which should be a symbolic expression. +% +% The calendar time passed to {\tt time2str} has the same meaning as +% values returned by the function {\tt gmtime} (see Subsection +% \ref{gmtime}, page \pageref{gmtime}). Note that {\tt time2str} does +% {\it not} correct the specified calendar time for the local timezone, +% i.e. the calendar time 0 always corresponds to 00:00:00 on January 1, +% 1970. +% +% For example, the model statements: +% +% \begin{verbatim} +% param s, symbolic, := time2str(gmtime(), "%FT%TZ"); +% display s; +% \end{verbatim} +% +% \noindent may produce the following printout: +% +% \begin{verbatim} +% s = '2008-12-04T00:23:45Z' +% \end{verbatim} +% +% \noindent which is a timestamp in the ISO format. +% +% The format string passed to the function {\tt time2str} consists of +% conversion specifiers and ordinary characters. Each conversion +% specifier begins with a percent ({\tt\%}) character followed by a +% letter. +% +% The following conversion specifiers may be used in the format string: +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%a}&The abbreviated (2-character) weekday name.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%A}&The full weekday name.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%b}&The abbreviated (3-character) month name.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%B}&The full month name.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%C}&The century of the year, that is the greatest integer not +% greater than the year divided by~100.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%d}&The day of the month as a decimal number (range 01 to 31).\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%D}&The date using the format \verb|%m/%d/%y|.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%e}&The day of the month like with \verb|%d|, but padded with +% blank rather than zero.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%F}&The date using the format \verb|%Y-%m-%d|.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%g}&The year corresponding to the ISO week number, but without the +% century (range 00 to~99). This has the same format and value as +% \verb|%y|, except that if the ISO week number (see \verb|%V|) belongs +% to the previous or next year, that year is used instead.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%G}&The year corresponding to the ISO week number. This has the +% same format and value as \verb|%Y|, except that if the ISO week number +% (see \verb|%V|) belongs to the previous or next year, that year is used +% instead. +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%h}&The same as \verb|%b|.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%H}&The hour as a decimal number, using a 24-hour clock (range 00 +% to 23).\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%I}&The hour as a decimal number, using a 12-hour clock (range 01 +% to 12).\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%j}&The day of the year as a decimal number (range 001 to 366).\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%k}&The hour as a decimal number, using a 24-hour clock like +% \verb|%H|, but padded with blank rather than zero.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%l}&The hour as a decimal number, using a 12-hour clock like +% \verb|%I|, but padded with blank rather than zero. +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%m}&The month as a decimal number (range 01 to 12).\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%M}&The minute as a decimal number (range 00 to 59).\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%p}&Either {\tt AM} or {\tt PM}, according to the given time value. +% Midnight is treated as {\tt AM} and noon as {\tt PM}.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%P}&Either {\tt am} or {\tt pm}, according to the given time value. +% Midnight is treated as {\tt am} and noon as {\tt pm}.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%R}&The hour and minute in decimal numbers using the format +% \verb|%H:%M|.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%S}&The second as a decimal number (range 00 to 59).\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%T}&The time of day in decimal numbers using the format +% \verb|%H:%M:%S|.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%u}&The day of the week as a decimal number (range 1 to 7), Monday +% being 1.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%U}&The week number of the current year as a decimal number (range +% 00 to 53), starting with the first Sunday as the first day of the first +% week. Days preceding the first Sunday in the year are considered to be +% in week 00. +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%V}&The ISO week number as a decimal number (range 01 to 53). ISO +% weeks start with Monday and end with Sunday. Week 01 of a year is the +% first week which has the majority of its days in that year; this is +% equivalent to the week containing January 4. Week 01 of a year can +% contain days from the previous year. The week before week 01 of a year +% is the last week (52 or 53) of the previous year even if it contains +% days from the new year. In other word, if 1 January is Monday, Tuesday, +% Wednesday or Thursday, it is in week 01; if 1 January is Friday, +% Saturday or Sunday, it is in week 52 or 53 of the previous year.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%w}&The day of the week as a decimal number (range 0 to 6), Sunday +% being 0.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%W}&The week number of the current year as a decimal number (range +% 00 to 53), starting with the first Monday as the first day of the first +% week. Days preceding the first Monday in the year are considered to be +% in week 00.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%y}&The year without a century as a decimal number (range 00 to +% 99), that is the year modulo~100.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%Y}&The year as a decimal number, using the Gregorian calendar.\\ +% \end{tabular} +% +% \begin{tabular}{@{}p{20pt}p{421.5pt}@{}} +% {\tt\%\%}&A literal \verb|%| character.\\ +% \end{tabular} +% +% All other (ordinary) characters in the format string are simply copied +% to the resultant string. +% +% The first argument (calendar time) passed to the function {\tt time2str} +% should be in the range from $-62135596800$ to $+64092211199$ that +% corresponds to the period from 00:00:00 on January 1, 0001 to 23:59:59 +% on December 31, 4000 of the Gregorian calendar. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\chapter{Controladores de tabelas} +\label{drivers} + +\noindent\hfil +\begin{tabular}{c} +por Andrew Makhorin \verb||\\ +e Heinrich Schuchardt \verb||\\ +\end{tabular} + +\bigskip\bigskip + +O {\it controlador de tabelas} é um módulo do programa que permite transmitir +dados entre objetos de um modelo MathProg e tabela de dados. + +Atualmente, o pacote GLPK possui quatro controladores de tabelas: + +\vspace*{-8pt} + +\begin{itemize} +\item controlador interno de tabelas CSV; +\item controlador interno de tabelas xBASE; +\item controlador de tabelas ODBC; +\item controlador de tabelas MySQL. +\end{itemize} + + +% The {\it table driver} is a program module which provides transmitting +% data between MathProg model objects and data tables. +% +% Currently the GLPK package has four table drivers: +% +% \vspace*{-8pt} +% +% \begin{itemize} +% \item built-in CSV table driver; +% \item built-in xBASE table driver; +% \item ODBC table driver; +% \item MySQL table driver. +% \end{itemize} + +\vspace*{-8pt} + +\section{Controlador de tabelas CSV} + +O controlador de tabelas CSV assume que a tabela de dados está representada +na forma de \linebreak arquivo de texto plano, em formato de arquivo CSV +(valores serparados por vígula: \linebreak comma-separated values) como descrito +abaixo. + +Para escolher o controlador de tabelas CSV, seu nome na sentença table deve ser +especificado como \verb|"CSV"| e o único argumento deve especificar o nome do +arquivo de texto plano contendo a tabela. Por exemplo: + +\begin{verbatim} + table dados IN "CSV" "dados.csv": ... ; +\end{verbatim} + +O sufixo do nome do arquivo pode ser arbitrário, no entanto, +é recomendado usar o sufixo `\verb|.csv|'. + +Ao ler tabelas de entrada o controlador de tabelas CSV fornece um campo +implícito chamado \verb|RECNO|, que contém o número do registro corrente. +Este campo pode ser especificado na sentença de entrada table, como +se realmente houvesse um campo chamado \verb|RECNO| no arquivo CSV. Por exemplo: + +\begin{verbatim} + table lista IN "CSV" "lista.csv": num <- [RECNO], ... ; +\end{verbatim} + + +% The CSV table driver assumes that the data table is represented in the +% form of a plain text file in the CSV (comma-separated values) file +% format as described below. +% +% To choose the CSV table driver its name in the table statement should +% be specified as \verb|"CSV"|, and the only argument should specify the +% name of a plain text file containing the table. For example: +% +% \begin{verbatim} +% table data IN "CSV" "data.csv": ... ; +% \end{verbatim} +% +% The filename suffix may be arbitrary, however, it is recommended to use +% the suffix `\verb|.csv|'. +% +% On reading input tables the CSV table driver provides an implicit field +% named \verb|RECNO|, which contains the current record number. This +% field can be specified in the input table statement as if there were +% the actual field named \verb|RECNO| in the CSV file. For example: +% +% \begin{verbatim} +% table list IN "CSV" "list.csv": num <- [RECNO], ... ; +% \end{verbatim} + +\newpage + +\subsection*{Formato CSV\footnote{Este material é baseado no documento RFC +4180.}} + +O formato CSV (\textit{comma-separated values}) é um formato de arquivo de texto plano +definido como segue. + +1. Cada registro é localizado em uma linha separada, delimitada por uma quebra de linha. Por exemplo: + +\begin{verbatim} + aaa,bbb,ccc\n + xxx,yyy,zzz\n +\end{verbatim} + +\noindent +onde \verb|\n| significa o caractere de controle \verb|LF| ({\tt 0x0A}). + +2. O último registro no arquivo pode ou não ter a quebra de linha. Por exemplo: + +\begin{verbatim} + aaa,bbb,ccc\n + xxx,yyy,zzz +\end{verbatim} + +3. Deve haver uma linha de cabeçalho na primeira linha do arquivo no +mesmo formato das linhas de registros normais. Este cabeçalho deve +conter nomes correspondendo aos campos no arquivo. O número de nomes +de campos na linha de cabeçalho deve ser o mesmo do número de campos +dos registros do arquivo. Por exemplo: + +\begin{verbatim} + nome1,nome2,nome3\n + aaa,bbb,ccc\n + xxx,yyy,zzz\n +\end{verbatim} + +4. Dentro do cabeçalho e de cada registro, podem haver um ou mais campos +separados por vírgulas. Cada linha deve conter o mesmo número de campos +por todos arquivo. Espaços são considerados parte de um campo, portanto, +não são ignorados. O último campo do registro não deve ser seguido de +vírgula. Por exemplo: + +\begin{verbatim} + aaa,bbb,ccc\n +\end{verbatim} + +5. Campos podem ou não estar cercados em aspas duplas. Por exemplo: + +\begin{verbatim} + "aaa","bbb","ccc"\n + zzz,yyy,xxx\n +\end{verbatim} + +6. Se um campo é cercado de aspas duplas, cada aspa dupla que faça +parte do campo deve ser codificado duas vezes. Por exemplo: + +\begin{verbatim} + "aaa","b""bb","ccc"\n +\end{verbatim} + +\para{Exemplo} + +\begin{verbatim} +DE,PARA,DISTANCIA,CUSTO +Seattle,New-York,2.5,0.12 +Seattle,Chicago,1.7,0.08 +Seattle,Topeka,1.8,0.09 +San-Diego,New-York,2.5,0.15 +San-Diego,Chicago,1.8,0.10 +San-Diego,Topeka,1.4,0.07 +\end{verbatim} + + + +% The CSV (comma-separated values) format is a plain text file format +% defined as follows. +% +% 1. Each record is located on a separate line, delimited by a line +% break. For example: +% +% \begin{verbatim} +% aaa,bbb,ccc\n +% xxx,yyy,zzz\n +% \end{verbatim} +% +% \noindent +% where \verb|\n| means the control character \verb|LF| ({\tt 0x0A}). +% +% 2. The last record in the file may or may not have an ending line +% break. For example: +% +% \begin{verbatim} +% aaa,bbb,ccc\n +% xxx,yyy,zzz +% \end{verbatim} +% +% 3. There should be a header line appearing as the first line of the +% file in the same format as normal record lines. This header should +% contain names corresponding to the fields in the file. The number of +% field names in the header line should be the same as the number of +% fields in the records of the file. For example: +% +% \begin{verbatim} +% name1,name2,name3\n +% aaa,bbb,ccc\n +% xxx,yyy,zzz\n +% \end{verbatim} +% +% 4. Within the header and each record there may be one or more fields +% separated by commas. Each line should contain the same number of fields +% throughout the file. Spaces are considered as part of a field and +% therefore not ignored. The last field in the record should not be +% followed by a comma. For example: +% +% \begin{verbatim} +% aaa,bbb,ccc\n +% \end{verbatim} +% +% 5. Fields may or may not be enclosed in double quotes. For example: +% +% \begin{verbatim} +% "aaa","bbb","ccc"\n +% zzz,yyy,xxx\n +% \end{verbatim} +% +% 6. If a field is enclosed in double quotes, each double quote which is +% part of the field should be coded twice. For example: +% +% \begin{verbatim} +% "aaa","b""bb","ccc"\n +% \end{verbatim} +% +% \para{Example} +% +% \begin{verbatim} +% FROM,TO,DISTANCE,COST +% Seattle,New-York,2.5,0.12 +% Seattle,Chicago,1.7,0.08 +% Seattle,Topeka,1.8,0.09 +% San-Diego,New-York,2.5,0.15 +% San-Diego,Chicago,1.8,0.10 +% San-Diego,Topeka,1.4,0.07 +% \end{verbatim} + +\newpage + +\section{Controlador de tabelas xBASE} + +O controlador de tabelas xBASE assume que a tabela de dados é armazenada no +formato de arquivo .dbf. + +Para escolher o controlador de tabela xBASE, seu nome na sentença table deve ser +especificado como \verb|"xBASE"| e o primeiro argumento deve especificar o nome +de um arquivo .dbf contendo a tabela. Para a tabela de saída deve haver um +segundo argumento definindo o formato da tabela na forma +\verb|"FF...F"|, onde \verb|F| é tanto {\tt C({\it n})}, +que especifica um campo de caractere de tamanho $n$, ou +{\tt N({\it n}{\rm [},{\it p}{\rm ]})}, que especifica um campo numérico +de tamanho $n$ e precisão $p$ (por padrão $p$ é 0). + +Adiante está um simples exemplo que ilustra a criação e leitura de um arquivo .dbf: + +\begin{verbatim} +table tab1{i in 1..10} OUT "xBASE" "foo.dbf" + "N(5)N(10,4)C(1)C(10)": 2*i+1 ~ B, Uniform(-20,+20) ~ A, + "?" ~ FOO, "[" & i & "]" ~ C; +set S, dimen 4; +table tab2 IN "xBASE" "foo.dbf": S <- [B, C, RECNO, A]; +display S; +end; +\end{verbatim} + + +% The xBASE table driver assumes that the data table is stored in the +% .dbf file format. +% +% To choose the xBASE table driver its name in the table statement should +% be specified as \verb|"xBASE"|, and the first argument should specify +% the name of a .dbf file containing the table. For the output table there +% should be the second argument defining the table format in the form +% \verb|"FF...F"|, where \verb|F| is either {\tt C({\it n})}, +% which specifies a character field of length $n$, or +% {\tt N({\it n}{\rm [},{\it p}{\rm ]})}, which specifies a numeric field +% of length $n$ and precision $p$ (by default $p$ is 0). +% +% The following is a simple example which illustrates creating and +% reading a .dbf file: +% +% \begin{verbatim} +% table tab1{i in 1..10} OUT "xBASE" "foo.dbf" +% "N(5)N(10,4)C(1)C(10)": 2*i+1 ~ B, Uniform(-20,+20) ~ A, +% "?" ~ FOO, "[" & i & "]" ~ C; +% set S, dimen 4; +% table tab2 IN "xBASE" "foo.dbf": S <- [B, C, RECNO, A]; +% display S; +% end; +% \end{verbatim} + +\section{Controlador de tabelas ODBC} + +O controlador de tabelas ODBC permite conexões com bancos de dados SQL usando +uma \linebreak implementação da interface ODBC baseada na Call Level Interface +(CLI).\footnote{A norma software correspondente é definida na +ISO/IEC 9075-3:2003.} + +\para{Debian GNU/Linux.} +No Debian GNU/Linux o controlador de tabelas ODBC usa o pacote iODBC, +\footnote{Ver {\tt}.} que deve ser instalado antes +de montar o pacote GLPK. A instalação pode ser efetuada com o seguinte +comando: + +\begin{verbatim} + sudo apt-get install libiodbc2-dev +\end{verbatim} + +Note que, ao configurar o pacote GLPK, para habilitar o uso da biblioteca do iODBC +a opção `\verb|--enable-odbc|' deve ser passada para o script de configuração. + +Para seu uso em todo sistema, as bases de dados individuais devem ser inseridas em +\verb|/etc/odbc.ini| e \verb|/etc/odbcinst.ini|. As conexões das bases de dados +a serem usadas por um único usuário são especificadas por arquivos do diretório +home (\verb|.odbc.ini| e \verb|.odbcinst.ini|). + +\para{Microsoft Windows.} +No Microsoft Windows o controlador de tabelas ODBC usa a biblioteca Microsoft ODBC. +Para habilitar esta funcionalidade, o símbolo: + +\begin{verbatim} + #define ODBC_DLNAME "odbc32.dll" +\end{verbatim} + +\noindent +deve ser definido no arquivo de configuração do GLPK `\verb|config.h|'. + +Fontes de dados podem ser criados via Ferramentas Administrativas do +Painel de Controle. + +Para escolher do controlador de tabelas ODBC, seu nome na sentença table deve +ser especificado como \verb|'ODBC'| ou \verb|'iODBC'|. + +% \newpage + +A lista de argumentos é especificada como segue. + +O primeiro argumento é a cadeia de conexão passada para a biblioteca ODBC, +por exemplo: + +\verb|'DSN=glpk;UID=user;PWD=password'|, ou + +\verb|'DRIVER=MySQL;DATABASE=glpkdb;UID=user;PWD=password'|. + +Diferentes partes da cadeia são separadas por ponto e vírgula. Cada parte +consiste de um par {\it nome-do-campo} e {\it valor} separados pelo sinar +de igualdade. Os nomes de campo permitidos dependem da biblioteca ODBC. +Tipicamente os seguintes nomes-de-campo são permitidos: + +\verb|DATABASE | base de dados; + +\verb|DRIVER | controlador ODBC; + +\verb|DSN | nome de uma fonte de dados; + +\verb|FILEDSN | nome de um arquivo de fonte de dados; + +\verb|PWD | senha de usuário; + +\verb|SERVER | base de dados; + +\verb|UID | nome de usuário. + +O segundo argumento e todos os seguintes são considerados como +sentenças SQL. + +As sentenças SQL podem ser estendidas sobre múltiplos argumentos. Se o +último caractere de um argumento é um ponto e vírgula, este indica +o fim de uma sentença SQL. + +Os argumentos de uma sentença SQL são concatenados separados por espaço. +O eventual ponto e vírgula final será removido. + +Todas as sentenças SQL, exceto a última, serão executadas diretamente. + +Para tabela-IN, a última sentença SQL pode ser um comando SELECT que se inicia +com \verb|'SELECT '| em letras maiúsculas. Se a cadeia não se inicia com +\verb|'SELECT '|, se considera que é um nome de uma tabela e uma sentença +SELECT é automaticamente gerada. + + +Para tabela-OUT, a última sentença SQL pode conter um ou múltiplos pontos de +interrogação. Se contém um ponto de interrogação, é considerado um gabarito +para a rotina de escrita. Caso contrário, a cadeia é considerada um +nome de tabela e um gabarito INSERT é automaticamente gerado. + +A rotina de escrita usa um gabarito com o pontos de interrogação e +o substitui o primeiro ponto de interrogação pelo primeiro parâmetro +de saída, o segundo ponto de interrogação, pelo segundo parâmetro e +assim por diante. Em seguida, o comando SQL é emitido. + +O que segue é um exemplo da sentença table de saída: + +\begin{verbatim} +table ta { l in LOCAIS } OUT + 'ODBC' + 'DSN=glpkdb;UID=glpkuser;PWD=glpkpassword' + 'DROP TABLE IF EXISTS resultado;' + 'CREATE TABLE resultado ( ID INT, LOC VARCHAR(255), QUAN DOUBLE );' + 'INSERT INTO resultado 'VALUES ( 4, ?, ? )' : + l ~ LOC, quantidade[l] ~ QUAN; +\end{verbatim} + +% \newpage + +\noindent +Alternativamente pode se escrever como segue: + +\begin{verbatim} +table ta { l in LOCAIS } OUT + 'ODBC' + 'DSN=glpkdb;UID=glpkuser;PWD=glpkpassword' + 'DROP TABLE IF EXISTS resultado;' + 'CREATE TABLE resultado ( ID INT, LOC VARCHAR(255), QUAN DOUBLE );' + 'resultado' : + l ~ LOC, quantidade[l] ~ QUAN, 4 ~ ID; +\end{verbatim} + +O uso de gabaritos com `\verb|?|' não só permite INSERT, como também o +UPDATE, DELETE, etc. Por exemplo: + +\begin{verbatim} +table ta { l in LOCAIS } OUT + 'ODBC' + 'DSN=glpkdb;UID=glpkuser;PWD=glpkpassword' + 'UPDATE resultado SET DATA = ' & data & ' WHERE ID = 4;' + 'UPDATE resultado SET QUAN = ? WHERE LOC = ? AND ID = 4' : + quantidade[l], l; +\end{verbatim} + + + +% The ODBC table driver allows connecting to SQL databases using an +% implementation of the ODBC interface based on the Call Level Interface +% (CLI).\footnote{The corresponding software standard is defined in +% ISO/IEC 9075-3:2003.} +% +% \para{Debian GNU/Linux.} +% Under Debian GNU/Linux the ODBC table driver uses the iODBC +% package,\footnote{See {\tt}.} which should be +% installed before building the GLPK package. The installation can be +% effected with the following command: +% +% \begin{verbatim} +% sudo apt-get install libiodbc2-dev +% \end{verbatim} +% +% Note that on configuring the GLPK package to enable using the iODBC +% library the option `\verb|--enable-odbc|' should be passed to the +% configure script. +% +% The individual databases should be entered for systemwide usage in +% \verb|/etc/odbc.ini| and\linebreak \verb|/etc/odbcinst.ini|. Database +% connections to be used by a single user are specified by files in the +% home directory (\verb|.odbc.ini| and \verb|.odbcinst.ini|). +% +% \para{Microsoft Windows.} +% Under Microsoft Windows the ODBC table driver uses the Microsoft ODBC +% library. To enable this feature the symbol: +% +% \begin{verbatim} +% #define ODBC_DLNAME "odbc32.dll" +% \end{verbatim} +% +% \noindent +% should be defined in the GLPK configuration file `\verb|config.h|'. +% +% Data sources can be created via the Administrative Tools from the +% Control Panel. +% +% To choose the ODBC table driver its name in the table statement should +% be specified as \verb|'ODBC'| or \verb|'iODBC'|. +% +% \newpage +% +% The argument list is specified as follows. +% +% The first argument is the connection string passed to the ODBC library, +% for example: +% +% \verb|'DSN=glpk;UID=user;PWD=password'|, or +% +% \verb|'DRIVER=MySQL;DATABASE=glpkdb;UID=user;PWD=password'|. +% +% Different parts of the string are separated by semicolons. Each part +% consists of a pair {\it fieldname} and {\it value} separated by the +% equal sign. Allowable fieldnames depend on the ODBC library. Typically +% the following fieldnames are allowed: +% +% \verb|DATABASE | database; +% +% \verb|DRIVER | ODBC driver; +% +% \verb|DSN | name of a data source; +% +% \verb|FILEDSN | name of a file data source; +% +% \verb|PWD | user password; +% +% \verb|SERVER | database; +% +% \verb|UID | user name. +% +% The second argument and all following are considered to be SQL +% statements +% +% SQL statements may be spread over multiple arguments. If the last +% character of an argument is a semicolon this indicates the end of +% a SQL statement. +% +% The arguments of a SQL statement are concatenated separated by space. +% The eventual trailing semicolon will be removed. +% +% All but the last SQL statement will be executed directly. +% +% For IN-table the last SQL statement can be a SELECT command starting +% with the capitalized letters \verb|'SELECT '|. If the string does not +% start with \verb|'SELECT '| it is considered to be a table name and a +% SELECT statement is automatically generated. +% +% For OUT-table the last SQL statement can contain one or multiple +% question marks. If it contains a question mark it is considered a +% template for the write routine. Otherwise the string is considered a +% table name and an INSERT template is automatically generated. +% +% The writing routine uses the template with the question marks and +% replaces the first question mark by the first output parameter, the +% second question mark by the second output parameter and so forth. Then +% the SQL command is issued. +% +% The following is an example of the output table statement: +% +% \begin{verbatim} +% table ta { l in LOCATIONS } OUT +% 'ODBC' +% 'DSN=glpkdb;UID=glpkuser;PWD=glpkpassword' +% 'DROP TABLE IF EXISTS result;' +% 'CREATE TABLE result ( ID INT, LOC VARCHAR(255), QUAN DOUBLE );' +% 'INSERT INTO result 'VALUES ( 4, ?, ? )' : +% l ~ LOC, quantity[l] ~ QUAN; +% \end{verbatim} +% +% \newpage +% +% \noindent +% Alternatively it could be written as follows: +% +% \begin{verbatim} +% table ta { l in LOCATIONS } OUT +% 'ODBC' +% 'DSN=glpkdb;UID=glpkuser;PWD=glpkpassword' +% 'DROP TABLE IF EXISTS result;' +% 'CREATE TABLE result ( ID INT, LOC VARCHAR(255), QUAN DOUBLE );' +% 'result' : +% l ~ LOC, quantity[l] ~ QUAN, 4 ~ ID; +% \end{verbatim} +% +% Using templates with `\verb|?|' supports not only INSERT, but also +% UPDATE, DELETE, etc. For example: +% +% \begin{verbatim} +% table ta { l in LOCATIONS } OUT +% 'ODBC' +% 'DSN=glpkdb;UID=glpkuser;PWD=glpkpassword' +% 'UPDATE result SET DATE = ' & date & ' WHERE ID = 4;' +% 'UPDATE result SET QUAN = ? WHERE LOC = ? AND ID = 4' : +% quantity[l], l; +% \end{verbatim} + + +\section{Controlador de tabelas MySQL} + +O controlador de tabelas MySQL permite a conexão a base de dados MySQL. + +\para{Debian GNU/Linux.} +No Debian GNU/Linux o controlador de tabelas MySQL usa o pacote MySQL, +\footnote{Para fazer o download de arquivos de desenvolvimento, ver +{\tt}.} que deve ser instalado +antes da criação do pacote GLPK. A instalação pode ser efetuada com +o seguinte comando: + +\begin{verbatim} + sudo apt-get install libmysqlclient15-dev +\end{verbatim} + +Note que ao configurar o pacote GLPK para habilitar o uso da biblioteca MySQL +a opção `\verb|--enable-mysql|' deve ser passada ao script de +configuração. + +\para{Microsoft Windows.} +No Microsoft Windows o controlador de tabelas MySQL também usa +a biblioteca MySQL. Para habilitar esta funcionalidade o símbolo: + +\begin{verbatim} + #define MYSQL_DLNAME "libmysql.dll" +\end{verbatim} + +\noindent +deve ser definido no arquivo de configuração do GLPK `\verb|config.h|'. + +Para escolher o controlador de tabelas MySQL, seu nome na sentença table deve +ser especificada como \verb|'MySQL'|. + +A lista de argumentos é especificada como segue. + +O primeiro argumento especifica como conectar a base de dados no estilo DSN, +por exemplo: + +\verb|'Database=glpk;UID=glpk;PWD=gnu'|. + +Diferentes partes da cadeia são separadas por ponto e vírgula. Cada parte +consiste de um par {\it nome-do-campo} e {\it valor} separado pelo sinal +de igualdade. Os seguintes nomes de campo são permitidos: + +% \newpage + +\verb|Server | servidor rodando a base de dados (localhost por padrão); + +\verb|Database | nome da base de dados; + +\verb|UID | nome de usuário; + +\verb|PWD | senha de usuário; + +\verb|Port | porta usada pelo servidor (3306 por padrão). + +O segundo argumento e todos os seguintes são considerados sentenças SQL. + +Sentenças SQL podem se estender sobre múltiplos argumentos. Se o último +caractere de um argumento é um ponto e vírgula, isto indica o fim de uma +sentença SQL. + +Os argumentos de uma sentença SQL são concatenados e separados por espaço. +O eventual ponto e vírgula final será removido. + +Todas sentenças SQL, menos a última, serão executadas diretamente. + +Para tabela-IN, a última sentença SQL pode ser um comando SELECT iniciado +com letras maiúsculas \verb|'SELECT '|. Se a cadeia não inicia com +\verb|'SELECT '| é considerado um nome de tabela e a sentença +SELECT é automaticamente gerada. + +Para tabela-OUT, a última sentença SQL pode conter um ou múltiplos pontos de +interrogação. Se contém um ponto de interrogação, é considerado um gabarito +para a rotina de escrita. Caso contrário, a cadeia é considerada um +nome de tabela e um gabarito INSERT é automaticamente gerado. + +A rotina de escrita usa um gabarito com o pontos de interrogação e +o substitui o primeiro ponto de interrogação pelo primeiro parâmetro +de saída, o segundo ponto de interrogação, pelo segundo parâmetro e +assim por diante. Em seguida, o comando SQL é emitido. + +O que segue é um exemplo da sentença table de saída: + +\begin{verbatim} +table ta { l in LOCAIS } OUT + 'MySQL' + 'Database=glpkdb;UID=glpkuser;PWD=glpkpassword' + 'DROP TABLE IF EXISTS resultado;' + 'CREATE TABLE resultado ( ID INT, LOC VARCHAR(255), QUAN DOUBLE );' + 'INSERT INTO resultado VALUES ( 4, ?, ? )' : + l ~ LOC, quantidade[l] ~ QUAN; +\end{verbatim} + +\noindent +Alternativamente poderia ser escrito como segue: + +\begin{verbatim} +table ta { l in LOCAIS } OUT + 'MySQL' + 'Database=glpkdb;UID=glpkuser;PWD=glpkpassword' + 'DROP TABLE IF EXISTS resultado;' + 'CREATE TABLE resultado ( ID INT, LOC VARCHAR(255), QUAN DOUBLE );' + 'resultado' : + l ~ LOC, quantidade[l] ~ QUAN, 4 ~ ID; +\end{verbatim} + +% \newpage + +O uso de gabaritos com `\verb|?|' não só permite INSERT, como também o +UPDATE, DELETE, etc. Por exemplo: + +\begin{verbatim} +table ta { l in LOCAIS } OUT + 'MySQL' + 'Database=glpkdb;UID=glpkuser;PWD=glpkpassword' + 'UPDATE resultado SET DATE = ' & date & ' WHERE ID = 4;' + 'UPDATE resultado SET QUAN = ? WHERE LOC = ? AND ID = 4' : + quantidade[l], l; +\end{verbatim} + + +% The MySQL table driver allows connecting to MySQL databases. +% +% \para{Debian GNU/Linux.} +% Under Debian GNU/Linux the MySQL table driver uses the MySQL +% package,\footnote{For download development files see +% {\tt}.} which should be +% installed before building the GLPK package. The installation can be +% effected with the following command: +% +% \begin{verbatim} +% sudo apt-get install libmysqlclient15-dev +% \end{verbatim} +% +% Note that on configuring the GLPK package to enable using the MySQL +% library the option `\verb|--enable-mysql|' should be passed to the +% configure script. +% +% \para{Microsoft Windows.} +% Under Microsoft Windows the MySQL table driver also uses the MySQL +% library. To enable this feature the symbol: +% +% \begin{verbatim} +% #define MYSQL_DLNAME "libmysql.dll" +% \end{verbatim} +% +% \noindent +% should be defined in the GLPK configuration file `\verb|config.h|'. +% +% To choose the MySQL table driver its name in the table statement should +% be specified as \verb|'MySQL'|. +% +% The argument list is specified as follows. +% +% The first argument specifies how to connect the data base in the DSN +% style, for example: +% +% \verb|'Database=glpk;UID=glpk;PWD=gnu'|. +% +% Different parts of the string are separated by semicolons. Each part +% consists of a pair {\it fieldname} and {\it value} separated by the +% equal sign. The following fieldnames are allowed: +% +% \newpage +% +% \verb|Server | server running the database (defaulting to localhost); +% +% \verb|Database | name of the database; +% +% \verb|UID | user name; +% +% \verb|PWD | user password; +% +% \verb|Port | port used by the server (defaulting to 3306). +% +% The second argument and all following are considered to be SQL +% statements. +% +% SQL statements may be spread over multiple arguments. If the last +% character of an argument is a semicolon this indicates the end of +% a SQL statement. +% +% The arguments of a SQL statement are concatenated separated by space. +% The eventual trailing semicolon will be removed. +% +% All but the last SQL statement will be executed directly. +% +% For IN-table the last SQL statement can be a SELECT command starting +% with the capitalized letters \verb|'SELECT '|. If the string does not +% start with \verb|'SELECT '| it is considered to be a table name and a +% SELECT statement is automatically generated. +% +% For OUT-table the last SQL statement can contain one or multiple +% question marks. If it contains a question mark it is considered a +% template for the write routine. Otherwise the string is considered a +% table name and an INSERT template is automatically generated. +% +% The writing routine uses the template with the question marks and +% replaces the first question mark by the first output parameter, the +% second question mark by the second output parameter and so forth. Then +% the SQL command is issued. +% +% The following is an example of the output table statement: +% +% \begin{verbatim} +% table ta { l in LOCATIONS } OUT +% 'MySQL' +% 'Database=glpkdb;UID=glpkuser;PWD=glpkpassword' +% 'DROP TABLE IF EXISTS result;' +% 'CREATE TABLE result ( ID INT, LOC VARCHAR(255), QUAN DOUBLE );' +% 'INSERT INTO result VALUES ( 4, ?, ? )' : +% l ~ LOC, quantity[l] ~ QUAN; +% \end{verbatim} +% +% \noindent +% Alternatively it could be written as follows: +% +% \begin{verbatim} +% table ta { l in LOCATIONS } OUT +% 'MySQL' +% 'Database=glpkdb;UID=glpkuser;PWD=glpkpassword' +% 'DROP TABLE IF EXISTS result;' +% 'CREATE TABLE result ( ID INT, LOC VARCHAR(255), QUAN DOUBLE );' +% 'result' : +% l ~ LOC, quantity[l] ~ QUAN, 4 ~ ID; +% \end{verbatim} +% +% \newpage +% +% Using templates with `\verb|?|' supports not only INSERT, but also +% UPDATE, DELETE, etc. For example: +% +% \begin{verbatim} +% table ta { l in LOCATIONS } OUT +% 'MySQL' +% 'Database=glpkdb;UID=glpkuser;PWD=glpkpassword' +% 'UPDATE result SET DATE = ' & date & ' WHERE ID = 4;' +% 'UPDATE result SET QUAN = ? WHERE LOC = ? AND ID = 4' : +% quantity[l], l; +% \end{verbatim} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ##################### PAREI AQUI % ##################### + +\chapter{Resolvendo modelos com glpsol} + +O pacote GLPK \footnote{{\tt http://www.gnu.org/software/glpk/}} +inclui o programa {\tt glpsol}, um solver de PL/PIM autônomo. Este +programa pode ser chamado por uma linha de comando ou pelo shell para +resolver modelos escritos na \linebreak linguagem de modelagem GNU MathProg. + +Para comunicar ao solver que o arquivo de entrada contém uma descrição +do modelo, é necessário especificar a opção \verb|--model| na linha de +comando. Por exemplo: + +\begin{verbatim} + glpsol --model foo.mod +\end{verbatim} + +Às vezes é necessário usar a seção de dados posicionado em um arquivo +separado. Neste caso, deve-se usar o seguinte comando: + +\begin{verbatim} + glpsol --model foo.mod --data foo.dat +\end{verbatim} + +\noindent Note que ser o arquivo de modelo também contém a seção de dados, +aquela seção é ignorada. + +Também é permitido especificar mais de um arquivo contendo a seção de dados, +por exemplo: + +\begin{verbatim} + glpsol --model foo.mod --data foo1.dat --data foo2.dat +\end{verbatim} + +Se a descrição do modelo contém alguma sentença display e/ou printf, +o resultado é enviado para o terminal por padrão. Se há a necessidade +de redirecionar a saída para um arquivo, deve-se usar o seguinte comando: + +\begin{verbatim} + glpsol --model foo.mod --display foo.out +\end{verbatim} + +Se há a necessidade de ver o problema que está sendo gerado pelo tradutor +de modelo, deve-ser usar a opção \verb|--wlp| como segue: + +\begin{verbatim} + glpsol --model foo.mod --wlp foo.lp +\end{verbatim} + +\noindent Neste caso, os dados do problema são escritos no arquivo +\verb|foo.lp| no formato CPLEX LP viável para análise visual. + +Ás vezes, é necessário checar a descrição do modelo sem ter que resolver +a instância do problema gerado. Neste caso, deve-se especificar a opção +\verb|--check|, por exemplo: + +\begin{verbatim} + glpsol --check --model foo.mod --wlp foo.lp +\end{verbatim} + +\newpage + +Se há a necessidade de escrever uma solução numérica obtida pelo solver +para um arquivo, deve-se usar o seguinte comando: + +\begin{verbatim} + glpsol --model foo.mod --output foo.sol +\end{verbatim} + +\noindent neste caso, a solução é escrita no arquivo \verb|foo.sol| +em formato de texto plano, viável para análise visual. + +A lista completa de opções do \verb|glpsol| pode ser encontrada no manual +de referência do GLPK incluída na distribuição do GLPK. + + + +% The GLPK package\footnote{{\tt http://www.gnu.org/software/glpk/}} +% includes the program {\tt glpsol}, a stand-alone LP/MIP solver. This +% program can be launched from the command line or from the shell to +% solve models written in the GNU MathProg modeling language. +% +% To tell the solver that the input file contains a model description you +% need to specify the option \verb|--model| in the command line. +% For example: +% +% \begin{verbatim} +% glpsol --model foo.mod +% \end{verbatim} +% +% Sometimes it is necessary to use the data section placed in a separate +% file, in which case you may use the following command: +% +% \begin{verbatim} +% glpsol --model foo.mod --data foo.dat +% \end{verbatim} +% +% \noindent Note that if the model file also contains the data section, +% that section is ignored. +% +% It is also allowed to specify more than one file containing the data +% section, for example: +% +% \begin{verbatim} +% glpsol --model foo.mod --data foo1.dat --data foo2.dat +% \end{verbatim} +% +% If the model description contains some display and/or printf +% statements, by default the output is sent to the terminal. If you need +% to redirect the output to a file, you may use the following command: +% +% \begin{verbatim} +% glpsol --model foo.mod --display foo.out +% \end{verbatim} +% +% If you need to look at the problem, which has been generated by the +% model translator, you may use the option \verb|--wlp| as follows: +% +% \begin{verbatim} +% glpsol --model foo.mod --wlp foo.lp +% \end{verbatim} +% +% \noindent In this case the problem data is written to file +% \verb|foo.lp| in CPLEX LP format suitable for visual analysis. +% +% Sometimes it is needed merely to check the model description not +% solving the generated problem instance. In this case you may specify +% the option \verb|--check|, for example: +% +% \begin{verbatim} +% glpsol --check --model foo.mod --wlp foo.lp +% \end{verbatim} +% +% \newpage +% +% If you need to write a numeric solution obtained by the solver to +% a file, you may use the following command: +% +% \begin{verbatim} +% glpsol --model foo.mod --output foo.sol +% \end{verbatim} +% +% \noindent in which case the solution is written to file \verb|foo.sol| +% in a plain text format suitable for visual analysis. +% +% The complete list of the \verb|glpsol| options can be found in the +% GLPK reference manual included in the GLPK distribution. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Exemplo de descrição de modelo} + +\section{Descrição de modelo escrito em MathProg} + +Este é um exemplo completo de descrição de modelo escrito na linguagem +de modelagem GNU MathProg. + +\bigskip + +\begin{verbatim} +# UM PROBLEMA DE TRANSPORTE +# +# Este problema encontra a logística de custo mínimo que atende das demandas +# de mercado e as ofertas das fábricas. +# +# Referência: +# Dantzig G B, "Linear Programming and Extensions." +# Princeton University Press, Princeton, New Jersey, 1963, +# Chapter 3-3. + +set I; +/* fábricas de enlatados*/ + +set J; +/* mercados */ + +param a{i in I}; +/* capacidade da fábrica i, em caixas */ + +param b{j in J}; +/* demanda no mercado j, em caixas */ + +param d{i in I, j in J}; +/* distância, em milhares de milhas */ + +param f; +/* frete, em dólares por caixa a cada mil milhas */ + +param c{i in I, j in J} := f * d[i,j] / 1000; +/* custo de transporte, em milhares de dólares por caixa */ + +var x{i in I, j in J} >= 0; +/* quantidade enviada, em caixas */ + +minimize custo: sum{i in I, j in J} c[i,j] * x[i,j]; +/* custo total de transporte, em milhares de dólares */ + +s.t. suprimento{i in I}: sum{j in J} x[i,j] <= a[i]; +/* observa o limite de suprimento na fábrica i */ + +s.t. demanda{j in J}: sum{i in I} x[i,j] >= b[j]; +/* satisfaz a demanda do mercado j */ + +data; + +set I := Seattle San-Diego; + +set J := New-York Chicago Topeka; + +param a := Seattle 350 + San-Diego 600; + +param b := New-York 325 + Chicago 300 + Topeka 275; + +param d : New-York Chicago Topeka := + Seattle 2.5 1.7 1.8 + San-Diego 2.5 1.8 1.4 ; + +param f := 90; + +end; +\end{verbatim} + + +% Below here is a complete example of the model description written in +% the GNU MathProg modeling language. +% +% \bigskip +% +% \begin{verbatim} +% # A TRANSPORTATION PROBLEM +% # +% # This problem finds a least cost shipping schedule that meets +% # requirements at markets and supplies at factories. +% # +% # References: +% # Dantzig G B, "Linear Programming and Extensions." +% # Princeton University Press, Princeton, New Jersey, 1963, +% # Chapter 3-3. +% +% set I; +% /* canning plants */ +% +% set J; +% /* markets */ +% +% param a{i in I}; +% /* capacity of plant i in cases */ +% +% param b{j in J}; +% /* demand at market j in cases */ +% +% param d{i in I, j in J}; +% /* distance in thousands of miles */ +% +% param f; +% /* freight in dollars per case per thousand miles */ +% +% param c{i in I, j in J} := f * d[i,j] / 1000; +% /* transport cost in thousands of dollars per case */ +% +% var x{i in I, j in J} >= 0; +% /* shipment quantities in cases */ +% +% minimize cost: sum{i in I, j in J} c[i,j] * x[i,j]; +% /* total transportation costs in thousands of dollars */ +% +% s.t. supply{i in I}: sum{j in J} x[i,j] <= a[i]; +% /* observe supply limit at plant i */ +% +% s.t. demand{j in J}: sum{i in I} x[i,j] >= b[j]; +% /* satisfy demand at market j */ +% +% data; +% +% set I := Seattle San-Diego; +% +% set J := New-York Chicago Topeka; +% +% param a := Seattle 350 +% San-Diego 600; +% +% param b := New-York 325 +% Chicago 300 +% Topeka 275; +% +% param d : New-York Chicago Topeka := +% Seattle 2.5 1.7 1.8 +% San-Diego 2.5 1.8 1.4 ; +% +% param f := 90; +% +% end; +% \end{verbatim} + +\newpage + +\section{Instância gerada do problema de PL} + +Este é o resultado da tradução do modelo de exemplo produzido +pelo solver \verb|glpsol| e escrito no formato CPLEX LP +com a opção \verb|--wlp|. + +\medskip + +\begin{verbatim} +\* Problem: transporte *\ + +Minimize + custo: + 0.225 x(Seattle,New~York) + 0.153 x(Seattle,Chicago) + + 0.162 x(Seattle,Topeka) + 0.225 x(San~Diego,New~York) + + 0.162 x(San~Diego,Chicago) + 0.126 x(San~Diego,Topeka) + +Subject To + suprimento(Seattle): + x(Seattle,New~York) + x(Seattle,Chicago) + + x(Seattle,Topeka) <= 350 + suprimento(San~Diego): + x(San~Diego,New~York) + x(San~Diego,Chicago) + + x(San~Diego,Topeka) <= 600 + demanda(New~York): + x(Seattle,New~York) + x(San~Diego,New~York) >= 325 + demanda(Chicago): + x(Seattle,Chicago) + x(San~Diego,Chicago) >= 300 + demanda(Topeka): + x(Seattle,Topeka) + x(San~Diego,Topeka) >= 275 + +End +\end{verbatim} + +\section{solução ótima do problema de PL} + +Esta é a solução ótima da instância gerada do problema de PL +encontrada pelo solver \verb|glpsol| e escrita em formato de texto plano +com a opção\verb|--output|. + +\medskip + +\begin{footnotesize} +\begin{verbatim} +Problem: transporte +Rows: 6 +Columns: 6 +Non-zeros: 18 +Status: OPTIMAL +Objective: custo = 153.675 (MINimum) + + No. Row name St Activity Lower bound Upper bound Marginal +------ ------------ -- ------------- ------------- ------------- ------------- + 1 cust B 153.675 + 2 suprimento[Seattle] + NU 350 350 < eps + 3 suprimento[San-Diego] + B 550 600 + 4 demanda[New-York] + NL 325 325 0.225 + 5 demanda[Chicago] + NL 300 300 0.153 + 6 demanda[Topeka] + NL 275 275 0.126 + + No. Column name St Activity Lower bound Upper bound Marginal +------ ------------ -- ------------- ------------- ------------- ------------- + 1 x[Seattle,New-York] + B 50 0 + 2 x[Seattle,Chicago] + B 300 0 + 3 x[Seattle,Topeka] + NL 0 0 0.036 + 4 x[San-Diego,New-York] + B 275 0 + 5 x[San-Diego,Chicago] + NL 0 0 0.009 + 6 x[San-Diego,Topeka] + B 275 0 + +End of output +\end{verbatim} +\end{footnotesize} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newpage + +\section*{Agradecimentos} +\addcontentsline{toc}{chapter}{Agradecimentos} + +Os autores gostariam de agradecer as seguintes pessoas que gentilmente leram, +comentaram e corrigiram o rascunho deste documento: + +\noindent Juan Carlos Borras \verb|| + +\noindent Harley Mackenzie \verb|| + +\noindent Robbie Morrison \verb|| + +\end{document} diff --git a/resources/3rdparty/glpk-4.65/doc/graphs.pdf b/resources/3rdparty/glpk-4.65/doc/graphs.pdf new file mode 100644 index 000000000..b3c7fe0ee Binary files /dev/null and b/resources/3rdparty/glpk-4.65/doc/graphs.pdf differ diff --git a/resources/3rdparty/glpk-4.57/doc/graphs.tex b/resources/3rdparty/glpk-4.65/doc/graphs.tex similarity index 97% rename from resources/3rdparty/glpk-4.57/doc/graphs.tex rename to resources/3rdparty/glpk-4.65/doc/graphs.tex index cddb7518e..446a858c6 100644 --- a/resources/3rdparty/glpk-4.57/doc/graphs.tex +++ b/resources/3rdparty/glpk-4.65/doc/graphs.tex @@ -4,7 +4,7 @@ % This code is part of GLPK (GNU Linear Programming Kit). % % Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -% 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +% 2009, 2010, 2011, 2013, 2016 Andrew Makhorin, Department for Applied % Informatics, Moscow Aviation Institute, Moscow, Russia. All rights % reserved. E-mail: . % @@ -22,32 +22,41 @@ % along with GLPK. If not, see . %*********************************************************************** +% To make graphs.pdf from graphs.tex run the following two commands: +% latex graphs.tex +% dvipdfm -p letter graphs.dvi +% Note: You need TeX Live 2010 or later version. + \documentclass[11pt]{report} \usepackage{amssymb} \usepackage[dvipdfm,linktocpage,colorlinks,linkcolor=blue, urlcolor=blue]{hyperref} \usepackage{indentfirst} +\usepackage{niceframe} \usepackage[all]{xy} +% US Letter = 8.5 x 11 in \setlength{\textwidth}{6.5in} -\setlength{\textheight}{8.5in} +\setlength{\textheight}{9in} \setlength{\oddsidemargin}{0in} \setlength{\topmargin}{0in} \setlength{\headheight}{0in} \setlength{\headsep}{0in} -\setlength{\footskip}{0.5in} +%\setlength{\footskip}{0.5in} \setlength{\parindent}{16pt} \setlength{\parskip}{5pt} \setlength{\topsep}{0pt} \setlength{\partopsep}{0pt} -\setlength{\itemsep}{\parskip} -\setlength{\parsep}{0pt} -\setlength{\leftmargini}{\parindent} -\renewcommand{\labelitemi}{---} +%\setlength{\itemsep}{\parskip} +%\setlength{\parsep}{0pt} +%\setlength{\leftmargini}{\parindent} +%\renewcommand{\labelitemi}{---} +\newcommand{\Item}[1]{\parbox[t]{\parindent}{#1}} \def\para#1{\noindent{\bf#1}} \def\synopsis{\para{Synopsis}} \def\description{\para{Description}} +\def\note{\para{Note}} \def\returns{\para{Returns}} \renewcommand\contentsname{\sf\bfseries Contents} @@ -65,6 +74,8 @@ urlcolor=blue]{hyperref} \thispagestyle{empty} +\curlyframe{ + \begin{center} \vspace*{1.5in} @@ -82,15 +93,18 @@ urlcolor=blue]{hyperref} \vspace{0.5in} \begin{LARGE} -\sf for GLPK Version 4.49 +\sf for GLPK Version 4.59 \end{LARGE} \vspace{0.5in} \begin{Large} -\sf (DRAFT, April 2013) +\sf (DRAFT, March 2016) \end{Large} \end{center} +\vspace*{4.1in} +} + \newpage \vspace*{1in} @@ -103,9 +117,9 @@ GNU. \noindent Copyright \copyright{} 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -2008, 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied -Informatics, Moscow Aviation Institute, Moscow, Russia. All rights -reserved. +2008, 2009, 2010, 2011, 2013, 2016\linebreak +Andrew Makhorin, Department for Applied Informatics, Moscow Aviation +Institute, Moscow, Russia. All rights reserved. \noindent Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA @@ -130,9 +144,7 @@ into another language, under the above conditions for modified versions. \newpage -{\setlength{\parskip}{0pt} -\tableofcontents -} +{\setlength{\parskip}{0pt}\tableofcontents} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -152,17 +164,17 @@ vertex} of arc $a$, and $y\in V$ is called its {\it head vertex}. Representation of a graph in the program includes three structs defined by typedef in the header \verb|glpk.h|: -\vspace*{-8pt} +%\vspace*{-8pt} -\begin{itemize} -\item \verb|glp_graph|, which represents the graph in a whole, +%\begin{itemize} +\Item{---}\verb|glp_graph|, which represents the graph in a whole, -\item \verb|glp_vertex|, which represents a vertex of the graph, and +\Item{---}\verb|glp_vertex|, which represents a vertex of the graph, and -\item \verb|glp_arc|, which represents an arc of the graph. -\end{itemize} +\Item{---}\verb|glp_arc|, which represents an arc of the graph. +%\end{itemize} -\vspace*{-8pt} +%\vspace*{-8pt} All these three structs are ``semi-opaque'', i.e. the application program can directly access their fields through pointers, however, @@ -173,8 +185,11 @@ performed only with appropriate GLPK API routines. {\addtolength{\leftskip}{16pt}\noindent} {\par\addtolength{\leftskip}{-16pt}} -\para{\bf glp\_graph.} The struct \verb|glp_graph| has the following -fields available to the application program: +\subsection{Structure glp\_graph} + +%\para{\bf glp\_graph.} +The struct \verb|glp_graph| has the following fields available to the +application program. \noindent \verb|char *name;| @@ -225,8 +240,11 @@ $0\leq v\_size\leq 256$. (See also the field \verb|data| in the struct \verb|glp_arc|.) \end{comment} -\para{\bf glp\_vertex.} The struct \verb|glp_vertex| has the following -fields available to the application program: +\subsection{Structure glp\_vertex} + +%\para{\bf glp\_vertex.} +The struct \verb|glp_vertex| has the following fields available to the +application program. \noindent \verb|int i;| @@ -274,8 +292,11 @@ vertex has no incoming arcs, this field contains \verb|NULL|. vertex has no outgoing arcs, this field contains \verb|NULL|. \end{comment} -\para{\bf glp\_arc.} The struct \verb|glp_arc| has the following fields -available to the application program: +\subsection{Structure glp\_arc} + +%\para{\bf glp\_arc.} +The struct \verb|glp_arc| has the following fields available to the +application program. \noindent \verb|glp_vertex *tail;| @@ -283,13 +304,15 @@ available to the application program: \begin{comment}Pointer to a vertex, which is tail endpoint of the arc. \end{comment} +\newpage + \noindent \verb|glp_vertex *head;| \begin{comment}Pointer to a vertex, which is head endpoint of the arc. \end{comment} -\newpage +%\newpage \noindent \verb|void *data;| @@ -327,6 +350,8 @@ incoming arcs. \newpage +\setlength{\parskip}{4.6pt} + \section{Graph creating and modifying routines} \subsection{glp\_create\_graph --- create graph} @@ -398,6 +423,10 @@ Otherwise, if the block size is zero, the field \verb|data| is set to The routine \verb|glp_add_vertices| returns the ordinal number of the first new vertex added to the graph. +\setlength{\parskip}{5pt} + +\newpage + \subsection{glp\_set\_vertex\_name --- assign (change) vertex name} \synopsis @@ -456,7 +485,7 @@ vertices remaining in the graph. New ordinal numbers of the remaining vertices are assigned under the assumption that the original order of vertices is not changed. -\newpage +%\newpage \subsection{glp\_del\_arc --- delete arc from graph} @@ -565,7 +594,7 @@ exist, the routine does nothing. \section{Graph reading/writing routines} -\subsection{glp\_read\_graph --- read graph from plain text file} +\subsection{glp\_read\_graph --- read graph from text file} \synopsis @@ -575,20 +604,22 @@ exist, the routine does nothing. \description -The routine \verb|glp_read_graph| reads a graph from a plain text file, -whose name is specified by the parameter \verb|fname|. Note that before -reading data the current content of the graph object is completely -erased with the routine \verb|glp_erase_graph|. +The routine \verb|glp_read_graph| reads a graph from a text file, whose +name is specified by the parameter \verb|fname|. It is equivalent to -For the file format see description of the routine -\verb|glp_write_graph|. +\begin{verbatim} + glp_read_ccdata(G, -1, fname); +\end{verbatim} + +Note that before reading data the current content of the graph object +is completely erased with the routine \verb|glp_erase_graph|. \returns If the operation was successful, the routine returns zero. Otherwise it prints an error message and returns non-zero. -\subsection{glp\_write\_graph --- write graph to plain text file} +\subsection{glp\_write\_graph --- write graph to text file} \synopsis @@ -598,34 +629,18 @@ it prints an error message and returns non-zero. \description -The routine \verb|glp_write_graph| writes the graph to a plain text -file, whose name is specified by the parameter \verb|fname|. - -\returns - -If the operation was successful, the routine returns zero. Otherwise -it prints an error message and returns non-zero. - -\para{File format} - -The file created by the routine \verb|glp_write_graph| is a plain text -file, which contains the following information: +The routine \verb|glp_write_graph| writes the graph to a text file, +whose name is specified by the parameter \verb|fname|. +It is equivalent to \begin{verbatim} - nv na - i[1] j[1] - i[2] j[2] - . . . - i[na] j[na] + glp_write_ccdata(G, -1, fname); \end{verbatim} -\noindent -where: \verb|nv| is the number of vertices (nodes); \verb|na| is the -number of arcs; \verb|i[k]|, $k=1,\dots,na$, is the index of tail -vertex of arc $k$; \verb|j[k]|, $k=1,\dots,na$, is the index of head -vertex of arc $k$. +\returns -\newpage +If the operation was successful, the routine returns zero. Otherwise +it prints an error message and returns non-zero. \subsection{glp\_read\_ccdata --- read graph from text file in DIMACS clique/coloring\\format} @@ -646,6 +661,8 @@ directed graphs, because the routine allows reading self-loops and multiple edges/arcs keeping the order of vertices specified for each edge/arc of the graph.) +\newpage + The parameter {\tt G} specifies the graph object to be read in. Note that before reading data the current content of the graph object is completely erased with the routine {\tt glp\_erase\_graph}. @@ -666,7 +683,7 @@ it prints an error message and returns non-zero. \para{DIMACS clique/coloring format\footnote{This material is based on the paper ``Clique and Coloring Problems Graph Format'', which -is publically available at \url{http://dimacs.rutgers.edu/Challenges}.}} +is publicly available at \url{http://dimacs.rutgers.edu/Challenges}.}} The DIMACS input file is a plain ASCII text file. It contains {\it lines} of several types described below. A line is terminated with @@ -731,7 +748,9 @@ The lower-case character \verb|e| signifies that this is an edge descriptor line. For an edge (arc) $(i,j)$ the fields \verb|I| and \verb|J| specify its endpoints. -\para{Example.} The following example of an undirected graph: +\newpage + +\para{Example.} The following undirected graph \bigskip @@ -749,7 +768,7 @@ descriptor line. For an edge (arc) $(i,j)$ the fields \verb|I| and \bigskip \noindent -might be coded in DIMACS clique/coloring format as follows: +might be coded in DIMACS clique/coloring format as follows. \begin{footnotesize} \begin{verbatim} @@ -786,6 +805,8 @@ c eof \end{verbatim} \end{footnotesize} +\newpage + \subsection{glp\_write\_ccdata --- write graph to text file in DIMACS clique/coloring\\format} @@ -1025,6 +1046,8 @@ int main(void) \end{verbatim} \end{footnotesize} +\newpage + \noindent If the file `\verb|graph.txt|' contains the following graph: @@ -1255,7 +1278,7 @@ int main(void) \para{DIMACS minimum cost flow problem format\footnote{This material is based on the paper ``The First DIMACS International Algorithm Implementation Challenge: Problem Definitions and -Specifications'', which is publically available at +Specifications'', which is publicly available at \url{http://dimacs.rutgers.edu/Challenges}.}} \label{subsecmincost} @@ -1278,7 +1301,7 @@ character \verb|c|. c This is a comment line \end{verbatim} -\newpage +%\newpage \para{Problem line.} There is one problem line per data file. The problem line must appear before any node or arc descriptor lines. It @@ -1288,6 +1311,8 @@ has the following format: p min NODES ARCS \end{verbatim} +\newpage + \noindent The lower-case character \verb|p| signifies that this is a problem line. The three-character problem designator \verb|min| identifies the file as @@ -1366,6 +1391,8 @@ c eof \end{verbatim} \end{footnotesize} +\newpage + \subsection{glp\_write\_mincost --- write minimum cost flow problem data in DIMACS\\format} @@ -1416,7 +1443,7 @@ automatic compression on writing it.) If the operation was successful, the routine returns zero. Otherwise, it prints an error message and returns non-zero. -\newpage +%\newpage \subsection{glp\_mincost\_lp --- convert minimum cost flow problem to LP} @@ -1542,7 +1569,7 @@ End \end{verbatim} \end{footnotesize} -\newpage +%\newpage \subsection{glp\_mincost\_okalg --- solve minimum cost flow problem with out-of-kilter\\algorithm} @@ -1585,6 +1612,8 @@ bound to the arc flow (the arc capacity). This bound must be integer in the range [$l_{ij}$, \verb|INT_MAX|]. If \verb|a_cap| $<0$, it is assumed that $u_{ij}=1$ for all arcs. +\newpage + The parameter \verb|a_cost| specifies an offset of the field of type \verb|double| in the arc data block, which contains $c_{ij}$, the per-unit cost of the arc flow. This value must be integer in the range @@ -1611,7 +1640,7 @@ bound constraints (see (3) ibid.), using the following formula: $$\lambda_{ij}=c_{ij}-(\pi_i-\pi_j),$$ where $c_{ij}$ is the per-unit cost for arc $(i,j)$. -\newpage +%\newpage Note that all solution components (the objective value, arc flows, and node potentials) computed by the routine are always integer-valued. @@ -1661,6 +1690,8 @@ flow $x_{ts}$ through which is also costless ($c_{ts}=0$) and fixed to $F$ ($l_{ts}=u_{ts}=F$), where $\displaystyle F=\sum_{b_i>0}b_i$ is the total supply. +\newpage + \para{Example} The example program below reads the minimum cost problem instance in @@ -1797,7 +1828,10 @@ per-unit cost of the arc flow. This value must be integer in the range [$-$\verb|INT_MAX|/4, $+$\verb|INT_MAX|/4]. If \verb|a_cost| $<0$, it is assumed that $c_{ij}=0$ for all arcs. -The parameter \verb|crash| is option specifying initialization method: +\newpage + +The parameter \verb|crash| is an option that specifies initialization +method: 0 --- default initialization is used; @@ -1813,8 +1847,6 @@ The parameter \verb|sol| specifies a location, to which the routine stores the objective value (that is, the total cost) found. If \verb|sol| is NULL, the objective value is not stored. -\newpage - The parameter \verb|a_x| specifies an offset of the field of type \verb|double| in the arc data block, to which the routine stores $x_{ij}$, the arc flow found. If \verb|a_x| $<0$, the arc flow value is @@ -1940,6 +1972,8 @@ The parameter \verb|G| specifies the graph object, to which the generated problem data have to be stored. Note that on entry the graph object is erased with the routine \verb|glp_erase_graph|. +\newpage + The parameter \verb|v_rhs| specifies an offset of the field of type \verb|double| in the vertex data block, to which the routine stores the supply or demand value. If \verb|v_rhs| $<0$, the value is not stored. @@ -1948,8 +1982,6 @@ The parameter \verb|a_cap| specifies an offset of the field of type \verb|double| in the arc data block, to which the routine stores the arc capacity. If \verb|a_cap| $<0$, the capacity is not stored. -\newpage - The parameter \verb|a_cost| specifies an offset of the field of type \verb|double| in the arc data block, to which the routine stores the per-unit cost if the arc flow. If \verb|a_cost| $<0$, the cost is not @@ -2002,6 +2034,8 @@ connected, the routine generates a few remaining arcs to ensure connectedness. Thus, the actual number of arcs generated by the routine may be greater than the requested number of arcs. +\newpage + \subsection{glp\_netgen\_prob --- Klingman's standard network problem instance} @@ -2090,6 +2124,8 @@ $$ \end{array} $$ +\newpage + \subsection{glp\_gridgen --- grid-like network problem generator} \synopsis @@ -2104,14 +2140,12 @@ $$ The routine \verb|glp_gridgen| is a GLPK version of the grid-like network problem generator developed by Yusin Lee and Jim Orlin.\footnote{Y.~Lee and J.~Orlin. GRIDGEN generator., 1991. The -original code is publically available from +original code is publicly available from \url{ftp://dimacs.rutgers.edu/pub/netflow/generators/network/gridgen}.} -\newpage - The parameter \verb|G| specifies the graph object, to which the -generated problem data have to be stored. Note that on entry the graph -object is erased with the routine \verb|glp_erase_graph|. +generated problem data have to be stored. Note that on entry the graph +object is erased with the routine \verb|glp_erase_graph|. The parameter \verb|v_rhs| specifies an offset of the field of type \verb|double| in the vertex data block, to which the routine stores the @@ -2162,6 +2196,8 @@ If the instance was successfully generated, the routine \verb|glp_gridgen| returns zero; otherwise, if specified parameters are inconsistent, the routine returns a non-zero error code. +\newpage + \para{Comments\footnote{This material is based on comments to the original version of GRIDGEN.}} @@ -2290,6 +2326,8 @@ $$ $$0\leq x_{ij}\leq u_{ij}\ \ \ \hbox{for all}\ (i,j)\in A \eqno(9)$$ +\newpage + \subsection{glp\_read\_maxflow --- read maximum flow problem data in DIMACS\\format} @@ -2361,7 +2399,7 @@ int main(void) \para{DIMACS maximum flow problem format\footnote{This material is based on the paper ``The First DIMACS International Algorithm Implementation Challenge: Problem Definitions and Specifications'', -which is publically available at +which is publicly available at \url{http://dimacs.rutgers.edu/Challenges/}.}} \label{subsecmaxflow} @@ -2637,10 +2675,10 @@ specifies the maximum flow problem instance to be solved. The parameter $s$ specifies the ordinal number of the source node. -\newpage - The parameter $t$ specifies the ordinal number of the sink node. +\newpage + The parameter \verb|a_cap| specifies an offset of the field of type \verb|double| in the arc data block, which contains $u_{ij}$, the upper bound to the arc flow (the arc capacity). This bound must be integer in @@ -2768,23 +2806,23 @@ pp.~83-123.}$^{,}$\footnote{U.~Derigs and W.~Meier, ``Implementing Goldberg's max-flow algorithm: A computational investigation.'' Zeitschrift f\"ur Operations Research 33 (1989), pp.~383-403.}$^{,}$\footnote{The original code of RMFGEN implemented by -Tamas Badics is publically available from +Tamas Badics is publicly available from \url{ftp://dimacs.rutgers.edu/pub/netflow/generators/network/genrmf}.} The parameter \verb|G| specifies the graph object, to which the generated problem data have to be stored. Note that on entry the graph object is erased with the routine \verb|glp_erase_graph|. -\newpage - The pointers \verb|s| and \verb|t| specify locations, to which the routine stores the source and sink node numbers, respectively. If \verb|s| or \verb|t| is \verb|NULL|, corresponding node number is not stored. The parameter \verb|a_cap| specifies an offset of the field of type -\verb|double| in the arc data block, to which the routine stores the arc -capacity. If \verb|a_cap| $<0$, the capacity is not stored. +\verb|double| in the arc data block, to which the routine stores the +arc capacity. If \verb|a_cap| $<0$, the capacity is not stored. + +\newpage The array \verb|parm| contains description of the network to be generated: @@ -2936,6 +2974,10 @@ directed graph $\overline{G}=(V,A)$, where $V=R\cup S$ and $A=\{(i,j):(i,j)\in E\}$, i.e. every edge $(i,j)\in E$ in $G$ corresponds to arc $(i\rightarrow j)\in A$ in $\overline{G}$. +\newpage + +\setlength{\parskip}{4.4pt} + \subsection{glp\_read\_asnprob --- read assignment problem data in DIMACS format} @@ -3012,10 +3054,14 @@ int main(void) \end{verbatim} \end{footnotesize} +\setlength{\parskip}{5pt} + +\newpage + \para{DIMACS assignment problem format\footnote{This material is based on the paper ``The First DIMACS International Algorithm Implementation Challenge: Problem Definitions and Specifications'', which is -publically available at \url{http://dimacs.rutgers.edu/Challenges/}.}} +publicly available at \url{http://dimacs.rutgers.edu/Challenges/}.}} \label{subsecasnprob} The DIMACS input file is a plain ASCII text file. It contains @@ -3132,8 +3178,6 @@ c eof \end{verbatim} \end{footnotesize} -\newpage - \subsection{glp\_write\_asnprob --- write assignment problem data in DIMACS format} @@ -3168,6 +3212,8 @@ The parameter \verb|a_cost| specifies an offset of the field of type cost. If \verb|a_cost| $<0$, it is assumed that $c_{ij}=1$ for all edges. +\newpage + The character string \verb|fname| specifies a name of the text file to be written out. (If the file name ends with suffix `\verb|.gz|', the file is assumed to be compressed, in which case the routine performs @@ -3240,6 +3286,8 @@ or more outgoing arcs; The routine \verb|glp_asnprob_lp| builds LP problem, which corresponds to the specified assignment problem. +\newpage + The parameter \verb|P| is the resultant LP problem object to be built. Note that on entry its current content is erased with the routine \verb|glp_erase_prob|. @@ -3277,8 +3325,6 @@ The parameter \verb|a_cost| specifies an offset of the field of type cost. If \verb|a_cost| $<0$, it is assumed that $c_{ij}=1$ for all edges. -\newpage - \returns If the LP problem has been successfully built, the routine @@ -3317,6 +3363,8 @@ int main(void) \end{verbatim} \end{footnotesize} +\newpage + If `\verb|sample.asn|' is the example data file from the subsection describing \verb|glp_read_asnprob|, file `\verb|matching.lp|' may look like follows: @@ -3378,6 +3426,8 @@ End \end{verbatim} \end{footnotesize} +\newpage + \subsection{glp\_asnprob\_okalg --- solve assignment problem with out-of-kilter\\algorithm} @@ -3406,8 +3456,6 @@ The parameter \verb|form| defines which LP formulation should be used: \verb|GLP_ASN_MMP| --- maximum weighted matching (11)---(14). -\newpage - The parameter \verb|G| is the graph program object, which specifies the assignment problem instance. @@ -3456,6 +3504,8 @@ integer overflow.\\ \verb||.)\\ \end{retlist} +\newpage + \para{Comments} Since the out-of-kilter algorithm is designed to find a minimal cost @@ -3479,8 +3529,6 @@ arc $(k\rightarrow i)$, flow $x_{ki}$ through which is costless unity upper bound ($l_{ij}=0$, $u_{ij}=1$, in case of \verb|GLP_ASN_MMP|); -\newpage - 4) similarly, for each original node $j\in S$ the routine adds auxiliary demand arc $(j\rightarrow k)$, flow $x_{jk}$ through which is costless ($c_{jk}=0$) and either fixed at 1 ($l_{jk}=u_{jk}=1$, in case @@ -3597,6 +3645,8 @@ indicator: 1 --- the node is in set $S$. +\newpage + \noindent If \verb|v_set| $<0$, it is assumed that a node having no incoming arcs is in set $R$, and a node having no outgoing arcs is in set $S$. @@ -3612,8 +3662,6 @@ matching found. However, if the specified graph is incorrect (as detected by the routine \verb|glp_check_asnprob|), this routine returns a negative value. -\newpage - \para{Comments} The same solution may be obtained with the routine @@ -3668,6 +3716,8 @@ int main(void) If `\verb|sample.asn|' is the example data file from the subsection describing \verb|glp_read_asnprob|, the output may look like follows: +\newpage + \begin{footnotesize} \begin{verbatim} Reading assignment problem data from `sample.asn'... @@ -3757,12 +3807,6 @@ That representation, however, is much less convenient than the one, where jobs are represented as nodes of the network.} The project network for the example above is shown on Fig.~4. -May note that the project network must be acyclic; otherwise, it would -be impossible to satisfy to the precedence relation for any job that -belongs to a cycle. - -\newpage - \hspace*{.5in} \xymatrix {&&&C|3\ar[rd]&&I|5\ar[r]&K|4\ar[rd]&\\ @@ -3776,7 +3820,11 @@ A|3\ar[r]&B|4\ar[rru]\ar[rd]&&E|8\ar[r]&H|8\ar[ru]\ar[rd]&&&M|4\\ \noindent\hfil Fig.~4. An example of the project network. -\medskip +\newpage + +May note that the project network must be acyclic; otherwise, it would +be impossible to satisfy to the precedence relation for any job that +belongs to a cycle. The critical path problem can be naturally formulated as the following LP problem: @@ -3824,8 +3872,6 @@ The parameter \verb|v_es| specifies an offset of the field of type the {\it earliest start time} for corresponding job. If \verb|v_es| $<0$, this time is not stored. -\newpage - The parameter \verb|v_ls| specifies an offset of the field of type \verb|double| in the vertex data block, to which the routine stores the {\it latest start time} for corresponding job. If \verb|v_ls| @@ -3841,6 +3887,8 @@ zero, the corresponding job is critical. The routine \verb|glp_cpp| returns the minimal project duration, i.e. minimal time needed to perform all jobs in the project. +\newpage + \para{Example} The example program below solves the critical path problem shown on @@ -3943,6 +3991,10 @@ Job Time ES EF LS LF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\end{document} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \chapter{Graph Optimization API Routines} \section{Maximum clique problem} diff --git a/resources/3rdparty/glpk-4.57/doc/miplib2.txt b/resources/3rdparty/glpk-4.65/doc/miplib2.txt similarity index 100% rename from resources/3rdparty/glpk-4.57/doc/miplib2.txt rename to resources/3rdparty/glpk-4.65/doc/miplib2.txt diff --git a/resources/3rdparty/glpk-4.57/doc/miplib3.txt b/resources/3rdparty/glpk-4.65/doc/miplib3.txt similarity index 100% rename from resources/3rdparty/glpk-4.57/doc/miplib3.txt rename to resources/3rdparty/glpk-4.65/doc/miplib3.txt diff --git a/resources/3rdparty/glpk-4.57/doc/netlib.txt b/resources/3rdparty/glpk-4.65/doc/netlib.txt similarity index 100% rename from resources/3rdparty/glpk-4.57/doc/netlib.txt rename to resources/3rdparty/glpk-4.65/doc/netlib.txt diff --git a/resources/3rdparty/glpk-4.57/doc/notes/gomory.pdf b/resources/3rdparty/glpk-4.65/doc/notes/gomory.pdf similarity index 100% rename from resources/3rdparty/glpk-4.57/doc/notes/gomory.pdf rename to resources/3rdparty/glpk-4.65/doc/notes/gomory.pdf diff --git a/resources/3rdparty/glpk-4.57/doc/notes/keller.pdf b/resources/3rdparty/glpk-4.65/doc/notes/keller.pdf similarity index 100% rename from resources/3rdparty/glpk-4.57/doc/notes/keller.pdf rename to resources/3rdparty/glpk-4.65/doc/notes/keller.pdf diff --git a/resources/3rdparty/glpk-4.57/doc/notes/scf.pdf b/resources/3rdparty/glpk-4.65/doc/notes/scf.pdf similarity index 100% rename from resources/3rdparty/glpk-4.57/doc/notes/scf.pdf rename to resources/3rdparty/glpk-4.65/doc/notes/scf.pdf diff --git a/resources/3rdparty/glpk-4.65/doc/notes/simplex1.pdf b/resources/3rdparty/glpk-4.65/doc/notes/simplex1.pdf new file mode 100644 index 000000000..af8306dae Binary files /dev/null and b/resources/3rdparty/glpk-4.65/doc/notes/simplex1.pdf differ diff --git a/resources/3rdparty/glpk-4.65/doc/notes/simplex2.pdf b/resources/3rdparty/glpk-4.65/doc/notes/simplex2.pdf new file mode 100644 index 000000000..313ca69a8 Binary files /dev/null and b/resources/3rdparty/glpk-4.65/doc/notes/simplex2.pdf differ diff --git a/resources/3rdparty/glpk-4.65/doc/npp.txt b/resources/3rdparty/glpk-4.65/doc/npp.txt new file mode 100644 index 000000000..e5dc14485 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/doc/npp.txt @@ -0,0 +1,283 @@ +@.@ LP/MIP PREPROCESSING ROUTINES +================================= + +@.@.1 Introduction + +GLPK has a set of routines that constitute so called the LP/MIP +preprocessor. Its main purpose is to improve a given formulation of the +LP or MIP problem instance provided by the user. + +As a rule the LP/MIP preprocessor is used internally (if enabled) in +the LP or MIP solver. However, for various reasons the user may need +to call the preprocessing routines directly in his/her application +program, in which case he/she may use API routines described in this +section. + +The preprocessing of an LP/MIP problem instance and recovering its +solution include several steps, which are performed in the following +order. + +1. Allocating the workspace. The preprocessor allocates the workspace, + an internal data structure used on all subsequent steps. + +2. Loading the original problem instance. The preprocessor copies all + the problem components from the original problem object (glp_prob) + specified by the user into the workspace. On this step the user also + should specify the solution type: basic solution (assumes the + primal or dual simplex solver), interior-point solution (assumes the + interior-point solver), or MIP solution (assumes the MIP solver). + This is needed, because some preprocessing transformations depend on + the solution type. + +3. Preprocessing. The user calls preprocessing routines that transform + the problem instance residing in the workspace. + +4. Building the resultant problem instance. The preprocessor converts + the problem instance from an internal workspace representation + to the standard problem object (glp_prob) and returns that object to + the user. + +5. Solving the resultant problem instance. The user calls an + appropriate solver routine to obtain a solution to the resultant + problem instance. + +6. Postprocessing. The user provides the solution to the resultant + problem instance found on the previous step, and the preprocessor + performs inverse transformations to recover the solution to the + original problem instance. Should note that only optimal or integer + feasible (for MIP) solutions can be recovered. + +7. Obtaining original solution. The preprocessor copies the solution + to the original problem instance recovered on the previous step from + the workspace to the original problem object (glp_prob). The effect + is the same as if the solution were computed by a solver. Note that + steps 6 and 7 can be performed multiple times (for example, to + recover intermediate integer feasible solutions during the integer + optimization). + +8. Freeing the workspace. The preprocessor frees all the memory + allocated to the workspace. + +EXAMPLE + +In this example the program reads the LP problem data from input file +murtagh.mps\footnote{This is an example model included in the GLPK +distribution.}, performs standard preprocessing, solves the resultant +LP with the primal simplex method, and then recovers the solution to +the original LP. + +/* nppsamp.c */ + +#include +#include +#include + +int main(void) +{ glp_prep *npp; + glp_prob *P, *Q; + int ret; + npp = glp_npp_alloc_wksp(); + P = glp_create_prob(); + ret = glp_read_mps(P, GLP_MPS_DECK, NULL, "murtagh.mps"); + if (ret != 0) + { printf("Error on reading problem data\n"); + goto skip; + } + glp_set_obj_dir(P, GLP_MAX); + glp_npp_load_prob(npp, P, GLP_SOL, GLP_ON); + ret = glp_npp_preprocess1(npp, 0); + switch (ret) + { case 0: + break; + case GLP_ENOPFS: + printf("LP has no primal feasible solution\n"); + goto skip; + case GLP_ENODFS: + printf("LP has no dual feasible solution\n"); + goto skip; + default: + xassert(ret != ret); + } + Q = glp_create_prob(); + glp_npp_build_prob(npp, Q); + ret = glp_simplex(Q, NULL); + if (ret == 0 && glp_get_status(Q) == GLP_OPT) + { glp_npp_postprocess(npp, Q); + glp_npp_obtain_sol(npp, P); + } + else + printf("Unable to recover non-optimal solution\n"); + glp_delete_prob(Q); +skip: glp_npp_free_wksp(npp); + glp_delete_prob(P); + return 0; +} + +/* eof */ +------------------------------------------------------------------------ +@.@.2 glp_npp_alloc_wksp - allocate the preprocessor workspace + +SYNOPSIS + +glp_prep *glp_npp_alloc_wksp(void); + +DESCRIPTION + +The routine glp_npp_alloc_wksp allocates the preprocessor workspace. +(Note that multiple instances of the workspace may be allocated, if +necessary.) + +RETURNS + +The routine returns a pointer to the workspace, which should be used in +all subsequent operations. +------------------------------------------------------------------------ +@.@.3 glp_npp_load_prob - load original problem instance + +SYNOPSIS + +void glp_npp_load_prob(glp_prep *prep, glp_prob *P, int sol, + int names); + +DESCRIPTION + +The routine glp_npp_load_prob loads the original problem instance from +the specified problem object P into the preprocessor workspace. (Note +that this operation can be performed only once.) + +The parameter sol specifies which solution is required: + +GLP_SOL - basic solution; + +GLP_IPT - interior-point solution; + +GLP_MIP - mixed integer solution. + +The parameter names is a flag. If it is GLP_ON, the symbolic names of +original rows and columns are also loaded into the workspace. Otherwise, +if the flag is GLP_OFF, the row and column names are not loaded. +------------------------------------------------------------------------ +@.@.4 glp_npp_preprocess1 - perform basic LP/MIP preprocessing + +SYNOPSIS + +int glp_npp_preprocess1(glp_prep *prep, int hard); + +DESCRIPTION + +The routine glp_npp_preprocess1 performs basic LP/MIP preprocessing +that currently includes: + +-- removing free rows; + +-- replacing double-sided constraint rows with almost identical bounds, + by equality constraint rows; + +-- removing fixed columns; + +-- replacing double-bounded columns with almost identical bounds by + fixed columns and removing those columns; + +-- removing empty rows; + +-- removing equality constraint row singletons and corresponding + columns; + +-- removing inequality constraint row singletons and corresponding + columns; + +-- performing general row analysis; + +-- removing redundant row bounds; + +-- removing forcing rows and corresponding columns; + +-- removing rows which become free due to redundant bounds; + +-- computing implied bounds for all columns and using them to + strengthen current column bounds (MIP only, optional, performed if + the flag hard is on); + +-- fixing and removing empty columns; + +-- removing column singletons, which are implied slack variables, and + corresponding rows; + +-- removing bounds of columns, which are implied free variables, and + replacing corresponding rows by equality constraints. + +If the flag hard is GLP_ON, the routine attempts to improve current +column bounds multiple times within the main processing loop, in which +case this feature may take a time. Otherwise, if the flag hard is +GLP_OFF, improving column bounds is performed only once at the end of +the main loop. (Note that this feature is used for MIP only.) + +RETURNS + +0 - the problem instance has been successfully preprocessed; + +GLP_ENOPFS - primal/integer infeasibility has been detected; + +GLP_ENODFS - dual infeasibility has been detected. +------------------------------------------------------------------------ +@.@.5 glp_npp_build_prob - build resultant problem instance + +SYNOPSIS + +void glp_npp_build_prob(glp_prep *prep, glp_prob *Q); + +DESCRIPTION + +The routine glp_npp_build_prob obtains all necessary information from +the preprocessor workspace to build the resultant (preprocessed) +problem instance, and stores it in the specified problem object Q. Note +that before building the current content of this problem object is +erased with the routine glp_erase_prob. +------------------------------------------------------------------------ +@.@.6 glp_npp_postprocess - postprocess solution to resultant problem + +SYNOPSIS + +void glp_npp_postprocess(glp_prep *prep, glp_prob *Q); + +DESCRIPTION + +The routine glp_npp_postprocess performs postprocessing of a solution +to the resultant (preprocessed) problem instance specified by the +problem object Q and recovers corrseponding solution to the original +problem instance. The recovered solution is stored in the preprocessor +workspace and can be obtained with the routine glp_npp_obtain_sol. + +It is assumed that the resultant problem instance Q has been solved +with an appropriate solver depending on the solution type previously +passed to the routine glp_npp_load_prob (the parameter sol). Note that +only optimal or integer feasible (for MIP) solution can be recovered, +so the calling program should use the routine glp_status to make sure +that this condition is met. +------------------------------------------------------------------------ +@.@.7 glp_npp_obtain_sol - obtain solution to original problem + +SYNOPSIS + +void glp_npp_obtain_sol(glp_prep *prep, glp_prob *P); + +DESCRIPTION + +The routine glp_npp_obtain_sol copies the solution to the original +problem instance previously recovered by the routine +glp_npp_postorocess from the preprocessor workspace to the problem +object P. The effect is the same as if the solution were computed by an +appropriate solver. +------------------------------------------------------------------------ +@.@.8 glp_npp_free_wksp - free the preprocessor workspace + +SYNOPSIS + +void glp_npp_free_wksp(glp_prep *prep); + +DESCRIPTION + +The routine glp_npp_free_wksp frees all the memory allocated to the +preprocessor workspace. + +===EOF=== diff --git a/resources/3rdparty/glpk-4.57/examples/INDEX b/resources/3rdparty/glpk-4.65/examples/INDEX similarity index 82% rename from resources/3rdparty/glpk-4.57/examples/INDEX rename to resources/3rdparty/glpk-4.65/examples/INDEX index 2eadbcd97..6b51bf2c8 100644 --- a/resources/3rdparty/glpk-4.57/examples/INDEX +++ b/resources/3rdparty/glpk-4.65/examples/INDEX @@ -17,11 +17,13 @@ food.mod Food manufacture model food2.mod Food manufacture model furnace.mps Electric-arc furnace steelmaking gap.mod Generalized assignment problem +graceful.mod Graceful Tree Labeling Problem graph.mod Graph visualization hashi.mod A solver for the Japanese number-puzzle Hashiwokakero huge.mod Arithmetic mean of a large number of integers icecream.mps Ice cream blending jssp.mod Job-shop scheduling problem +life_goe.mod Conway's Game of Life garden of eden checker magic.mod Magic square maxcut.mod Maximum cut problem maxflow.mod Maximum flow problem @@ -34,9 +36,13 @@ murtagh.mps Oil refinery model mvcp.mod Minimum vertex cover problem numbrix.mod Number placement puzzle pbn/*.* Paint-by-numbers puzzle +pentomino.mod A geometric placement puzzle plan.lp A simple LP problem (CPLEX LP format) plan.mod A simple LP problem (MathProg format) plan.mps A simple LP problem (MPS format) +planarity.mod Graph planarity testing +powpl25h.mod Power plant LP scheduler (25hrs for daylightsavings) +powplant.mod Power plant LP scheduler prod.mod A multiperiod production model qfit.mod Quadratic curve fitting solution queens.mod A classic combinatorial optimization problem @@ -48,11 +54,16 @@ spp.mod Shortest path problem stigler.mod Original Stigler's 1939 diet problem sudoku.mod Number placement puzzle tas.mod Tail assignment problem +tiling.mod Rectifiable polyomino tilings generator todd.mod A class of hard instances of 0-1 knapsack problems +toto.mod Covering code generator, especially for football pool + systems train.mod A model of railroad passenger car allocation transp.mod A transportation problem trick.mod A transportation design problem tsp.mod Traveling salesman problem +wolfra6d.lp Neumann CA grid emulator generator +wolfra6d.mod Neumann CA grid emulator generator xyacfs.mod Extended yet another curve fitting solution yacfs.mod Yet another curve fitting solution zebra.mod Who owns the zebra? diff --git a/resources/3rdparty/glpk-4.57/examples/Makefile.am b/resources/3rdparty/glpk-4.65/examples/Makefile.am similarity index 81% rename from resources/3rdparty/glpk-4.57/examples/Makefile.am rename to resources/3rdparty/glpk-4.65/examples/Makefile.am index 04b6a47cf..7fff13603 100644 --- a/resources/3rdparty/glpk-4.57/examples/Makefile.am +++ b/resources/3rdparty/glpk-4.65/examples/Makefile.am @@ -10,6 +10,6 @@ glpsol_SOURCES = glpsol.c check: glpsol$(EXEEXT) ./glpsol$(EXEEXT) --version - ./glpsol$(EXEEXT) --mps $(srcdir)/plan.mps + ./glpsol$(EXEEXT) --mps $(srcdir)/murtagh.mps --max ## eof ## diff --git a/resources/3rdparty/glpk-4.57/examples/Makefile.in b/resources/3rdparty/glpk-4.65/examples/Makefile.in similarity index 99% rename from resources/3rdparty/glpk-4.57/examples/Makefile.in rename to resources/3rdparty/glpk-4.65/examples/Makefile.in index 9a9c0dca2..efbf3d773 100644 --- a/resources/3rdparty/glpk-4.57/examples/Makefile.in +++ b/resources/3rdparty/glpk-4.65/examples/Makefile.in @@ -137,6 +137,7 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ +NOUNDEFINED = @NOUNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ @@ -551,7 +552,7 @@ uninstall-am: uninstall-binPROGRAMS check: glpsol$(EXEEXT) ./glpsol$(EXEEXT) --version - ./glpsol$(EXEEXT) --mps $(srcdir)/plan.mps + ./glpsol$(EXEEXT) --mps $(srcdir)/murtagh.mps --max # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/resources/3rdparty/glpk-4.57/examples/alloy.mps b/resources/3rdparty/glpk-4.65/examples/alloy.mps similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/alloy.mps rename to resources/3rdparty/glpk-4.65/examples/alloy.mps diff --git a/resources/3rdparty/glpk-4.57/examples/assign.mod b/resources/3rdparty/glpk-4.65/examples/assign.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/assign.mod rename to resources/3rdparty/glpk-4.65/examples/assign.mod diff --git a/resources/3rdparty/glpk-4.57/examples/bpp.mod b/resources/3rdparty/glpk-4.65/examples/bpp.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/bpp.mod rename to resources/3rdparty/glpk-4.65/examples/bpp.mod diff --git a/resources/3rdparty/glpk-4.57/examples/cal.mod b/resources/3rdparty/glpk-4.65/examples/cal.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/cal.mod rename to resources/3rdparty/glpk-4.65/examples/cal.mod diff --git a/resources/3rdparty/glpk-4.57/examples/cf12a.mod b/resources/3rdparty/glpk-4.65/examples/cf12a.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/cf12a.mod rename to resources/3rdparty/glpk-4.65/examples/cf12a.mod diff --git a/resources/3rdparty/glpk-4.57/examples/cf12b.mod b/resources/3rdparty/glpk-4.65/examples/cf12b.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/cf12b.mod rename to resources/3rdparty/glpk-4.65/examples/cf12b.mod diff --git a/resources/3rdparty/glpk-4.57/examples/cflsq.mod b/resources/3rdparty/glpk-4.65/examples/cflsq.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/cflsq.mod rename to resources/3rdparty/glpk-4.65/examples/cflsq.mod diff --git a/resources/3rdparty/glpk-4.57/examples/color.mod b/resources/3rdparty/glpk-4.65/examples/color.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/color.mod rename to resources/3rdparty/glpk-4.65/examples/color.mod diff --git a/resources/3rdparty/glpk-4.57/examples/cplex/README b/resources/3rdparty/glpk-4.65/examples/cplex/README similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/cplex/README rename to resources/3rdparty/glpk-4.65/examples/cplex/README diff --git a/resources/3rdparty/glpk-4.57/examples/cplex/concorde.txt b/resources/3rdparty/glpk-4.65/examples/cplex/concorde.txt similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/cplex/concorde.txt rename to resources/3rdparty/glpk-4.65/examples/cplex/concorde.txt diff --git a/resources/3rdparty/glpk-4.57/examples/cplex/cplex.c b/resources/3rdparty/glpk-4.65/examples/cplex/cplex.c similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/cplex/cplex.c rename to resources/3rdparty/glpk-4.65/examples/cplex/cplex.c diff --git a/resources/3rdparty/glpk-4.57/examples/cplex/cplex.h b/resources/3rdparty/glpk-4.65/examples/cplex/cplex.h similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/cplex/cplex.h rename to resources/3rdparty/glpk-4.65/examples/cplex/cplex.h diff --git a/resources/3rdparty/glpk-4.57/examples/cpp.mod b/resources/3rdparty/glpk-4.65/examples/cpp.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/cpp.mod rename to resources/3rdparty/glpk-4.65/examples/cpp.mod diff --git a/resources/3rdparty/glpk-4.57/examples/crypto.mod b/resources/3rdparty/glpk-4.65/examples/crypto.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/crypto.mod rename to resources/3rdparty/glpk-4.65/examples/crypto.mod diff --git a/resources/3rdparty/glpk-4.57/examples/csv/distances.csv b/resources/3rdparty/glpk-4.65/examples/csv/distances.csv similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/csv/distances.csv rename to resources/3rdparty/glpk-4.65/examples/csv/distances.csv diff --git a/resources/3rdparty/glpk-4.57/examples/csv/markets.csv b/resources/3rdparty/glpk-4.65/examples/csv/markets.csv similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/csv/markets.csv rename to resources/3rdparty/glpk-4.65/examples/csv/markets.csv diff --git a/resources/3rdparty/glpk-4.57/examples/csv/parameters.csv b/resources/3rdparty/glpk-4.65/examples/csv/parameters.csv similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/csv/parameters.csv rename to resources/3rdparty/glpk-4.65/examples/csv/parameters.csv diff --git a/resources/3rdparty/glpk-4.57/examples/csv/plants.csv b/resources/3rdparty/glpk-4.65/examples/csv/plants.csv similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/csv/plants.csv rename to resources/3rdparty/glpk-4.65/examples/csv/plants.csv diff --git a/resources/3rdparty/glpk-4.57/examples/csv/transp_csv.mod b/resources/3rdparty/glpk-4.65/examples/csv/transp_csv.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/csv/transp_csv.mod rename to resources/3rdparty/glpk-4.65/examples/csv/transp_csv.mod diff --git a/resources/3rdparty/glpk-4.57/examples/dbf/ForestMgt_Model_I_GIS_dbf.mod b/resources/3rdparty/glpk-4.65/examples/dbf/ForestMgt_Model_I_GIS_dbf.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/dbf/ForestMgt_Model_I_GIS_dbf.mod rename to resources/3rdparty/glpk-4.65/examples/dbf/ForestMgt_Model_I_GIS_dbf.mod diff --git a/resources/3rdparty/glpk-4.57/examples/dbf/Forest_Cost.dbf b/resources/3rdparty/glpk-4.65/examples/dbf/Forest_Cost.dbf similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/dbf/Forest_Cost.dbf rename to resources/3rdparty/glpk-4.65/examples/dbf/Forest_Cost.dbf diff --git a/resources/3rdparty/glpk-4.57/examples/dbf/NetRev_Table.dbf b/resources/3rdparty/glpk-4.65/examples/dbf/NetRev_Table.dbf similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/dbf/NetRev_Table.dbf rename to resources/3rdparty/glpk-4.65/examples/dbf/NetRev_Table.dbf diff --git a/resources/3rdparty/glpk-4.57/examples/dbf/README b/resources/3rdparty/glpk-4.65/examples/dbf/README similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/dbf/README rename to resources/3rdparty/glpk-4.65/examples/dbf/README diff --git a/resources/3rdparty/glpk-4.57/examples/dbf/TCost_Table.dbf b/resources/3rdparty/glpk-4.65/examples/dbf/TCost_Table.dbf similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/dbf/TCost_Table.dbf rename to resources/3rdparty/glpk-4.65/examples/dbf/TCost_Table.dbf diff --git a/resources/3rdparty/glpk-4.57/examples/dbf/Yield_Table_Vol.dbf b/resources/3rdparty/glpk-4.65/examples/dbf/Yield_Table_Vol.dbf similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/dbf/Yield_Table_Vol.dbf rename to resources/3rdparty/glpk-4.65/examples/dbf/Yield_Table_Vol.dbf diff --git a/resources/3rdparty/glpk-4.57/examples/dbf/cultural_pres.dbf b/resources/3rdparty/glpk-4.65/examples/dbf/cultural_pres.dbf similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/dbf/cultural_pres.dbf rename to resources/3rdparty/glpk-4.65/examples/dbf/cultural_pres.dbf diff --git a/resources/3rdparty/glpk-4.57/examples/dbf/mgt_year.dbf b/resources/3rdparty/glpk-4.65/examples/dbf/mgt_year.dbf similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/dbf/mgt_year.dbf rename to resources/3rdparty/glpk-4.65/examples/dbf/mgt_year.dbf diff --git a/resources/3rdparty/glpk-4.57/examples/dbf/stands.dbf b/resources/3rdparty/glpk-4.65/examples/dbf/stands.dbf similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/dbf/stands.dbf rename to resources/3rdparty/glpk-4.65/examples/dbf/stands.dbf diff --git a/resources/3rdparty/glpk-4.57/examples/dbf/standtype.dbf b/resources/3rdparty/glpk-4.65/examples/dbf/standtype.dbf similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/dbf/standtype.dbf rename to resources/3rdparty/glpk-4.65/examples/dbf/standtype.dbf diff --git a/resources/3rdparty/glpk-4.57/examples/dea.mod b/resources/3rdparty/glpk-4.65/examples/dea.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/dea.mod rename to resources/3rdparty/glpk-4.65/examples/dea.mod diff --git a/resources/3rdparty/glpk-4.57/examples/diet.mod b/resources/3rdparty/glpk-4.65/examples/diet.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/diet.mod rename to resources/3rdparty/glpk-4.65/examples/diet.mod diff --git a/resources/3rdparty/glpk-4.57/examples/dist.mod b/resources/3rdparty/glpk-4.65/examples/dist.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/dist.mod rename to resources/3rdparty/glpk-4.65/examples/dist.mod diff --git a/resources/3rdparty/glpk-4.57/examples/egypt.mod b/resources/3rdparty/glpk-4.65/examples/egypt.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/egypt.mod rename to resources/3rdparty/glpk-4.65/examples/egypt.mod diff --git a/resources/3rdparty/glpk-4.57/examples/fctp.mod b/resources/3rdparty/glpk-4.65/examples/fctp.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/fctp.mod rename to resources/3rdparty/glpk-4.65/examples/fctp.mod diff --git a/resources/3rdparty/glpk-4.57/examples/food.mod b/resources/3rdparty/glpk-4.65/examples/food.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/food.mod rename to resources/3rdparty/glpk-4.65/examples/food.mod diff --git a/resources/3rdparty/glpk-4.57/examples/food2.mod b/resources/3rdparty/glpk-4.65/examples/food2.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/food2.mod rename to resources/3rdparty/glpk-4.65/examples/food2.mod diff --git a/resources/3rdparty/glpk-4.57/examples/furnace.mps b/resources/3rdparty/glpk-4.65/examples/furnace.mps similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/furnace.mps rename to resources/3rdparty/glpk-4.65/examples/furnace.mps diff --git a/resources/3rdparty/glpk-4.57/examples/gap.mod b/resources/3rdparty/glpk-4.65/examples/gap.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/gap.mod rename to resources/3rdparty/glpk-4.65/examples/gap.mod diff --git a/resources/3rdparty/glpk-4.57/src/glpapi21.c b/resources/3rdparty/glpk-4.65/examples/glpsol.c similarity index 93% rename from resources/3rdparty/glpk-4.57/src/glpapi21.c rename to resources/3rdparty/glpk-4.65/examples/glpsol.c index 30866310a..7a0c42c88 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi21.c +++ b/resources/3rdparty/glpk-4.65/examples/glpsol.c @@ -1,10 +1,9 @@ -/* glpapi21.c (stand-alone LP/MIP solver) */ +/* glpsol.c (stand-alone GLPK LP/MIP solver) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2000-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -22,11 +21,23 @@ * along with GLPK. If not, see . ***********************************************************************/ -#include "draft.h" -#include "env.h" -#include "glpgmp.h" -#include "misc.h" -#include "prob.h" +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include + +#define xassert glp_assert +#define xerror glp_error +#define xprintf glp_printf struct csa { /* common storage area */ @@ -94,6 +105,10 @@ struct csa /* input data checking flag; no solution is performed */ const char *new_name; /* new name to be assigned to the problem */ +#if 1 /* 18/I-2018 */ + int hide; + /* clear all symbolic names in the problem object */ +#endif const char *out_mps; /* name of output problem file in fixed MPS format */ const char *out_freemps; @@ -142,6 +157,38 @@ struct csa #endif }; +static int str2int(const char *s, int *x) +{ /* convert string to integer */ + long t; + char *endptr; + t = strtol(s, &endptr, 10); + if (*endptr != '\0') + return 2; + if (!(INT_MIN <= t && t <= INT_MAX)) + return 1; + *x = t; +#if 0 + xprintf("str2int: x = %d\n", *x); +#endif + return 0; +} + +static int str2num(const char *s, double *x) +{ /* convert string to floating point */ + double t; + char *endptr; + t = strtod(s, &endptr); + if (*endptr != '\0') + return 2; + if (!(-DBL_MAX <= t && t <= +DBL_MAX)) + return 1; + *x = t; +#if 0 + xprintf("str2num: x = %g\n", *x); +#endif + return 0; +} + static void print_help(const char *my_name) { /* print help information */ xprintf("Usage: %s [options...] filename\n", my_name); @@ -214,6 +261,10 @@ static void print_help(const char *my_name) xprintf(" --check do not solve problem, check input d" "ata only\n"); xprintf(" --name probname change problem name to probname\n"); +#if 1 /* 18/I-2018 */ + xprintf(" --hide remove all symbolic names from prob" + "lem object\n"); +#endif xprintf(" --wmps filename write problem to filename in fixed " "MPS format\n"); xprintf(" --wfreemps filename\n"); @@ -282,6 +333,15 @@ static void print_help(const char *my_name) "fault)\n"); xprintf(" --norelax use standard \"textbook\" ratio tes" "t\n"); +#if 0 /* 23/VI-2017 */ +#if 1 /* 28/III-2016 */ + xprintf(" --flip use flip-flop ratio test (assumes -" + "-dual)\n"); +#endif +#else + /* now this option is implemented in both primal and dual */ + xprintf(" --flip use long-step ratio test\n"); +#endif xprintf(" --presol use presolver (default; assumes --s" "cale and --adv)\n"); xprintf(" --nopresol do not use presolver\n"); @@ -374,8 +434,7 @@ static void print_version(int briefly) { /* print version information */ xprintf("GLPSOL: GLPK LP/MIP Solver, v%s\n", glp_version()); if (briefly) goto done; - xprintf("\n"); - xprintf("Copyright (C) 2000-2015 Andrew Makhorin, Department for " + xprintf("Copyright (C) 2000-2017 Andrew Makhorin, Department for " "Applied\n"); xprintf("Informatics, Moscow Aviation Institute, Moscow, Russia. " "All rights\n"); @@ -390,7 +449,7 @@ static void print_version(int briefly) done: return; } -static int parse_cmdline(struct csa *csa, int argc, const char *argv[]) +static int parse_cmdline(struct csa *csa, int argc, char *argv[]) { /* parse command-line parameters */ int k; #define p(str) (strcmp(argv[k], str) == 0) @@ -560,6 +619,10 @@ static int parse_cmdline(struct csa *csa, int argc, const char *argv[]) } csa->new_name = argv[k]; } +#if 1 /* 18/I-2018 */ + else if (p("--hide")) + csa->hide = 1; +#endif else if (p("--wmps")) { k++; if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-') @@ -729,6 +792,18 @@ static int parse_cmdline(struct csa *csa, int argc, const char *argv[]) csa->smcp.r_test = GLP_RT_HAR; else if (p("--norelax")) csa->smcp.r_test = GLP_RT_STD; +#if 1 /* 28/III-2016 */ + else if (p("--flip")) +#if 0 /* 23/VI-2017 */ + { csa->smcp.meth = GLP_DUAL; +#else + /* now this option is implemented in both primal and dual */ + { +#endif + csa->smcp.r_test = GLP_RT_FLIP; + csa->iocp.flip = GLP_ON; + } +#endif else if (p("--presol")) csa->smcp.presolve = GLP_ON; else if (p("--nopresol")) @@ -878,7 +953,11 @@ static int parse_cmdline(struct csa *csa, int argc, const char *argv[]) typedef struct { double rhs, pi; } v_data; typedef struct { double low, cap, cost, x; } a_data; -int glp_main(int argc, const char *argv[]) +#ifndef __WOE__ +int main(int argc, char *argv[]) +#else +int __cdecl main(int argc, char *argv[]) +#endif { /* stand-alone LP/MIP solver */ struct csa _csa, *csa = &_csa; int ret; @@ -911,6 +990,9 @@ int glp_main(int argc, const char *argv[]) csa->out_ranges = NULL; csa->check = 0; csa->new_name = NULL; +#if 1 /* 18/I-2018 */ + csa->hide = 0; +#endif csa->out_mps = NULL; csa->out_freemps = NULL; csa->out_cpxlp = NULL; @@ -1040,7 +1122,7 @@ err1: { xprintf("MPS file processing error\n"); #endif xprintf("Seed value %d will be used\n", csa->seed); } - _glp_mpl_init_rand(csa->tran, csa->seed); + glp_mpl_init_rand(csa->tran, csa->seed); /* read model section and optional data section */ if (glp_mpl_read_model(csa->tran, csa->in_file, csa->ndf > 0)) err2: { xprintf("MathProg model processing error\n"); @@ -1108,6 +1190,19 @@ err2: { xprintf("MathProg model processing error\n"); glp_set_obj_dir(csa->prob, csa->dir); /* sort elements of the constraint matrix */ glp_sort_matrix(csa->prob); +#if 1 /* 18/I-2018 */ + /*--------------------------------------------------------------*/ + /* remove all symbolic names from problem object, if required */ + if (csa->hide) + { int i, j; + glp_set_obj_name(csa->prob, NULL); + glp_delete_index(csa->prob); + for (i = glp_get_num_rows(csa->prob); i >= 1; i--) + glp_set_row_name(csa->prob, i, NULL); + for (j = glp_get_num_cols(csa->prob); j >= 1; j--) + glp_set_col_name(csa->prob, j, NULL); + } +#endif /*--------------------------------------------------------------*/ /* write problem data in fixed MPS format, if required */ if (csa->out_mps != NULL) @@ -1183,7 +1278,25 @@ err2: { xprintf("MathProg model processing error\n"); /*--------------------------------------------------------------*/ /* if only problem data check is required, skip computations */ if (csa->check) - { ret = EXIT_SUCCESS; + { +#if 1 /* 29/III-2016 */ + /* report problem characteristics */ + int j, cnt = 0; + xprintf("--- Problem Characteristics ---\n"); + xprintf("Number of rows = %8d\n", + glp_get_num_rows(csa->prob)); + xprintf("Number of columns = %8d\n", + glp_get_num_cols(csa->prob)); + xprintf("Number of non-zeros (matrix) = %8d\n", + glp_get_num_nz(csa->prob)); + for (j = glp_get_num_cols(csa->prob); j >= 1; j--) + { if (glp_get_obj_coef(csa->prob, j) != 0.0) + cnt++; + } + xprintf("Number of non-zeros (objrow) = %8d\n", + cnt); +#endif + ret = EXIT_SUCCESS; goto done; } /*--------------------------------------------------------------*/ @@ -1260,7 +1373,7 @@ err2: { xprintf("MathProg model processing error\n"); } /*--------------------------------------------------------------*/ /* solve the problem */ - start = xtime(); + start = glp_time(); if (csa->solution == SOL_BASIC) { if (!csa->exact) { glp_set_bfcp(csa->prob, &csa->bfcp); @@ -1300,6 +1413,12 @@ err2: { xprintf("MathProg model processing error\n"); #if 0 csa->iocp.msg_lev = GLP_MSG_DBG; csa->iocp.pp_tech = GLP_PP_NONE; +#endif +#ifdef GLP_CB_FUNC /* 05/IV-2016 */ + { extern void GLP_CB_FUNC(glp_tree *, void *); + csa->iocp.cb_func = GLP_CB_FUNC; + csa->iocp.cb_info = NULL; + } #endif glp_intopt(csa->prob, &csa->iocp); } @@ -1307,7 +1426,8 @@ err2: { xprintf("MathProg model processing error\n"); xassert(csa != csa); /*--------------------------------------------------------------*/ /* display statistics */ - xprintf("Time used: %.1f secs\n", xdifftime(xtime(), start)); + xprintf("Time used: %.1f secs\n", glp_difftime(glp_time(), + start)); #if 0 /* 16/II-2012 */ { glp_long tpeak; char buf[50]; @@ -1430,8 +1550,10 @@ done: /* delete the LP/MIP problem object */ /* delete the network problem object, if necessary */ if (csa->graph != NULL) glp_delete_graph(csa->graph); +#if 0 /* 23/XI-2015 */ xassert(gmp_pool_count() == 0); gmp_free_mem(); +#endif /* close log file, if necessary */ if (csa->log_file != NULL) glp_close_tee(); /* check that no memory blocks are still allocated */ diff --git a/resources/3rdparty/glpk-4.65/examples/graceful.mod b/resources/3rdparty/glpk-4.65/examples/graceful.mod new file mode 100644 index 000000000..404206537 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/graceful.mod @@ -0,0 +1,152 @@ +/* Graceful Tree Labeling Problem */ + +/* Author: Mike Appleby */ + +/* The Graceful Labeling Problem for a tree G = (V, E), where V is the + set of vertices and E is the set of edges, is to find a labeling of + the vertices with the integers between 1 and |V| inclusive, such + that no two vertices share a label, and such that each edge is + uniquely identified by the positive, or absolute difference between + the labels of its endpoints. + + In other words, if vl are the vertex labels and el are the edge + labels, then for every edge (u,v) in E, el[u,v]=abs(vl[u] - vl[v]). + + https://en.wikipedia.org/wiki/Graceful_labeling */ + +set V; +/* set of vertices */ + +set E within V cross V; +/* set of edges */ + +set N := 1..card(V); +/* vertex labels */ + +set M := 1..card(V)-1; +/* edge labels */ + +var vx{V, N}, binary; +/* binary encoding of vertex labels. + vx[v,n] == 1 means vertex v has label n. */ + +s.t. vxa{v in V}: sum{n in N} vx[v,n] = 1; +/* each vertex is assigned exactly one label. */ + +s.t. vxb{n in N}: sum{v in V} vx[v,n] = 1; +/* each label is assigned to exactly one vertex. */ + +var vl{V}, integer, >= 1, <= card(V); +/* integer encoding of vertex labels. + vl[v] == n means vertex v has label n. */ + +s.t. vla{v in V}: vl[v] = sum{n in N} n * vx[v,n]; +/* by constraint vxa, exactly one of vx[v,n] == 1 and the rest are + zero. So if vx[v,3] == 1, then vl[v] = 3. */ + +var ex{E, M}, binary; +/* binary encoding of edge labels. + ex[u,v,n] == 1 means edge (u,v) has label n. */ + +s.t. exa{(u,v) in E}: sum{m in M} ex[u,v,m] = 1; +/* each edge is assigned exactly one label. */ + +s.t. exb{m in M}: sum{(u,v) in E} ex[u,v,m] = 1; +/* each label is assigned to exactly one edge. */ + +var el{E}, integer, >= 1, <= card(E); +/* integer encoding of edge labels. + el[u,v] == n means edge (u,v) has label n. */ + +s.t. ela{(u,v) in E}: el[u,v] = sum{m in M} m * ex[u,v,m]; +/* similar to vla above, define integer encoding of edge labels in + terms of the corresponding binary variable. */ + +var gt{E}, binary; +/* gt[u,v] = 1 if vl[u] > vl[v] else 0. + gt helps encode the absolute value constraint, below. */ + +s.t. elb{(u,v) in E}: el[u,v] >= vl[u] - vl[v]; +s.t. elc{(u,v) in E}: el[u,v] <= vl[u] - vl[v] + 2*card(V)*(1-gt[u,v]); +s.t. eld{(u,v) in E}: el[u,v] >= vl[v] - vl[u]; +s.t. ele{(u,v) in E}: el[u,v] <= vl[v] - vl[u] + 2*card(V)*gt[u,v]; + +/* These four constraints together model the absolute value constraint + of the graceful labeling problem: el[u,v] == abs(vl[u] - vl[v]). + However, since the absolute value is a non-linear function, we + transform it into a series of linear constraints, as above. + + To see that these four constraints model the absolute value + condition, consider the following cases: + + if vl[u] > vl[v] and gt[u,v] == 0 then + - ele is unsatisfiable, since the constraint ele amounts to + + el[u,v] <= vl[v] - vl[u] + 0 (since gt[u,v] == 0) + <= -1 (since vl[u] > vl[v]) + + but el[u,v] is declared with lower bound >= 1; hence, the + constraints cannot be satisfied if vl[u] > vl[v] and + gt[u,v] == 0. + + if vl[u] > vl[v] and gt[u,v] == 1 then + - elb and elc together are equivalent to + + vl[u] - vl[v] <= el[u,v] <= vl[u] - vl[v], i.e. + el[u,v] = vl[u] - vl[v] + = abs(vl[u] - vl[v]) (since vl[u] > vl[v]) + + - eld and elc together are equivalent to + + vl[v] - vl[u] <= el[u,v] <= vl[v] - vl[u] + 2|V| + + the tightest possible bounds are + + -1 <= el[u,v] <= |V|+1 + + which is satisfied since both bounds are looser than the + constraints on el's variable declaration, namely + + var el{E}, integer, >= 1, <= card(E); + + where |E| = |V|-1 + + The cases for vl[v] > vl[u] are similar, but with roles reversed + for elb/elc and eld/ele. + + In other words, when vl[u] > vl[v], then gt[u,v] == 1, elb and elc + together model the absolute value constraint, and ele and eld are + satisfied due to bounds constraints on el. When vl[v] > vl[u], then + gt[u,v] == 0, ele and eld model the absolute value constraint, and + elb and elc are satisfied due to bounds constraints on el. + + Note that vl[u] != vl[v], by a combination of constraints vxa, vxb, + and vla. */ + +solve; + +check 0 = card(N symdiff setof{v in V} vl[v]); +/* every vertex label is assigned to one vertex */ + +check 0 = card(M symdiff setof{(u,v) in E} el[u,v]); +/* every edge label is assigned to one edge */ + +check {(u,v) in E} el[u,v] = abs(vl[u] - vl[v]); +/* every edge label for every edge (u,v) == abs(vl[u] - vl[v]) */ + +printf "vertices:\n"; +for{v in V} { printf "\t%s: %d\n", v, vl[v]; } + +printf "edges:\n"; +printf "\torig\tvlabel\telabel\tabs(u-v)\n"; +for{(u,v) in E} { + printf "\t(%s,%s)\t(%d,%d)\t%d\t%d\n", + u, v, vl[u], vl[v], el[u,v], abs(vl[u]-vl[v]); +} + +data; + +set V := a b c d e f g; +set E := a b, a d, a g, b c, b e, e f; + +end; diff --git a/resources/3rdparty/glpk-4.57/examples/graph.mod b/resources/3rdparty/glpk-4.65/examples/graph.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/graph.mod rename to resources/3rdparty/glpk-4.65/examples/graph.mod diff --git a/resources/3rdparty/glpk-4.57/examples/hashi.mod b/resources/3rdparty/glpk-4.65/examples/hashi.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/hashi.mod rename to resources/3rdparty/glpk-4.65/examples/hashi.mod diff --git a/resources/3rdparty/glpk-4.57/examples/huge.mod b/resources/3rdparty/glpk-4.65/examples/huge.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/huge.mod rename to resources/3rdparty/glpk-4.65/examples/huge.mod diff --git a/resources/3rdparty/glpk-4.57/examples/icecream.mps b/resources/3rdparty/glpk-4.65/examples/icecream.mps similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/icecream.mps rename to resources/3rdparty/glpk-4.65/examples/icecream.mps diff --git a/resources/3rdparty/glpk-4.57/examples/iptsamp.c b/resources/3rdparty/glpk-4.65/examples/iptsamp.c similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/iptsamp.c rename to resources/3rdparty/glpk-4.65/examples/iptsamp.c diff --git a/resources/3rdparty/glpk-4.57/examples/jssp.mod b/resources/3rdparty/glpk-4.65/examples/jssp.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/jssp.mod rename to resources/3rdparty/glpk-4.65/examples/jssp.mod diff --git a/resources/3rdparty/glpk-4.65/examples/life_goe.mod b/resources/3rdparty/glpk-4.65/examples/life_goe.mod new file mode 100644 index 000000000..57ca3c367 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/life_goe.mod @@ -0,0 +1,165 @@ +/* Conway's Game of Life garden of eden checker */ + +/* Written and converted to GNU MathProg by NASZVADI, Peter, 199x-2017 + */ + +/* + Conway's Game of Life (ref'd: CGoL) is a Cellular Automata described and + inspected by John H. Conway in the 1970s. CGoL is nothing but a 0-player + game on an infinite two-dimensional Euclydean grid. In the beginning of + the "game", some 1 values are put on some of the grid vertices, and all + others are set to 0. Grid vertices with values are called cells, and a + cell is called "alive", if its value is 1, and called "dead" otherwise, + these are the two "states". The game then turns to an infinite repetitive + process: all cells change together independently at the same time their + states depending only on their actual state and the actual number of + living cells in their so called Moore-neighbourhood: the 4 orthogonal and + 4 diagonal neighbouring cells. Conway also defined the transitions rule: + dead cell become alive if it has exactly 3 living adjacents, and an alive + cell survives only if it has 2 or 3 living neighbours. After executing a + transition for all cells, the two patterns are in a relationship: the + older is the father, the newer is the child. + + It is an interesting problem both in Mathematics and Phylosophy if + there is a fatherless pattern (in CGoL). Fairly trivial existence + proofs had been published since then, and immediately explicit + constructions are followed. + + This GMPL model searches for a father pattern of the pattern specified in + the c parameter matrix, and prints the found one if any both in human + readable format and in RLE format, which could be open with some Cellular + Automata simulators like Golly, for example. + + See more about Garden of Edens: + http://conwaylife.com/wiki/Garden_of_Eden + + Golly CA simulator: + http://golly.sourceforge.net/ + + Tip for running with the example pattern: + glpsol --math life_goe.mod --cuts --last + + WARNING: Rather CPU- and memory-intensive process to find out if a given + pattern is a GOE if it really is! +*/ + +param height, integer, > 0; +/* height of the successor pattern */ + +param width, integer, > 0; +/* width of the successor pattern */ + +set ROWS := 0..height + 1; +/* set of rows of the predecessor */ + +set COLUMNS := 0..width + 1; +/* set of columns of the predecessor */ + +set MOORE := {(0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (-1, 1), (1, -1), + (-1, -1)}; +/* Moore-neighbourhood relative coordinates */ + +param c{ROWS, COLUMNS}, >= 0; +/* Denotes the cellspace of 1st generation, where 0, 1 and 2 means dead, + alive or arbitrary cell values respectively. Usually the frame values + must be set to "2", and also "2" is allowed in the inner rectangle. */ + +set IJalive := setof{(i, j) in ROWS cross COLUMNS: c[i, j] = 1}(i, j); +/* set of alive cells in the child */ + +set IJdead := setof{(i, j) in ROWS cross COLUMNS: c[i, j] = 0}(i, j); +/* set of dead cells in the child */ + +set IJ := IJalive union IJdead; +/* set of cells in the child with enforced states */ + +var x{ROWS, COLUMNS}, binary; +/* father's states */ + +var dpos{ROWS, COLUMNS}, >= 0; +/* positive part of the distances from 6 */ + +var dneg{ROWS, COLUMNS}, >= 0; +/* negative part of the distances from 6 */ + +var dposup{ROWS, COLUMNS}, binary; +/* positive part's upper bound enforcement */ + +var dnegup{ROWS, COLUMNS}, binary; +/* negative part's upper bound enforcement */ + +s.t. maincons{(i, j) in IJ}: + x[i, j] + sum{(a, b) in MOORE} (2 * x[i + a, j + b]) = + 6 + dpos[i,j] - dneg[i,j]; +/* in the LHS, there is a function that maps from all possible 512 state + combinations of a father cell and its Moore-neighbourhood to [0..17]. + And for CGoL, if the child is alive, then it should be between 5 and 7. + Also implicit introduced "d" as distance from 6 in RHS, and immediately + decomposed "d" into positive and negative parts denoted dpos and dneg. */ + +s.t. posbound{(i,j) in IJ}: dpos[i,j] <= 11 * dposup[i,j]; +/* constraining positive part of distance */ + +s.t. negbound{(i,j) in IJ}: dneg[i,j] <= 6 * dnegup[i,j]; +/* constraining negative part of distance */ + +s.t. mutex{(i,j) in IJ}: dposup[i,j] + dnegup[i,j] = 1; +/* Ensuring that at most one is positive among the pos./neg. parts */ + +s.t. alive{(i,j) in IJalive}: dpos[i,j] + dneg[i,j] <= 1; +/* LHS of maincons must be 5, 6 or 7 either due to child cell is alive */ + +s.t. dead{(i,j) in IJdead}: dpos[i,j] + dneg[i,j] >= 2; +/* LHS of maincons must be at most 4 or at least 8 */ + +/* This is a feasibility problem, so no objective is needed */ + +solve; + +printf '\nFound a father pattern:\n\n'; +for{i in ROWS}{ + for{j in COLUMNS}{ + printf '%s%s', if j then ' ' else '', x[i, j].val; + } + printf '\n'; +} + +printf '\nThe father pattern in rle format:\n\n'; +for{i in ROWS}{ + for{j in COLUMNS}{ + printf '%s', if x[i, j].val then 'o' else 'b'; + } + printf '$'; +} +printf '!\n\n'; + +data; +/* + This example is a halved of a 10x10 garden of eden pattern from: + http://wwwhomes.uni-bielefeld.de/achim/orphan_7th.html + It has a 90 degree rotational symmetry, so if having enough resources, + just comment the line denoted with "8", and uncomment the following part! + And also do not forget to increase height parameter, respectively! +*/ + +param height := 7; + +param width := 10; + +param c : 0 1 2 3 4 5 6 7 8 9 10 11 := + 0 2 2 2 2 2 2 2 2 2 2 2 2 + 1 2 0 1 0 1 1 1 0 1 0 0 2 + 2 2 0 0 1 0 1 0 1 0 0 1 2 + 3 2 1 0 1 1 1 0 0 1 1 0 2 + 4 2 0 1 0 1 1 1 1 1 0 1 2 + 5 2 1 0 0 1 0 0 1 1 1 1 2 + 6 2 1 1 1 1 0 0 1 0 0 1 2 + 7 2 1 0 1 1 1 1 1 0 1 0 2 + 8 2 2 2 2 2 2 2 2 2 2 2 2; + +/* 8 2 0 1 1 0 0 1 1 1 0 1 2 + 9 2 1 0 0 1 0 1 0 1 0 0 2 + 10 2 0 0 1 0 1 1 1 0 1 0 2 + 11 2 2 2 2 2 2 2 2 2 2 2 2; */ + +end; diff --git a/resources/3rdparty/glpk-4.57/examples/magic.mod b/resources/3rdparty/glpk-4.65/examples/magic.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/magic.mod rename to resources/3rdparty/glpk-4.65/examples/magic.mod diff --git a/resources/3rdparty/glpk-4.57/examples/maxcut.mod b/resources/3rdparty/glpk-4.65/examples/maxcut.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/maxcut.mod rename to resources/3rdparty/glpk-4.65/examples/maxcut.mod diff --git a/resources/3rdparty/glpk-4.57/examples/maxflow.mod b/resources/3rdparty/glpk-4.65/examples/maxflow.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/maxflow.mod rename to resources/3rdparty/glpk-4.65/examples/maxflow.mod diff --git a/resources/3rdparty/glpk-4.57/examples/mfasp.mod b/resources/3rdparty/glpk-4.65/examples/mfasp.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/mfasp.mod rename to resources/3rdparty/glpk-4.65/examples/mfasp.mod diff --git a/resources/3rdparty/glpk-4.57/examples/mfvsp.mod b/resources/3rdparty/glpk-4.65/examples/mfvsp.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/mfvsp.mod rename to resources/3rdparty/glpk-4.65/examples/mfvsp.mod diff --git a/resources/3rdparty/glpk-4.57/examples/min01ks.mod b/resources/3rdparty/glpk-4.65/examples/min01ks.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/min01ks.mod rename to resources/3rdparty/glpk-4.65/examples/min01ks.mod diff --git a/resources/3rdparty/glpk-4.57/examples/misp.mod b/resources/3rdparty/glpk-4.65/examples/misp.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/misp.mod rename to resources/3rdparty/glpk-4.65/examples/misp.mod diff --git a/resources/3rdparty/glpk-4.57/examples/misp1.dat b/resources/3rdparty/glpk-4.65/examples/misp1.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/misp1.dat rename to resources/3rdparty/glpk-4.65/examples/misp1.dat diff --git a/resources/3rdparty/glpk-4.57/examples/misp2.dat b/resources/3rdparty/glpk-4.65/examples/misp2.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/misp2.dat rename to resources/3rdparty/glpk-4.65/examples/misp2.dat diff --git a/resources/3rdparty/glpk-4.57/examples/money.mod b/resources/3rdparty/glpk-4.65/examples/money.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/money.mod rename to resources/3rdparty/glpk-4.65/examples/money.mod diff --git a/resources/3rdparty/glpk-4.57/examples/mplsamp1.c b/resources/3rdparty/glpk-4.65/examples/mplsamp1.c similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/mplsamp1.c rename to resources/3rdparty/glpk-4.65/examples/mplsamp1.c diff --git a/resources/3rdparty/glpk-4.57/examples/mplsamp2.c b/resources/3rdparty/glpk-4.65/examples/mplsamp2.c similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/mplsamp2.c rename to resources/3rdparty/glpk-4.65/examples/mplsamp2.c diff --git a/resources/3rdparty/glpk-4.57/examples/murtagh.mps b/resources/3rdparty/glpk-4.65/examples/murtagh.mps similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/murtagh.mps rename to resources/3rdparty/glpk-4.65/examples/murtagh.mps diff --git a/resources/3rdparty/glpk-4.57/examples/mvcp.mod b/resources/3rdparty/glpk-4.65/examples/mvcp.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/mvcp.mod rename to resources/3rdparty/glpk-4.65/examples/mvcp.mod diff --git a/resources/3rdparty/glpk-4.57/examples/netgen.c b/resources/3rdparty/glpk-4.65/examples/netgen.c similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/netgen.c rename to resources/3rdparty/glpk-4.65/examples/netgen.c diff --git a/resources/3rdparty/glpk-4.65/examples/nppsamp.c b/resources/3rdparty/glpk-4.65/examples/nppsamp.c new file mode 100644 index 000000000..65f0e693e --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/nppsamp.c @@ -0,0 +1,48 @@ +/* nppsamp.c */ + +#include +#include +#include + +int main(void) +{ glp_prep *prep; + glp_prob *P, *Q; + int ret; + prep = glp_npp_alloc_wksp(); + P = glp_create_prob(); + ret = glp_read_mps(P, GLP_MPS_DECK, NULL, "murtagh.mps"); + if (ret != 0) + { printf("Error on reading problem data\n"); + goto skip; + } + glp_set_obj_dir(P, GLP_MAX); + glp_npp_load_prob(prep, P, GLP_SOL, GLP_ON); + ret = glp_npp_preprocess1(prep, 0); + switch (ret) + { case 0: + break; + case GLP_ENOPFS: + printf("LP has no primal feasible solution\n"); + goto skip; + case GLP_ENODFS: + printf("LP has no dual feasible solution\n"); + goto skip; + default: + glp_assert(ret != ret); + } + Q = glp_create_prob(); + glp_npp_build_prob(prep, Q); + ret = glp_simplex(Q, NULL); + if (ret == 0 && glp_get_status(Q) == GLP_OPT) + { glp_npp_postprocess(prep, Q); + glp_npp_obtain_sol(prep, P); + } + else + printf("Unable to recover non-optimal solution\n"); + glp_delete_prob(Q); +skip: glp_npp_free_wksp(prep); + glp_delete_prob(P); + return 0; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/examples/numbrix.mod b/resources/3rdparty/glpk-4.65/examples/numbrix.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/numbrix.mod rename to resources/3rdparty/glpk-4.65/examples/numbrix.mod diff --git a/resources/3rdparty/glpk-4.57/examples/oldapi/README b/resources/3rdparty/glpk-4.65/examples/oldapi/README similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/oldapi/README rename to resources/3rdparty/glpk-4.65/examples/oldapi/README diff --git a/resources/3rdparty/glpk-4.57/examples/oldapi/lpx.c b/resources/3rdparty/glpk-4.65/examples/oldapi/lpx.c similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/oldapi/lpx.c rename to resources/3rdparty/glpk-4.65/examples/oldapi/lpx.c diff --git a/resources/3rdparty/glpk-4.57/examples/oldapi/lpx.h b/resources/3rdparty/glpk-4.65/examples/oldapi/lpx.h similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/oldapi/lpx.h rename to resources/3rdparty/glpk-4.65/examples/oldapi/lpx.h diff --git a/resources/3rdparty/glpk-4.57/examples/oldapi/lpxsamp.c b/resources/3rdparty/glpk-4.65/examples/oldapi/lpxsamp.c similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/oldapi/lpxsamp.c rename to resources/3rdparty/glpk-4.65/examples/oldapi/lpxsamp.c diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/9dom.dat b/resources/3rdparty/glpk-4.65/examples/pbn/9dom.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/9dom.dat rename to resources/3rdparty/glpk-4.65/examples/pbn/9dom.dat diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/README b/resources/3rdparty/glpk-4.65/examples/pbn/README similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/README rename to resources/3rdparty/glpk-4.65/examples/pbn/README diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/bucks.dat b/resources/3rdparty/glpk-4.65/examples/pbn/bucks.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/bucks.dat rename to resources/3rdparty/glpk-4.65/examples/pbn/bucks.dat diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/cat.dat b/resources/3rdparty/glpk-4.65/examples/pbn/cat.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/cat.dat rename to resources/3rdparty/glpk-4.65/examples/pbn/cat.dat diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/dancer.dat b/resources/3rdparty/glpk-4.65/examples/pbn/dancer.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/dancer.dat rename to resources/3rdparty/glpk-4.65/examples/pbn/dancer.dat diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/disney.dat b/resources/3rdparty/glpk-4.65/examples/pbn/disney.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/disney.dat rename to resources/3rdparty/glpk-4.65/examples/pbn/disney.dat diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/dragon.dat b/resources/3rdparty/glpk-4.65/examples/pbn/dragon.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/dragon.dat rename to resources/3rdparty/glpk-4.65/examples/pbn/dragon.dat diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/edge.dat b/resources/3rdparty/glpk-4.65/examples/pbn/edge.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/edge.dat rename to resources/3rdparty/glpk-4.65/examples/pbn/edge.dat diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/forever.dat b/resources/3rdparty/glpk-4.65/examples/pbn/forever.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/forever.dat rename to resources/3rdparty/glpk-4.65/examples/pbn/forever.dat diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/knot.dat b/resources/3rdparty/glpk-4.65/examples/pbn/knot.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/knot.dat rename to resources/3rdparty/glpk-4.65/examples/pbn/knot.dat diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/light.dat b/resources/3rdparty/glpk-4.65/examples/pbn/light.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/light.dat rename to resources/3rdparty/glpk-4.65/examples/pbn/light.dat diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/mum.dat b/resources/3rdparty/glpk-4.65/examples/pbn/mum.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/mum.dat rename to resources/3rdparty/glpk-4.65/examples/pbn/mum.dat diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/pbn.mod b/resources/3rdparty/glpk-4.65/examples/pbn/pbn.mod similarity index 97% rename from resources/3rdparty/glpk-4.57/examples/pbn/pbn.mod rename to resources/3rdparty/glpk-4.65/examples/pbn/pbn.mod index f9616f104..c4a1b2cf3 100644 --- a/resources/3rdparty/glpk-4.57/examples/pbn/pbn.mod +++ b/resources/3rdparty/glpk-4.65/examples/pbn/pbn.mod @@ -52,16 +52,16 @@ param m, integer, >= 1; param n, integer, >= 1; /* the number of columns */ -param row{i in 1..m, 1..n div 2}, integer, >= 0, default 0; +param row{i in 1..m, 1..(n+1) div 2}, integer, >= 0, default 0; /* the cluster-size sequence for row i (raw data) */ -param col{j in 1..n, 1..m div 2}, integer, >= 0, default 0; +param col{j in 1..n, 1..(m+1) div 2}, integer, >= 0, default 0; /* the cluster-size sequence for column j (raw data) */ -param kr{i in 1..m} := sum{t in 1..n div 2: row[i,t] > 0} 1; +param kr{i in 1..m} := sum{t in 1..(n+1) div 2: row[i,t] > 0} 1; /* the number of clusters in row i */ -param kc{j in 1..n} := sum{t in 1..m div 2: col[j,t] > 0} 1; +param kc{j in 1..n} := sum{t in 1..(m+1) div 2: col[j,t] > 0} 1; /* the number of clusters in column j */ param sr{i in 1..m, t in 1..kr[i]} := row[i,t], integer, >= 1; diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/pbn.pdf b/resources/3rdparty/glpk-4.65/examples/pbn/pbn.pdf similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/pbn.pdf rename to resources/3rdparty/glpk-4.65/examples/pbn/pbn.pdf diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/pbn.tex b/resources/3rdparty/glpk-4.65/examples/pbn/pbn.tex similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/pbn.tex rename to resources/3rdparty/glpk-4.65/examples/pbn/pbn.tex diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/petro.dat b/resources/3rdparty/glpk-4.65/examples/pbn/petro.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/petro.dat rename to resources/3rdparty/glpk-4.65/examples/pbn/petro.dat diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/skid.dat b/resources/3rdparty/glpk-4.65/examples/pbn/skid.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/skid.dat rename to resources/3rdparty/glpk-4.65/examples/pbn/skid.dat diff --git a/resources/3rdparty/glpk-4.57/examples/pbn/swing.dat b/resources/3rdparty/glpk-4.65/examples/pbn/swing.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/pbn/swing.dat rename to resources/3rdparty/glpk-4.65/examples/pbn/swing.dat diff --git a/resources/3rdparty/glpk-4.65/examples/pentomino.mod b/resources/3rdparty/glpk-4.65/examples/pentomino.mod new file mode 100644 index 000000000..56aca7e3b --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/pentomino.mod @@ -0,0 +1,460 @@ +/* PENTOMINO, a geometric placement puzzle */ + +/* Written in GNU MathProg by Andrew Makhorin */ + +/* A pentomino is a plane geometric figure by joining five equal + squares edge to edge. It is a polyomino with five cells. Pentominoes + were defined by Prof. Solomon W. Golomb in his book "Polyominoes: + Puzzles, Patterns, Problems, and Packings." + + There are twelve pentominoes, not counting rotations and reflections + as distinct: + + +---+ + | | + +---+ +---+ +---+ + | | | | | | + +---+---+ +---+ +---+ +---+ + | | | | | | | | | + +---+---+---+ +---+ +---+ +---+---+ + | | | | | | | | | | + +---+---+ +---+ +---+---+ +---+---+ + | | | | | | | | | + +---+ +---+ +---+---+ +---+ + F I L N + + +---+---+ +---+---+---+ +---+ + | | | | | | | | | + +---+---+ +---+---+---+ +---+ +---+ +---+ + | | | | | | | | | | | + +---+---+ +---+ +---+---+---+ +---+---+---+ + | | | | | | | | | | | | + +---+ +---+ +---+---+---+ +---+---+---+ + P T U V + + +---+ + | | + +---+ +---+ +---+---+ +---+---+ + | | | | | | | | | | + +---+---+ +---+---+---+ +---+---+ +---+---+ + | | | | | | | | | | | + +---+---+---+ +---+---+---+ +---+ +---+---+ + | | | | | | | | | | + +---+---+ +---+ +---+ +---+---+ + W X Y Z + + + A classic pentomino puzzle is to tile a given outline, i.e. cover + it without overlap and without gaps. Each of 12 pentominoes has an + area of 5 unit squares, so the outline must have area of 60 units. + Note that it is allowed to rotate and reflect the pentominoes. + + (From Wikipedia, the free encyclopedia.) */ + +set A; +check card(A) = 12; +/* basic set of pentominoes */ + +set B{a in A}; +/* B[a] is a set of distinct versions of pentomino a obtained by its + rotations and reflections */ + +set C := setof{a in A, b in B[a]} b; +check card(C) = 63; +/* set of distinct versions of all pentominoes */ + +set D{c in C}, within {0..4} cross {0..4}; +/* D[c] is a set of squares (i,j), relative to (0,0), that constitute + a distinct version of pentomino c */ + +param m, default 6; +/* number of rows in the outline */ + +param n, default 10; +/* number of columns in the outline */ + +set R, default {1..m} cross {1..n}; +/* set of squares (i,j), relative to (1,1), of the outline to be tiled + with the pentominoes */ + +check card(R) = 60; +/* the outline must have exactly 60 squares */ + +set S := setof{c in C, i in 1..m, j in 1..n: + forall{(ii,jj) in D[c]} ((i+ii,j+jj) in R)} (c,i,j); +/* set of all possible placements, where triplet (c,i,j) means that + the base square (0,0) of a distinct version of pentomino c is placed + at square (i,j) of the outline */ + +var x{(c,i,j) in S}, binary; +/* x[c,i,j] = 1 means that placement (c,i,j) is used in the tiling */ + +s.t. use{a in A}: sum{(c,i,j) in S: substr(c,1,1) = a} x[c,i,j] = 1; +/* every pentomino must be used exactly once */ + +s.t. cov{(i,j) in R}: + sum{(c,ii,jj) in S: (i-ii, j-jj) in D[c]} x[c,ii,jj] = 1; +/* every square of the outline must be covered exactly once */ + +/* this is a feasibility problem, so no objective is needed */ + +solve; + +for {i in 1..m} +{ for {j in 1..n} + { for {0..0: (i,j) in R} + { for {(c,ii,jj) in S: (i-ii,j-jj) in D[c] and x[c,ii,jj]} + printf " %s", substr(c,1,1); + } + for {0..0: (i,j) not in R} + printf " ."; + } + printf "\n"; +} + +data; + +/* These data correspond to a puzzle from the book "Pentominoes" by + Jon Millington */ + +param m := 8; + +param n := 15; + +set R : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 := + 1 - - - - - - - + - - - - - - - + 2 - - - - - - + + + - - - - - - + 3 - - - - - + + + + + - - - - - + 4 - - - - + + + - + + + - - - - + 5 - - - + + + + - + + + + - - - + 6 - - + + + + + - + + + + + - - + 7 - + + + + + + - + + + + + + - + 8 + + + + + + + + + + + + + + + ; + +/* DO NOT CHANGE ANY DATA BELOW! */ + +set A := F, I, L, N, P, T, U, V, W, X, Y, Z; + +set B[F] := F1, F2, F3, F4, F5, F6, F7, F8; +set B[I] := I1, I2; +set B[L] := L1, L2, L3, L4, L5, L6, L7, L8; +set B[N] := N1, N2, N3, N4, N5, N6, N7, N8; +set B[P] := P1, P2, P3, P4, P5, P6, P7, P8; +set B[T] := T1, T2, T3, T4; +set B[U] := U1, U2, U3, U4; +set B[V] := V1, V2, V3, V4; +set B[W] := W1, W2, W3, W4; +set B[X] := X; +set B[Y] := Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8; +set B[Z] := Z1, Z2, Z3, Z4; + +set D[F1] : 0 1 2 := + 0 - + + + 1 + + - + 2 - + - ; + +set D[F2] : 0 1 2 := + 0 - + - + 1 + + + + 2 - - + ; + +set D[F3] : 0 1 2 := + 0 - + - + 1 - + + + 2 + + - ; + +set D[F4] : 0 1 2 := + 0 + - - + 1 + + + + 2 - + - ; + +set D[F5] : 0 1 2 := + 0 + + - + 1 - + + + 2 - + - ; + +set D[F6] : 0 1 2 := + 0 - - + + 1 + + + + 2 - + - ; + +set D[F7] : 0 1 2 := + 0 - + - + 1 + + - + 2 - + + ; + +set D[F8] : 0 1 2 := + 0 - + - + 1 + + + + 2 + - - ; + +set D[I1] : 0 := + 0 + + 1 + + 2 + + 3 + + 4 + ; + +set D[I2] : 0 1 2 3 4 := + 0 + + + + + ; + +set D[L1] : 0 1 := + 0 + - + 1 + - + 2 + - + 3 + + ; + +set D[L2] : 0 1 2 3 := + 0 + + + + + 1 + - - - ; + +set D[L3] : 0 1 := + 0 + + + 1 - + + 2 - + + 3 - + ; + +set D[L4] : 0 1 2 3 := + 0 - - - + + 1 + + + + ; + +set D[L5] : 0 1 := + 0 - + + 1 - + + 2 - + + 3 + + ; + +set D[L6] : 0 1 2 3 := + 0 + - - - + 1 + + + + ; + +set D[L7] : 0 1 := + 0 + + + 1 + - + 2 + - + 3 + - ; + +set D[L8] : 0 1 2 3 := + 0 + + + + + 1 - - - + ; + +set D[N1] : 0 1 := + 0 + - + 1 + - + 2 + + + 3 - + ; + +set D[N2] : 0 1 2 3 := + 0 - + + + + 1 + + - - ; + +set D[N3] : 0 1 := + 0 + - + 1 + + + 2 - + + 3 - + ; + +set D[N4] : 0 1 2 3 := + 0 - - + + + 1 + + + - ; + +set D[N5] : 0 1 := + 0 - + + 1 - + + 2 + + + 3 + - ; + +set D[N6] : 0 1 2 3 := + 0 + + - - + 1 - + + + ; + +set D[N7] : 0 1 := + 0 - + + 1 + + + 2 + - + 3 + - ; + +set D[N8] : 0 1 2 3 := + 0 + + + - + 1 - - + + ; + +set D[P1] : 0 1 := + 0 + + + 1 + + + 2 + - ; + +set D[P2] : 0 1 2 := + 0 + + + + 1 - + + ; + +set D[P3] : 0 1 := + 0 - + + 1 + + + 2 + + ; + +set D[P4] : 0 1 2 := + 0 + + - + 1 + + + ; + +set D[P5] : 0 1 := + 0 + + + 1 + + + 2 - + ; + +set D[P6] : 0 1 2 := + 0 - + + + 1 + + + ; + +set D[P7] : 0 1 := + 0 + - + 1 + + + 2 + + ; + +set D[P8] : 0 1 2 := + 0 + + + + 1 + + - ; + +set D[T1] : 0 1 2 := + 0 + + + + 1 - + - + 2 - + - ; + +set D[T2] : 0 1 2 := + 0 - - + + 1 + + + + 2 - - + ; + +set D[T3] : 0 1 2 := + 0 - + - + 1 - + - + 2 + + + ; + +set D[T4] : 0 1 2 := + 0 + - - + 1 + + + + 2 + - - ; + +set D[U1] : 0 1 2 := + 0 + - + + 1 + + + ; + +set D[U2] : 0 1 := + 0 + + + 1 + - + 2 + + ; + +set D[U3] : 0 1 2 := + 0 + + + + 1 + - + ; + +set D[U4] : 0 1 := + 0 + + + 1 - + + 2 + + ; + +set D[V1] : 0 1 2 := + 0 - - + + 1 - - + + 2 + + + ; + +set D[V2] : 0 1 2 := + 0 + - - + 1 + - - + 2 + + + ; + +set D[V3] : 0 1 2 := + 0 + + + + 1 + - - + 2 + - - ; + +set D[V4] : 0 1 2 := + 0 + + + + 1 - - + + 2 - - + ; + +set D[W1] : 0 1 2 := + 0 - - + + 1 - + + + 2 + + - ; + +set D[W2] : 0 1 2 := + 0 + - - + 1 + + - + 2 - + + ; + +set D[W3] : 0 1 2 := + 0 - + + + 1 + + - + 2 + - - ; + +set D[W4] : 0 1 2 := + 0 + + - + 1 - + + + 2 - - + ; + +set D[X] : 0 1 2 := + 0 - + - + 1 + + + + 2 - + - ; + +set D[Y1] : 0 1 := + 0 + - + 1 + - + 2 + + + 3 + - ; + +set D[Y2] : 0 1 2 3 := + 0 + + + + + 1 - + - - ; + +set D[Y3] : 0 1 := + 0 - + + 1 + + + 2 - + + 3 - + ; + +set D[Y4] : 0 1 2 3 := + 0 - - + - + 1 + + + + ; + +set D[Y5] : 0 1 := + 0 - + + 1 - + + 2 + + + 3 - + ; + +set D[Y6] : 0 1 2 3 := + 0 - + - - + 1 + + + + ; + +set D[Y7] : 0 1 := + 0 + - + 1 + + + 2 + - + 3 + - ; + +set D[Y8] : 0 1 2 3 := + 0 + + + + + 1 - - + - ; + +set D[Z1] : 0 1 2 := + 0 - + + + 1 - + - + 2 + + - ; + +set D[Z2] : 0 1 2 := + 0 + - - + 1 + + + + 2 - - + ; + +set D[Z3] : 0 1 2 := + 0 + + - + 1 - + - + 2 - + + ; + +set D[Z4] : 0 1 2 := + 0 - - + + 1 + + + + 2 + - - ; + +end; diff --git a/resources/3rdparty/glpk-4.57/examples/plan.lp b/resources/3rdparty/glpk-4.65/examples/plan.lp similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/plan.lp rename to resources/3rdparty/glpk-4.65/examples/plan.lp diff --git a/resources/3rdparty/glpk-4.57/examples/plan.mod b/resources/3rdparty/glpk-4.65/examples/plan.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/plan.mod rename to resources/3rdparty/glpk-4.65/examples/plan.mod diff --git a/resources/3rdparty/glpk-4.57/examples/plan.mps b/resources/3rdparty/glpk-4.65/examples/plan.mps similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/plan.mps rename to resources/3rdparty/glpk-4.65/examples/plan.mps diff --git a/resources/3rdparty/glpk-4.65/examples/planarity.mod b/resources/3rdparty/glpk-4.65/examples/planarity.mod new file mode 100644 index 000000000..28d608e42 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/planarity.mod @@ -0,0 +1,109 @@ +/* PLANARITY, Graph Planarity Testing */ + +/* Written in GNU MathProg by Andrew Makhorin */ + +/* Given a graph G = (V, E), where V is a set of vertices and E is + a set of edges (unordered pairs of vertices), this model tests if + G is planar, and if it is, finds its faces for some embedding. + It is assumed that G is loopless and the degree of any its vertex + is at least 2. + + Though there exist linear-time algorithms to test graph planarity, + this MIP feasibility model may be used, for example, to find + an embedding subject to some additional constraints or an "optimal" + embedding. + + This model is based on Mac Lane's planarity characterization that + states that a finite undirected graph is planar iff the cycle space + of the graph (in GF(2)) has a cycle basis in which each edge of the + graph participates in at most two basis vectors. */ + +param nv; +/* number of vertices */ + +set V := 1..nv; +/* set of vertices */ + +set E, within V cross V; +/* set of edges */ + +check{(i,j) in E} i <> j; +/* graph must have no loops */ + +set A := E union setof{(i,j) in E} (j,i); +/* set of arcs, where every edge (i,j) gives two arcs i->j and j->i */ + +check{i in V} sum{(i,j) in A} 1 >= 2; +/* degree of any vertex must be at least 2 */ + +param nf := 2 - nv + card(E); +/* number of faces (including outer face) */ + +set F := 1..nf; +/* set of faces = set of vertices of dual graph */ + +/* Let every face be assigned a unique color. Below we say that arc + i->j has color f if on moving from vertex i to vertex j face f is + located on the left to that arc. (Note that every face is defined + by a cycle mentioned in Mac Lane's characterization. In this model + cycles are constructed explicitly from arcs.) */ + +var x{(i,j) in A, f in F}, binary; +/* x[i,j,f] = 1 means that arc i->j has color f */ + +s.t. r1{(i,j) in A}: sum{f in F} x[i,j,f] = 1; +/* every arc must have exactly one color */ + +s.t. r2{j in V, f in F}: sum{(i,j) in A} x[i,j,f] <= 1; +/* two or more arcs of the same color must not enter the same vertex */ + +s.t. r3{j in V, f in F}: + sum{(i,j) in A} x[i,j,f] = sum{(j,i) in A} x[j,i,f]; +/* if arc of color f enters some vertex, exactly one arc of the same + color must leave that vertex */ + +s.t. r4{(i,j) in E, f in F}: x[i,j,f] + x[j,i,f] <= 1; +/* arcs that correspond to the same edge must have different colors + (to avoid invalid faces i->j->i) */ + +s.t. r5{f in F}: sum{(i,j) in A} x[i,j,f] >= 1; +/* every color must be used at least once */ + +/* this is a feasibility problem, so no objective is needed */ + +solve; + +printf "number of vertices = %d\n", nv; +printf "number of edges = %d\n", card(A) / 2; +printf "number of faces = %d\n", nf; + +for {f in F} +{ printf "face %d:", f; + printf {(i,j) in A: x[i,j,f] = 1} " %d->%d", i, j; + printf "\n"; +} + +data; + +/* The data below correspond to the following (planar) graph: + + 1 - 2 - - 3 - - 4 + | | | + | | | + 5 - 6 | | + | \ | | + | \ | | + 7 - - - - 8 - - 9 - - - - 10- - -11 + | / | \ | | + | / | \ | | + | / | \ | | + | / | \ | | + 12 - - - -13 - - - - - - - 14- - -15 */ + +param nv := 15; + +set E := (1,2) (1,5) (2,3) (3,4) (3,8) (4,9) (5,6) (5,7) (6,8) + (7,8) (7,12) (8,9) (8,12) (8,13) (9,10) (9,14) (10,11) + (10,14) (11,15) (12,13) (13,14) (14,15) ; + +end; diff --git a/resources/3rdparty/glpk-4.65/examples/powpl25h.mod b/resources/3rdparty/glpk-4.65/examples/powpl25h.mod new file mode 100644 index 000000000..bdeefb9c3 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/powpl25h.mod @@ -0,0 +1,203 @@ +/* Power plant LP scheduler, example data with 25hrs for daylightsavings */ + +/* Implemented, inspected, written and converted to GNU MathProg + by NASZVADI, Peter, 199x-2017 */ + +/* + Fast electric power plant scheduler implementation based on new + results in author's Thesis. + + The base problem is: + * given some power plants + * a short time scale partitioned to equidistant intervals + * the task is to yielding the cheapest schedule for the plants + * the daily demand forecast is usually accurate and part of the input + + The power plants has technical limitations: + * upper and lower bounds of produced energy + * and also a gradient barrier in both directions + (can depend on time, but this GMPL implementation is simplified) + * Also units with same properties (technical and price) should be + scheduled together usually with near same performance values + * Assumed a simplified network topology, which is contractive, so + keeping Kirchhoff's laws is a necessary constraint too + * All solutions must be integer + + The LP relaxation is equivalent with the MIP problem due to the + model's matrix interesting property: it is Totally Unimodular + (proven in 2004 by author) and also a Network Matrix (2006, + presented at OTDK 2016, Szeged, Hungary) so: + * it is strictly polynomial if it is solved by most simplex algs + * all base solutions become integer if the RHS vector is integer + (it is in real life, so this is an acceptable assumption) + * The transposed matrix is NOT a Network Matrix in most cases! + + However, adding several other constraints easily turns the problem + to be NP-hard, which is also pinpointed and discussed in the Thesis. + + See more about electric power plants' scheduling in the + author's Thesis (in Hungarian): + http://www.cs.elte.hu/matdiploma/vuk.pdf + + It is possible to run with custom parameters, what is needed + to define is: + * TIME set (daylightsaving cases or other than hour intervals) + * PLANTS set (the 'Demand' is mandatory and usually negative) + * PRICE parameter (can be negative if energy is sold to a consumer) + * BOUND parameter (technical bounds) + * MAXGRAD parameter (technical bounds) + + Then generate a pretty-printed solution by typing: + glpsol --math powpl25h.mod +*/ + +set TIME, default { + '00:00', '01:00', '02:00', '03:00', '04:00', + '05:00', '06:00', '07:00', '08:00', '09:00', + '10:00', '11:00', '12:00', '13:00', '14:00', + '15:00', '16:00', '17:00', '18:00', '19:00', + '20:00', '21:00', '22:00', '23:00', '24:00' +}; +/* Time labels, assumed natural ordering. daylightsaving's bias + can be inserted p.ex. in Central Europe like: + ... '01:00', '02:00', '02:00b', '03:00', ... */ + +set TADJ := setof{(r, s) in TIME cross TIME: r < s}(r, s) diff + setof{(t, u, v) in TIME cross TIME cross TIME: t < u and u < v}(t, v); +/* Tricky adjacent time label generator because GMPL lacks order determination + of set elements (except intervals composed of equidistant numbers) */ + +set PLANTS, default {'Demand'}; +/* Demand is a promoted, mandatory one, usually filled + with negative MW values in data section */ + +set DIRECTION, default {'Up', 'Down'}; +/* All possible directions of gradients, do not touch */ + +param MAXINT, default 10000; +/* A "macro" for bounding absolute value of all used numbers + and used as default value */ + +param PRICE{PLANTS}, default MAXINT; +/* Should be specified in data section, self-explanatory. + can be negative if there are energy buyers */ + +param BOUND{(p, t, d) in PLANTS cross TIME cross DIRECTION}, + default if t = '00:00' then if d = 'Down' then BOUND[p, t, 'Up'] else 0 else + if p <> 'Demand' or d = 'Up' then sum{(u, v) in TADJ: v = t} BOUND[p, u, d] + else BOUND[p, t, 'Up']; +/* Obvious, technical bounds of each power plant unit (real or virtual like + 'Demand'). If some parts are not given in data section, calculated + from preceeding values. Also for time '00:00', its 'Down' values by + default are the same as denoted with 'Up' */ + +param MAXGRAD{(p, d) in PLANTS cross DIRECTION}, default MAXINT; +/* Usually nonnegative integer, might differ in distinct directions per unit + in the cited thesis, it is allowed to gradient bounds to depend on time, + but this is a simplified model */ + +var x{(t, p) in TIME cross PLANTS}, <= BOUND[p, t, 'Up'], >= BOUND[p, t, 'Down']; +/* The schedule, dimension is MW */ + +s.t. kirchhoff{t in TIME: t <> '00:00'}: sum{p in PLANTS} x[t, p] = 0; +/* Conservative property */ + +s.t. gradient{(p, t, u) in PLANTS cross TADJ}: + -MAXGRAD[p, 'Down'] <= x[t, p] - x[u, p] <= MAXGRAD[p, 'Up']; +/* Technical limitations, each unit usually cannot change performance + arbitrarily in a short time, so limited in both directions per time unit*/ + +minimize obj: sum{(t, p) in TIME cross PLANTS}(x[t, p] * PRICE[p]); +/* The objective is the cost of the schedule */ + +solve; + +/* Pretty print solution in table */ + +printf '+--------+'; +for{p in PLANTS}{ + printf '-% 6s-+', '------'; +} +printf '\n'; +printf '|%7s |', ' '; +for{p in PLANTS}{ + printf ' % 6s |', p; +} +printf '\n'; +printf '+--------+'; +for{p in PLANTS}{ + printf '-% 6s-+', '------'; +} +printf '\n'; +for{t in TIME}{ + printf '|%7s |', t; + for{p in PLANTS}{ + printf ' % 6s |', x[t, p].val; + } + printf '\n'; +} +printf '+--------+'; +for{p in PLANTS}{ + printf '-% 6s-+', '------'; +} +printf '\n'; + +data; + +set TIME := + '00:00', '01:00', '02:00', '02:00b', '03:00', '04:00', + '05:00', '06:00', '07:00', '08:00', '09:00', + '10:00', '11:00', '12:00', '13:00', '14:00', + '15:00', '16:00', '17:00', '18:00', '19:00', + '20:00', '21:00', '22:00', '23:00', '24:00'; + +/* + Generated random default values and names, the demand is the sum of + 2 sinewaves. + Also specified a treshold for nuclear plants from 15:00 till 19:00 + The sun is shining only morning and in the afternoon: 07:00-18:00, so + solar plant cannot produce electric energy after sunset. + + Only touch this section, or export it to a data file! +*/ + +set PLANTS 'Demand', 'Atom1', 'Atom2', 'Coal', 'Gas1', 'Gas2', 'Green', 'Oil', 'Solar', 'Dam'; + +param PRICE := + 'Demand' 0 + 'Atom1' 2 + 'Atom2' 2 + 'Coal' 15.6 + 'Gas1' 12 + 'Gas2' 11.5 + 'Green' 8.8 + 'Oil' 23.3 + 'Solar' 7.6 + 'Dam' 3; +/* price per MW */ + +param BOUND := + [*, *, 'Up'] (tr): 'Atom1' 'Atom2' 'Coal' 'Gas1' 'Gas2' 'Green' 'Oil' 'Solar' 'Dam' := + '00:00' 240 240 100 150 150 20 90 0 20 + '01:00' 240 240 155 192 208 35 230 0 20 + [*, *, 'Up'] (tr): 'Atom1' 'Atom2' := + '15:00' 200 200 + '19:00' 235 235 + [*, *, 'Up'] (tr): 'Solar' := + '07:00' 20 + '18:00' 0 + [*, *, 'Down'] (tr): 'Atom1' 'Atom2' 'Coal' 'Gas1' 'Gas2' 'Green' 'Oil' 'Solar' 'Dam' := + '01:00' 100 100 50 62 68 0 75 0 20 + [*, *, 'Up'] : '01:00' '02:00' '02:00b' '03:00' '04:00' '05:00' '06:00' '07:00' '08:00' := + 'Demand' -868 -851 -842 -837 -791 -887 -912 -1046 -1155 + [*, *, 'Up'] : '09:00' '10:00' '11:00' '12:00' '13:00' '14:00' '15:00' '16:00' := + 'Demand' -945 -873 -797 -990 -1241 -1134 -815 -782 + [*, *, 'Up'] : '17:00' '18:00' '19:00' '20:00' '21:00' '22:00' '23:00' '24:00' := + 'Demand' -772 -827 -931 -1105 -1215 -1249 -1183 -952; + +param MAXGRAD (tr) + : 'Atom1' 'Atom2' 'Coal' 'Gas1' 'Gas2' 'Green' 'Oil' 'Solar' 'Dam' := + 'Up' 30 30 35 89 95 5 56 2 4 + 'Down' 30 30 45 96 102 5 56 2 4; + +end; diff --git a/resources/3rdparty/glpk-4.65/examples/powplant.mod b/resources/3rdparty/glpk-4.65/examples/powplant.mod new file mode 100644 index 000000000..3b5d73e32 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/powplant.mod @@ -0,0 +1,200 @@ +/* Power plant LP scheduler */ + +/* Implemented, inspected, written and converted to GNU MathProg + by NASZVADI, Peter, 199x-2017 */ + +/* + Fast electric power plant scheduler implementation based on new + results in author's Thesis. + + The base problem is: + * given some power plants + * a short time scale partitioned to equidistant intervals + * the task is to yielding the cheapest schedule for the plants + * the daily demand forecast is usually accurate and part of the input + + The power plants has technical limitations: + * upper and lower bounds of produced energy + * and also a gradient barrier in both directions + (can depend on time, but this GMPL implementation is simplified) + * Also units with same properties (technical and price) should be + scheduled together usually with near same performance values + * Assumed a simplified network topology, which is contractive, so + keeping Kirchhoff's laws is a necessary constraint too + * All solutions must be integer + + The LP relaxation is equivalent with the MIP problem due to the + model's matrix interesting property: it is Totally Unimodular + (proven in 2004 by author) and also a Network Matrix (2006, + presented at OTDK 2016, Szeged, Hungary) so: + * it is strictly polynomial if it is solved by most simplex algs + * all base solutions become integer if the RHS vector is integer + (it is in real life, so this is an acceptable assumption) + * The transposed matrix is NOT a Network Matrix in most cases! + + However, adding several other constraints easily turns the problem + to be NP-hard, which is also pinpointed and discussed in the Thesis. + + See more about electric power plants' scheduling in the + author's Thesis (in Hungarian): + http://www.cs.elte.hu/matdiploma/vuk.pdf + + It is possible to run with custom parameters, what is needed + to define is: + * TIME set (daylightsaving cases or other than hour intervals) + * PLANTS set (the 'Demand' is mandatory and usually negative) + * PRICE parameter (can be negative if energy is sold to a consumer) + * BOUND parameter (technical bounds) + * MAXGRAD parameter (technical bounds) + + Then generate a pretty-printed solution by typing: + glpsol --math powplant.mod [--data NEW_DATA.dat] + + where "NEW_DATA.dat" should contain the above 5 structures filled + with custom data. Square brackets shoudn't be entered, and specifying + custom data file is optional. +*/ + +set TIME, default { + '00:00', '01:00', '02:00', '03:00', '04:00', + '05:00', '06:00', '07:00', '08:00', '09:00', + '10:00', '11:00', '12:00', '13:00', '14:00', + '15:00', '16:00', '17:00', '18:00', '19:00', + '20:00', '21:00', '22:00', '23:00', '24:00' +}; +/* Time labels, assumed natural ordering. daylightsaving's bias + can be inserted p.ex. in Central Europe like: + ... '01:00', '02:00', '02:00b', '03:00', ... */ + +set TADJ := setof{(r, s) in TIME cross TIME: r < s}(r, s) diff + setof{(t, u, v) in TIME cross TIME cross TIME: t < u and u < v}(t, v); +/* Tricky adjacent time label generator because GMPL lacks order determination + of set elements (except intervals composed of equidistant numbers) */ + +set PLANTS, default {'Demand'}; +/* Demand is a promoted, mandatory one, usually filled + with negative MW values in data section */ + +set DIRECTION, default {'Up', 'Down'}; +/* All possible directions of gradients, do not touch */ + +param MAXINT, default 10000; +/* A "macro" for bounding absolute value of all used numbers + and used as default value */ + +param PRICE{PLANTS}, default MAXINT; +/* Should be specified in data section, self-explanatory. + can be negative if there are energy buyers */ + +param BOUND{(p, t, d) in PLANTS cross TIME cross DIRECTION}, + default if t = '00:00' then if d = 'Down' then BOUND[p, t, 'Up'] else 0 else + if p <> 'Demand' or d = 'Up' then sum{(u, v) in TADJ: v = t} BOUND[p, u, d] + else BOUND[p, t, 'Up']; +/* Obvious, technical bounds of each power plant unit (real or virtual like + 'Demand'). If some parts are not given in data section, calculated + from preceeding values. Also for time '00:00', its 'Down' values by + default are the same as denoted with 'Up' */ + +param MAXGRAD{(p, d) in PLANTS cross DIRECTION}, default MAXINT; +/* Usually nonnegative integer, might differ in distinct directions per unit + in the cited thesis, it is allowed to gradient bounds to depend on time, + but this is a simplified model */ + +var x{(t, p) in TIME cross PLANTS}, <= BOUND[p, t, 'Up'], >= BOUND[p, t, 'Down']; +/* The schedule, dimension is MW */ + +s.t. kirchhoff{t in TIME: t <> '00:00'}: sum{p in PLANTS} x[t, p] = 0; +/* Conservative property */ + +s.t. gradient{(p, t, u) in PLANTS cross TADJ}: + -MAXGRAD[p, 'Down'] <= x[t, p] - x[u, p] <= MAXGRAD[p, 'Up']; +/* Technical limitations, each unit usually cannot change performance + arbitrarily in a short time, so limited in both directions per time unit*/ + +minimize obj: sum{(t, p) in TIME cross PLANTS}(x[t, p] * PRICE[p]); +/* The objective is the cost of the schedule */ + +solve; + +/* Pretty print solution in table */ + +printf '+--------+'; +for{p in PLANTS}{ + printf '-% 6s-+', '------'; +} +printf '\n'; +printf '|%7s |', ' '; +for{p in PLANTS}{ + printf ' % 6s |', p; +} +printf '\n'; +printf '+--------+'; +for{p in PLANTS}{ + printf '-% 6s-+', '------'; +} +printf '\n'; +for{t in TIME}{ + printf '|%7s |', t; + for{p in PLANTS}{ + printf ' % 6s |', x[t, p].val; + } + printf '\n'; +} +printf '+--------+'; +for{p in PLANTS}{ + printf '-% 6s-+', '------'; +} +printf '\n'; + +data; + +/* + Generated random default values and names, the demand is the sum of + 2 sinewaves. + Also specified a treshold for nuclear plants from 15:00 till 19:00 + The sun is shining only morning and in the afternoon: 07:00-18:00, so + solar plant cannot produce electric energy after sunset. + + Only touch this section, or export it to a data file! +*/ + +set PLANTS 'Demand', 'Atom1', 'Atom2', 'Coal', 'Gas1', 'Gas2', 'Green', 'Oil', 'Solar', 'Dam'; + +param PRICE := + 'Demand' 0 + 'Atom1' 2 + 'Atom2' 2 + 'Coal' 15.6 + 'Gas1' 12 + 'Gas2' 11.5 + 'Green' 8.8 + 'Oil' 23.3 + 'Solar' 7.6 + 'Dam' 3; +/* price per MW */ + +param BOUND := + [*, *, 'Up'] (tr): 'Atom1' 'Atom2' 'Coal' 'Gas1' 'Gas2' 'Green' 'Oil' 'Solar' 'Dam' := + '00:00' 240 240 100 150 150 20 90 0 20 + '01:00' 240 240 155 192 208 35 230 0 20 + [*, *, 'Up'] (tr): 'Atom1' 'Atom2' := + '15:00' 200 200 + '19:00' 235 235 + [*, *, 'Up'] (tr): 'Solar' := + '07:00' 20 + '18:00' 0 + [*, *, 'Down'] (tr): 'Atom1' 'Atom2' 'Coal' 'Gas1' 'Gas2' 'Green' 'Oil' 'Solar' 'Dam' := + '01:00' 100 100 50 62 68 0 75 0 20 + [*, *, 'Up'] : '01:00' '02:00' '03:00' '04:00' '05:00' '06:00' '07:00' '08:00' := + 'Demand' -868 -851 -837 -791 -887 -912 -1046 -1155 + [*, *, 'Up'] : '09:00' '10:00' '11:00' '12:00' '13:00' '14:00' '15:00' '16:00' := + 'Demand' -945 -873 -797 -990 -1241 -1134 -815 -782 + [*, *, 'Up'] : '17:00' '18:00' '19:00' '20:00' '21:00' '22:00' '23:00' '24:00' := + 'Demand' -772 -827 -931 -1105 -1215 -1249 -1183 -952; + +param MAXGRAD (tr) + : 'Atom1' 'Atom2' 'Coal' 'Gas1' 'Gas2' 'Green' 'Oil' 'Solar' 'Dam' := + 'Up' 30 30 35 89 95 5 56 2 4 + 'Down' 30 30 45 96 102 5 56 2 4; + +end; diff --git a/resources/3rdparty/glpk-4.57/examples/prod.mod b/resources/3rdparty/glpk-4.65/examples/prod.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/prod.mod rename to resources/3rdparty/glpk-4.65/examples/prod.mod diff --git a/resources/3rdparty/glpk-4.57/examples/qfit.mod b/resources/3rdparty/glpk-4.65/examples/qfit.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/qfit.mod rename to resources/3rdparty/glpk-4.65/examples/qfit.mod diff --git a/resources/3rdparty/glpk-4.57/examples/queens.mod b/resources/3rdparty/glpk-4.65/examples/queens.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/queens.mod rename to resources/3rdparty/glpk-4.65/examples/queens.mod diff --git a/resources/3rdparty/glpk-4.57/examples/samp1.mps b/resources/3rdparty/glpk-4.65/examples/samp1.mps similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/samp1.mps rename to resources/3rdparty/glpk-4.65/examples/samp1.mps diff --git a/resources/3rdparty/glpk-4.57/examples/samp2.mps b/resources/3rdparty/glpk-4.65/examples/samp2.mps similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/samp2.mps rename to resources/3rdparty/glpk-4.65/examples/samp2.mps diff --git a/resources/3rdparty/glpk-4.57/examples/sample.asn b/resources/3rdparty/glpk-4.65/examples/sample.asn similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sample.asn rename to resources/3rdparty/glpk-4.65/examples/sample.asn diff --git a/resources/3rdparty/glpk-4.57/examples/sample.c b/resources/3rdparty/glpk-4.65/examples/sample.c similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sample.c rename to resources/3rdparty/glpk-4.65/examples/sample.c diff --git a/resources/3rdparty/glpk-4.57/examples/sample.clq b/resources/3rdparty/glpk-4.65/examples/sample.clq similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sample.clq rename to resources/3rdparty/glpk-4.65/examples/sample.clq diff --git a/resources/3rdparty/glpk-4.57/examples/sample.cnf b/resources/3rdparty/glpk-4.65/examples/sample.cnf similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sample.cnf rename to resources/3rdparty/glpk-4.65/examples/sample.cnf diff --git a/resources/3rdparty/glpk-4.57/examples/sample.col b/resources/3rdparty/glpk-4.65/examples/sample.col similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sample.col rename to resources/3rdparty/glpk-4.65/examples/sample.col diff --git a/resources/3rdparty/glpk-4.57/examples/sample.max b/resources/3rdparty/glpk-4.65/examples/sample.max similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sample.max rename to resources/3rdparty/glpk-4.65/examples/sample.max diff --git a/resources/3rdparty/glpk-4.57/examples/sample.min b/resources/3rdparty/glpk-4.65/examples/sample.min similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sample.min rename to resources/3rdparty/glpk-4.65/examples/sample.min diff --git a/resources/3rdparty/glpk-4.57/examples/sat.mod b/resources/3rdparty/glpk-4.65/examples/sat.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sat.mod rename to resources/3rdparty/glpk-4.65/examples/sat.mod diff --git a/resources/3rdparty/glpk-4.57/examples/shiftcov.mod b/resources/3rdparty/glpk-4.65/examples/shiftcov.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/shiftcov.mod rename to resources/3rdparty/glpk-4.65/examples/shiftcov.mod diff --git a/resources/3rdparty/glpk-4.57/examples/shikaku.mod b/resources/3rdparty/glpk-4.65/examples/shikaku.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/shikaku.mod rename to resources/3rdparty/glpk-4.65/examples/shikaku.mod diff --git a/resources/3rdparty/glpk-4.57/examples/sorting.mod b/resources/3rdparty/glpk-4.65/examples/sorting.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sorting.mod rename to resources/3rdparty/glpk-4.65/examples/sorting.mod diff --git a/resources/3rdparty/glpk-4.57/examples/spp.mod b/resources/3rdparty/glpk-4.65/examples/spp.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/spp.mod rename to resources/3rdparty/glpk-4.65/examples/spp.mod diff --git a/resources/3rdparty/glpk-4.57/examples/spxsamp1.c b/resources/3rdparty/glpk-4.65/examples/spxsamp1.c similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/spxsamp1.c rename to resources/3rdparty/glpk-4.65/examples/spxsamp1.c diff --git a/resources/3rdparty/glpk-4.57/examples/spxsamp2.c b/resources/3rdparty/glpk-4.65/examples/spxsamp2.c similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/spxsamp2.c rename to resources/3rdparty/glpk-4.65/examples/spxsamp2.c diff --git a/resources/3rdparty/glpk-4.57/examples/sql/README b/resources/3rdparty/glpk-4.65/examples/sql/README similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sql/README rename to resources/3rdparty/glpk-4.65/examples/sql/README diff --git a/resources/3rdparty/glpk-4.57/examples/sql/mysql_setup.sh b/resources/3rdparty/glpk-4.65/examples/sql/mysql_setup.sh similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sql/mysql_setup.sh rename to resources/3rdparty/glpk-4.65/examples/sql/mysql_setup.sh diff --git a/resources/3rdparty/glpk-4.57/examples/sql/sudoku.sql b/resources/3rdparty/glpk-4.65/examples/sql/sudoku.sql similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sql/sudoku.sql rename to resources/3rdparty/glpk-4.65/examples/sql/sudoku.sql diff --git a/resources/3rdparty/glpk-4.57/examples/sql/sudoku_mysql.mod b/resources/3rdparty/glpk-4.65/examples/sql/sudoku_mysql.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sql/sudoku_mysql.mod rename to resources/3rdparty/glpk-4.65/examples/sql/sudoku_mysql.mod diff --git a/resources/3rdparty/glpk-4.57/examples/sql/sudoku_odbc.mod b/resources/3rdparty/glpk-4.65/examples/sql/sudoku_odbc.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sql/sudoku_odbc.mod rename to resources/3rdparty/glpk-4.65/examples/sql/sudoku_odbc.mod diff --git a/resources/3rdparty/glpk-4.57/examples/sql/transp.sql b/resources/3rdparty/glpk-4.65/examples/sql/transp.sql similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sql/transp.sql rename to resources/3rdparty/glpk-4.65/examples/sql/transp.sql diff --git a/resources/3rdparty/glpk-4.57/examples/sql/transp_mysql.mod b/resources/3rdparty/glpk-4.65/examples/sql/transp_mysql.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sql/transp_mysql.mod rename to resources/3rdparty/glpk-4.65/examples/sql/transp_mysql.mod diff --git a/resources/3rdparty/glpk-4.57/examples/sql/transp_odbc.mod b/resources/3rdparty/glpk-4.65/examples/sql/transp_odbc.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sql/transp_odbc.mod rename to resources/3rdparty/glpk-4.65/examples/sql/transp_odbc.mod diff --git a/resources/3rdparty/glpk-4.57/examples/stigler.mod b/resources/3rdparty/glpk-4.65/examples/stigler.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/stigler.mod rename to resources/3rdparty/glpk-4.65/examples/stigler.mod diff --git a/resources/3rdparty/glpk-4.57/examples/sudoku.dat b/resources/3rdparty/glpk-4.65/examples/sudoku.dat similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sudoku.dat rename to resources/3rdparty/glpk-4.65/examples/sudoku.dat diff --git a/resources/3rdparty/glpk-4.57/examples/sudoku.mod b/resources/3rdparty/glpk-4.65/examples/sudoku.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/sudoku.mod rename to resources/3rdparty/glpk-4.65/examples/sudoku.mod diff --git a/resources/3rdparty/glpk-4.57/examples/t1.cs b/resources/3rdparty/glpk-4.65/examples/t1.cs similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/t1.cs rename to resources/3rdparty/glpk-4.65/examples/t1.cs diff --git a/resources/3rdparty/glpk-4.57/examples/tas.mod b/resources/3rdparty/glpk-4.65/examples/tas.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tas.mod rename to resources/3rdparty/glpk-4.65/examples/tas.mod diff --git a/resources/3rdparty/glpk-4.65/examples/threads/Build_Multiseed.bat b/resources/3rdparty/glpk-4.65/examples/threads/Build_Multiseed.bat new file mode 100644 index 000000000..34dd95f60 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/threads/Build_Multiseed.bat @@ -0,0 +1,12 @@ +rem Build GLPK DLL with Microsoft Visual Studio Community 2015 + +rem NOTE: Make sure that HOME variable specifies correct path +set HOME="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC" + +call %HOME%\vcvarsall.bat x64 +copy config_VC config.h +%HOME%\bin\nmake.exe /f Makefile_VC +set PATH=..\..\w64\ +%HOME%\bin\nmake.exe /f Makefile_VC check + +pause diff --git a/resources/3rdparty/glpk-4.65/examples/threads/Makefile b/resources/3rdparty/glpk-4.65/examples/threads/Makefile new file mode 100644 index 000000000..61063d360 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/threads/Makefile @@ -0,0 +1,5 @@ +all: + gcc multiseed.c -I. -lglpk -pthread -o multiseed + +check: + ./multiseed clustering.mod 20 diff --git a/resources/3rdparty/glpk-4.65/examples/threads/Makefile_VC b/resources/3rdparty/glpk-4.65/examples/threads/Makefile_VC new file mode 100644 index 000000000..5bb817941 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/threads/Makefile_VC @@ -0,0 +1,26 @@ +## Build multiseed example with Microsoft Visual Studio Express ## + +CFLAGS = \ +/I. \ +/I..\..\src \ +/I..\..\w64 \ +/DHAVE_CONFIG_H=1 \ +/D_CRT_SECURE_NO_WARNINGS=1 \ +/nologo \ +/W3 \ +/O2 \ +/Zi + +.c.obj: + cl.exe $(CFLAGS) /Fo$*.obj /c $*.c + +all: multiseed.exe + +multiseed.exe: multiseed.obj ..\..\w64\glpk_4_61.dll + cl.exe $(CFLAGS) /Fmultiseed.exe \ + multiseed.obj ..\..\w64\glpk_4_61.lib + +check: multiseed.exe + .\multiseed.exe clustering.mod 20 + +## eof ## diff --git a/resources/3rdparty/glpk-4.65/examples/threads/README b/resources/3rdparty/glpk-4.65/examples/threads/README new file mode 100644 index 000000000..cb547f0ed --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/threads/README @@ -0,0 +1,66 @@ +Thread local memory example +=========================== + +The GLPK library, when compiled with default options, uses a separate environment +for each thread that is executed. So each thread is isolated. The only exeption +is error handling. An error in any of the library functions will not only +terminate the active thread but the complete process. + +This can be circumvented by defining an error handling routine with +glp_error_hook(). This directory contains an example demonstrating running a +multithreaded application with error handling. + + +The example code +---------------- + +The program multiseed solves a MathProg model multiple times in separate parallel +threads. Each threads uses a different seed for the MathProg pseudo random number +generator. + +The MathProg model clustering.mod generates 50 randomly distributed "towns". Out +of the towns it selects 3 to be cluster centers and assign the other towns to the +clusters such that the sum of the population weighted euclidian distances between +towns and centers is minimized. + +The solution is written to a Scalable Vector File which can be viewed with a web +browser. + +For demonstration purposes at the end of every third thread the error handling +routine is triggered by calling glp_error(). This results in output like + + 18-00086 Model has been successfully processed + 18-00087 Voluntarily throwing an error in multiseed.c at line 147 + 18-00088 Error detected in file multiseed.c at line 146 + 18-00089 Error caught + +Terminal output is preceeded by numbers indicating the thread index and the +output line. You can pipe it through sort to get a better overiew, e.g. + + multiseed clustering.mod 20 | sort + + +Building and running the example code +------------------------------------- + +On Linux multiseed can be compiled with gcc by calling + + make + +The code can be executed with + + make check + +For compiling the example on 64bit Windows with Microsoft Visual Studio C++ run + + Build_Multiseed.bat + +You may have to adust the variable HOME in the batch file depending on the +installation path of Visual Studio. + +You can run multiseed with + + multiseed + +Where filename is the path to the model file and count is the number of parallel +threads. diff --git a/resources/3rdparty/glpk-4.65/examples/threads/clustering.mod b/resources/3rdparty/glpk-4.65/examples/threads/clustering.mod new file mode 100644 index 000000000..cd8cd372e --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/threads/clustering.mod @@ -0,0 +1,109 @@ +/* + * Author: Heinrich Schuchardt + * + * This model solves a clustering problem: + * + * Out of 50 towns select 3 to be cluster centers and assign the other + * towns to the clusters such that the sum of the population weighted + * euclidian distances between towns and centers is minimized. + * + * The solution is saved as a scalable vector graphic file with a + * pseudo-random file name. + */ + +# Output file +param fn, symbolic := "00000" & 100000 * Uniform01(); +param f, symbolic := "ct" & substr(fn, length(fn) - 4) & ".svg"; + +# Centers +param nc := 3; +set C := {1 .. nc}; + +# Towns +param nt := 50; +set T := {1 .. nt}; +param xt{T} := Uniform01(); +param yt{T} := Uniform01(); +param pt{T} := ceil(1000 * Uniform01()); + +# Image size +param scale := 1000; + +# Colors +# saturation [0, 255] +param sat := 192; +param hue{c in C} := 6 * (c - 1) / nc; +param red{c in C} := + if hue[c] <= 1 or hue[c] >= 5 then 255 + else (if hue[c] >=2 and hue[c] <= 4 then 255 - sat + else (if hue[c] <=2 then 255 - sat + sat * (2-hue[c]) + else 255 - sat + sat * (hue[c]-4) )); +param green{c in C} := + if hue[c] >= 1 and hue[c] <= 3 then 255 + else (if hue[c] >= 4 then 255 - sat + else (if hue[c] <=1 then 255 - sat + sat * hue[c] + else 255 - sat + sat * (4-hue[c]) )); +param blue{c in C} := + if hue[c] >= 3 and hue[c] <= 5 then 255 + else (if hue[c] <=2 then 255 - sat + else (if hue[c] <=3 then 255 - sat + sat * (hue[c]-2) + else 255 - sat + sat * (6-hue[c]) )); + +var x{T}; +var y{T,T}, binary; + +minimize obj : sum{c in T, t in T} y[c,t] * pt[t] + * sqrt((xt[c] - xt[t])^2 + (yt[c] - yt[t])^2); + +s.t. sumx : sum{c in T} x[c] = nc; +s.t. cxy{c in T, t in T} : y[c,t] <= x[c]; +s.t. sumy{t in T} : sum{c in T} y[c,t] = 1; + +solve; + +for {c in T : x[c] > .5} { + printf "Center %5.4f %5.4f\n", xt[c], yt[c]; + for {t in T : y[c,t] > .5} { + printf " Town %5.4f %5.4f (%5.0f)\n", xt[t], yt[t], pt[t]; + } +} + +# Output the solution as scalable vector graphic + +# header +printf "\n" > f; +printf "> f; +printf """http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"">\n" >> f; +printf "> f; +printf "xmlns=""http://www.w3.org/2000/svg"">\n" >> f; + +# background +printf "\n", + 1.2 * scale, 1.2 * scale>> f; + +# border +printf "\n", + .1 * scale, .1 * scale, scale, scale >> f; + +# circles for towns +for {t in T} + printf {s in T, c in C : y[s,t] > .5 + && c = floor( .5 + sum{u in T : u <= s} x[u])} + "\n", + (.1 + xt[t]) * scale, (.1 + yt[t]) * scale, .001 * sqrt(pt[t]) * scale, + red[c], green[c] , blue[c] >> f; + +# lines from towns to assigned centers +for {t in T, c in T : y[c,t] > .5} + printf "\n", + (.1 + xt[c]) * scale, (.1 + yt[c]) * scale, + (.1 + xt[t]) * scale, (.1 + yt[t]) * scale >> f; + +printf "\n" >> f; + +end; diff --git a/resources/3rdparty/glpk-4.65/examples/threads/multiseed.c b/resources/3rdparty/glpk-4.65/examples/threads/multiseed.c new file mode 100644 index 000000000..9f8727a34 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/threads/multiseed.c @@ -0,0 +1,259 @@ +/* multiseed.c (multithreading demo) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Author: Heinrich Schuchardt +* +* Copyright (C) 2017 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +/* + * This program demonstrates running the GLPK library with multiple threads. + * + * When called the program requires two arguments: + * + * filename - the name of the MathProg model to be solved + * threads - the count of parallel threads to be run. + * + * Each thread is run with a different seed for the random number generator + * provided by the GLPK library. + */ + +#include +#include +#include +#include +#include +#include + +#include "thread.h" + +#define BUFLEN 256 + +/* Task descriptor */ +struct task { + pthread_t tid; + char *filename; + int seed; + size_t pos; + char buf[BUFLEN + 1]; + int line; + jmp_buf jmp; +}; + +/* Mutex for console output */ +pthread_mutex_t mutex; + +/* Console output handler */ +int term_hook(void *info, const char *text) +{ + struct task *task = (struct task *) info; + size_t len = strlen(text); + + /* Lock mutex so this is the only task creating console output. */ + pthread_mutex_lock(&mutex); + + /* Append the new text to the buffer. */ + if (task->pos + len > BUFLEN) { + printf("%02d-%05d %s%s", task->seed, ++task->line, task->buf, text); + task->pos = 0; + task->buf[0] = 0; + } else { + strcpy(task->buf + task->pos, text); + task->pos += len; + } + + /* If a complete line is available, send it to the console. */ + if (strchr(task->buf, '\n')) { + printf("%02d-%05d %s", task->seed, ++task->line, task->buf); + task->pos = 0; + task->buf[0] = 0; + } + + /* Unlock the mutex. */ + pthread_mutex_unlock(&mutex); + + /* Disable default output. */ + return -1; +} + +/* Error handler */ +void error_hook(void *info) +{ + struct task *task = (struct task *) info; + + term_hook(task, "Error caught\n"); + glp_free_env(); + longjmp(task->jmp, 1); +} + +void worker(void *arg) +{ + struct task *task = (struct task *) arg; + int ret; + glp_prob *lp; + glp_tran *tran; + glp_iocp iocp; + + if (setjmp(task->jmp)) { + /* If an error is caught leave the function. */ + return; + } + + /* Set the error handler. */ + glp_error_hook(error_hook, task); + + /* Set the console output handler. */ + glp_term_hook(term_hook, arg); + + glp_printf("Seed %02d\n", task->seed); + + /* Create the problem object. */ + lp = glp_create_prob(); + if (!lp) { + glp_error("Out of memory\n"); + } + + /* Create the MathProg translator workspace. */ + tran = glp_mpl_alloc_wksp(); + if (!lp) { + glp_error("Out of memory\n"); + } + + /* Set the pseudo random number generator seed. */ + glp_mpl_init_rand(tran, task->seed); + + /* Read the model file. */ + ret = glp_mpl_read_model (tran, task->filename, GLP_OFF); + if (ret != 0) { + glp_error("Model %s is not valid\n", task->filename); + } + + /* Generate the model. */ + ret = glp_mpl_generate(tran, NULL); + if (ret != 0) { + glp_error("Cannot generate model %s\n", task->filename); + } + + /* Build the problem. */ + glp_mpl_build_prob(tran, lp); + + /* Solve the problem. */ + glp_init_iocp(&iocp); + iocp.presolve = GLP_ON; + ret = glp_intopt(lp, &iocp); + if (ret == 0) { + /* Execute the post solve part of the model. */ + glp_mpl_postsolve(tran, lp, GLP_MIP); + } + + /* Release the memory. */ + glp_mpl_free_wksp (tran); + glp_delete_prob(lp); + + if (0 == task->seed % 3) { + glp_error("Voluntarily throwing an error in %s at line %d\n", + __FILE__, __LINE__); + } + + glp_term_hook(NULL, NULL); + + glp_error_hook(NULL, NULL); + + glp_free_env(); +} + +#ifdef __WOE__ +DWORD run(void *arg) +{ +#else +void *run(void *arg) +{ +#endif + worker(arg); + pthread_exit(NULL); +} + +int main(int argc, char *argv[]) +{ + int i, n, rc; + struct task *tasks; + + /* Make sure thread local memory is used by the GLPK library. */ + if (!glp_config("TLS")) { + printf("The loaded GLPK library does not support thread local memory.\n" + "You need a version of the library configured with " + "--enable-reentrant=yes to run this program.\n"); + exit(EXIT_FAILURE); + } + + /* Check program arguments. */ + if (argc != 3) { + printf("Usage %s filename threads\n" + " filename - MathProg model file\n" + " threads - number of threads\n", + argv[0]); + exit(EXIT_FAILURE); + } + + /* Parse the arguments. */ + n = atoi(argv[2]); + if (n > 50) { + printf("Number of threads is to high (> 50).\n"); + exit(EXIT_FAILURE); + } + if (n <= 1) { + printf("Need positive number of threads\n"); + exit(EXIT_FAILURE); + } + + /* Allocate memory for the task descriptors. */ + tasks = calloc(n, sizeof(struct task)); + if (!tasks) { + printf("Out of memory"); + exit(EXIT_FAILURE); + } + + /* Create a mutex for console output. */ + pthread_mutex_init(&mutex, NULL); + + /* Create the threads. */ + for (i = 0; i < n; ++i) { + tasks[i].filename = argv[1]; + tasks[i].seed = i + 1; + tasks[i].pos = 0; + tasks[i].buf[0] = 0; + tasks[i].line = 0; + rc = pthread_create(&tasks[i].tid, NULL, run, &tasks[i]); + if (rc) { + printf("ERROR; return code from pthread_create() is %d\n", rc); + exit(EXIT_FAILURE); + } + } + + /* Wait for all threads to complete. */ + for (i = 0; i < n; ++i) { + pthread_join(tasks[i].tid, NULL); + } + + /* Destroy the mutex. */ + pthread_mutex_destroy(&mutex); + + return EXIT_SUCCESS; +} diff --git a/resources/3rdparty/glpk-4.65/examples/threads/thread.h b/resources/3rdparty/glpk-4.65/examples/threads/thread.h new file mode 100644 index 000000000..6ed779bcd --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/threads/thread.h @@ -0,0 +1,49 @@ +/* thread.h (pthread emulation for Windows) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2011-2017, Heinrich Schuchardt +* +* Permission to use, copy, modify, and/or distribute this software for +* any purpose with or without fee is hereby granted. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA +* OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +***********************************************************************/ + +#ifndef THREAD_H + +#define THREAD_H 1 + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // HAVE_CONFIG_H + +#ifdef __WOE__ +#include +typedef CRITICAL_SECTION pthread_mutex_t; +typedef HANDLE pthread_t; +// @todo The return type of routine C is "DWORD" for Windows and +// "void *" for Posix. +#define pthread_create(A,B,C,D) \ + (int)((*A = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)&C,D,0,NULL))==NULL) +#define pthread_exit(A) ExitThread(0) +#define pthread_mutex_destroy(A) DeleteCriticalSection(A) +#define pthread_mutex_init(A,B) (InitializeCriticalSection(A),0) +#define pthread_mutex_lock(A) (EnterCriticalSection(A),0) +#define pthread_mutex_unlock(A) (LeaveCriticalSection(A),0) +#define pthread_self() GetCurrentThreadId() +#define pthread_join(A, B) \ + (WaitForSingleObject(A, INFINITE),CloseHandle(A),0) +#else +#include +#endif + +#endif // THREAD_H diff --git a/resources/3rdparty/glpk-4.65/examples/tiling.mod b/resources/3rdparty/glpk-4.65/examples/tiling.mod new file mode 100644 index 000000000..6e0cabd95 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/tiling.mod @@ -0,0 +1,118 @@ +/* Rectifiable polyomino tilings generator */ + +/* Written and converted to GNU MathProg by NASZVADI, Peter, 2007-2017 + */ + +/* + This model searches for a maximal packing of a given polyomino + composed of unit squares in a given rectangle. In a feasible packing, a + placed polyomino and its intersection of a unit square's inner part in + the rectangle must be the square or empty. If there exists a packing + that covers totally the rectangle, then the polyomino is called + "rectifiable" + + Summary: + Decides if an Im * Jm rectangle could be tiled with given pattern + and prints a (sub)optimal solution if found + + Generated magic numbers are implicit tables, check them: + + # for magic in 3248 688 1660 3260 + do printf "Magic % 5d:" "$magic" + for e in 0 1 2 3 4 5 6 7 + do printf "% 3d" "$((-1 + ((magic / (3**e)) % 3)))" + done + echo + done + Magic 3248: 1 1 -1 -1 0 0 0 0 + Magic 688: 0 0 0 0 1 1 -1 -1 + Magic 1660: 0 0 0 0 1 -1 1 -1 + Magic 3260: 1 -1 1 -1 0 0 0 0 + # +*/ + +param Im, default 3; +/* vertical edge length of the box */ + +param Jm, default 3; +/* horizontal edge length of the box */ + +set S, default {(0, 0), (1, 0), (2, 0), (0, 1), (1, 1), (2, 1), (0, 2)}; +/* P-heptomino is the default shape. More info on this heptomino: + http://www.cflmath.com/Polyomino/7omino4_rect.html */ + +set I := 1..Im; +/* rows of rectangle */ + +set J := 1..Jm; +/* columns of rectangle */ + +set IJ := I cross J; +/* the rectangle itself */ + +set E := 0..7; +/* helper set to allow iterating on all transformations of the S shape */ + +set Shifts := setof{(i, j, e) in IJ cross E: + setof{(x, y) in S} + ((x * (-1 + floor(3248 / 3^e) mod 3)) + + (y * (-1 + floor(688 / 3^e) mod 3)) + i, + (x * (-1 + floor(1660 / 3^e) mod 3)) + + (y * (-1 + floor(3260 / 3^e) mod 3)) + j) within IJ}(i, j, e); +/* all shifted, flipped, rotated, mirrored mappings of polyomino that + contained by the rectangle */ + +var cell{IJ}, binary; +/* booleans denoting if a cell is covered in the rectangle */ + +var tile{Shifts}, binary; +/* booleans denoting usage of a shift */ + +var objvalue; + +s.t. covers{(i, j) in IJ}: sum{(k, l, e, a, b) in Shifts cross S: + i = k + a * (-1 + floor(3248 / 3^e) mod 3) + + b * (-1 + floor(688 / 3^e) mod 3) + and + j = l + a * (-1 + floor(1660 / 3^e) mod 3) + + b * (-1 + floor(3260 / 3^e) mod 3) + }tile[k, l, e] = cell[i, j]; + +s.t. objeval: sum{(i, j) in IJ}cell[i, j] - objvalue = 0; + +maximize obj: objvalue; + +solve; + +printf '\nCovered cells/all cells = %d/%d\n\n', objvalue.val, Im * Jm; +printf '\nA tiling:\n\n'; +for{i in I}{ + for{j in J}{ + printf '%s', if cell[i, j].val then '' else ' *** '; + for{(k, l, e, a, b) in Shifts cross S: + cell[i, j].val + and i = k + a * (-1 + floor(3248 / 3^e) mod 3) + + b * (-1 + floor(688 / 3^e) mod 3) + and j = l + a * (-1 + floor(1660 / 3^e) mod 3) + + b * (-1 + floor(3260 / 3^e) mod 3) + and tile[k, l, e].val + }{ + printf '% 5d', (k * Jm + l) * 8 + e; + } + } + printf '\n'; +} +printf '\n'; + +data; + +param Im := 14; +/* here can be set rectangle's one side */ + +param Jm := 14; +/* here can be set rectangle's other side */ + +set S := (0,0),(1,0),(2,0),(0,1),(1,1),(2,1),(0,2); +/* here you can specify arbitrary polyomino */ + +end; diff --git a/resources/3rdparty/glpk-4.57/examples/todd.mod b/resources/3rdparty/glpk-4.65/examples/todd.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/todd.mod rename to resources/3rdparty/glpk-4.65/examples/todd.mod diff --git a/resources/3rdparty/glpk-4.65/examples/toto.mod b/resources/3rdparty/glpk-4.65/examples/toto.mod new file mode 100644 index 000000000..6b4318edc --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/toto.mod @@ -0,0 +1,135 @@ +/* Covering code generator, especially for football pool systems */ + +/* Written and converted to GNU MathProg by NASZVADI, Peter, 199x-2017 + */ + +/* + Looks up for minimal covering codes in the specified Hamming-space. + Without specifying model data, by default it looks up for covering + for a mixed covering code in Hamming-space {X, 1, 2, 3}*{X, 1}^4 + with one layer. + + Hamming space is a set of finite words with all the same length over + a finite alphabet: the space could be decomposed to Cartesian + products of subsets of the alphabet, e.g. the first letter of an + element can be chosen from a 2-element set, the next from 6 letters, + and so on. + + There is a natural metric function in these spaces: the + Hamming-distance (hence the name, from now referred as: distance). + The distance of two (equal-length) words is the number of different + letter pairs in the corresponding positions. + + Covering Hamming-spaces with minimal number of spheres with given + radius - usually difficult problem excluding special cases. + + Relationship with sports: + Football pool system in Hungarian: "Toto'kulcs", so Toto, totogol and + other football pool systems are usually need mixed ternary/binary + code coverings in order to minimize loss of the gambler. + + See more at: + https://en.wikipedia.org/wiki/Covering_code + + A tricky workaround is used: + floor(), abs() and cosine() magic are used at 'coverings' constraints, + because GMPL lacks proper boolean<->integer evaluation/casting. +*/ + +param ArgNum1, >= 1, default 1; +param ArgNum2, >= 1, default 1; +param ArgNum3, >= 1, default 1; +param ArgNum4, >= 1, default 1; +param ArgNum5, >= 1, default 1; +param ArgNum6, >= 1, default 1; +param ArgNum7, >= 1, default 1; +param ArgNum8, >= 1, default 1; +param ArgNum9, >= 1, default 1; +param ArgNum10, >= 1, default 1; +param ArgNum11, >= 1, default 1; +param ArgNum12, >= 1, default 1; +param ArgNum13, >= 1, default 1; +/* at most 13 matches' outcomes */ + +param Radius, >= 1, default 1; +/* covering radius */ + +param Layer, >= 1, default 1; +/* each point of space must be covered at least Layer times */ + +set X := 0..ArgNum1 - 1 cross 0..ArgNum2 - 1 cross 0..ArgNum3 - 1 cross + 0..ArgNum4 - 1 cross 0..ArgNum5 - 1 cross 0..ArgNum6 - 1 cross + 0..ArgNum7 - 1 cross 0..ArgNum8 - 1 cross 0..ArgNum9 - 1 cross + 0..ArgNum10 - 1 cross 0..ArgNum11 - 1 cross 0..ArgNum12 - 1 cross + 0..ArgNum13 - 1; +/* the Hamming-space generated by the Cartesian-products of sets + with elements ArgNum[n] */ + +var x{X}, integer, >=0; +/* denotes each point's amount of containing covering sets */ + +var objvalue; + +s.t. coverings{(i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13) in X}: + sum{(j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13) in X: + floor(abs(cos(i1 - j1))) + floor(abs(cos(i2 - j2))) + + floor(abs(cos(i3 - j3))) + floor(abs(cos(i4 - j4))) + + floor(abs(cos(i5 - j5))) + floor(abs(cos(i6 - j6))) + + floor(abs(cos(i7 - j7))) + floor(abs(cos(i8 - j8))) + + floor(abs(cos(i9 - j9))) + floor(abs(cos(i10 - j10))) + + floor(abs(cos(i11 - j11))) + floor(abs(cos(i12 - j12))) + + floor(abs(cos(i13 - j13))) >= 13 - Radius + } x[j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13] >= Layer; +/* covering constraints, select at least 'Layer' amount of spheres that cover + (i1,i2,...) and has radius 'Radius' */ + +s.t. oneisset: x[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] >= 1; +/* this does not violate symmetry nor excludes important solutions but + boosts the solving process */ + +s.t. objc: sum{(i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13) in X} + x[i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13] = objvalue; +/* the total number of pools (covering sets) */ + +minimize obj: objvalue; +/* Also 'objc' could be used directly instead of 'obj', but for + experiments, it is useful to set up additional constraints for + introduced objvalue variable */ + +solve; + +printf 'Solution: %s\nRadius: %s\nLayer: %s\n', + objvalue.val, Radius, Layer; +/* report important scalars */ + +printf 'Selected bets:\n'; +for{(i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13) in X: + x[i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13]}{ + printf ' Times %s:', + x[i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13].val; + printf '%s', if ArgNum1 == 1 then '' else ' ' & if i1 then i1 else 'X'; + printf '%s', if ArgNum2 == 1 then '' else '-' & if i2 then i2 else 'X'; + printf '%s', if ArgNum3 == 1 then '' else '-' & if i3 then i3 else 'X'; + printf '%s', if ArgNum4 == 1 then '' else '-' & if i4 then i4 else 'X'; + printf '%s', if ArgNum5 == 1 then '' else '-' & if i5 then i5 else 'X'; + printf '%s', if ArgNum6 == 1 then '' else '-' & if i6 then i6 else 'X'; + printf '%s', if ArgNum7 == 1 then '' else '-' & if i7 then i7 else 'X'; + printf '%s', if ArgNum8 == 1 then '' else '-' & if i8 then i8 else 'X'; + printf '%s', if ArgNum9 == 1 then '' else '-' & if i9 then i9 else 'X'; + printf '%s', if ArgNum10 == 1 then '' else '-' & if i10 then i10 else 'X'; + printf '%s', if ArgNum11 == 1 then '' else '-' & if i11 then i11 else 'X'; + printf '%s', if ArgNum12 == 1 then '' else '-' & if i12 then i12 else 'X'; + printf '%s', if ArgNum13 == 1 then '' else '-' & if i13 then i13 else 'X'; + printf '\n'; +} +/* pretty-print a generated football pool system (covering code) */ + +data; + +param ArgNum1 := 4; +param ArgNum2 := 2; +param ArgNum3 := 2; +param ArgNum4 := 2; +param ArgNum5 := 2; + +end; diff --git a/resources/3rdparty/glpk-4.57/examples/train.mod b/resources/3rdparty/glpk-4.65/examples/train.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/train.mod rename to resources/3rdparty/glpk-4.65/examples/train.mod diff --git a/resources/3rdparty/glpk-4.57/examples/transp.mod b/resources/3rdparty/glpk-4.65/examples/transp.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/transp.mod rename to resources/3rdparty/glpk-4.65/examples/transp.mod diff --git a/resources/3rdparty/glpk-4.57/examples/trick.mod b/resources/3rdparty/glpk-4.65/examples/trick.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/trick.mod rename to resources/3rdparty/glpk-4.65/examples/trick.mod diff --git a/resources/3rdparty/glpk-4.57/examples/tsp.mod b/resources/3rdparty/glpk-4.65/examples/tsp.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tsp.mod rename to resources/3rdparty/glpk-4.65/examples/tsp.mod diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/README b/resources/3rdparty/glpk-4.65/examples/tsp/README similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tsp/README rename to resources/3rdparty/glpk-4.65/examples/tsp/README diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/bench.txt b/resources/3rdparty/glpk-4.65/examples/tsp/bench.txt similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tsp/bench.txt rename to resources/3rdparty/glpk-4.65/examples/tsp/bench.txt diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/build.sh b/resources/3rdparty/glpk-4.65/examples/tsp/build.sh similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tsp/build.sh rename to resources/3rdparty/glpk-4.65/examples/tsp/build.sh diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/dantzig42.tsp b/resources/3rdparty/glpk-4.65/examples/tsp/dantzig42.tsp similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tsp/dantzig42.tsp rename to resources/3rdparty/glpk-4.65/examples/tsp/dantzig42.tsp diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/gr120.tsp b/resources/3rdparty/glpk-4.65/examples/tsp/gr120.tsp similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tsp/gr120.tsp rename to resources/3rdparty/glpk-4.65/examples/tsp/gr120.tsp diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/main.c b/resources/3rdparty/glpk-4.65/examples/tsp/main.c similarity index 99% rename from resources/3rdparty/glpk-4.57/examples/tsp/main.c rename to resources/3rdparty/glpk-4.65/examples/tsp/main.c index 822af324a..06857421f 100644 --- a/resources/3rdparty/glpk-4.57/examples/tsp/main.c +++ b/resources/3rdparty/glpk-4.65/examples/tsp/main.c @@ -268,7 +268,7 @@ void build_tour(void) * tour_length - calculate tour length * * This routine calculates the length of the specified tour, which is -* a sum of corresponding edge length. */ +* the sum of corresponding edge lengths. */ int tour_length(const int tour[/*1+n*/]) { int i, j, sum; diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/maxflow.c b/resources/3rdparty/glpk-4.65/examples/tsp/maxflow.c similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tsp/maxflow.c rename to resources/3rdparty/glpk-4.65/examples/tsp/maxflow.c diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/maxflow.h b/resources/3rdparty/glpk-4.65/examples/tsp/maxflow.h similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tsp/maxflow.h rename to resources/3rdparty/glpk-4.65/examples/tsp/maxflow.h diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/mincut.c b/resources/3rdparty/glpk-4.65/examples/tsp/mincut.c similarity index 99% rename from resources/3rdparty/glpk-4.57/examples/tsp/mincut.c rename to resources/3rdparty/glpk-4.65/examples/tsp/mincut.c index 46905aa0e..225fb7f44 100644 --- a/resources/3rdparty/glpk-4.57/examples/tsp/mincut.c +++ b/resources/3rdparty/glpk-4.65/examples/tsp/mincut.c @@ -21,7 +21,7 @@ * * DESCRIPTION * -* This routine find min cut in a given undirected network. +* This routine finds min cut in a given undirected network. * * The undirected capacitated network is specified by the parameters * nn, ne, beg, end, and cap. The parameter nn specifies the number of @@ -207,7 +207,7 @@ int min_st_cut(int nn, int ne, const int beg[/*1+ne*/], * * The basic idea of Stoer&Wagner algorithm is the following. Let G be * a capacitated network, and G(s,t) be a network, in which the nodes s -* and t are merged into one new node, loops are deleted, but multuple +* and t are merged into one new node, loops are deleted, but multiple * edges are retained. It is obvious that a minimum cut in G is the * minimum of two quantities: the minimum cut in G(s,t) and a minimum * cut that separates s and t. This allows to find a minimum cut in the diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/mincut.h b/resources/3rdparty/glpk-4.65/examples/tsp/mincut.h similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tsp/mincut.h rename to resources/3rdparty/glpk-4.65/examples/tsp/mincut.h diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/misc.c b/resources/3rdparty/glpk-4.65/examples/tsp/misc.c similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tsp/misc.c rename to resources/3rdparty/glpk-4.65/examples/tsp/misc.c diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/misc.h b/resources/3rdparty/glpk-4.65/examples/tsp/misc.h similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tsp/misc.h rename to resources/3rdparty/glpk-4.65/examples/tsp/misc.h diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/moscow.tsp b/resources/3rdparty/glpk-4.65/examples/tsp/moscow.tsp similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tsp/moscow.tsp rename to resources/3rdparty/glpk-4.65/examples/tsp/moscow.tsp diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/sample.tsp b/resources/3rdparty/glpk-4.65/examples/tsp/sample.tsp similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tsp/sample.tsp rename to resources/3rdparty/glpk-4.65/examples/tsp/sample.tsp diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/tsplib.c b/resources/3rdparty/glpk-4.65/examples/tsp/tsplib.c similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tsp/tsplib.c rename to resources/3rdparty/glpk-4.65/examples/tsp/tsplib.c diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/tsplib.h b/resources/3rdparty/glpk-4.65/examples/tsp/tsplib.h similarity index 98% rename from resources/3rdparty/glpk-4.57/examples/tsp/tsplib.h rename to resources/3rdparty/glpk-4.65/examples/tsp/tsplib.h index efadaef88..19936ad76 100644 --- a/resources/3rdparty/glpk-4.57/examples/tsp/tsplib.h +++ b/resources/3rdparty/glpk-4.65/examples/tsp/tsplib.h @@ -40,7 +40,7 @@ struct TSP #define TSP_UNDEF 0 /* undefined */ #define TSP_FUNCTION 1 /* given by a function */ #define TSP_FULL_MATRIX 2 /* given by a full matrix */ -#define TSP_UPPER_ROW 3 /* upper triangulat matrix (row-wise +#define TSP_UPPER_ROW 3 /* upper triangular matrix (row-wise * without diagonal entries) */ #define TSP_LOWER_DIAG_ROW 4 /* lower triangular matrix (row-wise * including diagonal entries) */ diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/ulysses16.tsp b/resources/3rdparty/glpk-4.65/examples/tsp/ulysses16.tsp similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tsp/ulysses16.tsp rename to resources/3rdparty/glpk-4.65/examples/tsp/ulysses16.tsp diff --git a/resources/3rdparty/glpk-4.57/examples/tsp/ulysses22.tsp b/resources/3rdparty/glpk-4.65/examples/tsp/ulysses22.tsp similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/tsp/ulysses22.tsp rename to resources/3rdparty/glpk-4.65/examples/tsp/ulysses22.tsp diff --git a/resources/3rdparty/glpk-4.65/examples/wolfra6d.lp b/resources/3rdparty/glpk-4.65/examples/wolfra6d.lp new file mode 100644 index 000000000..a3437d83f --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/wolfra6d.lp @@ -0,0 +1,596 @@ +\* Any Wolfram elementary CA in 6D eucl. Neumann CA grid emulator generator *\ + +\* Written and converted to *LP format by NASZVADI, Peter, 2016,2017 *\ +\* *\ + +\* Standalone version; GMPL version is in wolfra6d.mod *\ + +\* This model looks up for a subset of vertices in 6D euclyd. grid, *\ +\* which has the following properties: *\ +\* 1. each vertex' coordinate pairs' difference is at most 1 *\ +\* 2. contains the vertices in the main diagonal of the 6d space *\ +\* 3. connecting with directed graph edges from all selected vertices *\ +\* to all selected ones with greater coordinate sums with *\ +\* Hamming-distance 1, the following in-out edge numbers are *\ +\* allowed: (3,6), (1,2), (2,3), (1,2), (4,1), (3,1); according to *\ +\* the mod 6 sum of the coordinate values *\ +\* 4. Only vertices of the unit cube's with {0,1} coordinates are *\ +\* calculated, but the other cells could be obtained via shifting. *\ +\* Assume that the grid is a 6dim. cellular automaton grid with Neumann- *\ +\* -neighbourhood, now construct an outer-totalistic rule that emulates *\ +\* W110 cellular automaton on the selected vertices: *\ +\* Suppose that the 1D W110 cellspace cells are denoted with signed *\ +\* integers. Every 1D cell is assigned to (at most "6 over 2") selected *\ +\* vertices where each coordinate sums are the same with the integer *\ +\* assigned to the origin cell in the domain, they must have the same *\ +\* value. Rule-110 means that cell's value is being changed only when its *\ +\* neighbours are: (1,1,1), (1,0,1), (0,0,1), other cells remain unchanged. *\ +\* Let's denote the default cellstate with "2" in the 6D automaton, and *\ +\* the remaining 2 states with "0" and "1" respectively, which correspond *\ +\* with the states in W110. The selected vertices must be 0 or 1 of course, *\ +\* and the others are "2". *\ +\* Now, the transition rule for emulating W110 is the following: *\ +\* (x),{1,1,1,1,1,1,1,1,1,2,2,2}->(1-x), x!=2, *\ +\* (x),{1,1,1,2,2,2,2,2,2,2,2,2}->(1-x), x!=2, *\ +\* (x),{1,1,1,1,2,2,2,2,2,2,2,2}->(1-x), x!=2, *\ +\* (x),{1,1,1,1,1,2,2,2,2,2,2,2}->(1-x), x!=2, *\ +\* (1),{0,0,0,1,1,1,1,1,1,2,2,2}->(0), *\ +\* (1),{0,1,1,2,2,2,2,2,2,2,2,2}->(0), *\ +\* (1),{0,0,1,1,1,2,2,2,2,2,2,2}->(0), *\ +\* (1),{0,0,0,0,1,2,2,2,2,2,2,2}->(0), *\ +\* (1),{0,0,0,1,2,2,2,2,2,2,2,2}->(0); *\ +\* notation: (old state),{old neighbours - all permutations}->(new state) *\ +\* Other states won't change between two generations. And is known that W110 *\ +\* is Turing-complete. So there is a universal CA rule in 6+D eucl. gridS *\ +\* Result is in x****** binary variables (total 44 among the 64) *\ + +Minimize + obj: x000000 +x000001 +x000010 +x000011 +x000100 +x000101 +x000110 +x000111 + +x001000 +x001001 +x001010 +x001011 +x001100 +x001101 +x001110 +x001111 + +x010000 +x010001 +x010010 +x010011 +x010100 +x010101 +x010110 +x010111 + +x011000 +x011001 +x011010 +x011011 +x011100 +x011101 +x011110 +x011111 + +x100000 +x100001 +x100010 +x100011 +x100100 +x100101 +x100110 +x100111 + +x101000 +x101001 +x101010 +x101011 +x101100 +x101101 +x101110 +x101111 + +x110000 +x110001 +x110010 +x110011 +x110100 +x110101 +x110110 +x110111 + +x111000 +x111001 +x111010 +x111011 +x111100 +x111101 +x111110 +x111111 +Subject To + x000000 = 1 + x111111 = 1 + x111110 -x111101 >= 0 + x111101 -x111011 >= 0 + x111011 -x110111 >= 0 + x110111 -x101111 >= 0 + x101111 -x011111 >= 0 + dn000000 -dn111111 = 0 + up000000 -up111111 = 0 + cup000000: + x000001 +x000010 +x000100 +x001000 +x010000 +x100000 -up000000 = 0 + cup000001: + x000011 +x000101 +x001001 +x010001 +x100001 -up000001 = 0 + cup000010: + x000011 +x000110 +x001010 +x010010 +x100010 -up000010 = 0 + cup000011: + x000111 +x001011 +x010011 +x100011 -up000011 = 0 + cup000100: + x000101 +x000110 +x001100 +x010100 +x100100 -up000100 = 0 + cup000101: + x000111 +x001101 +x010101 +x100101 -up000101 = 0 + cup000110: + x000111 +x001110 +x010110 +x100110 -up000110 = 0 + cup000111: + x001111 +x010111 +x100111 -up000111 = 0 + cup001000: + x001001 +x001010 +x001100 +x011000 +x101000 -up001000 = 0 + cup001001: + x001011 +x001101 +x011001 +x101001 -up001001 = 0 + cup001010: + x001011 +x001110 +x011010 +x101010 -up001010 = 0 + cup001011: + x001111 +x011011 +x101011 -up001011 = 0 + cup001100: + x001101 +x001110 +x011100 +x101100 -up001100 = 0 + cup001101: + x001111 +x011101 +x101101 -up001101 = 0 + cup001110: + x001111 +x011110 +x101110 -up001110 = 0 + cup001111: + x011111 +x101111 -up001111 = 0 + cup010000: + x010001 +x010010 +x010100 +x011000 +x110000 -up010000 = 0 + cup010001: + x010011 +x010101 +x011001 +x110001 -up010001 = 0 + cup010010: + x010011 +x010110 +x011010 +x110010 -up010010 = 0 + cup010011: + x010111 +x011011 +x110011 -up010011 = 0 + cup010100: + x010101 +x010110 +x011100 +x110100 -up010100 = 0 + cup010101: + x010111 +x011101 +x110101 -up010101 = 0 + cup010110: + x010111 +x011110 +x110110 -up010110 = 0 + cup010111: + x011111 +x110111 -up010111 = 0 + cup011000: + x011001 +x011010 +x011100 +x111000 -up011000 = 0 + cup011001: + x011011 +x011101 +x111001 -up011001 = 0 + cup011010: + x011011 +x011110 +x111010 -up011010 = 0 + cup011011: + x011111 +x111011 -up011011 = 0 + cup011100: + x011101 +x011110 +x111100 -up011100 = 0 + cup011101: + x011111 +x111101 -up011101 = 0 + cup011110: + x011111 +x111110 -up011110 = 0 + cup011111: + x111111 -up011111 = 0 + cup100000: + x100001 +x100010 +x100100 +x101000 +x110000 -up100000 = 0 + cup100001: + x100011 +x100101 +x101001 +x110001 -up100001 = 0 + cup100010: + x100011 +x100110 +x101010 +x110010 -up100010 = 0 + cup100011: + x100111 +x101011 +x110011 -up100011 = 0 + cup100100: + x100101 +x100110 +x101100 +x110100 -up100100 = 0 + cup100101: + x100111 +x101101 +x110101 -up100101 = 0 + cup100110: + x100111 +x101110 +x110110 -up100110 = 0 + cup100111: + x101111 +x110111 -up100111 = 0 + cup101000: + x101001 +x101010 +x101100 +x111000 -up101000 = 0 + cup101001: + x101011 +x101101 +x111001 -up101001 = 0 + cup101010: + x101011 +x101110 +x111010 -up101010 = 0 + cup101011: + x101111 +x111011 -up101011 = 0 + cup101100: + x101101 +x101110 +x111100 -up101100 = 0 + cup101101: + x101111 +x111101 -up101101 = 0 + cup101110: + x101111 +x111110 -up101110 = 0 + cup101111: + x111111 -up101111 = 0 + cup110000: + x110001 +x110010 +x110100 +x111000 -up110000 = 0 + cup110001: + x110011 +x110101 +x111001 -up110001 = 0 + cup110010: + x110011 +x110110 +x111010 -up110010 = 0 + cup110011: + x110111 +x111011 -up110011 = 0 + cup110100: + x110101 +x110110 +x111100 -up110100 = 0 + cup110101: + x110111 +x111101 -up110101 = 0 + cup110110: + x110111 +x111110 -up110110 = 0 + cup110111: + x111111 -up110111 = 0 + cup111000: + x111001 +x111010 +x111100 -up111000 = 0 + cup111001: + x111011 +x111101 -up111001 = 0 + cup111010: + x111011 +x111110 -up111010 = 0 + cup111011: + x111111 -up111011 = 0 + cup111100: + x111101 +x111110 -up111100 = 0 + cup111101: + x111111 -up111101 = 0 + cup111110: + x111111 -up111110 = 0 + cdn000001: + x000000 -dn000001 = 0 + cdn000010: + x000000 -dn000010 = 0 + cdn000011: + x000001 +x000010 -dn000011 = 0 + cdn000100: + x000000 -dn000100 = 0 + cdn000101: + x000001 +x000100 -dn000101 = 0 + cdn000110: + x000010 +x000100 -dn000110 = 0 + cdn000111: + x000011 +x000101 +x000110 -dn000111 = 0 + cdn001000: + x000000 -dn001000 = 0 + cdn001001: + x000001 +x001000 -dn001001 = 0 + cdn001010: + x000010 +x001000 -dn001010 = 0 + cdn001011: + x000011 +x001001 +x001010 -dn001011 = 0 + cdn001100: + x000100 +x001000 -dn001100 = 0 + cdn001101: + x000101 +x001001 +x001100 -dn001101 = 0 + cdn001110: + x000110 +x001010 +x001100 -dn001110 = 0 + cdn001111: + x000111 +x001011 +x001101 +x001110 -dn001111 = 0 + cdn010000: + x000000 -dn010000 = 0 + cdn010001: + x000001 +x010000 -dn010001 = 0 + cdn010010: + x000010 +x010000 -dn010010 = 0 + cdn010011: + x000011 +x010001 +x010010 -dn010011 = 0 + cdn010100: + x000100 +x010000 -dn010100 = 0 + cdn010101: + x000101 +x010001 +x010100 -dn010101 = 0 + cdn010110: + x000110 +x010010 +x010100 -dn010110 = 0 + cdn010111: + x000111 +x010011 +x010101 +x010110 -dn010111 = 0 + cdn011000: + x001000 +x010000 -dn011000 = 0 + cdn011001: + x001001 +x010001 +x011000 -dn011001 = 0 + cdn011010: + x001010 +x010010 +x011000 -dn011010 = 0 + cdn011011: + x001011 +x010011 +x011001 +x011010 -dn011011 = 0 + cdn011100: + x001100 +x010100 +x011000 -dn011100 = 0 + cdn011101: + x001101 +x010101 +x011001 +x011100 -dn011101 = 0 + cdn011110: + x001110 +x010110 +x011010 +x011100 -dn011110 = 0 + cdn011111: + x001111 +x010111 +x011011 +x011101 +x011110 -dn011111 = 0 + cdn100000: + x000000 -dn100000 = 0 + cdn100001: + x000001 +x100000 -dn100001 = 0 + cdn100010: + x000010 +x100000 -dn100010 = 0 + cdn100011: + x000011 +x100001 +x100010 -dn100011 = 0 + cdn100100: + x000100 +x100000 -dn100100 = 0 + cdn100101: + x000101 +x100001 +x100100 -dn100101 = 0 + cdn100110: + x000110 +x100010 +x100100 -dn100110 = 0 + cdn100111: + x000111 +x100011 +x100101 +x100110 -dn100111 = 0 + cdn101000: + x001000 +x100000 -dn101000 = 0 + cdn101001: + x001001 +x100001 +x101000 -dn101001 = 0 + cdn101010: + x001010 +x100010 +x101000 -dn101010 = 0 + cdn101011: + x001011 +x100011 +x101001 +x101010 -dn101011 = 0 + cdn101100: + x001100 +x100100 +x101000 -dn101100 = 0 + cdn101101: + x001101 +x100101 +x101001 +x101100 -dn101101 = 0 + cdn101110: + x001110 +x100110 +x101010 +x101100 -dn101110 = 0 + cdn101111: + x001111 +x100111 +x101011 +x101101 +x101110 -dn101111 = 0 + cdn110000: + x010000 +x100000 -dn110000 = 0 + cdn110001: + x010001 +x100001 +x110000 -dn110001 = 0 + cdn110010: + x010010 +x100010 +x110000 -dn110010 = 0 + cdn110011: + x010011 +x100011 +x110001 +x110010 -dn110011 = 0 + cdn110100: + x010100 +x100100 +x110000 -dn110100 = 0 + cdn110101: + x010101 +x100101 +x110001 +x110100 -dn110101 = 0 + cdn110110: + x010110 +x100110 +x110010 +x110100 -dn110110 = 0 + cdn110111: + x010111 +x100111 +x110011 +x110101 +x110110 -dn110111 = 0 + cdn111000: + x011000 +x101000 +x110000 -dn111000 = 0 + cdn111001: + x011001 +x101001 +x110001 +x111000 -dn111001 = 0 + cdn111010: + x011010 +x101010 +x110010 +x111000 -dn111010 = 0 + cdn111011: + x011011 +x101011 +x110011 +x111001 +x111010 -dn111011 = 0 + cdn111100: + x011100 +x101100 +x110100 +x111000 -dn111100 = 0 + cdn111101: + x011101 +x101101 +x110101 +x111001 +x111100 -dn111101 = 0 + cdn111110: + x011110 +x101110 +x110110 +x111010 +x111100 -dn111110 = 0 + cdn111111: + x011111 +x101111 +x110111 +x111011 +x111101 +x111110 -dn111111 = 0 + up000000 -6 x000000 >= 0 + up000000 +64 x000000 <= 70 + up000001 -2 x000001 >= 0 + up000001 +64 x000001 <= 66 + up000010 -2 x000010 >= 0 + up000010 +64 x000010 <= 66 + up000011 -3 x000011 >= 0 + up000011 +64 x000011 <= 67 + up000100 -2 x000100 >= 0 + up000100 +64 x000100 <= 66 + up000101 -3 x000101 >= 0 + up000101 +64 x000101 <= 67 + up000110 -3 x000110 >= 0 + up000110 +64 x000110 <= 67 + up000111 -2 x000111 >= 0 + up000111 +64 x000111 <= 66 + up001000 -2 x001000 >= 0 + up001000 +64 x001000 <= 66 + up001001 -3 x001001 >= 0 + up001001 +64 x001001 <= 67 + up001010 -3 x001010 >= 0 + up001010 +64 x001010 <= 67 + up001011 -2 x001011 >= 0 + up001011 +64 x001011 <= 66 + up001100 -3 x001100 >= 0 + up001100 +64 x001100 <= 67 + up001101 -2 x001101 >= 0 + up001101 +64 x001101 <= 66 + up001110 -2 x001110 >= 0 + up001110 +64 x001110 <= 66 + up001111 -1 x001111 >= 0 + up001111 +64 x001111 <= 65 + up010000 -2 x010000 >= 0 + up010000 +64 x010000 <= 66 + up010001 -3 x010001 >= 0 + up010001 +64 x010001 <= 67 + up010010 -3 x010010 >= 0 + up010010 +64 x010010 <= 67 + up010011 -2 x010011 >= 0 + up010011 +64 x010011 <= 66 + up010100 -3 x010100 >= 0 + up010100 +64 x010100 <= 67 + up010101 -2 x010101 >= 0 + up010101 +64 x010101 <= 66 + up010110 -2 x010110 >= 0 + up010110 +64 x010110 <= 66 + up010111 -1 x010111 >= 0 + up010111 +64 x010111 <= 65 + up011000 -3 x011000 >= 0 + up011000 +64 x011000 <= 67 + up011001 -2 x011001 >= 0 + up011001 +64 x011001 <= 66 + up011010 -2 x011010 >= 0 + up011010 +64 x011010 <= 66 + up011011 -1 x011011 >= 0 + up011011 +64 x011011 <= 65 + up011100 -2 x011100 >= 0 + up011100 +64 x011100 <= 66 + up011101 -1 x011101 >= 0 + up011101 +64 x011101 <= 65 + up011110 -1 x011110 >= 0 + up011110 +64 x011110 <= 65 + up011111 -1 x011111 >= 0 + up011111 +64 x011111 <= 65 + up100000 -2 x100000 >= 0 + up100000 +64 x100000 <= 66 + up100001 -3 x100001 >= 0 + up100001 +64 x100001 <= 67 + up100010 -3 x100010 >= 0 + up100010 +64 x100010 <= 67 + up100011 -2 x100011 >= 0 + up100011 +64 x100011 <= 66 + up100100 -3 x100100 >= 0 + up100100 +64 x100100 <= 67 + up100101 -2 x100101 >= 0 + up100101 +64 x100101 <= 66 + up100110 -2 x100110 >= 0 + up100110 +64 x100110 <= 66 + up100111 -1 x100111 >= 0 + up100111 +64 x100111 <= 65 + up101000 -3 x101000 >= 0 + up101000 +64 x101000 <= 67 + up101001 -2 x101001 >= 0 + up101001 +64 x101001 <= 66 + up101010 -2 x101010 >= 0 + up101010 +64 x101010 <= 66 + up101011 -1 x101011 >= 0 + up101011 +64 x101011 <= 65 + up101100 -2 x101100 >= 0 + up101100 +64 x101100 <= 66 + up101101 -1 x101101 >= 0 + up101101 +64 x101101 <= 65 + up101110 -1 x101110 >= 0 + up101110 +64 x101110 <= 65 + up101111 -1 x101111 >= 0 + up101111 +64 x101111 <= 65 + up110000 -3 x110000 >= 0 + up110000 +64 x110000 <= 67 + up110001 -2 x110001 >= 0 + up110001 +64 x110001 <= 66 + up110010 -2 x110010 >= 0 + up110010 +64 x110010 <= 66 + up110011 -1 x110011 >= 0 + up110011 +64 x110011 <= 65 + up110100 -2 x110100 >= 0 + up110100 +64 x110100 <= 66 + up110101 -1 x110101 >= 0 + up110101 +64 x110101 <= 65 + up110110 -1 x110110 >= 0 + up110110 +64 x110110 <= 65 + up110111 -1 x110111 >= 0 + up110111 +64 x110111 <= 65 + up111000 -2 x111000 >= 0 + up111000 +64 x111000 <= 66 + up111001 -1 x111001 >= 0 + up111001 +64 x111001 <= 65 + up111010 -1 x111010 >= 0 + up111010 +64 x111010 <= 65 + up111011 -1 x111011 >= 0 + up111011 +64 x111011 <= 65 + up111100 -1 x111100 >= 0 + up111100 +64 x111100 <= 65 + up111101 -1 x111101 >= 0 + up111101 +64 x111101 <= 65 + up111110 -1 x111110 >= 0 + up111110 +64 x111110 <= 65 + dn000001 -1 x000001 >= 0 + dn000001 +64 x000001 <= 65 + dn000010 -1 x000010 >= 0 + dn000010 +64 x000010 <= 65 + dn000011 -2 x000011 >= 0 + dn000011 +64 x000011 <= 66 + dn000100 -1 x000100 >= 0 + dn000100 +64 x000100 <= 65 + dn000101 -2 x000101 >= 0 + dn000101 +64 x000101 <= 66 + dn000110 -2 x000110 >= 0 + dn000110 +64 x000110 <= 66 + dn000111 -1 x000111 >= 0 + dn000111 +64 x000111 <= 65 + dn001000 -1 x001000 >= 0 + dn001000 +64 x001000 <= 65 + dn001001 -2 x001001 >= 0 + dn001001 +64 x001001 <= 66 + dn001010 -2 x001010 >= 0 + dn001010 +64 x001010 <= 66 + dn001011 -1 x001011 >= 0 + dn001011 +64 x001011 <= 65 + dn001100 -2 x001100 >= 0 + dn001100 +64 x001100 <= 66 + dn001101 -1 x001101 >= 0 + dn001101 +64 x001101 <= 65 + dn001110 -1 x001110 >= 0 + dn001110 +64 x001110 <= 65 + dn001111 -4 x001111 >= 0 + dn001111 +64 x001111 <= 68 + dn010000 -1 x010000 >= 0 + dn010000 +64 x010000 <= 65 + dn010001 -2 x010001 >= 0 + dn010001 +64 x010001 <= 66 + dn010010 -2 x010010 >= 0 + dn010010 +64 x010010 <= 66 + dn010011 -1 x010011 >= 0 + dn010011 +64 x010011 <= 65 + dn010100 -2 x010100 >= 0 + dn010100 +64 x010100 <= 66 + dn010101 -1 x010101 >= 0 + dn010101 +64 x010101 <= 65 + dn010110 -1 x010110 >= 0 + dn010110 +64 x010110 <= 65 + dn010111 -4 x010111 >= 0 + dn010111 +64 x010111 <= 68 + dn011000 -2 x011000 >= 0 + dn011000 +64 x011000 <= 66 + dn011001 -1 x011001 >= 0 + dn011001 +64 x011001 <= 65 + dn011010 -1 x011010 >= 0 + dn011010 +64 x011010 <= 65 + dn011011 -4 x011011 >= 0 + dn011011 +64 x011011 <= 68 + dn011100 -1 x011100 >= 0 + dn011100 +64 x011100 <= 65 + dn011101 -4 x011101 >= 0 + dn011101 +64 x011101 <= 68 + dn011110 -4 x011110 >= 0 + dn011110 +64 x011110 <= 68 + dn011111 -3 x011111 >= 0 + dn011111 +64 x011111 <= 67 + dn100000 -1 x100000 >= 0 + dn100000 +64 x100000 <= 65 + dn100001 -2 x100001 >= 0 + dn100001 +64 x100001 <= 66 + dn100010 -2 x100010 >= 0 + dn100010 +64 x100010 <= 66 + dn100011 -1 x100011 >= 0 + dn100011 +64 x100011 <= 65 + dn100100 -2 x100100 >= 0 + dn100100 +64 x100100 <= 66 + dn100101 -1 x100101 >= 0 + dn100101 +64 x100101 <= 65 + dn100110 -1 x100110 >= 0 + dn100110 +64 x100110 <= 65 + dn100111 -4 x100111 >= 0 + dn100111 +64 x100111 <= 68 + dn101000 -2 x101000 >= 0 + dn101000 +64 x101000 <= 66 + dn101001 -1 x101001 >= 0 + dn101001 +64 x101001 <= 65 + dn101010 -1 x101010 >= 0 + dn101010 +64 x101010 <= 65 + dn101011 -4 x101011 >= 0 + dn101011 +64 x101011 <= 68 + dn101100 -1 x101100 >= 0 + dn101100 +64 x101100 <= 65 + dn101101 -4 x101101 >= 0 + dn101101 +64 x101101 <= 68 + dn101110 -4 x101110 >= 0 + dn101110 +64 x101110 <= 68 + dn101111 -3 x101111 >= 0 + dn101111 +64 x101111 <= 67 + dn110000 -2 x110000 >= 0 + dn110000 +64 x110000 <= 66 + dn110001 -1 x110001 >= 0 + dn110001 +64 x110001 <= 65 + dn110010 -1 x110010 >= 0 + dn110010 +64 x110010 <= 65 + dn110011 -4 x110011 >= 0 + dn110011 +64 x110011 <= 68 + dn110100 -1 x110100 >= 0 + dn110100 +64 x110100 <= 65 + dn110101 -4 x110101 >= 0 + dn110101 +64 x110101 <= 68 + dn110110 -4 x110110 >= 0 + dn110110 +64 x110110 <= 68 + dn110111 -3 x110111 >= 0 + dn110111 +64 x110111 <= 67 + dn111000 -1 x111000 >= 0 + dn111000 +64 x111000 <= 65 + dn111001 -4 x111001 >= 0 + dn111001 +64 x111001 <= 68 + dn111010 -4 x111010 >= 0 + dn111010 +64 x111010 <= 68 + dn111011 -3 x111011 >= 0 + dn111011 +64 x111011 <= 67 + dn111100 -4 x111100 >= 0 + dn111100 +64 x111100 <= 68 + dn111101 -3 x111101 >= 0 + dn111101 +64 x111101 <= 67 + dn111110 -3 x111110 >= 0 + dn111110 +64 x111110 <= 67 + dn111111 -3 x111111 >= 0 + dn111111 +64 x111111 <= 67 +binary + x000000 x000001 x000010 x000011 x000100 x000101 x000110 x000111 + x001000 x001001 x001010 x001011 x001100 x001101 x001110 x001111 + x010000 x010001 x010010 x010011 x010100 x010101 x010110 x010111 + x011000 x011001 x011010 x011011 x011100 x011101 x011110 x011111 + x100000 x100001 x100010 x100011 x100100 x100101 x100110 x100111 + x101000 x101001 x101010 x101011 x101100 x101101 x101110 x101111 + x110000 x110001 x110010 x110011 x110100 x110101 x110110 x110111 + x111000 x111001 x111010 x111011 x111100 x111101 x111110 x111111 +integer + dn000000 up000000 dn000001 up000001 dn000010 up000010 dn000011 up000011 + dn000100 up000100 dn000101 up000101 dn000110 up000110 dn000111 up000111 + dn001000 up001000 dn001001 up001001 dn001010 up001010 dn001011 up001011 + dn001100 up001100 dn001101 up001101 dn001110 up001110 dn001111 up001111 + dn010000 up010000 dn010001 up010001 dn010010 up010010 dn010011 up010011 + dn010100 up010100 dn010101 up010101 dn010110 up010110 dn010111 up010111 + dn011000 up011000 dn011001 up011001 dn011010 up011010 dn011011 up011011 + dn011100 up011100 dn011101 up011101 dn011110 up011110 dn011111 up011111 + dn100000 up100000 dn100001 up100001 dn100010 up100010 dn100011 up100011 + dn100100 up100100 dn100101 up100101 dn100110 up100110 dn100111 up100111 + dn101000 up101000 dn101001 up101001 dn101010 up101010 dn101011 up101011 + dn101100 up101100 dn101101 up101101 dn101110 up101110 dn101111 up101111 + dn110000 up110000 dn110001 up110001 dn110010 up110010 dn110011 up110011 + dn110100 up110100 dn110101 up110101 dn110110 up110110 dn110111 up110111 + dn111000 up111000 dn111001 up111001 dn111010 up111010 dn111011 up111011 + dn111100 up111100 dn111101 up111101 dn111110 up111110 dn111111 up111111 +End diff --git a/resources/3rdparty/glpk-4.65/examples/wolfra6d.mod b/resources/3rdparty/glpk-4.65/examples/wolfra6d.mod new file mode 100644 index 000000000..c478487b5 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/examples/wolfra6d.mod @@ -0,0 +1,94 @@ +/* Any Wolfram elementary CA in 6D eucl. Neumann CA grid emulator generator */ + +/* Implemented, inspected, written and converted to GNU MathProg + by NASZVADI, Peter, 2016-2017 */ + +/* see background info and more details in wolfra6d.lp */ + +/* each axis has this two endpoints */ +set V := 0..1; + +/* this model processes a hypercube in 6d, so 6+1 parallel planes intersect */ +set H := 0..6; + +/* denoting all vertices in the 6d unit hypercube */ +set Cells := V cross V cross V cross V cross V cross V; + + +/* input parameters, bup/bdn = number of upper/lower neighbour 6d cells of a (cyclic) segment */ +param bup{i in H}, default 1; +param bdn{i in H}, default 2; + +/* boolean meaning if a vertex is chosen */ +var x{Cells}, binary; + +/* temporary calculations to enforce bup/bdn */ +var up{Cells}, >=0; +var dn{Cells}, >=0; + +/* the total weight of selected cells near the main diagonal */ +var obj; + +/* up/dn vars denote the number of selected upper/lower neighbours */ +s.t. cup{(v1,v2,v3,v4,v5,v6) in Cells: v1+v2+v3+v4+v5+v6<6}: + sum{(w1,w2,w3,w4,w5,w6) in Cells: max(v1-w1,v2-w2,v3-w3,v4-w4,v5-w5,v6-w6)<=0} + if (w1+w2+w3+w4+w5+w6) = (1+v1+v2+v3+v4+v5+v6) then x[w1,w2,w3,w4,w5,w6] else 0 = + up[v1,v2,v3,v4,v5,v6]; + +s.t. cdn{(v1,v2,v3,v4,v5,v6) in Cells: v1+v2+v3+v4+v5+v6>0}: + sum{(w1,w2,w3,w4,w5,w6) in Cells: min(v1-w1,v2-w2,v3-w3,v4-w4,v5-w5,v6-w6)>=0} + if (w1+w2+w3+w4+w5+w6) = (-1+v1+v2+v3+v4+v5+v6) then x[w1,w2,w3,w4,w5,w6] else 0 = + dn[v1,v2,v3,v4,v5,v6]; + +/* 4 helper constraints, hences the leading "c" */ +s.t. cbup1{(v1,v2,v3,v4,v5,v6) in Cells: v1+v2+v3+v4+v5+v6<6}: + up[v1,v2,v3,v4,v5,v6] >= bup[v1+v2+v3+v4+v5+v6] * x[v1,v2,v3,v4,v5,v6]; + +s.t. cbup2{(v1,v2,v3,v4,v5,v6) in Cells: v1+v2+v3+v4+v5+v6<6}: + up[v1,v2,v3,v4,v5,v6] + (2**6) * x[v1,v2,v3,v4,v5,v6] <= (2**6) + bup[v1+v2+v3+v4+v5+v6]; + +s.t. cbdn1{(v1,v2,v3,v4,v5,v6) in Cells: v1+v2+v3+v4+v5+v6>0}: + dn[v1,v2,v3,v4,v5,v6] >= bdn[v1+v2+v3+v4+v5+v6] * x[v1,v2,v3,v4,v5,v6]; + +s.t. cbdn2{(v1,v2,v3,v4,v5,v6) in Cells: v1+v2+v3+v4+v5+v6>0}: + dn[v1,v2,v3,v4,v5,v6] + (2**6) * x[v1,v2,v3,v4,v5,v6] <= (2**6) + bdn[v1+v2+v3+v4+v5+v6]; + +/* these two promoted points should be selected */ +s.t. initdiag: x[0,0,0,0,0,0] + x[1,1,1,1,1,1] = 2; + +/* obvious */ +s.t. sumx: sum{(v1,v2,v3,v4,v5,v6) in Cells} x[v1,v2,v3,v4,v5,v6] = obj; + +minimize cobj: obj; + +solve; + +/* pretty-printing hopefully nontrivial solution */ +printf "\nChosen vertex subset:\n"; +for{i in H}: { + printf "Weight=%s\n", i; + printf{(v1,v2,v3,v4,v5,v6) in Cells: v1+v2+v3+v4+v5+v6 = i+(8-8*x[v1,v2,v3,v4,v5,v6])} + " %s%s%s%s%s%s\n",v1,v2,v3,v4,v5,v6; +} +printf "\nTotal number of selected cells in the hypercube: %g\n\n", obj; + +data; + +/* these parameters were chosen in the first run that yielded a solution */ +param bup := 0 6 + 1 2 + 2 3 + 3 2 + 4 1 + 5 1 + 6 6; + +param bdn := 0 3 + 1 1 + 2 2 + 3 1 + 4 4 + 5 3 + 6 3; + +end; diff --git a/resources/3rdparty/glpk-4.57/examples/xyacfs.mod b/resources/3rdparty/glpk-4.65/examples/xyacfs.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/xyacfs.mod rename to resources/3rdparty/glpk-4.65/examples/xyacfs.mod diff --git a/resources/3rdparty/glpk-4.57/examples/yacfs.mod b/resources/3rdparty/glpk-4.65/examples/yacfs.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/yacfs.mod rename to resources/3rdparty/glpk-4.65/examples/yacfs.mod diff --git a/resources/3rdparty/glpk-4.57/examples/zebra.mod b/resources/3rdparty/glpk-4.65/examples/zebra.mod similarity index 100% rename from resources/3rdparty/glpk-4.57/examples/zebra.mod rename to resources/3rdparty/glpk-4.65/examples/zebra.mod diff --git a/resources/3rdparty/glpk-4.57/install-sh b/resources/3rdparty/glpk-4.65/install-sh similarity index 100% rename from resources/3rdparty/glpk-4.57/install-sh rename to resources/3rdparty/glpk-4.65/install-sh diff --git a/resources/3rdparty/glpk-4.57/ltmain.sh b/resources/3rdparty/glpk-4.65/ltmain.sh similarity index 100% rename from resources/3rdparty/glpk-4.57/ltmain.sh rename to resources/3rdparty/glpk-4.65/ltmain.sh diff --git a/resources/3rdparty/glpk-4.57/m4/libtool.m4 b/resources/3rdparty/glpk-4.65/m4/libtool.m4 similarity index 100% rename from resources/3rdparty/glpk-4.57/m4/libtool.m4 rename to resources/3rdparty/glpk-4.65/m4/libtool.m4 diff --git a/resources/3rdparty/glpk-4.57/m4/ltoptions.m4 b/resources/3rdparty/glpk-4.65/m4/ltoptions.m4 similarity index 100% rename from resources/3rdparty/glpk-4.57/m4/ltoptions.m4 rename to resources/3rdparty/glpk-4.65/m4/ltoptions.m4 diff --git a/resources/3rdparty/glpk-4.57/m4/ltsugar.m4 b/resources/3rdparty/glpk-4.65/m4/ltsugar.m4 similarity index 100% rename from resources/3rdparty/glpk-4.57/m4/ltsugar.m4 rename to resources/3rdparty/glpk-4.65/m4/ltsugar.m4 diff --git a/resources/3rdparty/glpk-4.57/m4/ltversion.m4 b/resources/3rdparty/glpk-4.65/m4/ltversion.m4 similarity index 100% rename from resources/3rdparty/glpk-4.57/m4/ltversion.m4 rename to resources/3rdparty/glpk-4.65/m4/ltversion.m4 diff --git a/resources/3rdparty/glpk-4.57/m4/lt~obsolete.m4 b/resources/3rdparty/glpk-4.65/m4/lt~obsolete.m4 similarity index 100% rename from resources/3rdparty/glpk-4.57/m4/lt~obsolete.m4 rename to resources/3rdparty/glpk-4.65/m4/lt~obsolete.m4 diff --git a/resources/3rdparty/glpk-4.57/missing b/resources/3rdparty/glpk-4.65/missing similarity index 100% rename from resources/3rdparty/glpk-4.57/missing rename to resources/3rdparty/glpk-4.65/missing diff --git a/resources/3rdparty/glpk-4.65/src/Makefile.am b/resources/3rdparty/glpk-4.65/src/Makefile.am new file mode 100644 index 000000000..eb5dc1bea --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/Makefile.am @@ -0,0 +1,222 @@ +## Process this file with automake to produce Makefile.in ## + +include_HEADERS = glpk.h + +lib_LTLIBRARIES = libglpk.la + +libglpk_la_CPPFLAGS = \ +-I$(srcdir) \ +-I$(srcdir)/amd \ +-I$(srcdir)/api \ +-I$(srcdir)/bflib \ +-I$(srcdir)/colamd \ +-I$(srcdir)/draft \ +-I$(srcdir)/env \ +-I$(srcdir)/intopt \ +-I$(srcdir)/minisat \ +-I$(srcdir)/misc \ +-I$(srcdir)/mpl \ +-I$(srcdir)/npp \ +-I$(srcdir)/proxy \ +-I$(srcdir)/simplex \ +-I$(srcdir)/zlib + +libglpk_la_LDFLAGS = \ +-version-info 43:0:3 \ +-export-symbols-regex '^glp_*' \ +${NOUNDEFINED} + +libglpk_la_SOURCES = \ +amd/amd_1.c \ +amd/amd_2.c \ +amd/amd_aat.c \ +amd/amd_control.c \ +amd/amd_defaults.c \ +amd/amd_dump.c \ +amd/amd_info.c \ +amd/amd_order.c \ +amd/amd_post_tree.c \ +amd/amd_postorder.c \ +amd/amd_preprocess.c \ +amd/amd_valid.c \ +api/advbas.c \ +api/asnhall.c \ +api/asnlp.c \ +api/asnokalg.c \ +api/ckasn.c \ +api/ckcnf.c \ +api/cplex.c \ +api/cpp.c \ +api/cpxbas.c \ +api/graph.c \ +api/gridgen.c \ +api/intfeas1.c \ +api/maxffalg.c \ +api/maxflp.c \ +api/mcflp.c \ +api/mcfokalg.c \ +api/mcfrelax.c \ +api/minisat1.c \ +api/mpl.c \ +api/mps.c \ +api/netgen.c \ +api/npp.c \ +api/pript.c \ +api/prmip.c \ +api/prob1.c \ +api/prob2.c \ +api/prob3.c \ +api/prob4.c \ +api/prob5.c \ +api/prrngs.c \ +api/prsol.c \ +api/rdasn.c \ +api/rdcc.c \ +api/rdcnf.c \ +api/rdipt.c \ +api/rdmaxf.c \ +api/rdmcf.c \ +api/rdmip.c \ +api/rdprob.c \ +api/rdsol.c \ +api/rmfgen.c \ +api/strong.c \ +api/topsort.c \ +api/weak.c \ +api/wcliqex.c \ +api/wrasn.c \ +api/wrcc.c \ +api/wrcnf.c \ +api/wript.c \ +api/wrmaxf.c \ +api/wrmcf.c \ +api/wrmip.c \ +api/wrprob.c \ +api/wrsol.c \ +bflib/btf.c \ +bflib/btfint.c \ +bflib/fhv.c \ +bflib/fhvint.c \ +bflib/ifu.c \ +bflib/luf.c \ +bflib/lufint.c \ +bflib/scf.c \ +bflib/scfint.c \ +bflib/sgf.c \ +bflib/sva.c \ +colamd/colamd.c \ +draft/bfd.c \ +draft/bfx.c \ +draft/glpapi06.c \ +draft/glpapi07.c \ +draft/glpapi08.c \ +draft/glpapi09.c \ +draft/glpapi10.c \ +draft/glpapi12.c \ +draft/glpapi13.c \ +draft/glphbm.c \ +draft/glpios01.c \ +draft/glpios02.c \ +draft/glpios03.c \ +draft/glpios07.c \ +draft/glpios09.c \ +draft/glpios11.c \ +draft/glpios12.c \ +draft/glpipm.c \ +draft/glpmat.c \ +draft/glprgr.c \ +draft/glpscl.c \ +draft/glpspm.c \ +draft/glpssx01.c \ +draft/glpssx02.c \ +draft/lux.c \ +env/alloc.c \ +env/dlsup.c \ +env/env.c \ +env/error.c \ +env/stdc.c \ +env/stdout.c \ +env/stream.c \ +env/time.c \ +env/tls.c \ +intopt/cfg.c \ +intopt/cfg1.c \ +intopt/cfg2.c \ +intopt/clqcut.c \ +intopt/covgen.c \ +intopt/fpump.c \ +intopt/gmicut.c \ +intopt/gmigen.c \ +intopt/mirgen.c \ +intopt/spv.c \ +minisat/minisat.c \ +misc/avl.c \ +misc/bignum.c \ +misc/dimacs.c \ +misc/dmp.c \ +misc/ffalg.c \ +misc/fp2rat.c \ +misc/fvs.c \ +misc/gcd.c \ +misc/jd.c \ +misc/keller.c \ +misc/ks.c \ +misc/mc13d.c \ +misc/mc21a.c \ +misc/mt1.c \ +misc/mygmp.c \ +misc/okalg.c \ +misc/qmd.c \ +misc/relax4.c \ +misc/rng.c \ +misc/rng1.c \ +misc/round2n.c \ +misc/str2int.c \ +misc/str2num.c \ +misc/strspx.c \ +misc/strtrim.c \ +misc/triang.c \ +misc/wclique.c \ +misc/wclique1.c \ +mpl/mpl1.c \ +mpl/mpl2.c \ +mpl/mpl3.c \ +mpl/mpl4.c \ +mpl/mpl5.c \ +mpl/mpl6.c \ +mpl/mplsql.c \ +npp/npp1.c \ +npp/npp2.c \ +npp/npp3.c \ +npp/npp4.c \ +npp/npp5.c \ +npp/npp6.c \ +proxy/proxy.c \ +proxy/proxy1.c \ +simplex/spxat.c \ +simplex/spxchuzc.c \ +simplex/spxchuzr.c \ +simplex/spxlp.c \ +simplex/spxnt.c \ +simplex/spxprim.c \ +simplex/spxprob.c \ +simplex/spychuzc.c \ +simplex/spychuzr.c \ +simplex/spydual.c \ +zlib/adler32.c \ +zlib/compress.c \ +zlib/crc32.c \ +zlib/deflate.c \ +zlib/gzclose.c \ +zlib/gzlib.c \ +zlib/gzread.c \ +zlib/gzwrite.c \ +zlib/inffast.c \ +zlib/inflate.c \ +zlib/inftrees.c \ +zlib/trees.c \ +zlib/uncompr.c \ +zlib/zio.c \ +zlib/zutil.c + +## eof ## diff --git a/resources/3rdparty/glpk-4.57/src/Makefile.in b/resources/3rdparty/glpk-4.65/src/Makefile.in similarity index 65% rename from resources/3rdparty/glpk-4.57/src/Makefile.in rename to resources/3rdparty/glpk-4.65/src/Makefile.in index cf9f95ae2..a06a2dcec 100644 --- a/resources/3rdparty/glpk-4.57/src/Makefile.in +++ b/resources/3rdparty/glpk-4.65/src/Makefile.in @@ -95,73 +95,80 @@ am__uninstall_files_from_dir = { \ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) libglpk_la_LIBADD = -am_libglpk_la_OBJECTS = libglpk_la-avl.lo libglpk_la-bfd.lo \ - libglpk_la-bfx.lo libglpk_la-glpapi01.lo \ - libglpk_la-glpapi02.lo libglpk_la-glpapi03.lo \ - libglpk_la-glpapi04.lo libglpk_la-glpapi05.lo \ - libglpk_la-glpapi06.lo libglpk_la-glpapi07.lo \ - libglpk_la-glpapi08.lo libglpk_la-glpapi09.lo \ - libglpk_la-glpapi10.lo libglpk_la-glpapi11.lo \ - libglpk_la-glpapi12.lo libglpk_la-glpapi13.lo \ - libglpk_la-glpapi14.lo libglpk_la-glpapi15.lo \ - libglpk_la-glpapi16.lo libglpk_la-glpapi17.lo \ - libglpk_la-glpapi18.lo libglpk_la-glpapi19.lo \ - libglpk_la-glpapi20.lo libglpk_la-glpapi21.lo \ - libglpk_la-glpcpx.lo libglpk_la-glpdmx.lo libglpk_la-glpgmp.lo \ - libglpk_la-glphbm.lo libglpk_la-glpini01.lo \ - libglpk_la-glpini02.lo libglpk_la-glpios01.lo \ - libglpk_la-glpios02.lo libglpk_la-glpios03.lo \ - libglpk_la-glpios04.lo libglpk_la-glpios05.lo \ - libglpk_la-glpios06.lo libglpk_la-glpios07.lo \ - libglpk_la-glpios08.lo libglpk_la-glpios09.lo \ - libglpk_la-glpios10.lo libglpk_la-glpios11.lo \ - libglpk_la-glpios12.lo libglpk_la-glpipm.lo \ - libglpk_la-glpmat.lo libglpk_la-glpmpl01.lo \ - libglpk_la-glpmpl02.lo libglpk_la-glpmpl03.lo \ - libglpk_la-glpmpl04.lo libglpk_la-glpmpl05.lo \ - libglpk_la-glpmpl06.lo libglpk_la-glpmps.lo \ - libglpk_la-glpnet03.lo libglpk_la-glpnet04.lo \ - libglpk_la-glpnet05.lo libglpk_la-glpnpp01.lo \ - libglpk_la-glpnpp02.lo libglpk_la-glpnpp03.lo \ - libglpk_la-glpnpp04.lo libglpk_la-glpnpp05.lo \ - libglpk_la-glpnpp06.lo libglpk_la-glprgr.lo \ - libglpk_la-glpscl.lo libglpk_la-glpsdf.lo libglpk_la-glpspm.lo \ - libglpk_la-glpsql.lo libglpk_la-glpssx01.lo \ - libglpk_la-glpssx02.lo libglpk_la-lux.lo libglpk_la-amd_1.lo \ - libglpk_la-amd_2.lo libglpk_la-amd_aat.lo \ - libglpk_la-amd_control.lo libglpk_la-amd_defaults.lo \ - libglpk_la-amd_dump.lo libglpk_la-amd_info.lo \ - libglpk_la-amd_order.lo libglpk_la-amd_post_tree.lo \ - libglpk_la-amd_postorder.lo libglpk_la-amd_preprocess.lo \ - libglpk_la-amd_valid.lo libglpk_la-btf.lo libglpk_la-btfint.lo \ +am_libglpk_la_OBJECTS = libglpk_la-amd_1.lo libglpk_la-amd_2.lo \ + libglpk_la-amd_aat.lo libglpk_la-amd_control.lo \ + libglpk_la-amd_defaults.lo libglpk_la-amd_dump.lo \ + libglpk_la-amd_info.lo libglpk_la-amd_order.lo \ + libglpk_la-amd_post_tree.lo libglpk_la-amd_postorder.lo \ + libglpk_la-amd_preprocess.lo libglpk_la-amd_valid.lo \ + libglpk_la-advbas.lo libglpk_la-asnhall.lo libglpk_la-asnlp.lo \ + libglpk_la-asnokalg.lo libglpk_la-ckasn.lo libglpk_la-ckcnf.lo \ + libglpk_la-cplex.lo libglpk_la-cpp.lo libglpk_la-cpxbas.lo \ + libglpk_la-graph.lo libglpk_la-gridgen.lo \ + libglpk_la-intfeas1.lo libglpk_la-maxffalg.lo \ + libglpk_la-maxflp.lo libglpk_la-mcflp.lo \ + libglpk_la-mcfokalg.lo libglpk_la-mcfrelax.lo \ + libglpk_la-minisat1.lo libglpk_la-mpl.lo libglpk_la-mps.lo \ + libglpk_la-netgen.lo libglpk_la-npp.lo libglpk_la-pript.lo \ + libglpk_la-prmip.lo libglpk_la-prob1.lo libglpk_la-prob2.lo \ + libglpk_la-prob3.lo libglpk_la-prob4.lo libglpk_la-prob5.lo \ + libglpk_la-prrngs.lo libglpk_la-prsol.lo libglpk_la-rdasn.lo \ + libglpk_la-rdcc.lo libglpk_la-rdcnf.lo libglpk_la-rdipt.lo \ + libglpk_la-rdmaxf.lo libglpk_la-rdmcf.lo libglpk_la-rdmip.lo \ + libglpk_la-rdprob.lo libglpk_la-rdsol.lo libglpk_la-rmfgen.lo \ + libglpk_la-strong.lo libglpk_la-topsort.lo libglpk_la-weak.lo \ + libglpk_la-wcliqex.lo libglpk_la-wrasn.lo libglpk_la-wrcc.lo \ + libglpk_la-wrcnf.lo libglpk_la-wript.lo libglpk_la-wrmaxf.lo \ + libglpk_la-wrmcf.lo libglpk_la-wrmip.lo libglpk_la-wrprob.lo \ + libglpk_la-wrsol.lo libglpk_la-btf.lo libglpk_la-btfint.lo \ libglpk_la-fhv.lo libglpk_la-fhvint.lo libglpk_la-ifu.lo \ libglpk_la-luf.lo libglpk_la-lufint.lo libglpk_la-scf.lo \ libglpk_la-scfint.lo libglpk_la-sgf.lo libglpk_la-sva.lo \ - libglpk_la-cfg.lo libglpk_la-cfg1.lo libglpk_la-colamd.lo \ - libglpk_la-alloc.lo libglpk_la-dlsup.lo libglpk_la-env.lo \ - libglpk_la-error.lo libglpk_la-stdout.lo libglpk_la-stream.lo \ - libglpk_la-time.lo libglpk_la-tls.lo libglpk_la-minisat.lo \ - libglpk_la-bignum.lo libglpk_la-dmp.lo libglpk_la-ffalg.lo \ - libglpk_la-fp2rat.lo libglpk_la-gcd.lo libglpk_la-jd.lo \ - libglpk_la-keller.lo libglpk_la-mc13d.lo libglpk_la-mc21a.lo \ - libglpk_la-okalg.lo libglpk_la-qmd.lo libglpk_la-relax4.lo \ - libglpk_la-rng.lo libglpk_la-rng1.lo libglpk_la-round2n.lo \ - libglpk_la-str2int.lo libglpk_la-str2num.lo \ - libglpk_la-strspx.lo libglpk_la-strtrim.lo \ - libglpk_la-triang.lo libglpk_la-wclique.lo \ - libglpk_la-wclique1.lo libglpk_la-proxy.lo \ - libglpk_la-proxy1.lo libglpk_la-spxat.lo \ - libglpk_la-spxchuzc.lo libglpk_la-spxchuzr.lo \ - libglpk_la-spxlp.lo libglpk_la-spxnt.lo libglpk_la-spxprim.lo \ - libglpk_la-spxprob.lo libglpk_la-spychuzc.lo \ - libglpk_la-spychuzr.lo libglpk_la-spydual.lo \ - libglpk_la-adler32.lo libglpk_la-compress.lo \ - libglpk_la-crc32.lo libglpk_la-deflate.lo \ - libglpk_la-gzclose.lo libglpk_la-gzlib.lo libglpk_la-gzread.lo \ - libglpk_la-gzwrite.lo libglpk_la-inffast.lo \ - libglpk_la-inflate.lo libglpk_la-inftrees.lo \ - libglpk_la-trees.lo libglpk_la-uncompr.lo libglpk_la-zio.lo \ - libglpk_la-zutil.lo + libglpk_la-colamd.lo libglpk_la-bfd.lo libglpk_la-bfx.lo \ + libglpk_la-glpapi06.lo libglpk_la-glpapi07.lo \ + libglpk_la-glpapi08.lo libglpk_la-glpapi09.lo \ + libglpk_la-glpapi10.lo libglpk_la-glpapi12.lo \ + libglpk_la-glpapi13.lo libglpk_la-glphbm.lo \ + libglpk_la-glpios01.lo libglpk_la-glpios02.lo \ + libglpk_la-glpios03.lo libglpk_la-glpios07.lo \ + libglpk_la-glpios09.lo libglpk_la-glpios11.lo \ + libglpk_la-glpios12.lo libglpk_la-glpipm.lo \ + libglpk_la-glpmat.lo libglpk_la-glprgr.lo libglpk_la-glpscl.lo \ + libglpk_la-glpspm.lo libglpk_la-glpssx01.lo \ + libglpk_la-glpssx02.lo libglpk_la-lux.lo libglpk_la-alloc.lo \ + libglpk_la-dlsup.lo libglpk_la-env.lo libglpk_la-error.lo \ + libglpk_la-stdc.lo libglpk_la-stdout.lo libglpk_la-stream.lo \ + libglpk_la-time.lo libglpk_la-tls.lo libglpk_la-cfg.lo \ + libglpk_la-cfg1.lo libglpk_la-cfg2.lo libglpk_la-clqcut.lo \ + libglpk_la-covgen.lo libglpk_la-fpump.lo libglpk_la-gmicut.lo \ + libglpk_la-gmigen.lo libglpk_la-mirgen.lo libglpk_la-spv.lo \ + libglpk_la-minisat.lo libglpk_la-avl.lo libglpk_la-bignum.lo \ + libglpk_la-dimacs.lo libglpk_la-dmp.lo libglpk_la-ffalg.lo \ + libglpk_la-fp2rat.lo libglpk_la-fvs.lo libglpk_la-gcd.lo \ + libglpk_la-jd.lo libglpk_la-keller.lo libglpk_la-ks.lo \ + libglpk_la-mc13d.lo libglpk_la-mc21a.lo libglpk_la-mt1.lo \ + libglpk_la-mygmp.lo libglpk_la-okalg.lo libglpk_la-qmd.lo \ + libglpk_la-relax4.lo libglpk_la-rng.lo libglpk_la-rng1.lo \ + libglpk_la-round2n.lo libglpk_la-str2int.lo \ + libglpk_la-str2num.lo libglpk_la-strspx.lo \ + libglpk_la-strtrim.lo libglpk_la-triang.lo \ + libglpk_la-wclique.lo libglpk_la-wclique1.lo \ + libglpk_la-mpl1.lo libglpk_la-mpl2.lo libglpk_la-mpl3.lo \ + libglpk_la-mpl4.lo libglpk_la-mpl5.lo libglpk_la-mpl6.lo \ + libglpk_la-mplsql.lo libglpk_la-npp1.lo libglpk_la-npp2.lo \ + libglpk_la-npp3.lo libglpk_la-npp4.lo libglpk_la-npp5.lo \ + libglpk_la-npp6.lo libglpk_la-proxy.lo libglpk_la-proxy1.lo \ + libglpk_la-spxat.lo libglpk_la-spxchuzc.lo \ + libglpk_la-spxchuzr.lo libglpk_la-spxlp.lo libglpk_la-spxnt.lo \ + libglpk_la-spxprim.lo libglpk_la-spxprob.lo \ + libglpk_la-spychuzc.lo libglpk_la-spychuzr.lo \ + libglpk_la-spydual.lo libglpk_la-adler32.lo \ + libglpk_la-compress.lo libglpk_la-crc32.lo \ + libglpk_la-deflate.lo libglpk_la-gzclose.lo \ + libglpk_la-gzlib.lo libglpk_la-gzread.lo libglpk_la-gzwrite.lo \ + libglpk_la-inffast.lo libglpk_la-inflate.lo \ + libglpk_la-inftrees.lo libglpk_la-trees.lo \ + libglpk_la-uncompr.lo libglpk_la-zio.lo libglpk_la-zutil.lo libglpk_la_OBJECTS = $(am_libglpk_la_OBJECTS) libglpk_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ @@ -233,6 +240,7 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ +NOUNDEFINED = @NOUNDEFINED@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ @@ -308,89 +316,26 @@ lib_LTLIBRARIES = libglpk.la libglpk_la_CPPFLAGS = \ -I$(srcdir) \ -I$(srcdir)/amd \ +-I$(srcdir)/api \ -I$(srcdir)/bflib \ --I$(srcdir)/cglib \ -I$(srcdir)/colamd \ +-I$(srcdir)/draft \ -I$(srcdir)/env \ +-I$(srcdir)/intopt \ -I$(srcdir)/minisat \ -I$(srcdir)/misc \ +-I$(srcdir)/mpl \ +-I$(srcdir)/npp \ -I$(srcdir)/proxy \ -I$(srcdir)/simplex \ -I$(srcdir)/zlib libglpk_la_LDFLAGS = \ --version-info 38:0:2 \ --export-symbols-regex '^glp_*' +-version-info 43:0:3 \ +-export-symbols-regex '^glp_*' \ +${NOUNDEFINED} libglpk_la_SOURCES = \ -avl.c \ -bfd.c \ -bfx.c \ -glpapi01.c \ -glpapi02.c \ -glpapi03.c \ -glpapi04.c \ -glpapi05.c \ -glpapi06.c \ -glpapi07.c \ -glpapi08.c \ -glpapi09.c \ -glpapi10.c \ -glpapi11.c \ -glpapi12.c \ -glpapi13.c \ -glpapi14.c \ -glpapi15.c \ -glpapi16.c \ -glpapi17.c \ -glpapi18.c \ -glpapi19.c \ -glpapi20.c \ -glpapi21.c \ -glpcpx.c \ -glpdmx.c \ -glpgmp.c \ -glphbm.c \ -glpini01.c \ -glpini02.c \ -glpios01.c \ -glpios02.c \ -glpios03.c \ -glpios04.c \ -glpios05.c \ -glpios06.c \ -glpios07.c \ -glpios08.c \ -glpios09.c \ -glpios10.c \ -glpios11.c \ -glpios12.c \ -glpipm.c \ -glpmat.c \ -glpmpl01.c \ -glpmpl02.c \ -glpmpl03.c \ -glpmpl04.c \ -glpmpl05.c \ -glpmpl06.c \ -glpmps.c \ -glpnet03.c \ -glpnet04.c \ -glpnet05.c \ -glpnpp01.c \ -glpnpp02.c \ -glpnpp03.c \ -glpnpp04.c \ -glpnpp05.c \ -glpnpp06.c \ -glprgr.c \ -glpscl.c \ -glpsdf.c \ -glpspm.c \ -glpsql.c \ -glpssx01.c \ -glpssx02.c \ -lux.c \ amd/amd_1.c \ amd/amd_2.c \ amd/amd_aat.c \ @@ -403,6 +348,60 @@ amd/amd_post_tree.c \ amd/amd_postorder.c \ amd/amd_preprocess.c \ amd/amd_valid.c \ +api/advbas.c \ +api/asnhall.c \ +api/asnlp.c \ +api/asnokalg.c \ +api/ckasn.c \ +api/ckcnf.c \ +api/cplex.c \ +api/cpp.c \ +api/cpxbas.c \ +api/graph.c \ +api/gridgen.c \ +api/intfeas1.c \ +api/maxffalg.c \ +api/maxflp.c \ +api/mcflp.c \ +api/mcfokalg.c \ +api/mcfrelax.c \ +api/minisat1.c \ +api/mpl.c \ +api/mps.c \ +api/netgen.c \ +api/npp.c \ +api/pript.c \ +api/prmip.c \ +api/prob1.c \ +api/prob2.c \ +api/prob3.c \ +api/prob4.c \ +api/prob5.c \ +api/prrngs.c \ +api/prsol.c \ +api/rdasn.c \ +api/rdcc.c \ +api/rdcnf.c \ +api/rdipt.c \ +api/rdmaxf.c \ +api/rdmcf.c \ +api/rdmip.c \ +api/rdprob.c \ +api/rdsol.c \ +api/rmfgen.c \ +api/strong.c \ +api/topsort.c \ +api/weak.c \ +api/wcliqex.c \ +api/wrasn.c \ +api/wrcc.c \ +api/wrcnf.c \ +api/wript.c \ +api/wrmaxf.c \ +api/wrmcf.c \ +api/wrmip.c \ +api/wrprob.c \ +api/wrsol.c \ bflib/btf.c \ bflib/btfint.c \ bflib/fhv.c \ @@ -414,27 +413,67 @@ bflib/scf.c \ bflib/scfint.c \ bflib/sgf.c \ bflib/sva.c \ -cglib/cfg.c \ -cglib/cfg1.c \ colamd/colamd.c \ +draft/bfd.c \ +draft/bfx.c \ +draft/glpapi06.c \ +draft/glpapi07.c \ +draft/glpapi08.c \ +draft/glpapi09.c \ +draft/glpapi10.c \ +draft/glpapi12.c \ +draft/glpapi13.c \ +draft/glphbm.c \ +draft/glpios01.c \ +draft/glpios02.c \ +draft/glpios03.c \ +draft/glpios07.c \ +draft/glpios09.c \ +draft/glpios11.c \ +draft/glpios12.c \ +draft/glpipm.c \ +draft/glpmat.c \ +draft/glprgr.c \ +draft/glpscl.c \ +draft/glpspm.c \ +draft/glpssx01.c \ +draft/glpssx02.c \ +draft/lux.c \ env/alloc.c \ env/dlsup.c \ env/env.c \ env/error.c \ +env/stdc.c \ env/stdout.c \ env/stream.c \ env/time.c \ env/tls.c \ +intopt/cfg.c \ +intopt/cfg1.c \ +intopt/cfg2.c \ +intopt/clqcut.c \ +intopt/covgen.c \ +intopt/fpump.c \ +intopt/gmicut.c \ +intopt/gmigen.c \ +intopt/mirgen.c \ +intopt/spv.c \ minisat/minisat.c \ +misc/avl.c \ misc/bignum.c \ +misc/dimacs.c \ misc/dmp.c \ misc/ffalg.c \ misc/fp2rat.c \ +misc/fvs.c \ misc/gcd.c \ misc/jd.c \ misc/keller.c \ +misc/ks.c \ misc/mc13d.c \ misc/mc21a.c \ +misc/mt1.c \ +misc/mygmp.c \ misc/okalg.c \ misc/qmd.c \ misc/relax4.c \ @@ -448,6 +487,19 @@ misc/strtrim.c \ misc/triang.c \ misc/wclique.c \ misc/wclique1.c \ +mpl/mpl1.c \ +mpl/mpl2.c \ +mpl/mpl3.c \ +mpl/mpl4.c \ +mpl/mpl5.c \ +mpl/mpl6.c \ +mpl/mplsql.c \ +npp/npp1.c \ +npp/npp2.c \ +npp/npp3.c \ +npp/npp4.c \ +npp/npp5.c \ +npp/npp6.c \ proxy/proxy.c \ proxy/proxy1.c \ simplex/spxat.c \ @@ -554,6 +606,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-adler32.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-advbas.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-alloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-amd_1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-amd_2.Plo@am__quote@ @@ -567,6 +620,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-amd_postorder.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-amd_preprocess.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-amd_valid.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-asnhall.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-asnlp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-asnokalg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-avl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-bfd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-bfx.Plo@am__quote@ @@ -575,10 +631,19 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-btfint.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-cfg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-cfg1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-cfg2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-ckasn.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-ckcnf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-clqcut.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-colamd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-compress.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-covgen.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-cplex.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-cpp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-cpxbas.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-crc32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-deflate.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-dimacs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-dlsup.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-dmp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-env.Plo@am__quote@ @@ -587,71 +652,35 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-fhv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-fhvint.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-fp2rat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-fpump.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-fvs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-gcd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi01.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi02.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi03.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi04.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi05.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi06.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi07.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi08.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi09.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi10.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi11.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi12.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi13.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi14.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi15.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi16.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi17.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi18.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi19.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi20.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpapi21.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpcpx.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpdmx.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpgmp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glphbm.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpini01.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpini02.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpios01.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpios02.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpios03.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpios04.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpios05.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpios06.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpios07.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpios08.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpios09.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpios10.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpios11.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpios12.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpipm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpmat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpmpl01.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpmpl02.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpmpl03.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpmpl04.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpmpl05.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpmpl06.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpmps.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpnet03.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpnet04.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpnet05.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpnpp01.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpnpp02.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpnpp03.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpnpp04.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpnpp05.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpnpp06.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glprgr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpscl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpsdf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpspm.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpsql.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpssx01.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-glpssx02.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-gmicut.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-gmigen.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-graph.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-gridgen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-gzclose.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-gzlib.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-gzread.Plo@am__quote@ @@ -660,25 +689,73 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-inffast.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-inflate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-inftrees.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-intfeas1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-jd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-keller.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-ks.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-luf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-lufint.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-lux.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-maxffalg.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-maxflp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mc13d.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mc21a.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mcflp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mcfokalg.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mcfrelax.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-minisat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-minisat1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mirgen.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mpl1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mpl2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mpl3.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mpl4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mpl5.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mpl6.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mplsql.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mps.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mt1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-mygmp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-netgen.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-npp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-npp1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-npp2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-npp3.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-npp4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-npp5.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-npp6.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-okalg.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-pript.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-prmip.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-prob1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-prob2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-prob3.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-prob4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-prob5.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-proxy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-proxy1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-prrngs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-prsol.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-qmd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-rdasn.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-rdcc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-rdcnf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-rdipt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-rdmaxf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-rdmcf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-rdmip.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-rdprob.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-rdsol.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-relax4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-rmfgen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-rng.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-rng1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-round2n.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-scf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-scfint.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-sgf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-spv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-spxat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-spxchuzc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-spxchuzr.Plo@am__quote@ @@ -689,20 +766,34 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-spychuzc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-spychuzr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-spydual.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-stdc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-stdout.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-str2int.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-str2num.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-stream.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-strong.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-strspx.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-strtrim.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-sva.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-time.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-tls.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-topsort.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-trees.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-triang.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-uncompr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-wcliqex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-wclique.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-wclique1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-weak.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-wrasn.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-wrcc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-wrcnf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-wript.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-wrmaxf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-wrmcf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-wrmip.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-wrprob.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-wrsol.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-zio.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglpk_la-zutil.Plo@am__quote@ @@ -727,565 +818,467 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< -libglpk_la-avl.lo: avl.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-avl.lo -MD -MP -MF $(DEPDIR)/libglpk_la-avl.Tpo -c -o libglpk_la-avl.lo `test -f 'avl.c' || echo '$(srcdir)/'`avl.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-avl.Tpo $(DEPDIR)/libglpk_la-avl.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='avl.c' object='libglpk_la-avl.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-avl.lo `test -f 'avl.c' || echo '$(srcdir)/'`avl.c - -libglpk_la-bfd.lo: bfd.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-bfd.lo -MD -MP -MF $(DEPDIR)/libglpk_la-bfd.Tpo -c -o libglpk_la-bfd.lo `test -f 'bfd.c' || echo '$(srcdir)/'`bfd.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-bfd.Tpo $(DEPDIR)/libglpk_la-bfd.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bfd.c' object='libglpk_la-bfd.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-bfd.lo `test -f 'bfd.c' || echo '$(srcdir)/'`bfd.c - -libglpk_la-bfx.lo: bfx.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-bfx.lo -MD -MP -MF $(DEPDIR)/libglpk_la-bfx.Tpo -c -o libglpk_la-bfx.lo `test -f 'bfx.c' || echo '$(srcdir)/'`bfx.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-bfx.Tpo $(DEPDIR)/libglpk_la-bfx.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bfx.c' object='libglpk_la-bfx.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-bfx.lo `test -f 'bfx.c' || echo '$(srcdir)/'`bfx.c - -libglpk_la-glpapi01.lo: glpapi01.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi01.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi01.Tpo -c -o libglpk_la-glpapi01.lo `test -f 'glpapi01.c' || echo '$(srcdir)/'`glpapi01.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi01.Tpo $(DEPDIR)/libglpk_la-glpapi01.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi01.c' object='libglpk_la-glpapi01.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi01.lo `test -f 'glpapi01.c' || echo '$(srcdir)/'`glpapi01.c - -libglpk_la-glpapi02.lo: glpapi02.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi02.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi02.Tpo -c -o libglpk_la-glpapi02.lo `test -f 'glpapi02.c' || echo '$(srcdir)/'`glpapi02.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi02.Tpo $(DEPDIR)/libglpk_la-glpapi02.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi02.c' object='libglpk_la-glpapi02.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi02.lo `test -f 'glpapi02.c' || echo '$(srcdir)/'`glpapi02.c - -libglpk_la-glpapi03.lo: glpapi03.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi03.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi03.Tpo -c -o libglpk_la-glpapi03.lo `test -f 'glpapi03.c' || echo '$(srcdir)/'`glpapi03.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi03.Tpo $(DEPDIR)/libglpk_la-glpapi03.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi03.c' object='libglpk_la-glpapi03.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi03.lo `test -f 'glpapi03.c' || echo '$(srcdir)/'`glpapi03.c - -libglpk_la-glpapi04.lo: glpapi04.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi04.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi04.Tpo -c -o libglpk_la-glpapi04.lo `test -f 'glpapi04.c' || echo '$(srcdir)/'`glpapi04.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi04.Tpo $(DEPDIR)/libglpk_la-glpapi04.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi04.c' object='libglpk_la-glpapi04.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi04.lo `test -f 'glpapi04.c' || echo '$(srcdir)/'`glpapi04.c - -libglpk_la-glpapi05.lo: glpapi05.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi05.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi05.Tpo -c -o libglpk_la-glpapi05.lo `test -f 'glpapi05.c' || echo '$(srcdir)/'`glpapi05.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi05.Tpo $(DEPDIR)/libglpk_la-glpapi05.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi05.c' object='libglpk_la-glpapi05.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi05.lo `test -f 'glpapi05.c' || echo '$(srcdir)/'`glpapi05.c - -libglpk_la-glpapi06.lo: glpapi06.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi06.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi06.Tpo -c -o libglpk_la-glpapi06.lo `test -f 'glpapi06.c' || echo '$(srcdir)/'`glpapi06.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi06.Tpo $(DEPDIR)/libglpk_la-glpapi06.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi06.c' object='libglpk_la-glpapi06.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi06.lo `test -f 'glpapi06.c' || echo '$(srcdir)/'`glpapi06.c - -libglpk_la-glpapi07.lo: glpapi07.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi07.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi07.Tpo -c -o libglpk_la-glpapi07.lo `test -f 'glpapi07.c' || echo '$(srcdir)/'`glpapi07.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi07.Tpo $(DEPDIR)/libglpk_la-glpapi07.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi07.c' object='libglpk_la-glpapi07.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi07.lo `test -f 'glpapi07.c' || echo '$(srcdir)/'`glpapi07.c - -libglpk_la-glpapi08.lo: glpapi08.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi08.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi08.Tpo -c -o libglpk_la-glpapi08.lo `test -f 'glpapi08.c' || echo '$(srcdir)/'`glpapi08.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi08.Tpo $(DEPDIR)/libglpk_la-glpapi08.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi08.c' object='libglpk_la-glpapi08.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi08.lo `test -f 'glpapi08.c' || echo '$(srcdir)/'`glpapi08.c - -libglpk_la-glpapi09.lo: glpapi09.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi09.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi09.Tpo -c -o libglpk_la-glpapi09.lo `test -f 'glpapi09.c' || echo '$(srcdir)/'`glpapi09.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi09.Tpo $(DEPDIR)/libglpk_la-glpapi09.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi09.c' object='libglpk_la-glpapi09.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi09.lo `test -f 'glpapi09.c' || echo '$(srcdir)/'`glpapi09.c - -libglpk_la-glpapi10.lo: glpapi10.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi10.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi10.Tpo -c -o libglpk_la-glpapi10.lo `test -f 'glpapi10.c' || echo '$(srcdir)/'`glpapi10.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi10.Tpo $(DEPDIR)/libglpk_la-glpapi10.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi10.c' object='libglpk_la-glpapi10.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi10.lo `test -f 'glpapi10.c' || echo '$(srcdir)/'`glpapi10.c - -libglpk_la-glpapi11.lo: glpapi11.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi11.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi11.Tpo -c -o libglpk_la-glpapi11.lo `test -f 'glpapi11.c' || echo '$(srcdir)/'`glpapi11.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi11.Tpo $(DEPDIR)/libglpk_la-glpapi11.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi11.c' object='libglpk_la-glpapi11.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi11.lo `test -f 'glpapi11.c' || echo '$(srcdir)/'`glpapi11.c - -libglpk_la-glpapi12.lo: glpapi12.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi12.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi12.Tpo -c -o libglpk_la-glpapi12.lo `test -f 'glpapi12.c' || echo '$(srcdir)/'`glpapi12.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi12.Tpo $(DEPDIR)/libglpk_la-glpapi12.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi12.c' object='libglpk_la-glpapi12.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-amd_1.lo: amd/amd_1.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_1.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_1.Tpo -c -o libglpk_la-amd_1.lo `test -f 'amd/amd_1.c' || echo '$(srcdir)/'`amd/amd_1.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_1.Tpo $(DEPDIR)/libglpk_la-amd_1.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_1.c' object='libglpk_la-amd_1.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi12.lo `test -f 'glpapi12.c' || echo '$(srcdir)/'`glpapi12.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_1.lo `test -f 'amd/amd_1.c' || echo '$(srcdir)/'`amd/amd_1.c -libglpk_la-glpapi13.lo: glpapi13.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi13.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi13.Tpo -c -o libglpk_la-glpapi13.lo `test -f 'glpapi13.c' || echo '$(srcdir)/'`glpapi13.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi13.Tpo $(DEPDIR)/libglpk_la-glpapi13.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi13.c' object='libglpk_la-glpapi13.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-amd_2.lo: amd/amd_2.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_2.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_2.Tpo -c -o libglpk_la-amd_2.lo `test -f 'amd/amd_2.c' || echo '$(srcdir)/'`amd/amd_2.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_2.Tpo $(DEPDIR)/libglpk_la-amd_2.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_2.c' object='libglpk_la-amd_2.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi13.lo `test -f 'glpapi13.c' || echo '$(srcdir)/'`glpapi13.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_2.lo `test -f 'amd/amd_2.c' || echo '$(srcdir)/'`amd/amd_2.c -libglpk_la-glpapi14.lo: glpapi14.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi14.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi14.Tpo -c -o libglpk_la-glpapi14.lo `test -f 'glpapi14.c' || echo '$(srcdir)/'`glpapi14.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi14.Tpo $(DEPDIR)/libglpk_la-glpapi14.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi14.c' object='libglpk_la-glpapi14.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-amd_aat.lo: amd/amd_aat.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_aat.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_aat.Tpo -c -o libglpk_la-amd_aat.lo `test -f 'amd/amd_aat.c' || echo '$(srcdir)/'`amd/amd_aat.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_aat.Tpo $(DEPDIR)/libglpk_la-amd_aat.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_aat.c' object='libglpk_la-amd_aat.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi14.lo `test -f 'glpapi14.c' || echo '$(srcdir)/'`glpapi14.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_aat.lo `test -f 'amd/amd_aat.c' || echo '$(srcdir)/'`amd/amd_aat.c -libglpk_la-glpapi15.lo: glpapi15.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi15.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi15.Tpo -c -o libglpk_la-glpapi15.lo `test -f 'glpapi15.c' || echo '$(srcdir)/'`glpapi15.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi15.Tpo $(DEPDIR)/libglpk_la-glpapi15.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi15.c' object='libglpk_la-glpapi15.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-amd_control.lo: amd/amd_control.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_control.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_control.Tpo -c -o libglpk_la-amd_control.lo `test -f 'amd/amd_control.c' || echo '$(srcdir)/'`amd/amd_control.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_control.Tpo $(DEPDIR)/libglpk_la-amd_control.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_control.c' object='libglpk_la-amd_control.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi15.lo `test -f 'glpapi15.c' || echo '$(srcdir)/'`glpapi15.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_control.lo `test -f 'amd/amd_control.c' || echo '$(srcdir)/'`amd/amd_control.c -libglpk_la-glpapi16.lo: glpapi16.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi16.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi16.Tpo -c -o libglpk_la-glpapi16.lo `test -f 'glpapi16.c' || echo '$(srcdir)/'`glpapi16.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi16.Tpo $(DEPDIR)/libglpk_la-glpapi16.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi16.c' object='libglpk_la-glpapi16.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-amd_defaults.lo: amd/amd_defaults.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_defaults.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_defaults.Tpo -c -o libglpk_la-amd_defaults.lo `test -f 'amd/amd_defaults.c' || echo '$(srcdir)/'`amd/amd_defaults.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_defaults.Tpo $(DEPDIR)/libglpk_la-amd_defaults.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_defaults.c' object='libglpk_la-amd_defaults.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi16.lo `test -f 'glpapi16.c' || echo '$(srcdir)/'`glpapi16.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_defaults.lo `test -f 'amd/amd_defaults.c' || echo '$(srcdir)/'`amd/amd_defaults.c -libglpk_la-glpapi17.lo: glpapi17.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi17.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi17.Tpo -c -o libglpk_la-glpapi17.lo `test -f 'glpapi17.c' || echo '$(srcdir)/'`glpapi17.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi17.Tpo $(DEPDIR)/libglpk_la-glpapi17.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi17.c' object='libglpk_la-glpapi17.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-amd_dump.lo: amd/amd_dump.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_dump.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_dump.Tpo -c -o libglpk_la-amd_dump.lo `test -f 'amd/amd_dump.c' || echo '$(srcdir)/'`amd/amd_dump.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_dump.Tpo $(DEPDIR)/libglpk_la-amd_dump.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_dump.c' object='libglpk_la-amd_dump.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi17.lo `test -f 'glpapi17.c' || echo '$(srcdir)/'`glpapi17.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_dump.lo `test -f 'amd/amd_dump.c' || echo '$(srcdir)/'`amd/amd_dump.c -libglpk_la-glpapi18.lo: glpapi18.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi18.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi18.Tpo -c -o libglpk_la-glpapi18.lo `test -f 'glpapi18.c' || echo '$(srcdir)/'`glpapi18.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi18.Tpo $(DEPDIR)/libglpk_la-glpapi18.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi18.c' object='libglpk_la-glpapi18.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-amd_info.lo: amd/amd_info.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_info.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_info.Tpo -c -o libglpk_la-amd_info.lo `test -f 'amd/amd_info.c' || echo '$(srcdir)/'`amd/amd_info.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_info.Tpo $(DEPDIR)/libglpk_la-amd_info.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_info.c' object='libglpk_la-amd_info.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi18.lo `test -f 'glpapi18.c' || echo '$(srcdir)/'`glpapi18.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_info.lo `test -f 'amd/amd_info.c' || echo '$(srcdir)/'`amd/amd_info.c -libglpk_la-glpapi19.lo: glpapi19.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi19.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi19.Tpo -c -o libglpk_la-glpapi19.lo `test -f 'glpapi19.c' || echo '$(srcdir)/'`glpapi19.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi19.Tpo $(DEPDIR)/libglpk_la-glpapi19.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi19.c' object='libglpk_la-glpapi19.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-amd_order.lo: amd/amd_order.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_order.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_order.Tpo -c -o libglpk_la-amd_order.lo `test -f 'amd/amd_order.c' || echo '$(srcdir)/'`amd/amd_order.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_order.Tpo $(DEPDIR)/libglpk_la-amd_order.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_order.c' object='libglpk_la-amd_order.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi19.lo `test -f 'glpapi19.c' || echo '$(srcdir)/'`glpapi19.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_order.lo `test -f 'amd/amd_order.c' || echo '$(srcdir)/'`amd/amd_order.c -libglpk_la-glpapi20.lo: glpapi20.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi20.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi20.Tpo -c -o libglpk_la-glpapi20.lo `test -f 'glpapi20.c' || echo '$(srcdir)/'`glpapi20.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi20.Tpo $(DEPDIR)/libglpk_la-glpapi20.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi20.c' object='libglpk_la-glpapi20.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-amd_post_tree.lo: amd/amd_post_tree.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_post_tree.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_post_tree.Tpo -c -o libglpk_la-amd_post_tree.lo `test -f 'amd/amd_post_tree.c' || echo '$(srcdir)/'`amd/amd_post_tree.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_post_tree.Tpo $(DEPDIR)/libglpk_la-amd_post_tree.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_post_tree.c' object='libglpk_la-amd_post_tree.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi20.lo `test -f 'glpapi20.c' || echo '$(srcdir)/'`glpapi20.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_post_tree.lo `test -f 'amd/amd_post_tree.c' || echo '$(srcdir)/'`amd/amd_post_tree.c -libglpk_la-glpapi21.lo: glpapi21.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi21.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi21.Tpo -c -o libglpk_la-glpapi21.lo `test -f 'glpapi21.c' || echo '$(srcdir)/'`glpapi21.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi21.Tpo $(DEPDIR)/libglpk_la-glpapi21.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpapi21.c' object='libglpk_la-glpapi21.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-amd_postorder.lo: amd/amd_postorder.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_postorder.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_postorder.Tpo -c -o libglpk_la-amd_postorder.lo `test -f 'amd/amd_postorder.c' || echo '$(srcdir)/'`amd/amd_postorder.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_postorder.Tpo $(DEPDIR)/libglpk_la-amd_postorder.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_postorder.c' object='libglpk_la-amd_postorder.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi21.lo `test -f 'glpapi21.c' || echo '$(srcdir)/'`glpapi21.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_postorder.lo `test -f 'amd/amd_postorder.c' || echo '$(srcdir)/'`amd/amd_postorder.c -libglpk_la-glpcpx.lo: glpcpx.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpcpx.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpcpx.Tpo -c -o libglpk_la-glpcpx.lo `test -f 'glpcpx.c' || echo '$(srcdir)/'`glpcpx.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpcpx.Tpo $(DEPDIR)/libglpk_la-glpcpx.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpcpx.c' object='libglpk_la-glpcpx.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-amd_preprocess.lo: amd/amd_preprocess.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_preprocess.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_preprocess.Tpo -c -o libglpk_la-amd_preprocess.lo `test -f 'amd/amd_preprocess.c' || echo '$(srcdir)/'`amd/amd_preprocess.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_preprocess.Tpo $(DEPDIR)/libglpk_la-amd_preprocess.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_preprocess.c' object='libglpk_la-amd_preprocess.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpcpx.lo `test -f 'glpcpx.c' || echo '$(srcdir)/'`glpcpx.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_preprocess.lo `test -f 'amd/amd_preprocess.c' || echo '$(srcdir)/'`amd/amd_preprocess.c -libglpk_la-glpdmx.lo: glpdmx.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpdmx.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpdmx.Tpo -c -o libglpk_la-glpdmx.lo `test -f 'glpdmx.c' || echo '$(srcdir)/'`glpdmx.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpdmx.Tpo $(DEPDIR)/libglpk_la-glpdmx.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpdmx.c' object='libglpk_la-glpdmx.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-amd_valid.lo: amd/amd_valid.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_valid.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_valid.Tpo -c -o libglpk_la-amd_valid.lo `test -f 'amd/amd_valid.c' || echo '$(srcdir)/'`amd/amd_valid.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_valid.Tpo $(DEPDIR)/libglpk_la-amd_valid.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_valid.c' object='libglpk_la-amd_valid.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpdmx.lo `test -f 'glpdmx.c' || echo '$(srcdir)/'`glpdmx.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_valid.lo `test -f 'amd/amd_valid.c' || echo '$(srcdir)/'`amd/amd_valid.c -libglpk_la-glpgmp.lo: glpgmp.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpgmp.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpgmp.Tpo -c -o libglpk_la-glpgmp.lo `test -f 'glpgmp.c' || echo '$(srcdir)/'`glpgmp.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpgmp.Tpo $(DEPDIR)/libglpk_la-glpgmp.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpgmp.c' object='libglpk_la-glpgmp.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-advbas.lo: api/advbas.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-advbas.lo -MD -MP -MF $(DEPDIR)/libglpk_la-advbas.Tpo -c -o libglpk_la-advbas.lo `test -f 'api/advbas.c' || echo '$(srcdir)/'`api/advbas.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-advbas.Tpo $(DEPDIR)/libglpk_la-advbas.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/advbas.c' object='libglpk_la-advbas.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpgmp.lo `test -f 'glpgmp.c' || echo '$(srcdir)/'`glpgmp.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-advbas.lo `test -f 'api/advbas.c' || echo '$(srcdir)/'`api/advbas.c -libglpk_la-glphbm.lo: glphbm.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glphbm.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glphbm.Tpo -c -o libglpk_la-glphbm.lo `test -f 'glphbm.c' || echo '$(srcdir)/'`glphbm.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glphbm.Tpo $(DEPDIR)/libglpk_la-glphbm.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glphbm.c' object='libglpk_la-glphbm.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-asnhall.lo: api/asnhall.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-asnhall.lo -MD -MP -MF $(DEPDIR)/libglpk_la-asnhall.Tpo -c -o libglpk_la-asnhall.lo `test -f 'api/asnhall.c' || echo '$(srcdir)/'`api/asnhall.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-asnhall.Tpo $(DEPDIR)/libglpk_la-asnhall.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/asnhall.c' object='libglpk_la-asnhall.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glphbm.lo `test -f 'glphbm.c' || echo '$(srcdir)/'`glphbm.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-asnhall.lo `test -f 'api/asnhall.c' || echo '$(srcdir)/'`api/asnhall.c -libglpk_la-glpini01.lo: glpini01.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpini01.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpini01.Tpo -c -o libglpk_la-glpini01.lo `test -f 'glpini01.c' || echo '$(srcdir)/'`glpini01.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpini01.Tpo $(DEPDIR)/libglpk_la-glpini01.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpini01.c' object='libglpk_la-glpini01.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-asnlp.lo: api/asnlp.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-asnlp.lo -MD -MP -MF $(DEPDIR)/libglpk_la-asnlp.Tpo -c -o libglpk_la-asnlp.lo `test -f 'api/asnlp.c' || echo '$(srcdir)/'`api/asnlp.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-asnlp.Tpo $(DEPDIR)/libglpk_la-asnlp.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/asnlp.c' object='libglpk_la-asnlp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpini01.lo `test -f 'glpini01.c' || echo '$(srcdir)/'`glpini01.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-asnlp.lo `test -f 'api/asnlp.c' || echo '$(srcdir)/'`api/asnlp.c -libglpk_la-glpini02.lo: glpini02.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpini02.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpini02.Tpo -c -o libglpk_la-glpini02.lo `test -f 'glpini02.c' || echo '$(srcdir)/'`glpini02.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpini02.Tpo $(DEPDIR)/libglpk_la-glpini02.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpini02.c' object='libglpk_la-glpini02.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-asnokalg.lo: api/asnokalg.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-asnokalg.lo -MD -MP -MF $(DEPDIR)/libglpk_la-asnokalg.Tpo -c -o libglpk_la-asnokalg.lo `test -f 'api/asnokalg.c' || echo '$(srcdir)/'`api/asnokalg.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-asnokalg.Tpo $(DEPDIR)/libglpk_la-asnokalg.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/asnokalg.c' object='libglpk_la-asnokalg.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpini02.lo `test -f 'glpini02.c' || echo '$(srcdir)/'`glpini02.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-asnokalg.lo `test -f 'api/asnokalg.c' || echo '$(srcdir)/'`api/asnokalg.c -libglpk_la-glpios01.lo: glpios01.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios01.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios01.Tpo -c -o libglpk_la-glpios01.lo `test -f 'glpios01.c' || echo '$(srcdir)/'`glpios01.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios01.Tpo $(DEPDIR)/libglpk_la-glpios01.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpios01.c' object='libglpk_la-glpios01.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-ckasn.lo: api/ckasn.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-ckasn.lo -MD -MP -MF $(DEPDIR)/libglpk_la-ckasn.Tpo -c -o libglpk_la-ckasn.lo `test -f 'api/ckasn.c' || echo '$(srcdir)/'`api/ckasn.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-ckasn.Tpo $(DEPDIR)/libglpk_la-ckasn.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/ckasn.c' object='libglpk_la-ckasn.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios01.lo `test -f 'glpios01.c' || echo '$(srcdir)/'`glpios01.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-ckasn.lo `test -f 'api/ckasn.c' || echo '$(srcdir)/'`api/ckasn.c -libglpk_la-glpios02.lo: glpios02.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios02.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios02.Tpo -c -o libglpk_la-glpios02.lo `test -f 'glpios02.c' || echo '$(srcdir)/'`glpios02.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios02.Tpo $(DEPDIR)/libglpk_la-glpios02.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpios02.c' object='libglpk_la-glpios02.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-ckcnf.lo: api/ckcnf.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-ckcnf.lo -MD -MP -MF $(DEPDIR)/libglpk_la-ckcnf.Tpo -c -o libglpk_la-ckcnf.lo `test -f 'api/ckcnf.c' || echo '$(srcdir)/'`api/ckcnf.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-ckcnf.Tpo $(DEPDIR)/libglpk_la-ckcnf.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/ckcnf.c' object='libglpk_la-ckcnf.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios02.lo `test -f 'glpios02.c' || echo '$(srcdir)/'`glpios02.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-ckcnf.lo `test -f 'api/ckcnf.c' || echo '$(srcdir)/'`api/ckcnf.c -libglpk_la-glpios03.lo: glpios03.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios03.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios03.Tpo -c -o libglpk_la-glpios03.lo `test -f 'glpios03.c' || echo '$(srcdir)/'`glpios03.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios03.Tpo $(DEPDIR)/libglpk_la-glpios03.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpios03.c' object='libglpk_la-glpios03.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-cplex.lo: api/cplex.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-cplex.lo -MD -MP -MF $(DEPDIR)/libglpk_la-cplex.Tpo -c -o libglpk_la-cplex.lo `test -f 'api/cplex.c' || echo '$(srcdir)/'`api/cplex.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-cplex.Tpo $(DEPDIR)/libglpk_la-cplex.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/cplex.c' object='libglpk_la-cplex.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios03.lo `test -f 'glpios03.c' || echo '$(srcdir)/'`glpios03.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-cplex.lo `test -f 'api/cplex.c' || echo '$(srcdir)/'`api/cplex.c -libglpk_la-glpios04.lo: glpios04.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios04.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios04.Tpo -c -o libglpk_la-glpios04.lo `test -f 'glpios04.c' || echo '$(srcdir)/'`glpios04.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios04.Tpo $(DEPDIR)/libglpk_la-glpios04.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpios04.c' object='libglpk_la-glpios04.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-cpp.lo: api/cpp.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-cpp.lo -MD -MP -MF $(DEPDIR)/libglpk_la-cpp.Tpo -c -o libglpk_la-cpp.lo `test -f 'api/cpp.c' || echo '$(srcdir)/'`api/cpp.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-cpp.Tpo $(DEPDIR)/libglpk_la-cpp.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/cpp.c' object='libglpk_la-cpp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios04.lo `test -f 'glpios04.c' || echo '$(srcdir)/'`glpios04.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-cpp.lo `test -f 'api/cpp.c' || echo '$(srcdir)/'`api/cpp.c -libglpk_la-glpios05.lo: glpios05.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios05.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios05.Tpo -c -o libglpk_la-glpios05.lo `test -f 'glpios05.c' || echo '$(srcdir)/'`glpios05.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios05.Tpo $(DEPDIR)/libglpk_la-glpios05.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpios05.c' object='libglpk_la-glpios05.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-cpxbas.lo: api/cpxbas.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-cpxbas.lo -MD -MP -MF $(DEPDIR)/libglpk_la-cpxbas.Tpo -c -o libglpk_la-cpxbas.lo `test -f 'api/cpxbas.c' || echo '$(srcdir)/'`api/cpxbas.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-cpxbas.Tpo $(DEPDIR)/libglpk_la-cpxbas.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/cpxbas.c' object='libglpk_la-cpxbas.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios05.lo `test -f 'glpios05.c' || echo '$(srcdir)/'`glpios05.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-cpxbas.lo `test -f 'api/cpxbas.c' || echo '$(srcdir)/'`api/cpxbas.c -libglpk_la-glpios06.lo: glpios06.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios06.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios06.Tpo -c -o libglpk_la-glpios06.lo `test -f 'glpios06.c' || echo '$(srcdir)/'`glpios06.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios06.Tpo $(DEPDIR)/libglpk_la-glpios06.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpios06.c' object='libglpk_la-glpios06.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-graph.lo: api/graph.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-graph.lo -MD -MP -MF $(DEPDIR)/libglpk_la-graph.Tpo -c -o libglpk_la-graph.lo `test -f 'api/graph.c' || echo '$(srcdir)/'`api/graph.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-graph.Tpo $(DEPDIR)/libglpk_la-graph.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/graph.c' object='libglpk_la-graph.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios06.lo `test -f 'glpios06.c' || echo '$(srcdir)/'`glpios06.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-graph.lo `test -f 'api/graph.c' || echo '$(srcdir)/'`api/graph.c -libglpk_la-glpios07.lo: glpios07.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios07.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios07.Tpo -c -o libglpk_la-glpios07.lo `test -f 'glpios07.c' || echo '$(srcdir)/'`glpios07.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios07.Tpo $(DEPDIR)/libglpk_la-glpios07.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpios07.c' object='libglpk_la-glpios07.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-gridgen.lo: api/gridgen.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-gridgen.lo -MD -MP -MF $(DEPDIR)/libglpk_la-gridgen.Tpo -c -o libglpk_la-gridgen.lo `test -f 'api/gridgen.c' || echo '$(srcdir)/'`api/gridgen.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-gridgen.Tpo $(DEPDIR)/libglpk_la-gridgen.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/gridgen.c' object='libglpk_la-gridgen.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios07.lo `test -f 'glpios07.c' || echo '$(srcdir)/'`glpios07.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-gridgen.lo `test -f 'api/gridgen.c' || echo '$(srcdir)/'`api/gridgen.c -libglpk_la-glpios08.lo: glpios08.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios08.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios08.Tpo -c -o libglpk_la-glpios08.lo `test -f 'glpios08.c' || echo '$(srcdir)/'`glpios08.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios08.Tpo $(DEPDIR)/libglpk_la-glpios08.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpios08.c' object='libglpk_la-glpios08.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-intfeas1.lo: api/intfeas1.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-intfeas1.lo -MD -MP -MF $(DEPDIR)/libglpk_la-intfeas1.Tpo -c -o libglpk_la-intfeas1.lo `test -f 'api/intfeas1.c' || echo '$(srcdir)/'`api/intfeas1.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-intfeas1.Tpo $(DEPDIR)/libglpk_la-intfeas1.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/intfeas1.c' object='libglpk_la-intfeas1.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios08.lo `test -f 'glpios08.c' || echo '$(srcdir)/'`glpios08.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-intfeas1.lo `test -f 'api/intfeas1.c' || echo '$(srcdir)/'`api/intfeas1.c -libglpk_la-glpios09.lo: glpios09.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios09.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios09.Tpo -c -o libglpk_la-glpios09.lo `test -f 'glpios09.c' || echo '$(srcdir)/'`glpios09.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios09.Tpo $(DEPDIR)/libglpk_la-glpios09.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpios09.c' object='libglpk_la-glpios09.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-maxffalg.lo: api/maxffalg.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-maxffalg.lo -MD -MP -MF $(DEPDIR)/libglpk_la-maxffalg.Tpo -c -o libglpk_la-maxffalg.lo `test -f 'api/maxffalg.c' || echo '$(srcdir)/'`api/maxffalg.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-maxffalg.Tpo $(DEPDIR)/libglpk_la-maxffalg.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/maxffalg.c' object='libglpk_la-maxffalg.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios09.lo `test -f 'glpios09.c' || echo '$(srcdir)/'`glpios09.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-maxffalg.lo `test -f 'api/maxffalg.c' || echo '$(srcdir)/'`api/maxffalg.c -libglpk_la-glpios10.lo: glpios10.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios10.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios10.Tpo -c -o libglpk_la-glpios10.lo `test -f 'glpios10.c' || echo '$(srcdir)/'`glpios10.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios10.Tpo $(DEPDIR)/libglpk_la-glpios10.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpios10.c' object='libglpk_la-glpios10.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-maxflp.lo: api/maxflp.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-maxflp.lo -MD -MP -MF $(DEPDIR)/libglpk_la-maxflp.Tpo -c -o libglpk_la-maxflp.lo `test -f 'api/maxflp.c' || echo '$(srcdir)/'`api/maxflp.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-maxflp.Tpo $(DEPDIR)/libglpk_la-maxflp.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/maxflp.c' object='libglpk_la-maxflp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios10.lo `test -f 'glpios10.c' || echo '$(srcdir)/'`glpios10.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-maxflp.lo `test -f 'api/maxflp.c' || echo '$(srcdir)/'`api/maxflp.c -libglpk_la-glpios11.lo: glpios11.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios11.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios11.Tpo -c -o libglpk_la-glpios11.lo `test -f 'glpios11.c' || echo '$(srcdir)/'`glpios11.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios11.Tpo $(DEPDIR)/libglpk_la-glpios11.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpios11.c' object='libglpk_la-glpios11.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-mcflp.lo: api/mcflp.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-mcflp.lo -MD -MP -MF $(DEPDIR)/libglpk_la-mcflp.Tpo -c -o libglpk_la-mcflp.lo `test -f 'api/mcflp.c' || echo '$(srcdir)/'`api/mcflp.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-mcflp.Tpo $(DEPDIR)/libglpk_la-mcflp.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/mcflp.c' object='libglpk_la-mcflp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios11.lo `test -f 'glpios11.c' || echo '$(srcdir)/'`glpios11.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-mcflp.lo `test -f 'api/mcflp.c' || echo '$(srcdir)/'`api/mcflp.c -libglpk_la-glpios12.lo: glpios12.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios12.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios12.Tpo -c -o libglpk_la-glpios12.lo `test -f 'glpios12.c' || echo '$(srcdir)/'`glpios12.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios12.Tpo $(DEPDIR)/libglpk_la-glpios12.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpios12.c' object='libglpk_la-glpios12.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-mcfokalg.lo: api/mcfokalg.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-mcfokalg.lo -MD -MP -MF $(DEPDIR)/libglpk_la-mcfokalg.Tpo -c -o libglpk_la-mcfokalg.lo `test -f 'api/mcfokalg.c' || echo '$(srcdir)/'`api/mcfokalg.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-mcfokalg.Tpo $(DEPDIR)/libglpk_la-mcfokalg.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/mcfokalg.c' object='libglpk_la-mcfokalg.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios12.lo `test -f 'glpios12.c' || echo '$(srcdir)/'`glpios12.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-mcfokalg.lo `test -f 'api/mcfokalg.c' || echo '$(srcdir)/'`api/mcfokalg.c -libglpk_la-glpipm.lo: glpipm.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpipm.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpipm.Tpo -c -o libglpk_la-glpipm.lo `test -f 'glpipm.c' || echo '$(srcdir)/'`glpipm.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpipm.Tpo $(DEPDIR)/libglpk_la-glpipm.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpipm.c' object='libglpk_la-glpipm.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-mcfrelax.lo: api/mcfrelax.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-mcfrelax.lo -MD -MP -MF $(DEPDIR)/libglpk_la-mcfrelax.Tpo -c -o libglpk_la-mcfrelax.lo `test -f 'api/mcfrelax.c' || echo '$(srcdir)/'`api/mcfrelax.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-mcfrelax.Tpo $(DEPDIR)/libglpk_la-mcfrelax.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/mcfrelax.c' object='libglpk_la-mcfrelax.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpipm.lo `test -f 'glpipm.c' || echo '$(srcdir)/'`glpipm.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-mcfrelax.lo `test -f 'api/mcfrelax.c' || echo '$(srcdir)/'`api/mcfrelax.c -libglpk_la-glpmat.lo: glpmat.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpmat.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpmat.Tpo -c -o libglpk_la-glpmat.lo `test -f 'glpmat.c' || echo '$(srcdir)/'`glpmat.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpmat.Tpo $(DEPDIR)/libglpk_la-glpmat.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpmat.c' object='libglpk_la-glpmat.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-minisat1.lo: api/minisat1.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-minisat1.lo -MD -MP -MF $(DEPDIR)/libglpk_la-minisat1.Tpo -c -o libglpk_la-minisat1.lo `test -f 'api/minisat1.c' || echo '$(srcdir)/'`api/minisat1.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-minisat1.Tpo $(DEPDIR)/libglpk_la-minisat1.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/minisat1.c' object='libglpk_la-minisat1.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpmat.lo `test -f 'glpmat.c' || echo '$(srcdir)/'`glpmat.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-minisat1.lo `test -f 'api/minisat1.c' || echo '$(srcdir)/'`api/minisat1.c -libglpk_la-glpmpl01.lo: glpmpl01.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpmpl01.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpmpl01.Tpo -c -o libglpk_la-glpmpl01.lo `test -f 'glpmpl01.c' || echo '$(srcdir)/'`glpmpl01.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpmpl01.Tpo $(DEPDIR)/libglpk_la-glpmpl01.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpmpl01.c' object='libglpk_la-glpmpl01.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-mpl.lo: api/mpl.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-mpl.lo -MD -MP -MF $(DEPDIR)/libglpk_la-mpl.Tpo -c -o libglpk_la-mpl.lo `test -f 'api/mpl.c' || echo '$(srcdir)/'`api/mpl.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-mpl.Tpo $(DEPDIR)/libglpk_la-mpl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/mpl.c' object='libglpk_la-mpl.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpmpl01.lo `test -f 'glpmpl01.c' || echo '$(srcdir)/'`glpmpl01.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-mpl.lo `test -f 'api/mpl.c' || echo '$(srcdir)/'`api/mpl.c -libglpk_la-glpmpl02.lo: glpmpl02.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpmpl02.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpmpl02.Tpo -c -o libglpk_la-glpmpl02.lo `test -f 'glpmpl02.c' || echo '$(srcdir)/'`glpmpl02.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpmpl02.Tpo $(DEPDIR)/libglpk_la-glpmpl02.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpmpl02.c' object='libglpk_la-glpmpl02.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-mps.lo: api/mps.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-mps.lo -MD -MP -MF $(DEPDIR)/libglpk_la-mps.Tpo -c -o libglpk_la-mps.lo `test -f 'api/mps.c' || echo '$(srcdir)/'`api/mps.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-mps.Tpo $(DEPDIR)/libglpk_la-mps.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/mps.c' object='libglpk_la-mps.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpmpl02.lo `test -f 'glpmpl02.c' || echo '$(srcdir)/'`glpmpl02.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-mps.lo `test -f 'api/mps.c' || echo '$(srcdir)/'`api/mps.c -libglpk_la-glpmpl03.lo: glpmpl03.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpmpl03.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpmpl03.Tpo -c -o libglpk_la-glpmpl03.lo `test -f 'glpmpl03.c' || echo '$(srcdir)/'`glpmpl03.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpmpl03.Tpo $(DEPDIR)/libglpk_la-glpmpl03.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpmpl03.c' object='libglpk_la-glpmpl03.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-netgen.lo: api/netgen.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-netgen.lo -MD -MP -MF $(DEPDIR)/libglpk_la-netgen.Tpo -c -o libglpk_la-netgen.lo `test -f 'api/netgen.c' || echo '$(srcdir)/'`api/netgen.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-netgen.Tpo $(DEPDIR)/libglpk_la-netgen.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/netgen.c' object='libglpk_la-netgen.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpmpl03.lo `test -f 'glpmpl03.c' || echo '$(srcdir)/'`glpmpl03.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-netgen.lo `test -f 'api/netgen.c' || echo '$(srcdir)/'`api/netgen.c -libglpk_la-glpmpl04.lo: glpmpl04.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpmpl04.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpmpl04.Tpo -c -o libglpk_la-glpmpl04.lo `test -f 'glpmpl04.c' || echo '$(srcdir)/'`glpmpl04.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpmpl04.Tpo $(DEPDIR)/libglpk_la-glpmpl04.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpmpl04.c' object='libglpk_la-glpmpl04.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-npp.lo: api/npp.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-npp.lo -MD -MP -MF $(DEPDIR)/libglpk_la-npp.Tpo -c -o libglpk_la-npp.lo `test -f 'api/npp.c' || echo '$(srcdir)/'`api/npp.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-npp.Tpo $(DEPDIR)/libglpk_la-npp.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/npp.c' object='libglpk_la-npp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpmpl04.lo `test -f 'glpmpl04.c' || echo '$(srcdir)/'`glpmpl04.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-npp.lo `test -f 'api/npp.c' || echo '$(srcdir)/'`api/npp.c -libglpk_la-glpmpl05.lo: glpmpl05.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpmpl05.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpmpl05.Tpo -c -o libglpk_la-glpmpl05.lo `test -f 'glpmpl05.c' || echo '$(srcdir)/'`glpmpl05.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpmpl05.Tpo $(DEPDIR)/libglpk_la-glpmpl05.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpmpl05.c' object='libglpk_la-glpmpl05.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-pript.lo: api/pript.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-pript.lo -MD -MP -MF $(DEPDIR)/libglpk_la-pript.Tpo -c -o libglpk_la-pript.lo `test -f 'api/pript.c' || echo '$(srcdir)/'`api/pript.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-pript.Tpo $(DEPDIR)/libglpk_la-pript.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/pript.c' object='libglpk_la-pript.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpmpl05.lo `test -f 'glpmpl05.c' || echo '$(srcdir)/'`glpmpl05.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-pript.lo `test -f 'api/pript.c' || echo '$(srcdir)/'`api/pript.c -libglpk_la-glpmpl06.lo: glpmpl06.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpmpl06.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpmpl06.Tpo -c -o libglpk_la-glpmpl06.lo `test -f 'glpmpl06.c' || echo '$(srcdir)/'`glpmpl06.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpmpl06.Tpo $(DEPDIR)/libglpk_la-glpmpl06.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpmpl06.c' object='libglpk_la-glpmpl06.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-prmip.lo: api/prmip.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-prmip.lo -MD -MP -MF $(DEPDIR)/libglpk_la-prmip.Tpo -c -o libglpk_la-prmip.lo `test -f 'api/prmip.c' || echo '$(srcdir)/'`api/prmip.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-prmip.Tpo $(DEPDIR)/libglpk_la-prmip.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/prmip.c' object='libglpk_la-prmip.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpmpl06.lo `test -f 'glpmpl06.c' || echo '$(srcdir)/'`glpmpl06.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-prmip.lo `test -f 'api/prmip.c' || echo '$(srcdir)/'`api/prmip.c -libglpk_la-glpmps.lo: glpmps.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpmps.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpmps.Tpo -c -o libglpk_la-glpmps.lo `test -f 'glpmps.c' || echo '$(srcdir)/'`glpmps.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpmps.Tpo $(DEPDIR)/libglpk_la-glpmps.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpmps.c' object='libglpk_la-glpmps.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-prob1.lo: api/prob1.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-prob1.lo -MD -MP -MF $(DEPDIR)/libglpk_la-prob1.Tpo -c -o libglpk_la-prob1.lo `test -f 'api/prob1.c' || echo '$(srcdir)/'`api/prob1.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-prob1.Tpo $(DEPDIR)/libglpk_la-prob1.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/prob1.c' object='libglpk_la-prob1.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpmps.lo `test -f 'glpmps.c' || echo '$(srcdir)/'`glpmps.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-prob1.lo `test -f 'api/prob1.c' || echo '$(srcdir)/'`api/prob1.c -libglpk_la-glpnet03.lo: glpnet03.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpnet03.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpnet03.Tpo -c -o libglpk_la-glpnet03.lo `test -f 'glpnet03.c' || echo '$(srcdir)/'`glpnet03.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpnet03.Tpo $(DEPDIR)/libglpk_la-glpnet03.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpnet03.c' object='libglpk_la-glpnet03.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-prob2.lo: api/prob2.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-prob2.lo -MD -MP -MF $(DEPDIR)/libglpk_la-prob2.Tpo -c -o libglpk_la-prob2.lo `test -f 'api/prob2.c' || echo '$(srcdir)/'`api/prob2.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-prob2.Tpo $(DEPDIR)/libglpk_la-prob2.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/prob2.c' object='libglpk_la-prob2.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpnet03.lo `test -f 'glpnet03.c' || echo '$(srcdir)/'`glpnet03.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-prob2.lo `test -f 'api/prob2.c' || echo '$(srcdir)/'`api/prob2.c -libglpk_la-glpnet04.lo: glpnet04.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpnet04.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpnet04.Tpo -c -o libglpk_la-glpnet04.lo `test -f 'glpnet04.c' || echo '$(srcdir)/'`glpnet04.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpnet04.Tpo $(DEPDIR)/libglpk_la-glpnet04.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpnet04.c' object='libglpk_la-glpnet04.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-prob3.lo: api/prob3.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-prob3.lo -MD -MP -MF $(DEPDIR)/libglpk_la-prob3.Tpo -c -o libglpk_la-prob3.lo `test -f 'api/prob3.c' || echo '$(srcdir)/'`api/prob3.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-prob3.Tpo $(DEPDIR)/libglpk_la-prob3.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/prob3.c' object='libglpk_la-prob3.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpnet04.lo `test -f 'glpnet04.c' || echo '$(srcdir)/'`glpnet04.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-prob3.lo `test -f 'api/prob3.c' || echo '$(srcdir)/'`api/prob3.c -libglpk_la-glpnet05.lo: glpnet05.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpnet05.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpnet05.Tpo -c -o libglpk_la-glpnet05.lo `test -f 'glpnet05.c' || echo '$(srcdir)/'`glpnet05.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpnet05.Tpo $(DEPDIR)/libglpk_la-glpnet05.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpnet05.c' object='libglpk_la-glpnet05.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-prob4.lo: api/prob4.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-prob4.lo -MD -MP -MF $(DEPDIR)/libglpk_la-prob4.Tpo -c -o libglpk_la-prob4.lo `test -f 'api/prob4.c' || echo '$(srcdir)/'`api/prob4.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-prob4.Tpo $(DEPDIR)/libglpk_la-prob4.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/prob4.c' object='libglpk_la-prob4.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpnet05.lo `test -f 'glpnet05.c' || echo '$(srcdir)/'`glpnet05.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-prob4.lo `test -f 'api/prob4.c' || echo '$(srcdir)/'`api/prob4.c -libglpk_la-glpnpp01.lo: glpnpp01.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpnpp01.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpnpp01.Tpo -c -o libglpk_la-glpnpp01.lo `test -f 'glpnpp01.c' || echo '$(srcdir)/'`glpnpp01.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpnpp01.Tpo $(DEPDIR)/libglpk_la-glpnpp01.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpnpp01.c' object='libglpk_la-glpnpp01.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-prob5.lo: api/prob5.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-prob5.lo -MD -MP -MF $(DEPDIR)/libglpk_la-prob5.Tpo -c -o libglpk_la-prob5.lo `test -f 'api/prob5.c' || echo '$(srcdir)/'`api/prob5.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-prob5.Tpo $(DEPDIR)/libglpk_la-prob5.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/prob5.c' object='libglpk_la-prob5.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpnpp01.lo `test -f 'glpnpp01.c' || echo '$(srcdir)/'`glpnpp01.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-prob5.lo `test -f 'api/prob5.c' || echo '$(srcdir)/'`api/prob5.c -libglpk_la-glpnpp02.lo: glpnpp02.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpnpp02.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpnpp02.Tpo -c -o libglpk_la-glpnpp02.lo `test -f 'glpnpp02.c' || echo '$(srcdir)/'`glpnpp02.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpnpp02.Tpo $(DEPDIR)/libglpk_la-glpnpp02.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpnpp02.c' object='libglpk_la-glpnpp02.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-prrngs.lo: api/prrngs.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-prrngs.lo -MD -MP -MF $(DEPDIR)/libglpk_la-prrngs.Tpo -c -o libglpk_la-prrngs.lo `test -f 'api/prrngs.c' || echo '$(srcdir)/'`api/prrngs.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-prrngs.Tpo $(DEPDIR)/libglpk_la-prrngs.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/prrngs.c' object='libglpk_la-prrngs.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpnpp02.lo `test -f 'glpnpp02.c' || echo '$(srcdir)/'`glpnpp02.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-prrngs.lo `test -f 'api/prrngs.c' || echo '$(srcdir)/'`api/prrngs.c -libglpk_la-glpnpp03.lo: glpnpp03.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpnpp03.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpnpp03.Tpo -c -o libglpk_la-glpnpp03.lo `test -f 'glpnpp03.c' || echo '$(srcdir)/'`glpnpp03.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpnpp03.Tpo $(DEPDIR)/libglpk_la-glpnpp03.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpnpp03.c' object='libglpk_la-glpnpp03.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-prsol.lo: api/prsol.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-prsol.lo -MD -MP -MF $(DEPDIR)/libglpk_la-prsol.Tpo -c -o libglpk_la-prsol.lo `test -f 'api/prsol.c' || echo '$(srcdir)/'`api/prsol.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-prsol.Tpo $(DEPDIR)/libglpk_la-prsol.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/prsol.c' object='libglpk_la-prsol.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpnpp03.lo `test -f 'glpnpp03.c' || echo '$(srcdir)/'`glpnpp03.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-prsol.lo `test -f 'api/prsol.c' || echo '$(srcdir)/'`api/prsol.c -libglpk_la-glpnpp04.lo: glpnpp04.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpnpp04.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpnpp04.Tpo -c -o libglpk_la-glpnpp04.lo `test -f 'glpnpp04.c' || echo '$(srcdir)/'`glpnpp04.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpnpp04.Tpo $(DEPDIR)/libglpk_la-glpnpp04.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpnpp04.c' object='libglpk_la-glpnpp04.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-rdasn.lo: api/rdasn.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-rdasn.lo -MD -MP -MF $(DEPDIR)/libglpk_la-rdasn.Tpo -c -o libglpk_la-rdasn.lo `test -f 'api/rdasn.c' || echo '$(srcdir)/'`api/rdasn.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-rdasn.Tpo $(DEPDIR)/libglpk_la-rdasn.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/rdasn.c' object='libglpk_la-rdasn.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpnpp04.lo `test -f 'glpnpp04.c' || echo '$(srcdir)/'`glpnpp04.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-rdasn.lo `test -f 'api/rdasn.c' || echo '$(srcdir)/'`api/rdasn.c -libglpk_la-glpnpp05.lo: glpnpp05.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpnpp05.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpnpp05.Tpo -c -o libglpk_la-glpnpp05.lo `test -f 'glpnpp05.c' || echo '$(srcdir)/'`glpnpp05.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpnpp05.Tpo $(DEPDIR)/libglpk_la-glpnpp05.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpnpp05.c' object='libglpk_la-glpnpp05.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-rdcc.lo: api/rdcc.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-rdcc.lo -MD -MP -MF $(DEPDIR)/libglpk_la-rdcc.Tpo -c -o libglpk_la-rdcc.lo `test -f 'api/rdcc.c' || echo '$(srcdir)/'`api/rdcc.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-rdcc.Tpo $(DEPDIR)/libglpk_la-rdcc.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/rdcc.c' object='libglpk_la-rdcc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpnpp05.lo `test -f 'glpnpp05.c' || echo '$(srcdir)/'`glpnpp05.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-rdcc.lo `test -f 'api/rdcc.c' || echo '$(srcdir)/'`api/rdcc.c -libglpk_la-glpnpp06.lo: glpnpp06.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpnpp06.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpnpp06.Tpo -c -o libglpk_la-glpnpp06.lo `test -f 'glpnpp06.c' || echo '$(srcdir)/'`glpnpp06.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpnpp06.Tpo $(DEPDIR)/libglpk_la-glpnpp06.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpnpp06.c' object='libglpk_la-glpnpp06.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-rdcnf.lo: api/rdcnf.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-rdcnf.lo -MD -MP -MF $(DEPDIR)/libglpk_la-rdcnf.Tpo -c -o libglpk_la-rdcnf.lo `test -f 'api/rdcnf.c' || echo '$(srcdir)/'`api/rdcnf.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-rdcnf.Tpo $(DEPDIR)/libglpk_la-rdcnf.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/rdcnf.c' object='libglpk_la-rdcnf.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpnpp06.lo `test -f 'glpnpp06.c' || echo '$(srcdir)/'`glpnpp06.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-rdcnf.lo `test -f 'api/rdcnf.c' || echo '$(srcdir)/'`api/rdcnf.c -libglpk_la-glprgr.lo: glprgr.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glprgr.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glprgr.Tpo -c -o libglpk_la-glprgr.lo `test -f 'glprgr.c' || echo '$(srcdir)/'`glprgr.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glprgr.Tpo $(DEPDIR)/libglpk_la-glprgr.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glprgr.c' object='libglpk_la-glprgr.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-rdipt.lo: api/rdipt.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-rdipt.lo -MD -MP -MF $(DEPDIR)/libglpk_la-rdipt.Tpo -c -o libglpk_la-rdipt.lo `test -f 'api/rdipt.c' || echo '$(srcdir)/'`api/rdipt.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-rdipt.Tpo $(DEPDIR)/libglpk_la-rdipt.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/rdipt.c' object='libglpk_la-rdipt.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glprgr.lo `test -f 'glprgr.c' || echo '$(srcdir)/'`glprgr.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-rdipt.lo `test -f 'api/rdipt.c' || echo '$(srcdir)/'`api/rdipt.c -libglpk_la-glpscl.lo: glpscl.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpscl.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpscl.Tpo -c -o libglpk_la-glpscl.lo `test -f 'glpscl.c' || echo '$(srcdir)/'`glpscl.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpscl.Tpo $(DEPDIR)/libglpk_la-glpscl.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpscl.c' object='libglpk_la-glpscl.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-rdmaxf.lo: api/rdmaxf.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-rdmaxf.lo -MD -MP -MF $(DEPDIR)/libglpk_la-rdmaxf.Tpo -c -o libglpk_la-rdmaxf.lo `test -f 'api/rdmaxf.c' || echo '$(srcdir)/'`api/rdmaxf.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-rdmaxf.Tpo $(DEPDIR)/libglpk_la-rdmaxf.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/rdmaxf.c' object='libglpk_la-rdmaxf.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpscl.lo `test -f 'glpscl.c' || echo '$(srcdir)/'`glpscl.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-rdmaxf.lo `test -f 'api/rdmaxf.c' || echo '$(srcdir)/'`api/rdmaxf.c -libglpk_la-glpsdf.lo: glpsdf.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpsdf.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpsdf.Tpo -c -o libglpk_la-glpsdf.lo `test -f 'glpsdf.c' || echo '$(srcdir)/'`glpsdf.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpsdf.Tpo $(DEPDIR)/libglpk_la-glpsdf.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpsdf.c' object='libglpk_la-glpsdf.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-rdmcf.lo: api/rdmcf.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-rdmcf.lo -MD -MP -MF $(DEPDIR)/libglpk_la-rdmcf.Tpo -c -o libglpk_la-rdmcf.lo `test -f 'api/rdmcf.c' || echo '$(srcdir)/'`api/rdmcf.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-rdmcf.Tpo $(DEPDIR)/libglpk_la-rdmcf.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/rdmcf.c' object='libglpk_la-rdmcf.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpsdf.lo `test -f 'glpsdf.c' || echo '$(srcdir)/'`glpsdf.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-rdmcf.lo `test -f 'api/rdmcf.c' || echo '$(srcdir)/'`api/rdmcf.c -libglpk_la-glpspm.lo: glpspm.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpspm.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpspm.Tpo -c -o libglpk_la-glpspm.lo `test -f 'glpspm.c' || echo '$(srcdir)/'`glpspm.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpspm.Tpo $(DEPDIR)/libglpk_la-glpspm.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpspm.c' object='libglpk_la-glpspm.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-rdmip.lo: api/rdmip.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-rdmip.lo -MD -MP -MF $(DEPDIR)/libglpk_la-rdmip.Tpo -c -o libglpk_la-rdmip.lo `test -f 'api/rdmip.c' || echo '$(srcdir)/'`api/rdmip.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-rdmip.Tpo $(DEPDIR)/libglpk_la-rdmip.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/rdmip.c' object='libglpk_la-rdmip.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpspm.lo `test -f 'glpspm.c' || echo '$(srcdir)/'`glpspm.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-rdmip.lo `test -f 'api/rdmip.c' || echo '$(srcdir)/'`api/rdmip.c -libglpk_la-glpsql.lo: glpsql.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpsql.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpsql.Tpo -c -o libglpk_la-glpsql.lo `test -f 'glpsql.c' || echo '$(srcdir)/'`glpsql.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpsql.Tpo $(DEPDIR)/libglpk_la-glpsql.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpsql.c' object='libglpk_la-glpsql.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-rdprob.lo: api/rdprob.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-rdprob.lo -MD -MP -MF $(DEPDIR)/libglpk_la-rdprob.Tpo -c -o libglpk_la-rdprob.lo `test -f 'api/rdprob.c' || echo '$(srcdir)/'`api/rdprob.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-rdprob.Tpo $(DEPDIR)/libglpk_la-rdprob.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/rdprob.c' object='libglpk_la-rdprob.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpsql.lo `test -f 'glpsql.c' || echo '$(srcdir)/'`glpsql.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-rdprob.lo `test -f 'api/rdprob.c' || echo '$(srcdir)/'`api/rdprob.c -libglpk_la-glpssx01.lo: glpssx01.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpssx01.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpssx01.Tpo -c -o libglpk_la-glpssx01.lo `test -f 'glpssx01.c' || echo '$(srcdir)/'`glpssx01.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpssx01.Tpo $(DEPDIR)/libglpk_la-glpssx01.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpssx01.c' object='libglpk_la-glpssx01.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-rdsol.lo: api/rdsol.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-rdsol.lo -MD -MP -MF $(DEPDIR)/libglpk_la-rdsol.Tpo -c -o libglpk_la-rdsol.lo `test -f 'api/rdsol.c' || echo '$(srcdir)/'`api/rdsol.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-rdsol.Tpo $(DEPDIR)/libglpk_la-rdsol.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/rdsol.c' object='libglpk_la-rdsol.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpssx01.lo `test -f 'glpssx01.c' || echo '$(srcdir)/'`glpssx01.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-rdsol.lo `test -f 'api/rdsol.c' || echo '$(srcdir)/'`api/rdsol.c -libglpk_la-glpssx02.lo: glpssx02.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpssx02.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpssx02.Tpo -c -o libglpk_la-glpssx02.lo `test -f 'glpssx02.c' || echo '$(srcdir)/'`glpssx02.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpssx02.Tpo $(DEPDIR)/libglpk_la-glpssx02.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glpssx02.c' object='libglpk_la-glpssx02.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-rmfgen.lo: api/rmfgen.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-rmfgen.lo -MD -MP -MF $(DEPDIR)/libglpk_la-rmfgen.Tpo -c -o libglpk_la-rmfgen.lo `test -f 'api/rmfgen.c' || echo '$(srcdir)/'`api/rmfgen.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-rmfgen.Tpo $(DEPDIR)/libglpk_la-rmfgen.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/rmfgen.c' object='libglpk_la-rmfgen.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpssx02.lo `test -f 'glpssx02.c' || echo '$(srcdir)/'`glpssx02.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-rmfgen.lo `test -f 'api/rmfgen.c' || echo '$(srcdir)/'`api/rmfgen.c -libglpk_la-lux.lo: lux.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-lux.lo -MD -MP -MF $(DEPDIR)/libglpk_la-lux.Tpo -c -o libglpk_la-lux.lo `test -f 'lux.c' || echo '$(srcdir)/'`lux.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-lux.Tpo $(DEPDIR)/libglpk_la-lux.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lux.c' object='libglpk_la-lux.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-strong.lo: api/strong.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-strong.lo -MD -MP -MF $(DEPDIR)/libglpk_la-strong.Tpo -c -o libglpk_la-strong.lo `test -f 'api/strong.c' || echo '$(srcdir)/'`api/strong.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-strong.Tpo $(DEPDIR)/libglpk_la-strong.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/strong.c' object='libglpk_la-strong.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-lux.lo `test -f 'lux.c' || echo '$(srcdir)/'`lux.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-strong.lo `test -f 'api/strong.c' || echo '$(srcdir)/'`api/strong.c -libglpk_la-amd_1.lo: amd/amd_1.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_1.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_1.Tpo -c -o libglpk_la-amd_1.lo `test -f 'amd/amd_1.c' || echo '$(srcdir)/'`amd/amd_1.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_1.Tpo $(DEPDIR)/libglpk_la-amd_1.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_1.c' object='libglpk_la-amd_1.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-topsort.lo: api/topsort.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-topsort.lo -MD -MP -MF $(DEPDIR)/libglpk_la-topsort.Tpo -c -o libglpk_la-topsort.lo `test -f 'api/topsort.c' || echo '$(srcdir)/'`api/topsort.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-topsort.Tpo $(DEPDIR)/libglpk_la-topsort.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/topsort.c' object='libglpk_la-topsort.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_1.lo `test -f 'amd/amd_1.c' || echo '$(srcdir)/'`amd/amd_1.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-topsort.lo `test -f 'api/topsort.c' || echo '$(srcdir)/'`api/topsort.c -libglpk_la-amd_2.lo: amd/amd_2.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_2.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_2.Tpo -c -o libglpk_la-amd_2.lo `test -f 'amd/amd_2.c' || echo '$(srcdir)/'`amd/amd_2.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_2.Tpo $(DEPDIR)/libglpk_la-amd_2.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_2.c' object='libglpk_la-amd_2.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-weak.lo: api/weak.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-weak.lo -MD -MP -MF $(DEPDIR)/libglpk_la-weak.Tpo -c -o libglpk_la-weak.lo `test -f 'api/weak.c' || echo '$(srcdir)/'`api/weak.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-weak.Tpo $(DEPDIR)/libglpk_la-weak.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/weak.c' object='libglpk_la-weak.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_2.lo `test -f 'amd/amd_2.c' || echo '$(srcdir)/'`amd/amd_2.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-weak.lo `test -f 'api/weak.c' || echo '$(srcdir)/'`api/weak.c -libglpk_la-amd_aat.lo: amd/amd_aat.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_aat.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_aat.Tpo -c -o libglpk_la-amd_aat.lo `test -f 'amd/amd_aat.c' || echo '$(srcdir)/'`amd/amd_aat.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_aat.Tpo $(DEPDIR)/libglpk_la-amd_aat.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_aat.c' object='libglpk_la-amd_aat.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-wcliqex.lo: api/wcliqex.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-wcliqex.lo -MD -MP -MF $(DEPDIR)/libglpk_la-wcliqex.Tpo -c -o libglpk_la-wcliqex.lo `test -f 'api/wcliqex.c' || echo '$(srcdir)/'`api/wcliqex.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-wcliqex.Tpo $(DEPDIR)/libglpk_la-wcliqex.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/wcliqex.c' object='libglpk_la-wcliqex.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_aat.lo `test -f 'amd/amd_aat.c' || echo '$(srcdir)/'`amd/amd_aat.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-wcliqex.lo `test -f 'api/wcliqex.c' || echo '$(srcdir)/'`api/wcliqex.c -libglpk_la-amd_control.lo: amd/amd_control.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_control.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_control.Tpo -c -o libglpk_la-amd_control.lo `test -f 'amd/amd_control.c' || echo '$(srcdir)/'`amd/amd_control.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_control.Tpo $(DEPDIR)/libglpk_la-amd_control.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_control.c' object='libglpk_la-amd_control.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-wrasn.lo: api/wrasn.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-wrasn.lo -MD -MP -MF $(DEPDIR)/libglpk_la-wrasn.Tpo -c -o libglpk_la-wrasn.lo `test -f 'api/wrasn.c' || echo '$(srcdir)/'`api/wrasn.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-wrasn.Tpo $(DEPDIR)/libglpk_la-wrasn.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/wrasn.c' object='libglpk_la-wrasn.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_control.lo `test -f 'amd/amd_control.c' || echo '$(srcdir)/'`amd/amd_control.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-wrasn.lo `test -f 'api/wrasn.c' || echo '$(srcdir)/'`api/wrasn.c -libglpk_la-amd_defaults.lo: amd/amd_defaults.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_defaults.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_defaults.Tpo -c -o libglpk_la-amd_defaults.lo `test -f 'amd/amd_defaults.c' || echo '$(srcdir)/'`amd/amd_defaults.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_defaults.Tpo $(DEPDIR)/libglpk_la-amd_defaults.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_defaults.c' object='libglpk_la-amd_defaults.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-wrcc.lo: api/wrcc.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-wrcc.lo -MD -MP -MF $(DEPDIR)/libglpk_la-wrcc.Tpo -c -o libglpk_la-wrcc.lo `test -f 'api/wrcc.c' || echo '$(srcdir)/'`api/wrcc.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-wrcc.Tpo $(DEPDIR)/libglpk_la-wrcc.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/wrcc.c' object='libglpk_la-wrcc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_defaults.lo `test -f 'amd/amd_defaults.c' || echo '$(srcdir)/'`amd/amd_defaults.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-wrcc.lo `test -f 'api/wrcc.c' || echo '$(srcdir)/'`api/wrcc.c -libglpk_la-amd_dump.lo: amd/amd_dump.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_dump.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_dump.Tpo -c -o libglpk_la-amd_dump.lo `test -f 'amd/amd_dump.c' || echo '$(srcdir)/'`amd/amd_dump.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_dump.Tpo $(DEPDIR)/libglpk_la-amd_dump.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_dump.c' object='libglpk_la-amd_dump.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-wrcnf.lo: api/wrcnf.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-wrcnf.lo -MD -MP -MF $(DEPDIR)/libglpk_la-wrcnf.Tpo -c -o libglpk_la-wrcnf.lo `test -f 'api/wrcnf.c' || echo '$(srcdir)/'`api/wrcnf.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-wrcnf.Tpo $(DEPDIR)/libglpk_la-wrcnf.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/wrcnf.c' object='libglpk_la-wrcnf.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_dump.lo `test -f 'amd/amd_dump.c' || echo '$(srcdir)/'`amd/amd_dump.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-wrcnf.lo `test -f 'api/wrcnf.c' || echo '$(srcdir)/'`api/wrcnf.c -libglpk_la-amd_info.lo: amd/amd_info.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_info.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_info.Tpo -c -o libglpk_la-amd_info.lo `test -f 'amd/amd_info.c' || echo '$(srcdir)/'`amd/amd_info.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_info.Tpo $(DEPDIR)/libglpk_la-amd_info.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_info.c' object='libglpk_la-amd_info.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-wript.lo: api/wript.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-wript.lo -MD -MP -MF $(DEPDIR)/libglpk_la-wript.Tpo -c -o libglpk_la-wript.lo `test -f 'api/wript.c' || echo '$(srcdir)/'`api/wript.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-wript.Tpo $(DEPDIR)/libglpk_la-wript.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/wript.c' object='libglpk_la-wript.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_info.lo `test -f 'amd/amd_info.c' || echo '$(srcdir)/'`amd/amd_info.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-wript.lo `test -f 'api/wript.c' || echo '$(srcdir)/'`api/wript.c -libglpk_la-amd_order.lo: amd/amd_order.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_order.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_order.Tpo -c -o libglpk_la-amd_order.lo `test -f 'amd/amd_order.c' || echo '$(srcdir)/'`amd/amd_order.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_order.Tpo $(DEPDIR)/libglpk_la-amd_order.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_order.c' object='libglpk_la-amd_order.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-wrmaxf.lo: api/wrmaxf.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-wrmaxf.lo -MD -MP -MF $(DEPDIR)/libglpk_la-wrmaxf.Tpo -c -o libglpk_la-wrmaxf.lo `test -f 'api/wrmaxf.c' || echo '$(srcdir)/'`api/wrmaxf.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-wrmaxf.Tpo $(DEPDIR)/libglpk_la-wrmaxf.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/wrmaxf.c' object='libglpk_la-wrmaxf.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_order.lo `test -f 'amd/amd_order.c' || echo '$(srcdir)/'`amd/amd_order.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-wrmaxf.lo `test -f 'api/wrmaxf.c' || echo '$(srcdir)/'`api/wrmaxf.c -libglpk_la-amd_post_tree.lo: amd/amd_post_tree.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_post_tree.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_post_tree.Tpo -c -o libglpk_la-amd_post_tree.lo `test -f 'amd/amd_post_tree.c' || echo '$(srcdir)/'`amd/amd_post_tree.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_post_tree.Tpo $(DEPDIR)/libglpk_la-amd_post_tree.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_post_tree.c' object='libglpk_la-amd_post_tree.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-wrmcf.lo: api/wrmcf.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-wrmcf.lo -MD -MP -MF $(DEPDIR)/libglpk_la-wrmcf.Tpo -c -o libglpk_la-wrmcf.lo `test -f 'api/wrmcf.c' || echo '$(srcdir)/'`api/wrmcf.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-wrmcf.Tpo $(DEPDIR)/libglpk_la-wrmcf.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/wrmcf.c' object='libglpk_la-wrmcf.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_post_tree.lo `test -f 'amd/amd_post_tree.c' || echo '$(srcdir)/'`amd/amd_post_tree.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-wrmcf.lo `test -f 'api/wrmcf.c' || echo '$(srcdir)/'`api/wrmcf.c -libglpk_la-amd_postorder.lo: amd/amd_postorder.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_postorder.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_postorder.Tpo -c -o libglpk_la-amd_postorder.lo `test -f 'amd/amd_postorder.c' || echo '$(srcdir)/'`amd/amd_postorder.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_postorder.Tpo $(DEPDIR)/libglpk_la-amd_postorder.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_postorder.c' object='libglpk_la-amd_postorder.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-wrmip.lo: api/wrmip.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-wrmip.lo -MD -MP -MF $(DEPDIR)/libglpk_la-wrmip.Tpo -c -o libglpk_la-wrmip.lo `test -f 'api/wrmip.c' || echo '$(srcdir)/'`api/wrmip.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-wrmip.Tpo $(DEPDIR)/libglpk_la-wrmip.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/wrmip.c' object='libglpk_la-wrmip.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_postorder.lo `test -f 'amd/amd_postorder.c' || echo '$(srcdir)/'`amd/amd_postorder.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-wrmip.lo `test -f 'api/wrmip.c' || echo '$(srcdir)/'`api/wrmip.c -libglpk_la-amd_preprocess.lo: amd/amd_preprocess.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_preprocess.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_preprocess.Tpo -c -o libglpk_la-amd_preprocess.lo `test -f 'amd/amd_preprocess.c' || echo '$(srcdir)/'`amd/amd_preprocess.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_preprocess.Tpo $(DEPDIR)/libglpk_la-amd_preprocess.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_preprocess.c' object='libglpk_la-amd_preprocess.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-wrprob.lo: api/wrprob.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-wrprob.lo -MD -MP -MF $(DEPDIR)/libglpk_la-wrprob.Tpo -c -o libglpk_la-wrprob.lo `test -f 'api/wrprob.c' || echo '$(srcdir)/'`api/wrprob.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-wrprob.Tpo $(DEPDIR)/libglpk_la-wrprob.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/wrprob.c' object='libglpk_la-wrprob.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_preprocess.lo `test -f 'amd/amd_preprocess.c' || echo '$(srcdir)/'`amd/amd_preprocess.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-wrprob.lo `test -f 'api/wrprob.c' || echo '$(srcdir)/'`api/wrprob.c -libglpk_la-amd_valid.lo: amd/amd_valid.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-amd_valid.lo -MD -MP -MF $(DEPDIR)/libglpk_la-amd_valid.Tpo -c -o libglpk_la-amd_valid.lo `test -f 'amd/amd_valid.c' || echo '$(srcdir)/'`amd/amd_valid.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-amd_valid.Tpo $(DEPDIR)/libglpk_la-amd_valid.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='amd/amd_valid.c' object='libglpk_la-amd_valid.lo' libtool=yes @AMDEPBACKSLASH@ +libglpk_la-wrsol.lo: api/wrsol.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-wrsol.lo -MD -MP -MF $(DEPDIR)/libglpk_la-wrsol.Tpo -c -o libglpk_la-wrsol.lo `test -f 'api/wrsol.c' || echo '$(srcdir)/'`api/wrsol.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-wrsol.Tpo $(DEPDIR)/libglpk_la-wrsol.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='api/wrsol.c' object='libglpk_la-wrsol.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-amd_valid.lo `test -f 'amd/amd_valid.c' || echo '$(srcdir)/'`amd/amd_valid.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-wrsol.lo `test -f 'api/wrsol.c' || echo '$(srcdir)/'`api/wrsol.c libglpk_la-btf.lo: bflib/btf.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-btf.lo -MD -MP -MF $(DEPDIR)/libglpk_la-btf.Tpo -c -o libglpk_la-btf.lo `test -f 'bflib/btf.c' || echo '$(srcdir)/'`bflib/btf.c @@ -1364,20 +1357,6 @@ libglpk_la-sva.lo: bflib/sva.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-sva.lo `test -f 'bflib/sva.c' || echo '$(srcdir)/'`bflib/sva.c -libglpk_la-cfg.lo: cglib/cfg.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-cfg.lo -MD -MP -MF $(DEPDIR)/libglpk_la-cfg.Tpo -c -o libglpk_la-cfg.lo `test -f 'cglib/cfg.c' || echo '$(srcdir)/'`cglib/cfg.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-cfg.Tpo $(DEPDIR)/libglpk_la-cfg.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cglib/cfg.c' object='libglpk_la-cfg.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-cfg.lo `test -f 'cglib/cfg.c' || echo '$(srcdir)/'`cglib/cfg.c - -libglpk_la-cfg1.lo: cglib/cfg1.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-cfg1.lo -MD -MP -MF $(DEPDIR)/libglpk_la-cfg1.Tpo -c -o libglpk_la-cfg1.lo `test -f 'cglib/cfg1.c' || echo '$(srcdir)/'`cglib/cfg1.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-cfg1.Tpo $(DEPDIR)/libglpk_la-cfg1.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cglib/cfg1.c' object='libglpk_la-cfg1.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-cfg1.lo `test -f 'cglib/cfg1.c' || echo '$(srcdir)/'`cglib/cfg1.c - libglpk_la-colamd.lo: colamd/colamd.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-colamd.lo -MD -MP -MF $(DEPDIR)/libglpk_la-colamd.Tpo -c -o libglpk_la-colamd.lo `test -f 'colamd/colamd.c' || echo '$(srcdir)/'`colamd/colamd.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-colamd.Tpo $(DEPDIR)/libglpk_la-colamd.Plo @@ -1385,6 +1364,181 @@ libglpk_la-colamd.lo: colamd/colamd.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-colamd.lo `test -f 'colamd/colamd.c' || echo '$(srcdir)/'`colamd/colamd.c +libglpk_la-bfd.lo: draft/bfd.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-bfd.lo -MD -MP -MF $(DEPDIR)/libglpk_la-bfd.Tpo -c -o libglpk_la-bfd.lo `test -f 'draft/bfd.c' || echo '$(srcdir)/'`draft/bfd.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-bfd.Tpo $(DEPDIR)/libglpk_la-bfd.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/bfd.c' object='libglpk_la-bfd.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-bfd.lo `test -f 'draft/bfd.c' || echo '$(srcdir)/'`draft/bfd.c + +libglpk_la-bfx.lo: draft/bfx.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-bfx.lo -MD -MP -MF $(DEPDIR)/libglpk_la-bfx.Tpo -c -o libglpk_la-bfx.lo `test -f 'draft/bfx.c' || echo '$(srcdir)/'`draft/bfx.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-bfx.Tpo $(DEPDIR)/libglpk_la-bfx.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/bfx.c' object='libglpk_la-bfx.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-bfx.lo `test -f 'draft/bfx.c' || echo '$(srcdir)/'`draft/bfx.c + +libglpk_la-glpapi06.lo: draft/glpapi06.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi06.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi06.Tpo -c -o libglpk_la-glpapi06.lo `test -f 'draft/glpapi06.c' || echo '$(srcdir)/'`draft/glpapi06.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi06.Tpo $(DEPDIR)/libglpk_la-glpapi06.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpapi06.c' object='libglpk_la-glpapi06.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi06.lo `test -f 'draft/glpapi06.c' || echo '$(srcdir)/'`draft/glpapi06.c + +libglpk_la-glpapi07.lo: draft/glpapi07.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi07.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi07.Tpo -c -o libglpk_la-glpapi07.lo `test -f 'draft/glpapi07.c' || echo '$(srcdir)/'`draft/glpapi07.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi07.Tpo $(DEPDIR)/libglpk_la-glpapi07.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpapi07.c' object='libglpk_la-glpapi07.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi07.lo `test -f 'draft/glpapi07.c' || echo '$(srcdir)/'`draft/glpapi07.c + +libglpk_la-glpapi08.lo: draft/glpapi08.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi08.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi08.Tpo -c -o libglpk_la-glpapi08.lo `test -f 'draft/glpapi08.c' || echo '$(srcdir)/'`draft/glpapi08.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi08.Tpo $(DEPDIR)/libglpk_la-glpapi08.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpapi08.c' object='libglpk_la-glpapi08.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi08.lo `test -f 'draft/glpapi08.c' || echo '$(srcdir)/'`draft/glpapi08.c + +libglpk_la-glpapi09.lo: draft/glpapi09.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi09.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi09.Tpo -c -o libglpk_la-glpapi09.lo `test -f 'draft/glpapi09.c' || echo '$(srcdir)/'`draft/glpapi09.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi09.Tpo $(DEPDIR)/libglpk_la-glpapi09.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpapi09.c' object='libglpk_la-glpapi09.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi09.lo `test -f 'draft/glpapi09.c' || echo '$(srcdir)/'`draft/glpapi09.c + +libglpk_la-glpapi10.lo: draft/glpapi10.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi10.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi10.Tpo -c -o libglpk_la-glpapi10.lo `test -f 'draft/glpapi10.c' || echo '$(srcdir)/'`draft/glpapi10.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi10.Tpo $(DEPDIR)/libglpk_la-glpapi10.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpapi10.c' object='libglpk_la-glpapi10.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi10.lo `test -f 'draft/glpapi10.c' || echo '$(srcdir)/'`draft/glpapi10.c + +libglpk_la-glpapi12.lo: draft/glpapi12.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi12.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi12.Tpo -c -o libglpk_la-glpapi12.lo `test -f 'draft/glpapi12.c' || echo '$(srcdir)/'`draft/glpapi12.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi12.Tpo $(DEPDIR)/libglpk_la-glpapi12.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpapi12.c' object='libglpk_la-glpapi12.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi12.lo `test -f 'draft/glpapi12.c' || echo '$(srcdir)/'`draft/glpapi12.c + +libglpk_la-glpapi13.lo: draft/glpapi13.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpapi13.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpapi13.Tpo -c -o libglpk_la-glpapi13.lo `test -f 'draft/glpapi13.c' || echo '$(srcdir)/'`draft/glpapi13.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpapi13.Tpo $(DEPDIR)/libglpk_la-glpapi13.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpapi13.c' object='libglpk_la-glpapi13.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpapi13.lo `test -f 'draft/glpapi13.c' || echo '$(srcdir)/'`draft/glpapi13.c + +libglpk_la-glphbm.lo: draft/glphbm.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glphbm.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glphbm.Tpo -c -o libglpk_la-glphbm.lo `test -f 'draft/glphbm.c' || echo '$(srcdir)/'`draft/glphbm.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glphbm.Tpo $(DEPDIR)/libglpk_la-glphbm.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glphbm.c' object='libglpk_la-glphbm.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glphbm.lo `test -f 'draft/glphbm.c' || echo '$(srcdir)/'`draft/glphbm.c + +libglpk_la-glpios01.lo: draft/glpios01.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios01.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios01.Tpo -c -o libglpk_la-glpios01.lo `test -f 'draft/glpios01.c' || echo '$(srcdir)/'`draft/glpios01.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios01.Tpo $(DEPDIR)/libglpk_la-glpios01.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpios01.c' object='libglpk_la-glpios01.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios01.lo `test -f 'draft/glpios01.c' || echo '$(srcdir)/'`draft/glpios01.c + +libglpk_la-glpios02.lo: draft/glpios02.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios02.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios02.Tpo -c -o libglpk_la-glpios02.lo `test -f 'draft/glpios02.c' || echo '$(srcdir)/'`draft/glpios02.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios02.Tpo $(DEPDIR)/libglpk_la-glpios02.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpios02.c' object='libglpk_la-glpios02.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios02.lo `test -f 'draft/glpios02.c' || echo '$(srcdir)/'`draft/glpios02.c + +libglpk_la-glpios03.lo: draft/glpios03.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios03.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios03.Tpo -c -o libglpk_la-glpios03.lo `test -f 'draft/glpios03.c' || echo '$(srcdir)/'`draft/glpios03.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios03.Tpo $(DEPDIR)/libglpk_la-glpios03.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpios03.c' object='libglpk_la-glpios03.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios03.lo `test -f 'draft/glpios03.c' || echo '$(srcdir)/'`draft/glpios03.c + +libglpk_la-glpios07.lo: draft/glpios07.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios07.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios07.Tpo -c -o libglpk_la-glpios07.lo `test -f 'draft/glpios07.c' || echo '$(srcdir)/'`draft/glpios07.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios07.Tpo $(DEPDIR)/libglpk_la-glpios07.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpios07.c' object='libglpk_la-glpios07.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios07.lo `test -f 'draft/glpios07.c' || echo '$(srcdir)/'`draft/glpios07.c + +libglpk_la-glpios09.lo: draft/glpios09.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios09.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios09.Tpo -c -o libglpk_la-glpios09.lo `test -f 'draft/glpios09.c' || echo '$(srcdir)/'`draft/glpios09.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios09.Tpo $(DEPDIR)/libglpk_la-glpios09.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpios09.c' object='libglpk_la-glpios09.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios09.lo `test -f 'draft/glpios09.c' || echo '$(srcdir)/'`draft/glpios09.c + +libglpk_la-glpios11.lo: draft/glpios11.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios11.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios11.Tpo -c -o libglpk_la-glpios11.lo `test -f 'draft/glpios11.c' || echo '$(srcdir)/'`draft/glpios11.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios11.Tpo $(DEPDIR)/libglpk_la-glpios11.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpios11.c' object='libglpk_la-glpios11.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios11.lo `test -f 'draft/glpios11.c' || echo '$(srcdir)/'`draft/glpios11.c + +libglpk_la-glpios12.lo: draft/glpios12.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpios12.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpios12.Tpo -c -o libglpk_la-glpios12.lo `test -f 'draft/glpios12.c' || echo '$(srcdir)/'`draft/glpios12.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpios12.Tpo $(DEPDIR)/libglpk_la-glpios12.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpios12.c' object='libglpk_la-glpios12.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpios12.lo `test -f 'draft/glpios12.c' || echo '$(srcdir)/'`draft/glpios12.c + +libglpk_la-glpipm.lo: draft/glpipm.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpipm.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpipm.Tpo -c -o libglpk_la-glpipm.lo `test -f 'draft/glpipm.c' || echo '$(srcdir)/'`draft/glpipm.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpipm.Tpo $(DEPDIR)/libglpk_la-glpipm.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpipm.c' object='libglpk_la-glpipm.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpipm.lo `test -f 'draft/glpipm.c' || echo '$(srcdir)/'`draft/glpipm.c + +libglpk_la-glpmat.lo: draft/glpmat.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpmat.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpmat.Tpo -c -o libglpk_la-glpmat.lo `test -f 'draft/glpmat.c' || echo '$(srcdir)/'`draft/glpmat.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpmat.Tpo $(DEPDIR)/libglpk_la-glpmat.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpmat.c' object='libglpk_la-glpmat.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpmat.lo `test -f 'draft/glpmat.c' || echo '$(srcdir)/'`draft/glpmat.c + +libglpk_la-glprgr.lo: draft/glprgr.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glprgr.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glprgr.Tpo -c -o libglpk_la-glprgr.lo `test -f 'draft/glprgr.c' || echo '$(srcdir)/'`draft/glprgr.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glprgr.Tpo $(DEPDIR)/libglpk_la-glprgr.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glprgr.c' object='libglpk_la-glprgr.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glprgr.lo `test -f 'draft/glprgr.c' || echo '$(srcdir)/'`draft/glprgr.c + +libglpk_la-glpscl.lo: draft/glpscl.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpscl.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpscl.Tpo -c -o libglpk_la-glpscl.lo `test -f 'draft/glpscl.c' || echo '$(srcdir)/'`draft/glpscl.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpscl.Tpo $(DEPDIR)/libglpk_la-glpscl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpscl.c' object='libglpk_la-glpscl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpscl.lo `test -f 'draft/glpscl.c' || echo '$(srcdir)/'`draft/glpscl.c + +libglpk_la-glpspm.lo: draft/glpspm.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpspm.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpspm.Tpo -c -o libglpk_la-glpspm.lo `test -f 'draft/glpspm.c' || echo '$(srcdir)/'`draft/glpspm.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpspm.Tpo $(DEPDIR)/libglpk_la-glpspm.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpspm.c' object='libglpk_la-glpspm.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpspm.lo `test -f 'draft/glpspm.c' || echo '$(srcdir)/'`draft/glpspm.c + +libglpk_la-glpssx01.lo: draft/glpssx01.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpssx01.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpssx01.Tpo -c -o libglpk_la-glpssx01.lo `test -f 'draft/glpssx01.c' || echo '$(srcdir)/'`draft/glpssx01.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpssx01.Tpo $(DEPDIR)/libglpk_la-glpssx01.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpssx01.c' object='libglpk_la-glpssx01.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpssx01.lo `test -f 'draft/glpssx01.c' || echo '$(srcdir)/'`draft/glpssx01.c + +libglpk_la-glpssx02.lo: draft/glpssx02.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-glpssx02.lo -MD -MP -MF $(DEPDIR)/libglpk_la-glpssx02.Tpo -c -o libglpk_la-glpssx02.lo `test -f 'draft/glpssx02.c' || echo '$(srcdir)/'`draft/glpssx02.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-glpssx02.Tpo $(DEPDIR)/libglpk_la-glpssx02.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/glpssx02.c' object='libglpk_la-glpssx02.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-glpssx02.lo `test -f 'draft/glpssx02.c' || echo '$(srcdir)/'`draft/glpssx02.c + +libglpk_la-lux.lo: draft/lux.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-lux.lo -MD -MP -MF $(DEPDIR)/libglpk_la-lux.Tpo -c -o libglpk_la-lux.lo `test -f 'draft/lux.c' || echo '$(srcdir)/'`draft/lux.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-lux.Tpo $(DEPDIR)/libglpk_la-lux.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='draft/lux.c' object='libglpk_la-lux.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-lux.lo `test -f 'draft/lux.c' || echo '$(srcdir)/'`draft/lux.c + libglpk_la-alloc.lo: env/alloc.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-alloc.lo -MD -MP -MF $(DEPDIR)/libglpk_la-alloc.Tpo -c -o libglpk_la-alloc.lo `test -f 'env/alloc.c' || echo '$(srcdir)/'`env/alloc.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-alloc.Tpo $(DEPDIR)/libglpk_la-alloc.Plo @@ -1413,6 +1567,13 @@ libglpk_la-error.lo: env/error.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-error.lo `test -f 'env/error.c' || echo '$(srcdir)/'`env/error.c +libglpk_la-stdc.lo: env/stdc.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-stdc.lo -MD -MP -MF $(DEPDIR)/libglpk_la-stdc.Tpo -c -o libglpk_la-stdc.lo `test -f 'env/stdc.c' || echo '$(srcdir)/'`env/stdc.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-stdc.Tpo $(DEPDIR)/libglpk_la-stdc.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='env/stdc.c' object='libglpk_la-stdc.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-stdc.lo `test -f 'env/stdc.c' || echo '$(srcdir)/'`env/stdc.c + libglpk_la-stdout.lo: env/stdout.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-stdout.lo -MD -MP -MF $(DEPDIR)/libglpk_la-stdout.Tpo -c -o libglpk_la-stdout.lo `test -f 'env/stdout.c' || echo '$(srcdir)/'`env/stdout.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-stdout.Tpo $(DEPDIR)/libglpk_la-stdout.Plo @@ -1441,6 +1602,76 @@ libglpk_la-tls.lo: env/tls.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-tls.lo `test -f 'env/tls.c' || echo '$(srcdir)/'`env/tls.c +libglpk_la-cfg.lo: intopt/cfg.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-cfg.lo -MD -MP -MF $(DEPDIR)/libglpk_la-cfg.Tpo -c -o libglpk_la-cfg.lo `test -f 'intopt/cfg.c' || echo '$(srcdir)/'`intopt/cfg.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-cfg.Tpo $(DEPDIR)/libglpk_la-cfg.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='intopt/cfg.c' object='libglpk_la-cfg.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-cfg.lo `test -f 'intopt/cfg.c' || echo '$(srcdir)/'`intopt/cfg.c + +libglpk_la-cfg1.lo: intopt/cfg1.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-cfg1.lo -MD -MP -MF $(DEPDIR)/libglpk_la-cfg1.Tpo -c -o libglpk_la-cfg1.lo `test -f 'intopt/cfg1.c' || echo '$(srcdir)/'`intopt/cfg1.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-cfg1.Tpo $(DEPDIR)/libglpk_la-cfg1.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='intopt/cfg1.c' object='libglpk_la-cfg1.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-cfg1.lo `test -f 'intopt/cfg1.c' || echo '$(srcdir)/'`intopt/cfg1.c + +libglpk_la-cfg2.lo: intopt/cfg2.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-cfg2.lo -MD -MP -MF $(DEPDIR)/libglpk_la-cfg2.Tpo -c -o libglpk_la-cfg2.lo `test -f 'intopt/cfg2.c' || echo '$(srcdir)/'`intopt/cfg2.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-cfg2.Tpo $(DEPDIR)/libglpk_la-cfg2.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='intopt/cfg2.c' object='libglpk_la-cfg2.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-cfg2.lo `test -f 'intopt/cfg2.c' || echo '$(srcdir)/'`intopt/cfg2.c + +libglpk_la-clqcut.lo: intopt/clqcut.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-clqcut.lo -MD -MP -MF $(DEPDIR)/libglpk_la-clqcut.Tpo -c -o libglpk_la-clqcut.lo `test -f 'intopt/clqcut.c' || echo '$(srcdir)/'`intopt/clqcut.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-clqcut.Tpo $(DEPDIR)/libglpk_la-clqcut.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='intopt/clqcut.c' object='libglpk_la-clqcut.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-clqcut.lo `test -f 'intopt/clqcut.c' || echo '$(srcdir)/'`intopt/clqcut.c + +libglpk_la-covgen.lo: intopt/covgen.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-covgen.lo -MD -MP -MF $(DEPDIR)/libglpk_la-covgen.Tpo -c -o libglpk_la-covgen.lo `test -f 'intopt/covgen.c' || echo '$(srcdir)/'`intopt/covgen.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-covgen.Tpo $(DEPDIR)/libglpk_la-covgen.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='intopt/covgen.c' object='libglpk_la-covgen.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-covgen.lo `test -f 'intopt/covgen.c' || echo '$(srcdir)/'`intopt/covgen.c + +libglpk_la-fpump.lo: intopt/fpump.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-fpump.lo -MD -MP -MF $(DEPDIR)/libglpk_la-fpump.Tpo -c -o libglpk_la-fpump.lo `test -f 'intopt/fpump.c' || echo '$(srcdir)/'`intopt/fpump.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-fpump.Tpo $(DEPDIR)/libglpk_la-fpump.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='intopt/fpump.c' object='libglpk_la-fpump.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-fpump.lo `test -f 'intopt/fpump.c' || echo '$(srcdir)/'`intopt/fpump.c + +libglpk_la-gmicut.lo: intopt/gmicut.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-gmicut.lo -MD -MP -MF $(DEPDIR)/libglpk_la-gmicut.Tpo -c -o libglpk_la-gmicut.lo `test -f 'intopt/gmicut.c' || echo '$(srcdir)/'`intopt/gmicut.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-gmicut.Tpo $(DEPDIR)/libglpk_la-gmicut.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='intopt/gmicut.c' object='libglpk_la-gmicut.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-gmicut.lo `test -f 'intopt/gmicut.c' || echo '$(srcdir)/'`intopt/gmicut.c + +libglpk_la-gmigen.lo: intopt/gmigen.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-gmigen.lo -MD -MP -MF $(DEPDIR)/libglpk_la-gmigen.Tpo -c -o libglpk_la-gmigen.lo `test -f 'intopt/gmigen.c' || echo '$(srcdir)/'`intopt/gmigen.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-gmigen.Tpo $(DEPDIR)/libglpk_la-gmigen.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='intopt/gmigen.c' object='libglpk_la-gmigen.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-gmigen.lo `test -f 'intopt/gmigen.c' || echo '$(srcdir)/'`intopt/gmigen.c + +libglpk_la-mirgen.lo: intopt/mirgen.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-mirgen.lo -MD -MP -MF $(DEPDIR)/libglpk_la-mirgen.Tpo -c -o libglpk_la-mirgen.lo `test -f 'intopt/mirgen.c' || echo '$(srcdir)/'`intopt/mirgen.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-mirgen.Tpo $(DEPDIR)/libglpk_la-mirgen.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='intopt/mirgen.c' object='libglpk_la-mirgen.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-mirgen.lo `test -f 'intopt/mirgen.c' || echo '$(srcdir)/'`intopt/mirgen.c + +libglpk_la-spv.lo: intopt/spv.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-spv.lo -MD -MP -MF $(DEPDIR)/libglpk_la-spv.Tpo -c -o libglpk_la-spv.lo `test -f 'intopt/spv.c' || echo '$(srcdir)/'`intopt/spv.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-spv.Tpo $(DEPDIR)/libglpk_la-spv.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='intopt/spv.c' object='libglpk_la-spv.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-spv.lo `test -f 'intopt/spv.c' || echo '$(srcdir)/'`intopt/spv.c + libglpk_la-minisat.lo: minisat/minisat.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-minisat.lo -MD -MP -MF $(DEPDIR)/libglpk_la-minisat.Tpo -c -o libglpk_la-minisat.lo `test -f 'minisat/minisat.c' || echo '$(srcdir)/'`minisat/minisat.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-minisat.Tpo $(DEPDIR)/libglpk_la-minisat.Plo @@ -1448,6 +1679,13 @@ libglpk_la-minisat.lo: minisat/minisat.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-minisat.lo `test -f 'minisat/minisat.c' || echo '$(srcdir)/'`minisat/minisat.c +libglpk_la-avl.lo: misc/avl.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-avl.lo -MD -MP -MF $(DEPDIR)/libglpk_la-avl.Tpo -c -o libglpk_la-avl.lo `test -f 'misc/avl.c' || echo '$(srcdir)/'`misc/avl.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-avl.Tpo $(DEPDIR)/libglpk_la-avl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc/avl.c' object='libglpk_la-avl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-avl.lo `test -f 'misc/avl.c' || echo '$(srcdir)/'`misc/avl.c + libglpk_la-bignum.lo: misc/bignum.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-bignum.lo -MD -MP -MF $(DEPDIR)/libglpk_la-bignum.Tpo -c -o libglpk_la-bignum.lo `test -f 'misc/bignum.c' || echo '$(srcdir)/'`misc/bignum.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-bignum.Tpo $(DEPDIR)/libglpk_la-bignum.Plo @@ -1455,6 +1693,13 @@ libglpk_la-bignum.lo: misc/bignum.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-bignum.lo `test -f 'misc/bignum.c' || echo '$(srcdir)/'`misc/bignum.c +libglpk_la-dimacs.lo: misc/dimacs.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-dimacs.lo -MD -MP -MF $(DEPDIR)/libglpk_la-dimacs.Tpo -c -o libglpk_la-dimacs.lo `test -f 'misc/dimacs.c' || echo '$(srcdir)/'`misc/dimacs.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-dimacs.Tpo $(DEPDIR)/libglpk_la-dimacs.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc/dimacs.c' object='libglpk_la-dimacs.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-dimacs.lo `test -f 'misc/dimacs.c' || echo '$(srcdir)/'`misc/dimacs.c + libglpk_la-dmp.lo: misc/dmp.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-dmp.lo -MD -MP -MF $(DEPDIR)/libglpk_la-dmp.Tpo -c -o libglpk_la-dmp.lo `test -f 'misc/dmp.c' || echo '$(srcdir)/'`misc/dmp.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-dmp.Tpo $(DEPDIR)/libglpk_la-dmp.Plo @@ -1476,6 +1721,13 @@ libglpk_la-fp2rat.lo: misc/fp2rat.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-fp2rat.lo `test -f 'misc/fp2rat.c' || echo '$(srcdir)/'`misc/fp2rat.c +libglpk_la-fvs.lo: misc/fvs.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-fvs.lo -MD -MP -MF $(DEPDIR)/libglpk_la-fvs.Tpo -c -o libglpk_la-fvs.lo `test -f 'misc/fvs.c' || echo '$(srcdir)/'`misc/fvs.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-fvs.Tpo $(DEPDIR)/libglpk_la-fvs.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc/fvs.c' object='libglpk_la-fvs.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-fvs.lo `test -f 'misc/fvs.c' || echo '$(srcdir)/'`misc/fvs.c + libglpk_la-gcd.lo: misc/gcd.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-gcd.lo -MD -MP -MF $(DEPDIR)/libglpk_la-gcd.Tpo -c -o libglpk_la-gcd.lo `test -f 'misc/gcd.c' || echo '$(srcdir)/'`misc/gcd.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-gcd.Tpo $(DEPDIR)/libglpk_la-gcd.Plo @@ -1497,6 +1749,13 @@ libglpk_la-keller.lo: misc/keller.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-keller.lo `test -f 'misc/keller.c' || echo '$(srcdir)/'`misc/keller.c +libglpk_la-ks.lo: misc/ks.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-ks.lo -MD -MP -MF $(DEPDIR)/libglpk_la-ks.Tpo -c -o libglpk_la-ks.lo `test -f 'misc/ks.c' || echo '$(srcdir)/'`misc/ks.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-ks.Tpo $(DEPDIR)/libglpk_la-ks.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc/ks.c' object='libglpk_la-ks.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-ks.lo `test -f 'misc/ks.c' || echo '$(srcdir)/'`misc/ks.c + libglpk_la-mc13d.lo: misc/mc13d.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-mc13d.lo -MD -MP -MF $(DEPDIR)/libglpk_la-mc13d.Tpo -c -o libglpk_la-mc13d.lo `test -f 'misc/mc13d.c' || echo '$(srcdir)/'`misc/mc13d.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-mc13d.Tpo $(DEPDIR)/libglpk_la-mc13d.Plo @@ -1511,6 +1770,20 @@ libglpk_la-mc21a.lo: misc/mc21a.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-mc21a.lo `test -f 'misc/mc21a.c' || echo '$(srcdir)/'`misc/mc21a.c +libglpk_la-mt1.lo: misc/mt1.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-mt1.lo -MD -MP -MF $(DEPDIR)/libglpk_la-mt1.Tpo -c -o libglpk_la-mt1.lo `test -f 'misc/mt1.c' || echo '$(srcdir)/'`misc/mt1.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-mt1.Tpo $(DEPDIR)/libglpk_la-mt1.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc/mt1.c' object='libglpk_la-mt1.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-mt1.lo `test -f 'misc/mt1.c' || echo '$(srcdir)/'`misc/mt1.c + +libglpk_la-mygmp.lo: misc/mygmp.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-mygmp.lo -MD -MP -MF $(DEPDIR)/libglpk_la-mygmp.Tpo -c -o libglpk_la-mygmp.lo `test -f 'misc/mygmp.c' || echo '$(srcdir)/'`misc/mygmp.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-mygmp.Tpo $(DEPDIR)/libglpk_la-mygmp.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc/mygmp.c' object='libglpk_la-mygmp.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-mygmp.lo `test -f 'misc/mygmp.c' || echo '$(srcdir)/'`misc/mygmp.c + libglpk_la-okalg.lo: misc/okalg.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-okalg.lo -MD -MP -MF $(DEPDIR)/libglpk_la-okalg.Tpo -c -o libglpk_la-okalg.lo `test -f 'misc/okalg.c' || echo '$(srcdir)/'`misc/okalg.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-okalg.Tpo $(DEPDIR)/libglpk_la-okalg.Plo @@ -1602,6 +1875,97 @@ libglpk_la-wclique1.lo: misc/wclique1.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-wclique1.lo `test -f 'misc/wclique1.c' || echo '$(srcdir)/'`misc/wclique1.c +libglpk_la-mpl1.lo: mpl/mpl1.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-mpl1.lo -MD -MP -MF $(DEPDIR)/libglpk_la-mpl1.Tpo -c -o libglpk_la-mpl1.lo `test -f 'mpl/mpl1.c' || echo '$(srcdir)/'`mpl/mpl1.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-mpl1.Tpo $(DEPDIR)/libglpk_la-mpl1.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpl/mpl1.c' object='libglpk_la-mpl1.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-mpl1.lo `test -f 'mpl/mpl1.c' || echo '$(srcdir)/'`mpl/mpl1.c + +libglpk_la-mpl2.lo: mpl/mpl2.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-mpl2.lo -MD -MP -MF $(DEPDIR)/libglpk_la-mpl2.Tpo -c -o libglpk_la-mpl2.lo `test -f 'mpl/mpl2.c' || echo '$(srcdir)/'`mpl/mpl2.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-mpl2.Tpo $(DEPDIR)/libglpk_la-mpl2.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpl/mpl2.c' object='libglpk_la-mpl2.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-mpl2.lo `test -f 'mpl/mpl2.c' || echo '$(srcdir)/'`mpl/mpl2.c + +libglpk_la-mpl3.lo: mpl/mpl3.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-mpl3.lo -MD -MP -MF $(DEPDIR)/libglpk_la-mpl3.Tpo -c -o libglpk_la-mpl3.lo `test -f 'mpl/mpl3.c' || echo '$(srcdir)/'`mpl/mpl3.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-mpl3.Tpo $(DEPDIR)/libglpk_la-mpl3.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpl/mpl3.c' object='libglpk_la-mpl3.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-mpl3.lo `test -f 'mpl/mpl3.c' || echo '$(srcdir)/'`mpl/mpl3.c + +libglpk_la-mpl4.lo: mpl/mpl4.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-mpl4.lo -MD -MP -MF $(DEPDIR)/libglpk_la-mpl4.Tpo -c -o libglpk_la-mpl4.lo `test -f 'mpl/mpl4.c' || echo '$(srcdir)/'`mpl/mpl4.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-mpl4.Tpo $(DEPDIR)/libglpk_la-mpl4.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpl/mpl4.c' object='libglpk_la-mpl4.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-mpl4.lo `test -f 'mpl/mpl4.c' || echo '$(srcdir)/'`mpl/mpl4.c + +libglpk_la-mpl5.lo: mpl/mpl5.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-mpl5.lo -MD -MP -MF $(DEPDIR)/libglpk_la-mpl5.Tpo -c -o libglpk_la-mpl5.lo `test -f 'mpl/mpl5.c' || echo '$(srcdir)/'`mpl/mpl5.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-mpl5.Tpo $(DEPDIR)/libglpk_la-mpl5.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpl/mpl5.c' object='libglpk_la-mpl5.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-mpl5.lo `test -f 'mpl/mpl5.c' || echo '$(srcdir)/'`mpl/mpl5.c + +libglpk_la-mpl6.lo: mpl/mpl6.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-mpl6.lo -MD -MP -MF $(DEPDIR)/libglpk_la-mpl6.Tpo -c -o libglpk_la-mpl6.lo `test -f 'mpl/mpl6.c' || echo '$(srcdir)/'`mpl/mpl6.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-mpl6.Tpo $(DEPDIR)/libglpk_la-mpl6.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpl/mpl6.c' object='libglpk_la-mpl6.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-mpl6.lo `test -f 'mpl/mpl6.c' || echo '$(srcdir)/'`mpl/mpl6.c + +libglpk_la-mplsql.lo: mpl/mplsql.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-mplsql.lo -MD -MP -MF $(DEPDIR)/libglpk_la-mplsql.Tpo -c -o libglpk_la-mplsql.lo `test -f 'mpl/mplsql.c' || echo '$(srcdir)/'`mpl/mplsql.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-mplsql.Tpo $(DEPDIR)/libglpk_la-mplsql.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpl/mplsql.c' object='libglpk_la-mplsql.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-mplsql.lo `test -f 'mpl/mplsql.c' || echo '$(srcdir)/'`mpl/mplsql.c + +libglpk_la-npp1.lo: npp/npp1.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-npp1.lo -MD -MP -MF $(DEPDIR)/libglpk_la-npp1.Tpo -c -o libglpk_la-npp1.lo `test -f 'npp/npp1.c' || echo '$(srcdir)/'`npp/npp1.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-npp1.Tpo $(DEPDIR)/libglpk_la-npp1.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='npp/npp1.c' object='libglpk_la-npp1.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-npp1.lo `test -f 'npp/npp1.c' || echo '$(srcdir)/'`npp/npp1.c + +libglpk_la-npp2.lo: npp/npp2.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-npp2.lo -MD -MP -MF $(DEPDIR)/libglpk_la-npp2.Tpo -c -o libglpk_la-npp2.lo `test -f 'npp/npp2.c' || echo '$(srcdir)/'`npp/npp2.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-npp2.Tpo $(DEPDIR)/libglpk_la-npp2.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='npp/npp2.c' object='libglpk_la-npp2.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-npp2.lo `test -f 'npp/npp2.c' || echo '$(srcdir)/'`npp/npp2.c + +libglpk_la-npp3.lo: npp/npp3.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-npp3.lo -MD -MP -MF $(DEPDIR)/libglpk_la-npp3.Tpo -c -o libglpk_la-npp3.lo `test -f 'npp/npp3.c' || echo '$(srcdir)/'`npp/npp3.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-npp3.Tpo $(DEPDIR)/libglpk_la-npp3.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='npp/npp3.c' object='libglpk_la-npp3.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-npp3.lo `test -f 'npp/npp3.c' || echo '$(srcdir)/'`npp/npp3.c + +libglpk_la-npp4.lo: npp/npp4.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-npp4.lo -MD -MP -MF $(DEPDIR)/libglpk_la-npp4.Tpo -c -o libglpk_la-npp4.lo `test -f 'npp/npp4.c' || echo '$(srcdir)/'`npp/npp4.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-npp4.Tpo $(DEPDIR)/libglpk_la-npp4.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='npp/npp4.c' object='libglpk_la-npp4.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-npp4.lo `test -f 'npp/npp4.c' || echo '$(srcdir)/'`npp/npp4.c + +libglpk_la-npp5.lo: npp/npp5.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-npp5.lo -MD -MP -MF $(DEPDIR)/libglpk_la-npp5.Tpo -c -o libglpk_la-npp5.lo `test -f 'npp/npp5.c' || echo '$(srcdir)/'`npp/npp5.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-npp5.Tpo $(DEPDIR)/libglpk_la-npp5.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='npp/npp5.c' object='libglpk_la-npp5.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-npp5.lo `test -f 'npp/npp5.c' || echo '$(srcdir)/'`npp/npp5.c + +libglpk_la-npp6.lo: npp/npp6.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-npp6.lo -MD -MP -MF $(DEPDIR)/libglpk_la-npp6.Tpo -c -o libglpk_la-npp6.lo `test -f 'npp/npp6.c' || echo '$(srcdir)/'`npp/npp6.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-npp6.Tpo $(DEPDIR)/libglpk_la-npp6.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='npp/npp6.c' object='libglpk_la-npp6.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglpk_la-npp6.lo `test -f 'npp/npp6.c' || echo '$(srcdir)/'`npp/npp6.c + libglpk_la-proxy.lo: proxy/proxy.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglpk_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglpk_la-proxy.lo -MD -MP -MF $(DEPDIR)/libglpk_la-proxy.Tpo -c -o libglpk_la-proxy.lo `test -f 'proxy/proxy.c' || echo '$(srcdir)/'`proxy/proxy.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libglpk_la-proxy.Tpo $(DEPDIR)/libglpk_la-proxy.Plo diff --git a/resources/3rdparty/glpk-4.57/src/amd/COPYING b/resources/3rdparty/glpk-4.65/src/amd/COPYING similarity index 100% rename from resources/3rdparty/glpk-4.57/src/amd/COPYING rename to resources/3rdparty/glpk-4.65/src/amd/COPYING diff --git a/resources/3rdparty/glpk-4.57/src/amd/README b/resources/3rdparty/glpk-4.65/src/amd/README similarity index 100% rename from resources/3rdparty/glpk-4.57/src/amd/README rename to resources/3rdparty/glpk-4.65/src/amd/README diff --git a/resources/3rdparty/glpk-4.57/src/amd/amd.h b/resources/3rdparty/glpk-4.65/src/amd/amd.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/amd/amd.h rename to resources/3rdparty/glpk-4.65/src/amd/amd.h diff --git a/resources/3rdparty/glpk-4.57/src/amd/amd_1.c b/resources/3rdparty/glpk-4.65/src/amd/amd_1.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/amd/amd_1.c rename to resources/3rdparty/glpk-4.65/src/amd/amd_1.c diff --git a/resources/3rdparty/glpk-4.57/src/amd/amd_2.c b/resources/3rdparty/glpk-4.65/src/amd/amd_2.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/amd/amd_2.c rename to resources/3rdparty/glpk-4.65/src/amd/amd_2.c diff --git a/resources/3rdparty/glpk-4.57/src/amd/amd_aat.c b/resources/3rdparty/glpk-4.65/src/amd/amd_aat.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/amd/amd_aat.c rename to resources/3rdparty/glpk-4.65/src/amd/amd_aat.c diff --git a/resources/3rdparty/glpk-4.57/src/amd/amd_control.c b/resources/3rdparty/glpk-4.65/src/amd/amd_control.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/amd/amd_control.c rename to resources/3rdparty/glpk-4.65/src/amd/amd_control.c diff --git a/resources/3rdparty/glpk-4.57/src/amd/amd_defaults.c b/resources/3rdparty/glpk-4.65/src/amd/amd_defaults.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/amd/amd_defaults.c rename to resources/3rdparty/glpk-4.65/src/amd/amd_defaults.c diff --git a/resources/3rdparty/glpk-4.57/src/amd/amd_dump.c b/resources/3rdparty/glpk-4.65/src/amd/amd_dump.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/amd/amd_dump.c rename to resources/3rdparty/glpk-4.65/src/amd/amd_dump.c diff --git a/resources/3rdparty/glpk-4.57/src/amd/amd_info.c b/resources/3rdparty/glpk-4.65/src/amd/amd_info.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/amd/amd_info.c rename to resources/3rdparty/glpk-4.65/src/amd/amd_info.c diff --git a/resources/3rdparty/glpk-4.57/src/amd/amd_internal.h b/resources/3rdparty/glpk-4.65/src/amd/amd_internal.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/amd/amd_internal.h rename to resources/3rdparty/glpk-4.65/src/amd/amd_internal.h diff --git a/resources/3rdparty/glpk-4.57/src/amd/amd_order.c b/resources/3rdparty/glpk-4.65/src/amd/amd_order.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/amd/amd_order.c rename to resources/3rdparty/glpk-4.65/src/amd/amd_order.c diff --git a/resources/3rdparty/glpk-4.57/src/amd/amd_post_tree.c b/resources/3rdparty/glpk-4.65/src/amd/amd_post_tree.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/amd/amd_post_tree.c rename to resources/3rdparty/glpk-4.65/src/amd/amd_post_tree.c diff --git a/resources/3rdparty/glpk-4.57/src/amd/amd_postorder.c b/resources/3rdparty/glpk-4.65/src/amd/amd_postorder.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/amd/amd_postorder.c rename to resources/3rdparty/glpk-4.65/src/amd/amd_postorder.c diff --git a/resources/3rdparty/glpk-4.57/src/amd/amd_preprocess.c b/resources/3rdparty/glpk-4.65/src/amd/amd_preprocess.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/amd/amd_preprocess.c rename to resources/3rdparty/glpk-4.65/src/amd/amd_preprocess.c diff --git a/resources/3rdparty/glpk-4.57/src/amd/amd_valid.c b/resources/3rdparty/glpk-4.65/src/amd/amd_valid.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/amd/amd_valid.c rename to resources/3rdparty/glpk-4.65/src/amd/amd_valid.c diff --git a/resources/3rdparty/glpk-4.57/src/glpini01.c b/resources/3rdparty/glpk-4.65/src/api/advbas.c similarity index 97% rename from resources/3rdparty/glpk-4.57/src/glpini01.c rename to resources/3rdparty/glpk-4.65/src/api/advbas.c index 76c021477..230676246 100644 --- a/resources/3rdparty/glpk-4.57/src/glpini01.c +++ b/resources/3rdparty/glpk-4.65/src/api/advbas.c @@ -1,9 +1,9 @@ -/* glpini01.c */ +/* advbas.c (construct advanced initial LP basis) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2012, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2008-2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * diff --git a/resources/3rdparty/glpk-4.65/src/api/asnhall.c b/resources/3rdparty/glpk-4.65/src/api/asnhall.c new file mode 100644 index 000000000..d7112a102 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/asnhall.c @@ -0,0 +1,163 @@ +/* asnhall.c (find bipartite matching of maximum cardinality) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "glpk.h" +#include "mc21a.h" + +/*********************************************************************** +* NAME +* +* glp_asnprob_hall - find bipartite matching of maximum cardinality +* +* SYNOPSIS +* +* int glp_asnprob_hall(glp_graph *G, int v_set, int a_x); +* +* DESCRIPTION +* +* The routine glp_asnprob_hall finds a matching of maximal cardinality +* in the specified bipartite graph G. It uses a version of the Fortran +* routine MC21A developed by I.S.Duff [1], which implements Hall's +* algorithm [2]. +* +* RETURNS +* +* The routine glp_asnprob_hall returns the cardinality of the matching +* found. However, if the specified graph is incorrect (as detected by +* the routine glp_check_asnprob), the routine returns negative value. +* +* REFERENCES +* +* 1. I.S.Duff, Algorithm 575: Permutations for zero-free diagonal, ACM +* Trans. on Math. Softw. 7 (1981), 387-390. +* +* 2. M.Hall, "An Algorithm for distinct representatives," Amer. Math. +* Monthly 63 (1956), 716-717. */ + +int glp_asnprob_hall(glp_graph *G, int v_set, int a_x) +{ glp_vertex *v; + glp_arc *a; + int card, i, k, loc, n, n1, n2, xij; + int *num, *icn, *ip, *lenr, *iperm, *pr, *arp, *cv, *out; + if (v_set >= 0 && v_set > G->v_size - (int)sizeof(int)) + xerror("glp_asnprob_hall: v_set = %d; invalid offset\n", + v_set); + if (a_x >= 0 && a_x > G->a_size - (int)sizeof(int)) + xerror("glp_asnprob_hall: a_x = %d; invalid offset\n", a_x); + if (glp_check_asnprob(G, v_set)) + return -1; + /* determine the number of vertices in sets R and S and renumber + vertices in S which correspond to columns of the matrix; skip + all isolated vertices */ + num = xcalloc(1+G->nv, sizeof(int)); + n1 = n2 = 0; + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + if (v->in == NULL && v->out != NULL) + n1++, num[i] = 0; /* vertex in R */ + else if (v->in != NULL && v->out == NULL) + n2++, num[i] = n2; /* vertex in S */ + else + { xassert(v->in == NULL && v->out == NULL); + num[i] = -1; /* isolated vertex */ + } + } + /* the matrix must be square, thus, if it has more columns than + rows, extra rows will be just empty, and vice versa */ + n = (n1 >= n2 ? n1 : n2); + /* allocate working arrays */ + icn = xcalloc(1+G->na, sizeof(int)); + ip = xcalloc(1+n, sizeof(int)); + lenr = xcalloc(1+n, sizeof(int)); + iperm = xcalloc(1+n, sizeof(int)); + pr = xcalloc(1+n, sizeof(int)); + arp = xcalloc(1+n, sizeof(int)); + cv = xcalloc(1+n, sizeof(int)); + out = xcalloc(1+n, sizeof(int)); + /* build the adjacency matrix of the bipartite graph in row-wise + format (rows are vertices in R, columns are vertices in S) */ + k = 0, loc = 1; + for (i = 1; i <= G->nv; i++) + { if (num[i] != 0) continue; + /* vertex i in R */ + ip[++k] = loc; + v = G->v[i]; + for (a = v->out; a != NULL; a = a->t_next) + { xassert(num[a->head->i] != 0); + icn[loc++] = num[a->head->i]; + } + lenr[k] = loc - ip[k]; + } + xassert(loc-1 == G->na); + /* make all extra rows empty (all extra columns are empty due to + the row-wise format used) */ + for (k++; k <= n; k++) + ip[k] = loc, lenr[k] = 0; + /* find a row permutation that maximizes the number of non-zeros + on the main diagonal */ + card = mc21a(n, icn, ip, lenr, iperm, pr, arp, cv, out); +#if 1 /* 18/II-2010 */ + /* FIXED: if card = n, arp remains clobbered on exit */ + for (i = 1; i <= n; i++) + arp[i] = 0; + for (i = 1; i <= card; i++) + { k = iperm[i]; + xassert(1 <= k && k <= n); + xassert(arp[k] == 0); + arp[k] = i; + } +#endif + /* store solution, if necessary */ + if (a_x < 0) goto skip; + k = 0; + for (i = 1; i <= G->nv; i++) + { if (num[i] != 0) continue; + /* vertex i in R */ + k++; + v = G->v[i]; + for (a = v->out; a != NULL; a = a->t_next) + { /* arp[k] is the number of matched column or zero */ + if (arp[k] == num[a->head->i]) + { xassert(arp[k] != 0); + xij = 1; + } + else + xij = 0; + memcpy((char *)a->data + a_x, &xij, sizeof(int)); + } + } +skip: /* free working arrays */ + xfree(num); + xfree(icn); + xfree(ip); + xfree(lenr); + xfree(iperm); + xfree(pr); + xfree(arp); + xfree(cv); + xfree(out); + return card; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/asnlp.c b/resources/3rdparty/glpk-4.65/src/api/asnlp.c new file mode 100644 index 000000000..cfa925d0e --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/asnlp.c @@ -0,0 +1,104 @@ +/* asnlp.c (convert assignment problem to LP) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "glpk.h" + +/*********************************************************************** +* NAME +* +* glp_asnprob_lp - convert assignment problem to LP +* +* SYNOPSIS +* +* int glp_asnprob_lp(glp_prob *P, int form, glp_graph *G, int names, +* int v_set, int a_cost); +* +* DESCRIPTION +* +* The routine glp_asnprob_lp builds an LP problem, which corresponds +* to the assignment problem on the specified graph G. +* +* RETURNS +* +* If the LP problem has been successfully built, the routine returns +* zero, otherwise, non-zero. */ + +int glp_asnprob_lp(glp_prob *P, int form, glp_graph *G, int names, + int v_set, int a_cost) +{ glp_vertex *v; + glp_arc *a; + int i, j, ret, ind[1+2]; + double cost, val[1+2]; + if (!(form == GLP_ASN_MIN || form == GLP_ASN_MAX || + form == GLP_ASN_MMP)) + xerror("glp_asnprob_lp: form = %d; invalid parameter\n", + form); + if (!(names == GLP_ON || names == GLP_OFF)) + xerror("glp_asnprob_lp: names = %d; invalid parameter\n", + names); + if (v_set >= 0 && v_set > G->v_size - (int)sizeof(int)) + xerror("glp_asnprob_lp: v_set = %d; invalid offset\n", + v_set); + if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) + xerror("glp_asnprob_lp: a_cost = %d; invalid offset\n", + a_cost); + ret = glp_check_asnprob(G, v_set); + if (ret != 0) goto done; + glp_erase_prob(P); + if (names) glp_set_prob_name(P, G->name); + glp_set_obj_dir(P, form == GLP_ASN_MIN ? GLP_MIN : GLP_MAX); + if (G->nv > 0) glp_add_rows(P, G->nv); + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + if (names) glp_set_row_name(P, i, v->name); + glp_set_row_bnds(P, i, form == GLP_ASN_MMP ? GLP_UP : GLP_FX, + 1.0, 1.0); + } + if (G->na > 0) glp_add_cols(P, G->na); + for (i = 1, j = 0; i <= G->nv; i++) + { v = G->v[i]; + for (a = v->out; a != NULL; a = a->t_next) + { j++; + if (names) + { char name[50+1]; + sprintf(name, "x[%d,%d]", a->tail->i, a->head->i); + xassert(strlen(name) < sizeof(name)); + glp_set_col_name(P, j, name); + } + ind[1] = a->tail->i, val[1] = +1.0; + ind[2] = a->head->i, val[2] = +1.0; + glp_set_mat_col(P, j, 2, ind, val); + glp_set_col_bnds(P, j, GLP_DB, 0.0, 1.0); + if (a_cost >= 0) + memcpy(&cost, (char *)a->data + a_cost, sizeof(double)); + else + cost = 1.0; + glp_set_obj_coef(P, j, cost); + } + } + xassert(j == G->na); +done: return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/asnokalg.c b/resources/3rdparty/glpk-4.65/src/api/asnokalg.c new file mode 100644 index 000000000..d55dbac7a --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/asnokalg.c @@ -0,0 +1,154 @@ +/* asnokalg.c (solve assignment problem with out-of-kilter alg.) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "glpk.h" +#include "okalg.h" + +int glp_asnprob_okalg(int form, glp_graph *G, int v_set, int a_cost, + double *sol, int a_x) +{ /* solve assignment problem with out-of-kilter algorithm */ + glp_vertex *v; + glp_arc *a; + int nv, na, i, k, *tail, *head, *low, *cap, *cost, *x, *pi, ret; + double temp; + if (!(form == GLP_ASN_MIN || form == GLP_ASN_MAX || + form == GLP_ASN_MMP)) + xerror("glp_asnprob_okalg: form = %d; invalid parameter\n", + form); + if (v_set >= 0 && v_set > G->v_size - (int)sizeof(int)) + xerror("glp_asnprob_okalg: v_set = %d; invalid offset\n", + v_set); + if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) + xerror("glp_asnprob_okalg: a_cost = %d; invalid offset\n", + a_cost); + if (a_x >= 0 && a_x > G->a_size - (int)sizeof(int)) + xerror("glp_asnprob_okalg: a_x = %d; invalid offset\n", a_x); + if (glp_check_asnprob(G, v_set)) + return GLP_EDATA; + /* nv is the total number of nodes in the resulting network */ + nv = G->nv + 1; + /* na is the total number of arcs in the resulting network */ + na = G->na + G->nv; + /* allocate working arrays */ + tail = xcalloc(1+na, sizeof(int)); + head = xcalloc(1+na, sizeof(int)); + low = xcalloc(1+na, sizeof(int)); + cap = xcalloc(1+na, sizeof(int)); + cost = xcalloc(1+na, sizeof(int)); + x = xcalloc(1+na, sizeof(int)); + pi = xcalloc(1+nv, sizeof(int)); + /* construct the resulting network */ + k = 0; + /* (original arcs) */ + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + for (a = v->out; a != NULL; a = a->t_next) + { k++; + tail[k] = a->tail->i; + head[k] = a->head->i; + low[k] = 0; + cap[k] = 1; + if (a_cost >= 0) + memcpy(&temp, (char *)a->data + a_cost, sizeof(double)); + else + temp = 1.0; + if (!(fabs(temp) <= (double)INT_MAX && temp == floor(temp))) + { ret = GLP_EDATA; + goto done; + } + cost[k] = (int)temp; + if (form != GLP_ASN_MIN) cost[k] = - cost[k]; + } + } + /* (artificial arcs) */ + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + k++; + if (v->out == NULL) + tail[k] = i, head[k] = nv; + else if (v->in == NULL) + tail[k] = nv, head[k] = i; + else + xassert(v != v); + low[k] = (form == GLP_ASN_MMP ? 0 : 1); + cap[k] = 1; + cost[k] = 0; + } + xassert(k == na); + /* find minimal-cost circulation in the resulting network */ + ret = okalg(nv, na, tail, head, low, cap, cost, x, pi); + switch (ret) + { case 0: + /* optimal circulation found */ + ret = 0; + break; + case 1: + /* no feasible circulation exists */ + ret = GLP_ENOPFS; + break; + case 2: + /* integer overflow occured */ + ret = GLP_ERANGE; + goto done; + case 3: + /* optimality test failed (logic error) */ + ret = GLP_EFAIL; + goto done; + default: + xassert(ret != ret); + } + /* store solution components */ + /* (objective function = the total cost) */ + if (sol != NULL) + { temp = 0.0; + for (k = 1; k <= na; k++) + temp += (double)cost[k] * (double)x[k]; + if (form != GLP_ASN_MIN) temp = - temp; + *sol = temp; + } + /* (arc flows) */ + if (a_x >= 0) + { k = 0; + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + for (a = v->out; a != NULL; a = a->t_next) + { k++; + if (ret == 0) + xassert(x[k] == 0 || x[k] == 1); + memcpy((char *)a->data + a_x, &x[k], sizeof(int)); + } + } + } +done: /* free working arrays */ + xfree(tail); + xfree(head); + xfree(low); + xfree(cap); + xfree(cost); + xfree(x); + xfree(pi); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/ckasn.c b/resources/3rdparty/glpk-4.65/src/api/ckasn.c new file mode 100644 index 000000000..56221a8a9 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/ckasn.c @@ -0,0 +1,78 @@ +/* ckasn.c (check correctness of assignment problem data) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "glpk.h" + +/*********************************************************************** +* NAME +* +* glp_check_asnprob - check correctness of assignment problem data +* +* SYNOPSIS +* +* int glp_check_asnprob(glp_graph *G, int v_set); +* +* RETURNS +* +* If the specified assignment problem data are correct, the routine +* glp_check_asnprob returns zero, otherwise, non-zero. */ + +int glp_check_asnprob(glp_graph *G, int v_set) +{ glp_vertex *v; + int i, k, ret = 0; + if (v_set >= 0 && v_set > G->v_size - (int)sizeof(int)) + xerror("glp_check_asnprob: v_set = %d; invalid offset\n", + v_set); + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + if (v_set >= 0) + { memcpy(&k, (char *)v->data + v_set, sizeof(int)); + if (k == 0) + { if (v->in != NULL) + { ret = 1; + break; + } + } + else if (k == 1) + { if (v->out != NULL) + { ret = 2; + break; + } + } + else + { ret = 3; + break; + } + } + else + { if (v->in != NULL && v->out != NULL) + { ret = 4; + break; + } + } + } + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/ckcnf.c b/resources/3rdparty/glpk-4.65/src/api/ckcnf.c new file mode 100644 index 000000000..0ee47ed96 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/ckcnf.c @@ -0,0 +1,82 @@ +/* ckcnf.c (check for CNF-SAT problem instance) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2010-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "prob.h" + +int glp_check_cnfsat(glp_prob *P) +{ /* check for CNF-SAT problem instance */ + int m = P->m; + int n = P->n; + GLPROW *row; + GLPCOL *col; + GLPAIJ *aij; + int i, j, neg; +#if 0 /* 04/IV-2016 */ + if (P == NULL || P->magic != GLP_PROB_MAGIC) + xerror("glp_check_cnfsat: P = %p; invalid problem object\n", + P); +#endif + /* check columns */ + for (j = 1; j <= n; j++) + { col = P->col[j]; + /* the variable should be binary */ + if (!(col->kind == GLP_IV && col->type == GLP_DB && + col->lb == 0.0 && col->ub == 1.0)) + return 1; + } + /* objective function should be zero */ + if (P->c0 != 0.0) + return 2; + for (j = 1; j <= n; j++) + { col = P->col[j]; + if (col->coef != 0.0) + return 3; + } + /* check rows */ + for (i = 1; i <= m; i++) + { row = P->row[i]; + /* the row should be of ">=" type */ + if (row->type != GLP_LO) + return 4; + /* check constraint coefficients */ + neg = 0; + for (aij = row->ptr; aij != NULL; aij = aij->r_next) + { /* the constraint coefficient should be +1 or -1 */ + if (aij->val == +1.0) + ; + else if (aij->val == -1.0) + neg++; + else + return 5; + } + /* the right-hand side should be (1 - neg), where neg is the + number of negative constraint coefficients in the row */ + if (row->lb != (double)(1 - neg)) + return 6; + } + /* congratulations; this is CNF-SAT */ + return 0; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpcpx.c b/resources/3rdparty/glpk-4.65/src/api/cplex.c similarity index 98% rename from resources/3rdparty/glpk-4.57/src/glpcpx.c rename to resources/3rdparty/glpk-4.65/src/api/cplex.c index 1aa3f346b..8403a6464 100644 --- a/resources/3rdparty/glpk-4.57/src/glpcpx.c +++ b/resources/3rdparty/glpk-4.65/src/api/cplex.c @@ -1,10 +1,9 @@ -/* glpcpx.c (CPLEX LP format routines) */ +/* cplex.c (CPLEX LP format routines) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2009-2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -144,7 +143,7 @@ struct csa }; #define CHAR_SET "!\"#$%&()/,.;?@_`'{}|~" -/* characters, which may appear in symbolic names */ +/* characters that may appear in symbolic names */ static void error(struct csa *csa, const char *fmt, ...) { /* print error message and terminate processing */ @@ -1067,7 +1066,29 @@ static char *col_name(struct csa *csa, int j, char cname[255+1]) adjust_name(cname); if (check_name(cname)) goto fake; return cname; +#if 0 /* 18/I-2018 */ fake: sprintf(cname, "x_%d", j); +#else +fake: /* construct fake name depending on column's attributes */ + { GLPCOL *col = csa->P->col[j]; + if (col->type == GLP_FX) + { /* fixed column */ + sprintf(cname, "s_%d", j); + } + else if (col->kind == GLP_CV) + { /* continuous variable */ + sprintf(cname, "x_%d", j); + } + else if (!(col->lb == 0 && col->ub == 1)) + { /* general (non-binary) integer variable */ + sprintf(cname, "y_%d", j); + } + else + { /* binary variable */ + sprintf(cname, "z_%d", j); + } + } +#endif return cname; } diff --git a/resources/3rdparty/glpk-4.65/src/api/cpp.c b/resources/3rdparty/glpk-4.65/src/api/cpp.c new file mode 100644 index 000000000..ac3d63ef8 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/cpp.c @@ -0,0 +1,185 @@ +/* cpp.c (solve critical path problem) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2010-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "glpk.h" + +/*********************************************************************** +* NAME +* +* glp_cpp - solve critical path problem +* +* SYNOPSIS +* +* double glp_cpp(glp_graph *G, int v_t, int v_es, int v_ls); +* +* DESCRIPTION +* +* The routine glp_cpp solves the critical path problem represented in +* the form of the project network. +* +* The parameter G is a pointer to the graph object, which specifies +* the project network. This graph must be acyclic. Multiple arcs are +* allowed being considered as single arcs. +* +* The parameter v_t specifies an offset of the field of type double +* in the vertex data block, which contains time t[i] >= 0 needed to +* perform corresponding job j. If v_t < 0, it is assumed that t[i] = 1 +* for all jobs. +* +* The parameter v_es specifies an offset of the field of type double +* in the vertex data block, to which the routine stores earliest start +* time for corresponding job. If v_es < 0, this time is not stored. +* +* The parameter v_ls specifies an offset of the field of type double +* in the vertex data block, to which the routine stores latest start +* time for corresponding job. If v_ls < 0, this time is not stored. +* +* RETURNS +* +* The routine glp_cpp returns the minimal project duration, that is, +* minimal time needed to perform all jobs in the project. */ + +static void sorting(glp_graph *G, int list[]); + +double glp_cpp(glp_graph *G, int v_t, int v_es, int v_ls) +{ glp_vertex *v; + glp_arc *a; + int i, j, k, nv, *list; + double temp, total, *t, *es, *ls; + if (v_t >= 0 && v_t > G->v_size - (int)sizeof(double)) + xerror("glp_cpp: v_t = %d; invalid offset\n", v_t); + if (v_es >= 0 && v_es > G->v_size - (int)sizeof(double)) + xerror("glp_cpp: v_es = %d; invalid offset\n", v_es); + if (v_ls >= 0 && v_ls > G->v_size - (int)sizeof(double)) + xerror("glp_cpp: v_ls = %d; invalid offset\n", v_ls); + nv = G->nv; + if (nv == 0) + { total = 0.0; + goto done; + } + /* allocate working arrays */ + t = xcalloc(1+nv, sizeof(double)); + es = xcalloc(1+nv, sizeof(double)); + ls = xcalloc(1+nv, sizeof(double)); + list = xcalloc(1+nv, sizeof(int)); + /* retrieve job times */ + for (i = 1; i <= nv; i++) + { v = G->v[i]; + if (v_t >= 0) + { memcpy(&t[i], (char *)v->data + v_t, sizeof(double)); + if (t[i] < 0.0) + xerror("glp_cpp: t[%d] = %g; invalid time\n", i, t[i]); + } + else + t[i] = 1.0; + } + /* perform topological sorting to determine the list of nodes + (jobs) such that if list[k] = i and list[kk] = j and there + exists arc (i->j), then k < kk */ + sorting(G, list); + /* FORWARD PASS */ + /* determine earliest start times */ + for (k = 1; k <= nv; k++) + { j = list[k]; + es[j] = 0.0; + for (a = G->v[j]->in; a != NULL; a = a->h_next) + { i = a->tail->i; + /* there exists arc (i->j) in the project network */ + temp = es[i] + t[i]; + if (es[j] < temp) es[j] = temp; + } + } + /* determine the minimal project duration */ + total = 0.0; + for (i = 1; i <= nv; i++) + { temp = es[i] + t[i]; + if (total < temp) total = temp; + } + /* BACKWARD PASS */ + /* determine latest start times */ + for (k = nv; k >= 1; k--) + { i = list[k]; + ls[i] = total - t[i]; + for (a = G->v[i]->out; a != NULL; a = a->t_next) + { j = a->head->i; + /* there exists arc (i->j) in the project network */ + temp = ls[j] - t[i]; + if (ls[i] > temp) ls[i] = temp; + } + /* avoid possible round-off errors */ + if (ls[i] < es[i]) ls[i] = es[i]; + } + /* store results, if necessary */ + if (v_es >= 0) + { for (i = 1; i <= nv; i++) + { v = G->v[i]; + memcpy((char *)v->data + v_es, &es[i], sizeof(double)); + } + } + if (v_ls >= 0) + { for (i = 1; i <= nv; i++) + { v = G->v[i]; + memcpy((char *)v->data + v_ls, &ls[i], sizeof(double)); + } + } + /* free working arrays */ + xfree(t); + xfree(es); + xfree(ls); + xfree(list); +done: return total; +} + +static void sorting(glp_graph *G, int list[]) +{ /* perform topological sorting to determine the list of nodes + (jobs) such that if list[k] = i and list[kk] = j and there + exists arc (i->j), then k < kk */ + int i, k, nv, v_size, *num; + void **save; + nv = G->nv; + v_size = G->v_size; + save = xcalloc(1+nv, sizeof(void *)); + num = xcalloc(1+nv, sizeof(int)); + G->v_size = sizeof(int); + for (i = 1; i <= nv; i++) + { save[i] = G->v[i]->data; + G->v[i]->data = &num[i]; + list[i] = 0; + } + if (glp_top_sort(G, 0) != 0) + xerror("glp_cpp: project network is not acyclic\n"); + G->v_size = v_size; + for (i = 1; i <= nv; i++) + { G->v[i]->data = save[i]; + k = num[i]; + xassert(1 <= k && k <= nv); + xassert(list[k] == 0); + list[k] = i; + } + xfree(save); + xfree(num); + return; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpini02.c b/resources/3rdparty/glpk-4.65/src/api/cpxbas.c similarity index 97% rename from resources/3rdparty/glpk-4.57/src/glpini02.c rename to resources/3rdparty/glpk-4.65/src/api/cpxbas.c index 6aad59feb..e1c656a74 100644 --- a/resources/3rdparty/glpk-4.57/src/glpini02.c +++ b/resources/3rdparty/glpk-4.65/src/api/cpxbas.c @@ -1,10 +1,9 @@ -/* glpini02.c */ +/* cpxbas.c (construct Bixby's initial LP basis) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2008-2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -33,7 +32,7 @@ struct var /* penalty value */ }; -static int fcmp(const void *ptr1, const void *ptr2) +static int CDECL fcmp(const void *ptr1, const void *ptr2) { /* this routine is passed to the qsort() function */ struct var *col1 = (void *)ptr1, *col2 = (void *)ptr2; if (col1->q < col2->q) return -1; diff --git a/resources/3rdparty/glpk-4.57/src/glpapi15.c b/resources/3rdparty/glpk-4.65/src/api/graph.c similarity index 82% rename from resources/3rdparty/glpk-4.57/src/glpapi15.c rename to resources/3rdparty/glpk-4.65/src/api/graph.c index be1248c57..82994c84f 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi15.c +++ b/resources/3rdparty/glpk-4.65/src/api/graph.c @@ -1,10 +1,9 @@ -/* glpapi15.c (basic graph and network routines) */ +/* graph.c (basic graph routines) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -22,11 +21,10 @@ * along with GLPK. If not, see . ***********************************************************************/ +#include "avl.h" +#include "dmp.h" #include "env.h" -#include "glpsdf.h" -#include "prob.h" - -#define xfprintf glp_format +#include "glpk.h" /* CAUTION: DO NOT CHANGE THE LIMITS BELOW */ @@ -503,113 +501,4 @@ void glp_delete_v_index(glp_graph *G) return; } -/*********************************************************************** -* NAME -* -* glp_read_graph - read graph from plain text file -* -* SYNOPSIS -* -* int glp_read_graph(glp_graph *G, const char *fname); -* -* DESCRIPTION -* -* The routine glp_read_graph reads a graph from a plain text file. -* -* RETURNS -* -* If the operation was successful, the routine returns zero. Otherwise -* it prints an error message and returns non-zero. */ - -int glp_read_graph(glp_graph *G, const char *fname) -{ glp_data *data; - jmp_buf jump; - int nv, na, i, j, k, ret; - glp_erase_graph(G, G->v_size, G->a_size); - xprintf("Reading graph from '%s'...\n", fname); - data = glp_sdf_open_file(fname); - if (data == NULL) - { ret = 1; - goto done; - } - if (setjmp(jump)) - { ret = 1; - goto done; - } - glp_sdf_set_jump(data, jump); - nv = glp_sdf_read_int(data); - if (nv < 0) - glp_sdf_error(data, "invalid number of vertices\n"); - na = glp_sdf_read_int(data); - if (na < 0) - glp_sdf_error(data, "invalid number of arcs\n"); - xprintf("Graph has %d vert%s and %d arc%s\n", - nv, nv == 1 ? "ex" : "ices", na, na == 1 ? "" : "s"); - if (nv > 0) glp_add_vertices(G, nv); - for (k = 1; k <= na; k++) - { i = glp_sdf_read_int(data); - if (!(1 <= i && i <= nv)) - glp_sdf_error(data, "tail vertex number out of range\n"); - j = glp_sdf_read_int(data); - if (!(1 <= j && j <= nv)) - glp_sdf_error(data, "head vertex number out of range\n"); - glp_add_arc(G, i, j); - } - xprintf("%d lines were read\n", glp_sdf_line(data)); - ret = 0; -done: if (data != NULL) glp_sdf_close_file(data); - return ret; -} - -/*********************************************************************** -* NAME -* -* glp_write_graph - write graph to plain text file -* -* SYNOPSIS -* -* int glp_write_graph(glp_graph *G, const char *fname). -* -* DESCRIPTION -* -* The routine glp_write_graph writes the specified graph to a plain -* text file. -* -* RETURNS -* -* If the operation was successful, the routine returns zero. Otherwise -* it prints an error message and returns non-zero. */ - -int glp_write_graph(glp_graph *G, const char *fname) -{ glp_file *fp; - glp_vertex *v; - glp_arc *a; - int i, count, ret; - xprintf("Writing graph to '%s'...\n", fname); - fp = glp_open(fname, "w"), count = 0; - if (fp == NULL) - { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xfprintf(fp, "%d %d\n", G->nv, G->na), count++; - for (i = 1; i <= G->nv; i++) - { v = G->v[i]; - for (a = v->out; a != NULL; a = a->t_next) - xfprintf(fp, "%d %d\n", a->tail->i, a->head->i), count++; - } -#if 0 /* FIXME */ - xfflush(fp); -#endif - if (glp_ioerr(fp)) - { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); - ret = 1; - goto done; - } - xprintf("%d lines were written\n", count); - ret = 0; -done: if (fp != NULL) glp_close(fp); - return ret; -} - /* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpnet04.c b/resources/3rdparty/glpk-4.65/src/api/gridgen.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpnet04.c rename to resources/3rdparty/glpk-4.65/src/api/gridgen.c index 391392878..8cd3517fa 100644 --- a/resources/3rdparty/glpk-4.57/src/glpnet04.c +++ b/resources/3rdparty/glpk-4.65/src/api/gridgen.c @@ -1,4 +1,4 @@ -/* glpnet04.c (grid-like network problem generator) */ +/* gridgen.c (grid-like network problem generator) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). diff --git a/resources/3rdparty/glpk-4.57/src/glpapi20.c b/resources/3rdparty/glpk-4.65/src/api/intfeas1.c similarity index 95% rename from resources/3rdparty/glpk-4.57/src/glpapi20.c rename to resources/3rdparty/glpk-4.65/src/api/intfeas1.c index 2a2f6f988..430643517 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi20.c +++ b/resources/3rdparty/glpk-4.65/src/api/intfeas1.c @@ -1,10 +1,9 @@ -/* glpapi20.c */ +/* intfeas1.c (solve integer feasibility problem) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2011-2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +22,7 @@ ***********************************************************************/ #include "env.h" -#include "glpnpp.h" +#include "npp.h" int glp_intfeas1(glp_prob *P, int use_bound, int obj_bound) { /* solve integer feasibility problem */ @@ -33,10 +32,12 @@ int glp_intfeas1(glp_prob *P, int use_bound, int obj_bound) double *obj_val = NULL; int obj_row = 0; int i, j, k, obj_len, temp, ret; +#if 0 /* 04/IV-2016 */ /* check the problem object */ if (P == NULL || P->magic != GLP_PROB_MAGIC) xerror("glp_intfeas1: P = %p; invalid problem object\n", P); +#endif if (P->tree != NULL) xerror("glp_intfeas1: operation not allowed\n"); /* integer solution is currently undefined */ @@ -45,7 +46,7 @@ int glp_intfeas1(glp_prob *P, int use_bound, int obj_bound) /* check columns (variables) */ for (j = 1; j <= P->n; j++) { GLPCOL *col = P->col[j]; -#if 0 /* currently binarization is not yet implemented */ +#if 0 /* binarization is not yet implemented */ if (!(col->kind == GLP_IV || col->type == GLP_FX)) { xprintf("glp_intfeas1: column %d: non-integer non-fixed var" "iable not allowed\n", j); @@ -123,6 +124,12 @@ int glp_intfeas1(glp_prob *P, int use_bound, int obj_bound) } } /* check the objective function */ +#if 1 /* 08/I-2017 by cmatraki & mao */ + if (!use_bound) + { /* skip check if no obj. bound is specified */ + goto skip; + } +#endif temp = (int)P->c0; if ((double)temp != P->c0) { xprintf("glp_intfeas1: objective constant term %g is non-integ" @@ -139,6 +146,9 @@ int glp_intfeas1(glp_prob *P, int use_bound, int obj_bound) goto done; } } +#if 1 /* 08/I-2017 by cmatraki & mao */ +skip: ; +#endif /* save the objective function and set it to zero */ obj_ind = xcalloc(1+P->n, sizeof(int)); obj_val = xcalloc(1+P->n, sizeof(double)); diff --git a/resources/3rdparty/glpk-4.65/src/api/maxffalg.c b/resources/3rdparty/glpk-4.65/src/api/maxffalg.c new file mode 100644 index 000000000..0f3f9b041 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/maxffalg.c @@ -0,0 +1,130 @@ +/* maxffalg.c (find maximal flow with Ford-Fulkerson algorithm) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "ffalg.h" +#include "glpk.h" + +int glp_maxflow_ffalg(glp_graph *G, int s, int t, int a_cap, + double *sol, int a_x, int v_cut) +{ /* find maximal flow with Ford-Fulkerson algorithm */ + glp_vertex *v; + glp_arc *a; + int nv, na, i, k, flag, *tail, *head, *cap, *x, ret; + char *cut; + double temp; + if (!(1 <= s && s <= G->nv)) + xerror("glp_maxflow_ffalg: s = %d; source node number out of r" + "ange\n", s); + if (!(1 <= t && t <= G->nv)) + xerror("glp_maxflow_ffalg: t = %d: sink node number out of ran" + "ge\n", t); + if (s == t) + xerror("glp_maxflow_ffalg: s = t = %d; source and sink nodes m" + "ust be distinct\n", s); + if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) + xerror("glp_maxflow_ffalg: a_cap = %d; invalid offset\n", + a_cap); + if (v_cut >= 0 && v_cut > G->v_size - (int)sizeof(int)) + xerror("glp_maxflow_ffalg: v_cut = %d; invalid offset\n", + v_cut); + /* allocate working arrays */ + nv = G->nv; + na = G->na; + tail = xcalloc(1+na, sizeof(int)); + head = xcalloc(1+na, sizeof(int)); + cap = xcalloc(1+na, sizeof(int)); + x = xcalloc(1+na, sizeof(int)); + if (v_cut < 0) + cut = NULL; + else + cut = xcalloc(1+nv, sizeof(char)); + /* copy the flow network */ + k = 0; + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + for (a = v->out; a != NULL; a = a->t_next) + { k++; + tail[k] = a->tail->i; + head[k] = a->head->i; + if (tail[k] == head[k]) + { ret = GLP_EDATA; + goto done; + } + if (a_cap >= 0) + memcpy(&temp, (char *)a->data + a_cap, sizeof(double)); + else + temp = 1.0; + if (!(0.0 <= temp && temp <= (double)INT_MAX && + temp == floor(temp))) + { ret = GLP_EDATA; + goto done; + } + cap[k] = (int)temp; + } + } + xassert(k == na); + /* find maximal flow in the flow network */ + ffalg(nv, na, tail, head, s, t, cap, x, cut); + ret = 0; + /* store solution components */ + /* (objective function = total flow through the network) */ + if (sol != NULL) + { temp = 0.0; + for (k = 1; k <= na; k++) + { if (tail[k] == s) + temp += (double)x[k]; + else if (head[k] == s) + temp -= (double)x[k]; + } + *sol = temp; + } + /* (arc flows) */ + if (a_x >= 0) + { k = 0; + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + for (a = v->out; a != NULL; a = a->t_next) + { temp = (double)x[++k]; + memcpy((char *)a->data + a_x, &temp, sizeof(double)); + } + } + } + /* (node flags) */ + if (v_cut >= 0) + { for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + flag = cut[i]; + memcpy((char *)v->data + v_cut, &flag, sizeof(int)); + } + } +done: /* free working arrays */ + xfree(tail); + xfree(head); + xfree(cap); + xfree(x); + if (cut != NULL) xfree(cut); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/maxflp.c b/resources/3rdparty/glpk-4.65/src/api/maxflp.c new file mode 100644 index 000000000..1135b78cb --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/maxflp.c @@ -0,0 +1,114 @@ +/* maxflp.c (convert maximum flow problem to LP) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "glpk.h" + +/*********************************************************************** +* NAME +* +* glp_maxflow_lp - convert maximum flow problem to LP +* +* SYNOPSIS +* +* void glp_maxflow_lp(glp_prob *lp, glp_graph *G, int names, int s, +* int t, int a_cap); +* +* DESCRIPTION +* +* The routine glp_maxflow_lp builds an LP problem, which corresponds +* to the maximum flow problem on the specified network G. */ + +void glp_maxflow_lp(glp_prob *lp, glp_graph *G, int names, int s, + int t, int a_cap) +{ glp_vertex *v; + glp_arc *a; + int i, j, type, ind[1+2]; + double cap, val[1+2]; + if (!(names == GLP_ON || names == GLP_OFF)) + xerror("glp_maxflow_lp: names = %d; invalid parameter\n", + names); + if (!(1 <= s && s <= G->nv)) + xerror("glp_maxflow_lp: s = %d; source node number out of rang" + "e\n", s); + if (!(1 <= t && t <= G->nv)) + xerror("glp_maxflow_lp: t = %d: sink node number out of range " + "\n", t); + if (s == t) + xerror("glp_maxflow_lp: s = t = %d; source and sink nodes must" + " be distinct\n", s); + if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) + xerror("glp_maxflow_lp: a_cap = %d; invalid offset\n", a_cap); + glp_erase_prob(lp); + if (names) glp_set_prob_name(lp, G->name); + glp_set_obj_dir(lp, GLP_MAX); + glp_add_rows(lp, G->nv); + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + if (names) glp_set_row_name(lp, i, v->name); + if (i == s) + type = GLP_LO; + else if (i == t) + type = GLP_UP; + else + type = GLP_FX; + glp_set_row_bnds(lp, i, type, 0.0, 0.0); + } + if (G->na > 0) glp_add_cols(lp, G->na); + for (i = 1, j = 0; i <= G->nv; i++) + { v = G->v[i]; + for (a = v->out; a != NULL; a = a->t_next) + { j++; + if (names) + { char name[50+1]; + sprintf(name, "x[%d,%d]", a->tail->i, a->head->i); + xassert(strlen(name) < sizeof(name)); + glp_set_col_name(lp, j, name); + } + if (a->tail->i != a->head->i) + { ind[1] = a->tail->i, val[1] = +1.0; + ind[2] = a->head->i, val[2] = -1.0; + glp_set_mat_col(lp, j, 2, ind, val); + } + if (a_cap >= 0) + memcpy(&cap, (char *)a->data + a_cap, sizeof(double)); + else + cap = 1.0; + if (cap == DBL_MAX) + type = GLP_LO; + else if (cap != 0.0) + type = GLP_DB; + else + type = GLP_FX; + glp_set_col_bnds(lp, j, type, 0.0, cap); + if (a->tail->i == s) + glp_set_obj_coef(lp, j, +1.0); + else if (a->head->i == s) + glp_set_obj_coef(lp, j, -1.0); + } + } + xassert(j == G->na); + return; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/mcflp.c b/resources/3rdparty/glpk-4.65/src/api/mcflp.c new file mode 100644 index 000000000..5cd240602 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/mcflp.c @@ -0,0 +1,114 @@ +/* mcflp.c (convert minimum cost flow problem to LP) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "glpk.h" + +/*********************************************************************** +* NAME +* +* glp_mincost_lp - convert minimum cost flow problem to LP +* +* SYNOPSIS +* +* void glp_mincost_lp(glp_prob *lp, glp_graph *G, int names, +* int v_rhs, int a_low, int a_cap, int a_cost); +* +* DESCRIPTION +* +* The routine glp_mincost_lp builds an LP problem, which corresponds +* to the minimum cost flow problem on the specified network G. */ + +void glp_mincost_lp(glp_prob *lp, glp_graph *G, int names, int v_rhs, + int a_low, int a_cap, int a_cost) +{ glp_vertex *v; + glp_arc *a; + int i, j, type, ind[1+2]; + double rhs, low, cap, cost, val[1+2]; + if (!(names == GLP_ON || names == GLP_OFF)) + xerror("glp_mincost_lp: names = %d; invalid parameter\n", + names); + if (v_rhs >= 0 && v_rhs > G->v_size - (int)sizeof(double)) + xerror("glp_mincost_lp: v_rhs = %d; invalid offset\n", v_rhs); + if (a_low >= 0 && a_low > G->a_size - (int)sizeof(double)) + xerror("glp_mincost_lp: a_low = %d; invalid offset\n", a_low); + if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) + xerror("glp_mincost_lp: a_cap = %d; invalid offset\n", a_cap); + if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) + xerror("glp_mincost_lp: a_cost = %d; invalid offset\n", a_cost) + ; + glp_erase_prob(lp); + if (names) glp_set_prob_name(lp, G->name); + if (G->nv > 0) glp_add_rows(lp, G->nv); + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + if (names) glp_set_row_name(lp, i, v->name); + if (v_rhs >= 0) + memcpy(&rhs, (char *)v->data + v_rhs, sizeof(double)); + else + rhs = 0.0; + glp_set_row_bnds(lp, i, GLP_FX, rhs, rhs); + } + if (G->na > 0) glp_add_cols(lp, G->na); + for (i = 1, j = 0; i <= G->nv; i++) + { v = G->v[i]; + for (a = v->out; a != NULL; a = a->t_next) + { j++; + if (names) + { char name[50+1]; + sprintf(name, "x[%d,%d]", a->tail->i, a->head->i); + xassert(strlen(name) < sizeof(name)); + glp_set_col_name(lp, j, name); + } + if (a->tail->i != a->head->i) + { ind[1] = a->tail->i, val[1] = +1.0; + ind[2] = a->head->i, val[2] = -1.0; + glp_set_mat_col(lp, j, 2, ind, val); + } + if (a_low >= 0) + memcpy(&low, (char *)a->data + a_low, sizeof(double)); + else + low = 0.0; + if (a_cap >= 0) + memcpy(&cap, (char *)a->data + a_cap, sizeof(double)); + else + cap = 1.0; + if (cap == DBL_MAX) + type = GLP_LO; + else if (low != cap) + type = GLP_DB; + else + type = GLP_FX; + glp_set_col_bnds(lp, j, type, low, cap); + if (a_cost >= 0) + memcpy(&cost, (char *)a->data + a_cost, sizeof(double)); + else + cost = 0.0; + glp_set_obj_coef(lp, j, cost); + } + } + xassert(j == G->na); + return; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/mcfokalg.c b/resources/3rdparty/glpk-4.65/src/api/mcfokalg.c new file mode 100644 index 000000000..786dc71bc --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/mcfokalg.c @@ -0,0 +1,221 @@ +/* mcfokalg.c (find minimum-cost flow with out-of-kilter algorithm) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "glpk.h" +#include "okalg.h" + +int glp_mincost_okalg(glp_graph *G, int v_rhs, int a_low, int a_cap, + int a_cost, double *sol, int a_x, int v_pi) +{ /* find minimum-cost flow with out-of-kilter algorithm */ + glp_vertex *v; + glp_arc *a; + int nv, na, i, k, s, t, *tail, *head, *low, *cap, *cost, *x, *pi, + ret; + double sum, temp; + if (v_rhs >= 0 && v_rhs > G->v_size - (int)sizeof(double)) + xerror("glp_mincost_okalg: v_rhs = %d; invalid offset\n", + v_rhs); + if (a_low >= 0 && a_low > G->a_size - (int)sizeof(double)) + xerror("glp_mincost_okalg: a_low = %d; invalid offset\n", + a_low); + if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) + xerror("glp_mincost_okalg: a_cap = %d; invalid offset\n", + a_cap); + if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) + xerror("glp_mincost_okalg: a_cost = %d; invalid offset\n", + a_cost); + if (a_x >= 0 && a_x > G->a_size - (int)sizeof(double)) + xerror("glp_mincost_okalg: a_x = %d; invalid offset\n", a_x); + if (v_pi >= 0 && v_pi > G->v_size - (int)sizeof(double)) + xerror("glp_mincost_okalg: v_pi = %d; invalid offset\n", v_pi); + /* s is artificial source node */ + s = G->nv + 1; + /* t is artificial sink node */ + t = s + 1; + /* nv is the total number of nodes in the resulting network */ + nv = t; + /* na is the total number of arcs in the resulting network */ + na = G->na + 1; + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + if (v_rhs >= 0) + memcpy(&temp, (char *)v->data + v_rhs, sizeof(double)); + else + temp = 0.0; + if (temp != 0.0) na++; + } + /* allocate working arrays */ + tail = xcalloc(1+na, sizeof(int)); + head = xcalloc(1+na, sizeof(int)); + low = xcalloc(1+na, sizeof(int)); + cap = xcalloc(1+na, sizeof(int)); + cost = xcalloc(1+na, sizeof(int)); + x = xcalloc(1+na, sizeof(int)); + pi = xcalloc(1+nv, sizeof(int)); + /* construct the resulting network */ + k = 0; + /* (original arcs) */ + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + for (a = v->out; a != NULL; a = a->t_next) + { k++; + tail[k] = a->tail->i; + head[k] = a->head->i; + if (tail[k] == head[k]) + { ret = GLP_EDATA; + goto done; + } + if (a_low >= 0) + memcpy(&temp, (char *)a->data + a_low, sizeof(double)); + else + temp = 0.0; + if (!(0.0 <= temp && temp <= (double)INT_MAX && + temp == floor(temp))) + { ret = GLP_EDATA; + goto done; + } + low[k] = (int)temp; + if (a_cap >= 0) + memcpy(&temp, (char *)a->data + a_cap, sizeof(double)); + else + temp = 1.0; + if (!((double)low[k] <= temp && temp <= (double)INT_MAX && + temp == floor(temp))) + { ret = GLP_EDATA; + goto done; + } + cap[k] = (int)temp; + if (a_cost >= 0) + memcpy(&temp, (char *)a->data + a_cost, sizeof(double)); + else + temp = 0.0; + if (!(fabs(temp) <= (double)INT_MAX && temp == floor(temp))) + { ret = GLP_EDATA; + goto done; + } + cost[k] = (int)temp; + } + } + /* (artificial arcs) */ + sum = 0.0; + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + if (v_rhs >= 0) + memcpy(&temp, (char *)v->data + v_rhs, sizeof(double)); + else + temp = 0.0; + if (!(fabs(temp) <= (double)INT_MAX && temp == floor(temp))) + { ret = GLP_EDATA; + goto done; + } + if (temp > 0.0) + { /* artificial arc from s to original source i */ + k++; + tail[k] = s; + head[k] = i; + low[k] = cap[k] = (int)(+temp); /* supply */ + cost[k] = 0; + sum += (double)temp; + } + else if (temp < 0.0) + { /* artificial arc from original sink i to t */ + k++; + tail[k] = i; + head[k] = t; + low[k] = cap[k] = (int)(-temp); /* demand */ + cost[k] = 0; + } + } + /* (feedback arc from t to s) */ + k++; + xassert(k == na); + tail[k] = t; + head[k] = s; + if (sum > (double)INT_MAX) + { ret = GLP_EDATA; + goto done; + } + low[k] = cap[k] = (int)sum; /* total supply/demand */ + cost[k] = 0; + /* find minimal-cost circulation in the resulting network */ + ret = okalg(nv, na, tail, head, low, cap, cost, x, pi); + switch (ret) + { case 0: + /* optimal circulation found */ + ret = 0; + break; + case 1: + /* no feasible circulation exists */ + ret = GLP_ENOPFS; + break; + case 2: + /* integer overflow occured */ + ret = GLP_ERANGE; + goto done; + case 3: + /* optimality test failed (logic error) */ + ret = GLP_EFAIL; + goto done; + default: + xassert(ret != ret); + } + /* store solution components */ + /* (objective function = the total cost) */ + if (sol != NULL) + { temp = 0.0; + for (k = 1; k <= na; k++) + temp += (double)cost[k] * (double)x[k]; + *sol = temp; + } + /* (arc flows) */ + if (a_x >= 0) + { k = 0; + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + for (a = v->out; a != NULL; a = a->t_next) + { temp = (double)x[++k]; + memcpy((char *)a->data + a_x, &temp, sizeof(double)); + } + } + } + /* (node potentials = Lagrange multipliers) */ + if (v_pi >= 0) + { for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + temp = - (double)pi[i]; + memcpy((char *)v->data + v_pi, &temp, sizeof(double)); + } + } +done: /* free working arrays */ + xfree(tail); + xfree(head); + xfree(low); + xfree(cap); + xfree(cost); + xfree(x); + xfree(pi); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/mcfrelax.c b/resources/3rdparty/glpk-4.65/src/api/mcfrelax.c new file mode 100644 index 000000000..9b34949a1 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/mcfrelax.c @@ -0,0 +1,251 @@ +/* mcfrelax.c (find minimum-cost flow with RELAX-IV) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2013-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "glpk.h" +#include "relax4.h" + +static int overflow(int u, int v) +{ /* check for integer overflow on computing u + v */ + if (u > 0 && v > 0 && u + v < 0) return 1; + if (u < 0 && v < 0 && u + v > 0) return 1; + return 0; +} + +int glp_mincost_relax4(glp_graph *G, int v_rhs, int a_low, int a_cap, + int a_cost, int crash, double *sol, int a_x, int a_rc) +{ /* find minimum-cost flow with Bertsekas-Tseng relaxation method + (RELAX-IV) */ + glp_vertex *v; + glp_arc *a; + struct relax4_csa csa; + int i, k, large, n, na, ret; + double cap, cost, low, rc, rhs, sum, x; + if (v_rhs >= 0 && v_rhs > G->v_size - (int)sizeof(double)) + xerror("glp_mincost_relax4: v_rhs = %d; invalid offset\n", + v_rhs); + if (a_low >= 0 && a_low > G->a_size - (int)sizeof(double)) + xerror("glp_mincost_relax4: a_low = %d; invalid offset\n", + a_low); + if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) + xerror("glp_mincost_relax4: a_cap = %d; invalid offset\n", + a_cap); + if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) + xerror("glp_mincost_relax4: a_cost = %d; invalid offset\n", + a_cost); + if (a_x >= 0 && a_x > G->a_size - (int)sizeof(double)) + xerror("glp_mincost_relax4: a_x = %d; invalid offset\n", + a_x); + if (a_rc >= 0 && a_rc > G->a_size - (int)sizeof(double)) + xerror("glp_mincost_relax4: a_rc = %d; invalid offset\n", + a_rc); + csa.n = n = G->nv; /* number of nodes */ + csa.na = na = G->na; /* number of arcs */ + csa.large = large = INT_MAX / 4; + csa.repeat = 0; + csa.crash = crash; + /* allocate working arrays */ + csa.startn = xcalloc(1+na, sizeof(int)); + csa.endn = xcalloc(1+na, sizeof(int)); + csa.fou = xcalloc(1+n, sizeof(int)); + csa.nxtou = xcalloc(1+na, sizeof(int)); + csa.fin = xcalloc(1+n, sizeof(int)); + csa.nxtin = xcalloc(1+na, sizeof(int)); + csa.rc = xcalloc(1+na, sizeof(int)); + csa.u = xcalloc(1+na, sizeof(int)); + csa.dfct = xcalloc(1+n, sizeof(int)); + csa.x = xcalloc(1+na, sizeof(int)); + csa.label = xcalloc(1+n, sizeof(int)); + csa.prdcsr = xcalloc(1+n, sizeof(int)); + csa.save = xcalloc(1+na, sizeof(int)); + csa.tfstou = xcalloc(1+n, sizeof(int)); + csa.tnxtou = xcalloc(1+na, sizeof(int)); + csa.tfstin = xcalloc(1+n, sizeof(int)); + csa.tnxtin = xcalloc(1+na, sizeof(int)); + csa.nxtqueue = xcalloc(1+n, sizeof(int)); + csa.scan = xcalloc(1+n, sizeof(char)); + csa.mark = xcalloc(1+n, sizeof(char)); + if (crash) + { csa.extend_arc = xcalloc(1+n, sizeof(int)); + csa.sb_level = xcalloc(1+n, sizeof(int)); + csa.sb_arc = xcalloc(1+n, sizeof(int)); + } + else + { csa.extend_arc = NULL; + csa.sb_level = NULL; + csa.sb_arc = NULL; + } + /* scan nodes */ + for (i = 1; i <= n; i++) + { v = G->v[i]; + /* get supply at i-th node */ + if (v_rhs >= 0) + memcpy(&rhs, (char *)v->data + v_rhs, sizeof(double)); + else + rhs = 0.0; + if (!(fabs(rhs) <= (double)large && rhs == floor(rhs))) + { ret = GLP_EDATA; + goto done; + } + /* set demand at i-th node */ + csa.dfct[i] = -(int)rhs; + } + /* scan arcs */ + k = 0; + for (i = 1; i <= n; i++) + { v = G->v[i]; + for (a = v->out; a != NULL; a = a->t_next) + { k++; + /* set endpoints of k-th arc */ + if (a->tail->i == a->head->i) + { /* self-loops not allowed */ + ret = GLP_EDATA; + goto done; + } + csa.startn[k] = a->tail->i; + csa.endn[k] = a->head->i; + /* set per-unit cost for k-th arc flow */ + if (a_cost >= 0) + memcpy(&cost, (char *)a->data + a_cost, sizeof(double)); + else + cost = 0.0; + if (!(fabs(cost) <= (double)large && cost == floor(cost))) + { ret = GLP_EDATA; + goto done; + } + csa.rc[k] = (int)cost; + /* get lower bound for k-th arc flow */ + if (a_low >= 0) + memcpy(&low, (char *)a->data + a_low, sizeof(double)); + else + low = 0.0; + if (!(0.0 <= low && low <= (double)large && + low == floor(low))) + { ret = GLP_EDATA; + goto done; + } + /* get upper bound for k-th arc flow */ + if (a_cap >= 0) + memcpy(&cap, (char *)a->data + a_cap, sizeof(double)); + else + cap = 1.0; + if (!(low <= cap && cap <= (double)large && + cap == floor(cap))) + { ret = GLP_EDATA; + goto done; + } + /* substitute x = x' + low, where 0 <= x' <= cap - low */ + csa.u[k] = (int)(cap - low); + /* correct demands at endpoints of k-th arc */ + if (overflow(csa.dfct[a->tail->i], +low)) + { ret = GLP_ERANGE; + goto done; + } +#if 0 /* 29/IX-2017 */ + csa.dfct[a->tail->i] += low; +#else + csa.dfct[a->tail->i] += (int)low; +#endif + if (overflow(csa.dfct[a->head->i], -low)) + { ret = GLP_ERANGE; + goto done; + } +#if 0 /* 29/IX-2017 */ + csa.dfct[a->head->i] -= low; +#else + csa.dfct[a->head->i] -= (int)low; +#endif + } + } + /* construct linked list for network topology */ + relax4_inidat(&csa); + /* find minimum-cost flow */ + ret = relax4(&csa); + if (ret != 0) + { /* problem is found to be infeasible */ + xassert(1 <= ret && ret <= 8); + ret = GLP_ENOPFS; + goto done; + } + /* store solution */ + sum = 0.0; + k = 0; + for (i = 1; i <= n; i++) + { v = G->v[i]; + for (a = v->out; a != NULL; a = a->t_next) + { k++; + /* get lower bound for k-th arc flow */ + if (a_low >= 0) + memcpy(&low, (char *)a->data + a_low, sizeof(double)); + else + low = 0.0; + /* store original flow x = x' + low thru k-th arc */ + x = (double)csa.x[k] + low; + if (a_x >= 0) + memcpy((char *)a->data + a_x, &x, sizeof(double)); + /* store reduced cost for k-th arc flow */ + rc = (double)csa.rc[k]; + if (a_rc >= 0) + memcpy((char *)a->data + a_rc, &rc, sizeof(double)); + /* get per-unit cost for k-th arc flow */ + if (a_cost >= 0) + memcpy(&cost, (char *)a->data + a_cost, sizeof(double)); + else + cost = 0.0; + /* compute the total cost */ + sum += cost * x; + } + } + /* store the total cost */ + if (sol != NULL) + *sol = sum; +done: /* free working arrays */ + xfree(csa.startn); + xfree(csa.endn); + xfree(csa.fou); + xfree(csa.nxtou); + xfree(csa.fin); + xfree(csa.nxtin); + xfree(csa.rc); + xfree(csa.u); + xfree(csa.dfct); + xfree(csa.x); + xfree(csa.label); + xfree(csa.prdcsr); + xfree(csa.save); + xfree(csa.tfstou); + xfree(csa.tnxtou); + xfree(csa.tfstin); + xfree(csa.tnxtin); + xfree(csa.nxtqueue); + xfree(csa.scan); + xfree(csa.mark); + if (crash) + { xfree(csa.extend_arc); + xfree(csa.sb_level); + xfree(csa.sb_arc); + } + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpapi19.c b/resources/3rdparty/glpk-4.65/src/api/minisat1.c similarity index 87% rename from resources/3rdparty/glpk-4.57/src/glpapi19.c rename to resources/3rdparty/glpk-4.65/src/api/minisat1.c index eda96a946..a669c487e 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi19.c +++ b/resources/3rdparty/glpk-4.65/src/api/minisat1.c @@ -1,10 +1,9 @@ -/* glpapi19.c (driver to MiniSat solver) */ +/* minisat1.c (driver to MiniSat solver) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2011-2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -32,10 +31,12 @@ int glp_minisat1(glp_prob *P) GLPAIJ *aij; int i, j, len, ret, *ind; double sum; +#if 0 /* 04/IV-2016 */ /* check problem object */ if (P == NULL || P->magic != GLP_PROB_MAGIC) xerror("glp_minisat1: P = %p; invalid problem object\n", P); +#endif if (P->tree != NULL) xerror("glp_minisat1: operation not allowed\n"); /* integer solution is currently undefined */ @@ -48,6 +49,7 @@ int glp_minisat1(glp_prob *P) ret = GLP_EDATA; goto done; } +#if 0 /* 08/I-2017 by cmatraki */ #if 1 /* 07/XI-2015 */ if (sizeof(void *) != sizeof(int)) { xprintf("glp_minisat1: sorry, MiniSat solver is not supported " @@ -55,6 +57,14 @@ int glp_minisat1(glp_prob *P) ret = GLP_EFAIL; goto done; } +#endif +#else + if (sizeof(void *) != sizeof(size_t)) + { xprintf("glp_minisat1: sorry, MiniSat solver is not supported " + "on this platform\n"); + ret = GLP_EFAIL; + goto done; + } #endif /* solve CNF-SAT problem */ xprintf("Solving CNF-SAT problem...\n"); @@ -87,7 +97,17 @@ int glp_minisat1(glp_prob *P) ind[len] = lit_neg(ind[len]); } xassert(len > 0); +#if 0 /* 08/I-2017 by cmatraki */ xassert(solver_addclause(s, &ind[1], &ind[1+len])); +#else + if (!solver_addclause(s, &ind[1], &ind[1+len])) + { /* found trivial conflict */ + xfree(ind); + solver_delete(s); + P->mip_stat = GLP_NOFEAS; + goto fini; + } +#endif } xfree(ind); /* call the solver */ diff --git a/resources/3rdparty/glpk-4.57/src/glpapi14.c b/resources/3rdparty/glpk-4.65/src/api/mpl.c similarity index 96% rename from resources/3rdparty/glpk-4.57/src/glpapi14.c rename to resources/3rdparty/glpk-4.65/src/api/mpl.c index fc3b73757..cfa6f75b6 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi14.c +++ b/resources/3rdparty/glpk-4.65/src/api/mpl.c @@ -1,10 +1,9 @@ -/* glpapi14.c (processing models in GNU MathProg language) */ +/* mpl.c (processing model in GNU MathProg language) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2008-2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -22,8 +21,7 @@ * along with GLPK. If not, see . ***********************************************************************/ -#include "draft.h" -#include "glpmpl.h" +#include "mpl.h" #include "prob.h" glp_tran *glp_mpl_alloc_wksp(void) @@ -33,14 +31,13 @@ glp_tran *glp_mpl_alloc_wksp(void) return tran; } -#if 1 /* 08/XII-2009 */ -void _glp_mpl_init_rand(glp_tran *tran, int seed) -{ if (tran->phase != 0) +void glp_mpl_init_rand(glp_tran *tran, int seed) +{ /* initialize pseudo-random number generator */ + if (tran->phase != 0) xerror("glp_mpl_init_rand: invalid call sequence\n"); rng_init_rand(tran->rand, seed); return; } -#endif int glp_mpl_read_model(glp_tran *tran, const char *fname, int skip) { /* read and translate model section */ diff --git a/resources/3rdparty/glpk-4.57/src/glpmps.c b/resources/3rdparty/glpk-4.65/src/api/mps.c similarity index 98% rename from resources/3rdparty/glpk-4.57/src/glpmps.c rename to resources/3rdparty/glpk-4.65/src/api/mps.c index 69be984c5..3bdc6db16 100644 --- a/resources/3rdparty/glpk-4.57/src/glpmps.c +++ b/resources/3rdparty/glpk-4.65/src/api/mps.c @@ -1,10 +1,9 @@ -/* glpmps.c (MPS format routines) */ +/* mps.c (MPS format routines) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2008-2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -708,12 +707,20 @@ blnk: { /* new RANGES vector */ csa->P->row[i]->name); else if (type == GLP_LO) { rhs = csa->P->row[i]->lb; +#if 0 /* 26/V-2017 by cmatraki */ glp_set_row_bnds(csa->P, i, rhs == 0.0 ? GLP_FX : GLP_DB, +#else + glp_set_row_bnds(csa->P, i, rng == 0.0 ? GLP_FX : GLP_DB, +#endif rhs, rhs + fabs(rng)); } else if (type == GLP_UP) { rhs = csa->P->row[i]->ub; +#if 0 /* 26/V-2017 by cmatraki */ glp_set_row_bnds(csa->P, i, rhs == 0.0 ? GLP_FX : GLP_DB, +#else + glp_set_row_bnds(csa->P, i, rng == 0.0 ? GLP_FX : GLP_DB, +#endif rhs - fabs(rng), rhs); } else if (type == GLP_FX) @@ -1010,6 +1017,9 @@ int glp_read_mps(glp_prob *P, int fmt, const glp_mpscp *parm, } } xprintf("%d records were read\n", csa->recno); +#if 1 /* 31/III-2016 */ + /* free (unbounded) row(s) in MPS file are intended to specify + * objective function(s), so all such rows can be removed */ #if 1 /* 08/VIII-2013 */ /* remove free rows */ { int i, nrs, *num; @@ -1028,6 +1038,15 @@ int glp_read_mps(glp_prob *P, int fmt, const glp_mpscp *parm, } tfree(num); } +#endif +#else + /* if objective function row is free, remove it */ + if (csa->obj_row != 0 && P->row[csa->obj_row]->type == GLP_FR) + { int num[1+1]; + num[1] = csa->obj_row; + glp_del_rows(P, 1, num); + xprintf("Free objective row was removed\n"); + } #endif /* problem data has been successfully read */ glp_delete_index(P); diff --git a/resources/3rdparty/glpk-4.57/src/glpnet03.c b/resources/3rdparty/glpk-4.65/src/api/netgen.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpnet03.c rename to resources/3rdparty/glpk-4.65/src/api/netgen.c index 9ddf1cb75..519fd6096 100644 --- a/resources/3rdparty/glpk-4.57/src/glpnet03.c +++ b/resources/3rdparty/glpk-4.65/src/api/netgen.c @@ -1,4 +1,4 @@ -/* glpnet03.c (Klingman's network problem generator) */ +/* netgen.c (Klingman's network problem generator) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). diff --git a/resources/3rdparty/glpk-4.65/src/api/npp.c b/resources/3rdparty/glpk-4.65/src/api/npp.c new file mode 100644 index 000000000..a7ae07c1a --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/npp.c @@ -0,0 +1,143 @@ +/* npp.c (LP/MIP preprocessing) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2017 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "npp.h" + +glp_prep *glp_npp_alloc_wksp(void) +{ /* allocate the preprocessor workspace */ + glp_prep *prep; + prep = npp_create_wksp(); + return prep; +} + +void glp_npp_load_prob(glp_prep *prep, glp_prob *P, int sol, int names) +{ /* load original problem instance */ + if (prep->sol != 0) + xerror("glp_npp_load_prob: invalid call sequence (original ins" + "tance already loaded)\n"); + if (!(sol == GLP_SOL || sol == GLP_IPT || sol == GLP_MIP)) + xerror("glp_npp_load_prob: sol = %d; invalid parameter\n", + sol); + if (!(names == GLP_ON || names == GLP_OFF)) + xerror("glp_npp_load_prob: names = %d; invalid parameter\n", + names); + npp_load_prob(prep, P, names, sol, GLP_OFF); + return; +} + +int glp_npp_preprocess1(glp_prep *prep, int hard) +{ /* perform basic LP/MIP preprocessing */ + if (prep->sol == 0) + xerror("glp_npp_preprocess1: invalid call sequence (original i" + "nstance not loaded yet)\n"); + if (prep->pool == NULL) + xerror("glp_npp_preprocess1: invalid call sequence (preprocess" + "ing already finished)\n"); + if (!(hard == GLP_ON || hard == GLP_OFF)) + xerror("glp_npp_preprocess1: hard = %d; invalid parameter\n", + hard); + return npp_process_prob(prep, hard); +} + +void glp_npp_build_prob(glp_prep *prep, glp_prob *Q) +{ /* build resultant problem instance */ + if (prep->sol == 0) + xerror("glp_npp_build_prob: invalid call sequence (original in" + "stance not loaded yet)\n"); + if (prep->pool == NULL) + xerror("glp_npp_build_prob: invalid call sequence (resultant i" + "nstance already built)\n"); + npp_build_prob(prep, Q); + return; +} + +void glp_npp_postprocess(glp_prep *prep, glp_prob *Q) +{ /* postprocess solution to resultant problem */ + if (prep->pool != NULL) + xerror("glp_npp_postprocess: invalid call sequence (resultant " + "instance not built yet)\n"); + if (!(prep->m == Q->m && prep->n == Q->n && prep->nnz == Q->nnz)) + xerror("glp_npp_postprocess: resultant instance mismatch\n"); + switch (prep->sol) + { case GLP_SOL: + if (glp_get_status(Q) != GLP_OPT) + xerror("glp_npp_postprocess: unable to recover non-optim" + "al basic solution\n"); + break; + case GLP_IPT: + if (glp_ipt_status(Q) != GLP_OPT) + xerror("glp_npp_postprocess: unable to recover non-optim" + "al interior-point solution\n"); + break; + case GLP_MIP: + if (!(glp_mip_status(Q) == GLP_OPT || glp_mip_status(Q) == + GLP_FEAS)) + xerror("glp_npp_postprocess: unable to recover integer n" + "on-feasible solution\n"); + break; + default: + xassert(prep != prep); + } + npp_postprocess(prep, Q); + return; +} + +void glp_npp_obtain_sol(glp_prep *prep, glp_prob *P) +{ /* obtain solution to original problem */ + if (prep->pool != NULL) + xerror("glp_npp_obtain_sol: invalid call sequence (resultant i" + "nstance not built yet)\n"); + switch (prep->sol) + { case GLP_SOL: + if (prep->p_stat == 0 || prep->d_stat == 0) + xerror("glp_npp_obtain_sol: invalid call sequence (basic" + " solution not provided yet)\n"); + break; + case GLP_IPT: + if (prep->t_stat == 0) + xerror("glp_npp_obtain_sol: invalid call sequence (inter" + "ior-point solution not provided yet)\n"); + break; + case GLP_MIP: + if (prep->i_stat == 0) + xerror("glp_npp_obtain_sol: invalid call sequence (MIP s" + "olution not provided yet)\n"); + break; + default: + xassert(prep != prep); + } + if (!(prep->orig_dir == P->dir && prep->orig_m == P->m && + prep->orig_n == P->n && prep->orig_nnz == P->nnz)) + xerror("glp_npp_obtain_sol: original instance mismatch\n"); + npp_unload_sol(prep, P); + return; +} + +void glp_npp_free_wksp(glp_prep *prep) +{ /* free the preprocessor workspace */ + npp_delete_wksp(prep); + return; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/pript.c b/resources/3rdparty/glpk-4.65/src/api/pript.c new file mode 100644 index 000000000..f123089df --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/pript.c @@ -0,0 +1,186 @@ +/* pript.c (write interior-point solution in printable format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "prob.h" + +#define xfprintf glp_format + +int glp_print_ipt(glp_prob *P, const char *fname) +{ /* write interior-point solution in printable format */ + glp_file *fp; + GLPROW *row; + GLPCOL *col; + int i, j, t, ae_ind, re_ind, ret; + double ae_max, re_max; + xprintf("Writing interior-point solution to '%s'...\n", fname); + fp = glp_open(fname, "w"); + if (fp == NULL) + { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + xfprintf(fp, "%-12s%s\n", "Problem:", + P->name == NULL ? "" : P->name); + xfprintf(fp, "%-12s%d\n", "Rows:", P->m); + xfprintf(fp, "%-12s%d\n", "Columns:", P->n); + xfprintf(fp, "%-12s%d\n", "Non-zeros:", P->nnz); + t = glp_ipt_status(P); + xfprintf(fp, "%-12s%s\n", "Status:", + t == GLP_OPT ? "OPTIMAL" : + t == GLP_UNDEF ? "UNDEFINED" : + t == GLP_INFEAS ? "INFEASIBLE (INTERMEDIATE)" : + t == GLP_NOFEAS ? "INFEASIBLE (FINAL)" : "???"); + xfprintf(fp, "%-12s%s%s%.10g (%s)\n", "Objective:", + P->obj == NULL ? "" : P->obj, + P->obj == NULL ? "" : " = ", P->ipt_obj, + P->dir == GLP_MIN ? "MINimum" : + P->dir == GLP_MAX ? "MAXimum" : "???"); + xfprintf(fp, "\n"); + xfprintf(fp, " No. Row name Activity Lower bound " + " Upper bound Marginal\n"); + xfprintf(fp, "------ ------------ ------------- ------------- " + "------------- -------------\n"); + for (i = 1; i <= P->m; i++) + { row = P->row[i]; + xfprintf(fp, "%6d ", i); + if (row->name == NULL || strlen(row->name) <= 12) + xfprintf(fp, "%-12s ", row->name == NULL ? "" : row->name); + else + xfprintf(fp, "%s\n%20s", row->name, ""); + xfprintf(fp, "%3s", ""); + xfprintf(fp, "%13.6g ", + fabs(row->pval) <= 1e-9 ? 0.0 : row->pval); + if (row->type == GLP_LO || row->type == GLP_DB || + row->type == GLP_FX) + xfprintf(fp, "%13.6g ", row->lb); + else + xfprintf(fp, "%13s ", ""); + if (row->type == GLP_UP || row->type == GLP_DB) + xfprintf(fp, "%13.6g ", row->ub); + else + xfprintf(fp, "%13s ", row->type == GLP_FX ? "=" : ""); + if (fabs(row->dval) <= 1e-9) + xfprintf(fp, "%13s", "< eps"); + else + xfprintf(fp, "%13.6g ", row->dval); + xfprintf(fp, "\n"); + } + xfprintf(fp, "\n"); + xfprintf(fp, " No. Column name Activity Lower bound " + " Upper bound Marginal\n"); + xfprintf(fp, "------ ------------ ------------- ------------- " + "------------- -------------\n"); + for (j = 1; j <= P->n; j++) + { col = P->col[j]; + xfprintf(fp, "%6d ", j); + if (col->name == NULL || strlen(col->name) <= 12) + xfprintf(fp, "%-12s ", col->name == NULL ? "" : col->name); + else + xfprintf(fp, "%s\n%20s", col->name, ""); + xfprintf(fp, "%3s", ""); + xfprintf(fp, "%13.6g ", + fabs(col->pval) <= 1e-9 ? 0.0 : col->pval); + if (col->type == GLP_LO || col->type == GLP_DB || + col->type == GLP_FX) + xfprintf(fp, "%13.6g ", col->lb); + else + xfprintf(fp, "%13s ", ""); + if (col->type == GLP_UP || col->type == GLP_DB) + xfprintf(fp, "%13.6g ", col->ub); + else + xfprintf(fp, "%13s ", col->type == GLP_FX ? "=" : ""); + if (fabs(col->dval) <= 1e-9) + xfprintf(fp, "%13s", "< eps"); + else + xfprintf(fp, "%13.6g ", col->dval); + xfprintf(fp, "\n"); + } + xfprintf(fp, "\n"); + xfprintf(fp, "Karush-Kuhn-Tucker optimality conditions:\n"); + xfprintf(fp, "\n"); + glp_check_kkt(P, GLP_IPT, GLP_KKT_PE, &ae_max, &ae_ind, &re_max, + &re_ind); + xfprintf(fp, "KKT.PE: max.abs.err = %.2e on row %d\n", + ae_max, ae_ind); + xfprintf(fp, " max.rel.err = %.2e on row %d\n", + re_max, re_ind); + xfprintf(fp, "%8s%s\n", "", + re_max <= 1e-9 ? "High quality" : + re_max <= 1e-6 ? "Medium quality" : + re_max <= 1e-3 ? "Low quality" : "PRIMAL SOLUTION IS WRONG"); + xfprintf(fp, "\n"); + glp_check_kkt(P, GLP_IPT, GLP_KKT_PB, &ae_max, &ae_ind, &re_max, + &re_ind); + xfprintf(fp, "KKT.PB: max.abs.err = %.2e on %s %d\n", + ae_max, ae_ind <= P->m ? "row" : "column", + ae_ind <= P->m ? ae_ind : ae_ind - P->m); + xfprintf(fp, " max.rel.err = %.2e on %s %d\n", + re_max, re_ind <= P->m ? "row" : "column", + re_ind <= P->m ? re_ind : re_ind - P->m); + xfprintf(fp, "%8s%s\n", "", + re_max <= 1e-9 ? "High quality" : + re_max <= 1e-6 ? "Medium quality" : + re_max <= 1e-3 ? "Low quality" : "PRIMAL SOLUTION IS INFEASIBL" + "E"); + xfprintf(fp, "\n"); + glp_check_kkt(P, GLP_IPT, GLP_KKT_DE, &ae_max, &ae_ind, &re_max, + &re_ind); + xfprintf(fp, "KKT.DE: max.abs.err = %.2e on column %d\n", + ae_max, ae_ind == 0 ? 0 : ae_ind - P->m); + xfprintf(fp, " max.rel.err = %.2e on column %d\n", + re_max, re_ind == 0 ? 0 : re_ind - P->m); + xfprintf(fp, "%8s%s\n", "", + re_max <= 1e-9 ? "High quality" : + re_max <= 1e-6 ? "Medium quality" : + re_max <= 1e-3 ? "Low quality" : "DUAL SOLUTION IS WRONG"); + xfprintf(fp, "\n"); + glp_check_kkt(P, GLP_IPT, GLP_KKT_DB, &ae_max, &ae_ind, &re_max, + &re_ind); + xfprintf(fp, "KKT.DB: max.abs.err = %.2e on %s %d\n", + ae_max, ae_ind <= P->m ? "row" : "column", + ae_ind <= P->m ? ae_ind : ae_ind - P->m); + xfprintf(fp, " max.rel.err = %.2e on %s %d\n", + re_max, re_ind <= P->m ? "row" : "column", + re_ind <= P->m ? re_ind : re_ind - P->m); + xfprintf(fp, "%8s%s\n", "", + re_max <= 1e-9 ? "High quality" : + re_max <= 1e-6 ? "Medium quality" : + re_max <= 1e-3 ? "Low quality" : "DUAL SOLUTION IS INFEASIBLE") + ; + xfprintf(fp, "\n"); + xfprintf(fp, "End of output\n"); +#if 0 /* FIXME */ + xfflush(fp); +#endif + if (glp_ioerr(fp)) + { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + ret = 0; +done: if (fp != NULL) glp_close(fp); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/prmip.c b/resources/3rdparty/glpk-4.65/src/api/prmip.c new file mode 100644 index 000000000..885ed82ab --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/prmip.c @@ -0,0 +1,155 @@ +/* prmip.c (write MIP solution in printable format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "prob.h" + +#define xfprintf glp_format + +int glp_print_mip(glp_prob *P, const char *fname) +{ /* write MIP solution in printable format */ + glp_file *fp; + GLPROW *row; + GLPCOL *col; + int i, j, t, ae_ind, re_ind, ret; + double ae_max, re_max; + xprintf("Writing MIP solution to '%s'...\n", fname); + fp = glp_open(fname, "w"); + if (fp == NULL) + { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + xfprintf(fp, "%-12s%s\n", "Problem:", + P->name == NULL ? "" : P->name); + xfprintf(fp, "%-12s%d\n", "Rows:", P->m); + xfprintf(fp, "%-12s%d (%d integer, %d binary)\n", "Columns:", + P->n, glp_get_num_int(P), glp_get_num_bin(P)); + xfprintf(fp, "%-12s%d\n", "Non-zeros:", P->nnz); + t = glp_mip_status(P); + xfprintf(fp, "%-12s%s\n", "Status:", + t == GLP_OPT ? "INTEGER OPTIMAL" : + t == GLP_FEAS ? "INTEGER NON-OPTIMAL" : + t == GLP_NOFEAS ? "INTEGER EMPTY" : + t == GLP_UNDEF ? "INTEGER UNDEFINED" : "???"); + xfprintf(fp, "%-12s%s%s%.10g (%s)\n", "Objective:", + P->obj == NULL ? "" : P->obj, + P->obj == NULL ? "" : " = ", P->mip_obj, + P->dir == GLP_MIN ? "MINimum" : + P->dir == GLP_MAX ? "MAXimum" : "???"); + xfprintf(fp, "\n"); + xfprintf(fp, " No. Row name Activity Lower bound " + " Upper bound\n"); + xfprintf(fp, "------ ------------ ------------- ------------- " + "-------------\n"); + for (i = 1; i <= P->m; i++) + { row = P->row[i]; + xfprintf(fp, "%6d ", i); + if (row->name == NULL || strlen(row->name) <= 12) + xfprintf(fp, "%-12s ", row->name == NULL ? "" : row->name); + else + xfprintf(fp, "%s\n%20s", row->name, ""); + xfprintf(fp, "%3s", ""); + xfprintf(fp, "%13.6g ", + fabs(row->mipx) <= 1e-9 ? 0.0 : row->mipx); + if (row->type == GLP_LO || row->type == GLP_DB || + row->type == GLP_FX) + xfprintf(fp, "%13.6g ", row->lb); + else + xfprintf(fp, "%13s ", ""); + if (row->type == GLP_UP || row->type == GLP_DB) + xfprintf(fp, "%13.6g ", row->ub); + else + xfprintf(fp, "%13s ", row->type == GLP_FX ? "=" : ""); + xfprintf(fp, "\n"); + } + xfprintf(fp, "\n"); + xfprintf(fp, " No. Column name Activity Lower bound " + " Upper bound\n"); + xfprintf(fp, "------ ------------ ------------- ------------- " + "-------------\n"); + for (j = 1; j <= P->n; j++) + { col = P->col[j]; + xfprintf(fp, "%6d ", j); + if (col->name == NULL || strlen(col->name) <= 12) + xfprintf(fp, "%-12s ", col->name == NULL ? "" : col->name); + else + xfprintf(fp, "%s\n%20s", col->name, ""); + xfprintf(fp, "%s ", + col->kind == GLP_CV ? " " : + col->kind == GLP_IV ? "*" : "?"); + xfprintf(fp, "%13.6g ", + fabs(col->mipx) <= 1e-9 ? 0.0 : col->mipx); + if (col->type == GLP_LO || col->type == GLP_DB || + col->type == GLP_FX) + xfprintf(fp, "%13.6g ", col->lb); + else + xfprintf(fp, "%13s ", ""); + if (col->type == GLP_UP || col->type == GLP_DB) + xfprintf(fp, "%13.6g ", col->ub); + else + xfprintf(fp, "%13s ", col->type == GLP_FX ? "=" : ""); + xfprintf(fp, "\n"); + } + xfprintf(fp, "\n"); + xfprintf(fp, "Integer feasibility conditions:\n"); + xfprintf(fp, "\n"); + glp_check_kkt(P, GLP_MIP, GLP_KKT_PE, &ae_max, &ae_ind, &re_max, + &re_ind); + xfprintf(fp, "KKT.PE: max.abs.err = %.2e on row %d\n", + ae_max, ae_ind); + xfprintf(fp, " max.rel.err = %.2e on row %d\n", + re_max, re_ind); + xfprintf(fp, "%8s%s\n", "", + re_max <= 1e-9 ? "High quality" : + re_max <= 1e-6 ? "Medium quality" : + re_max <= 1e-3 ? "Low quality" : "SOLUTION IS WRONG"); + xfprintf(fp, "\n"); + glp_check_kkt(P, GLP_MIP, GLP_KKT_PB, &ae_max, &ae_ind, &re_max, + &re_ind); + xfprintf(fp, "KKT.PB: max.abs.err = %.2e on %s %d\n", + ae_max, ae_ind <= P->m ? "row" : "column", + ae_ind <= P->m ? ae_ind : ae_ind - P->m); + xfprintf(fp, " max.rel.err = %.2e on %s %d\n", + re_max, re_ind <= P->m ? "row" : "column", + re_ind <= P->m ? re_ind : re_ind - P->m); + xfprintf(fp, "%8s%s\n", "", + re_max <= 1e-9 ? "High quality" : + re_max <= 1e-6 ? "Medium quality" : + re_max <= 1e-3 ? "Low quality" : "SOLUTION IS INFEASIBLE"); + xfprintf(fp, "\n"); + xfprintf(fp, "End of output\n"); +#if 0 /* FIXME */ + xfflush(fp); +#endif + if (glp_ioerr(fp)) + { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + ret = 0; +done: if (fp != NULL) glp_close(fp); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/prob.h b/resources/3rdparty/glpk-4.65/src/api/prob.h similarity index 98% rename from resources/3rdparty/glpk-4.57/src/prob.h rename to resources/3rdparty/glpk-4.65/src/api/prob.h index 69dea0eb8..cc9389b57 100644 --- a/resources/3rdparty/glpk-4.57/src/prob.h +++ b/resources/3rdparty/glpk-4.65/src/api/prob.h @@ -3,8 +3,7 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2000-2013 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -28,18 +27,25 @@ #include "avl.h" #include "bfd.h" #include "dmp.h" +#if 1 /* 28/III-2016 */ +#define GLP_UNDOC 1 +#endif #include "glpk.h" typedef struct GLPROW GLPROW; typedef struct GLPCOL GLPCOL; typedef struct GLPAIJ GLPAIJ; +#if 0 /* 04/IV-2016 */ #define GLP_PROB_MAGIC 0xD7D9D6C2 +#endif struct glp_prob { /* LP/MIP problem object */ +#if 0 /* 04/IV-2016 */ unsigned magic; /* magic value used for debugging */ +#endif DMP *pool; /* memory pool to store problem object components */ glp_tree *tree; diff --git a/resources/3rdparty/glpk-4.57/src/glpapi01.c b/resources/3rdparty/glpk-4.65/src/api/prob1.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpapi01.c rename to resources/3rdparty/glpk-4.65/src/api/prob1.c index 376d98c47..6afad442e 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi01.c +++ b/resources/3rdparty/glpk-4.65/src/api/prob1.c @@ -1,10 +1,9 @@ -/* glpapi01.c (problem creating and modifying routines) */ +/* prob1.c (problem creating and modifying routines) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2000-2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +22,7 @@ ***********************************************************************/ #include "env.h" -#include "glpios.h" +#include "ios.h" /* CAUTION: DO NOT CHANGE THE LIMITS BELOW */ @@ -56,7 +55,11 @@ * used in any subsequent operations on this object. */ static void create_prob(glp_prob *lp) +#if 0 /* 04/IV-2016 */ { lp->magic = GLP_PROB_MAGIC; +#else +{ +#endif lp->pool = dmp_create_pool(); #if 0 /* 08/III-2014 */ #if 0 /* 17/XI-2009 */ @@ -1203,9 +1206,11 @@ done: return ret; void glp_sort_matrix(glp_prob *P) { GLPAIJ *aij; int i, j; +#if 0 /* 04/IV-2016 */ if (P == NULL || P->magic != GLP_PROB_MAGIC) xerror("glp_sort_matrix: P = %p; invalid problem object\n", P); +#endif /* rebuild row linked lists */ for (i = P->m; i >= 1; i--) P->row[i]->ptr = NULL; @@ -1542,7 +1547,11 @@ void glp_erase_prob(glp_prob *lp) * frees all the memory allocated to it. */ static void delete_prob(glp_prob *lp) +#if 0 /* 04/IV-2016 */ { lp->magic = 0x3F3F3F3F; +#else +{ +#endif dmp_delete_pool(lp->pool); #if 0 /* 08/III-2014 */ #if 0 /* 17/XI-2009 */ diff --git a/resources/3rdparty/glpk-4.57/src/glpapi02.c b/resources/3rdparty/glpk-4.65/src/api/prob2.c similarity index 98% rename from resources/3rdparty/glpk-4.57/src/glpapi02.c rename to resources/3rdparty/glpk-4.65/src/api/prob2.c index 5b74aab95..d352db128 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi02.c +++ b/resources/3rdparty/glpk-4.65/src/api/prob2.c @@ -1,10 +1,9 @@ -/* glpapi02.c (problem retrieving routines) */ +/* prob2.c (problem retrieving routines) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2000-2013 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * diff --git a/resources/3rdparty/glpk-4.57/src/glpapi03.c b/resources/3rdparty/glpk-4.65/src/api/prob3.c similarity index 96% rename from resources/3rdparty/glpk-4.57/src/glpapi03.c rename to resources/3rdparty/glpk-4.65/src/api/prob3.c index daf9174af..d7edbd337 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi03.c +++ b/resources/3rdparty/glpk-4.65/src/api/prob3.c @@ -1,10 +1,9 @@ -/* glpapi03.c (row and column searching routines) */ +/* prob3.c (problem row/column searching routines) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2000-2013 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * diff --git a/resources/3rdparty/glpk-4.57/src/glpapi04.c b/resources/3rdparty/glpk-4.65/src/api/prob4.c similarity index 96% rename from resources/3rdparty/glpk-4.57/src/glpapi04.c rename to resources/3rdparty/glpk-4.65/src/api/prob4.c index adabb02c1..8c2b5ae5d 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi04.c +++ b/resources/3rdparty/glpk-4.65/src/api/prob4.c @@ -1,10 +1,9 @@ -/* glpapi04.c (problem scaling routines) */ +/* prob4.c (problem scaling routines) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2000-2013 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * diff --git a/resources/3rdparty/glpk-4.57/src/glpapi05.c b/resources/3rdparty/glpk-4.65/src/api/prob5.c similarity index 96% rename from resources/3rdparty/glpk-4.57/src/glpapi05.c rename to resources/3rdparty/glpk-4.65/src/api/prob5.c index b18845522..1c1d3160a 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi05.c +++ b/resources/3rdparty/glpk-4.65/src/api/prob5.c @@ -1,10 +1,9 @@ -/* glpapi05.c (LP basis constructing routines) */ +/* prob5.c (LP problem basis constructing routines) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2000-2013 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * diff --git a/resources/3rdparty/glpk-4.65/src/api/prrngs.c b/resources/3rdparty/glpk-4.65/src/api/prrngs.c new file mode 100644 index 000000000..41a141ff7 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/prrngs.c @@ -0,0 +1,302 @@ +/* prrngs.c (print sensitivity analysis report) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2010-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "prob.h" + +#define xfprintf glp_format + +static char *format(char buf[13+1], double x) +{ /* format floating-point number in MPS/360-like style */ + if (x == -DBL_MAX) + strcpy(buf, " -Inf"); + else if (x == +DBL_MAX) + strcpy(buf, " +Inf"); + else if (fabs(x) <= 999999.99998) + { sprintf(buf, "%13.5f", x); +#if 1 + if (strcmp(buf, " 0.00000") == 0 || + strcmp(buf, " -0.00000") == 0) + strcpy(buf, " . "); + else if (memcmp(buf, " 0.", 8) == 0) + memcpy(buf, " .", 8); + else if (memcmp(buf, " -0.", 8) == 0) + memcpy(buf, " -.", 8); +#endif + } + else + sprintf(buf, "%13.6g", x); + return buf; +} + +int glp_print_ranges(glp_prob *P, int len, const int list[], + int flags, const char *fname) +{ /* print sensitivity analysis report */ + glp_file *fp = NULL; + GLPROW *row; + GLPCOL *col; + int m, n, pass, k, t, numb, type, stat, var1, var2, count, page, + ret; + double lb, ub, slack, coef, prim, dual, value1, value2, coef1, + coef2, obj1, obj2; + const char *name, *limit; + char buf[13+1]; + /* sanity checks */ +#if 0 /* 04/IV-2016 */ + if (P == NULL || P->magic != GLP_PROB_MAGIC) + xerror("glp_print_ranges: P = %p; invalid problem object\n", + P); +#endif + m = P->m, n = P->n; + if (len < 0) + xerror("glp_print_ranges: len = %d; invalid list length\n", + len); + if (len > 0) + { if (list == NULL) + xerror("glp_print_ranges: list = %p: invalid parameter\n", + list); + for (t = 1; t <= len; t++) + { k = list[t]; + if (!(1 <= k && k <= m+n)) + xerror("glp_print_ranges: list[%d] = %d; row/column numb" + "er out of range\n", t, k); + } + } + if (flags != 0) + xerror("glp_print_ranges: flags = %d; invalid parameter\n", + flags); + if (fname == NULL) + xerror("glp_print_ranges: fname = %p; invalid parameter\n", + fname); + if (glp_get_status(P) != GLP_OPT) + { xprintf("glp_print_ranges: optimal basic solution required\n"); + ret = 1; + goto done; + } + if (!glp_bf_exists(P)) + { xprintf("glp_print_ranges: basis factorization required\n"); + ret = 2; + goto done; + } + /* start reporting */ + xprintf("Write sensitivity analysis report to '%s'...\n", fname); + fp = glp_open(fname, "w"); + if (fp == NULL) + { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); + ret = 3; + goto done; + } + page = count = 0; + for (pass = 1; pass <= 2; pass++) + for (t = 1; t <= (len == 0 ? m+n : len); t++) + { if (t == 1) count = 0; + k = (len == 0 ? t : list[t]); + if (pass == 1 && k > m || pass == 2 && k <= m) + continue; + if (count == 0) + { xfprintf(fp, "GLPK %-4s - SENSITIVITY ANALYSIS REPORT%73sPa" + "ge%4d\n", glp_version(), "", ++page); + xfprintf(fp, "\n"); + xfprintf(fp, "%-12s%s\n", "Problem:", + P->name == NULL ? "" : P->name); + xfprintf(fp, "%-12s%s%s%.10g (%s)\n", "Objective:", + P->obj == NULL ? "" : P->obj, + P->obj == NULL ? "" : " = ", P->obj_val, + P->dir == GLP_MIN ? "MINimum" : + P->dir == GLP_MAX ? "MAXimum" : "???"); + xfprintf(fp, "\n"); + xfprintf(fp, "%6s %-12s %2s %13s %13s %13s %13s %13s %13s " + "%s\n", "No.", pass == 1 ? "Row name" : "Column name", + "St", "Activity", pass == 1 ? "Slack" : "Obj coef", + "Lower bound", "Activity", "Obj coef", "Obj value at", + "Limiting"); + xfprintf(fp, "%6s %-12s %2s %13s %13s %13s %13s %13s %13s " + "%s\n", "", "", "", "", "Marginal", "Upper bound", + "range", "range", "break point", "variable"); + xfprintf(fp, "------ ------------ -- ------------- --------" + "----- ------------- ------------- ------------- ------" + "------- ------------\n"); + } + if (pass == 1) + { numb = k; + xassert(1 <= numb && numb <= m); + row = P->row[numb]; + name = row->name; + type = row->type; + lb = glp_get_row_lb(P, numb); + ub = glp_get_row_ub(P, numb); + coef = 0.0; + stat = row->stat; + prim = row->prim; + if (type == GLP_FR) + slack = - prim; + else if (type == GLP_LO) + slack = lb - prim; + else if (type == GLP_UP || type == GLP_DB || type == GLP_FX) + slack = ub - prim; + dual = row->dual; + } + else + { numb = k - m; + xassert(1 <= numb && numb <= n); + col = P->col[numb]; + name = col->name; + lb = glp_get_col_lb(P, numb); + ub = glp_get_col_ub(P, numb); + coef = col->coef; + stat = col->stat; + prim = col->prim; + slack = 0.0; + dual = col->dual; + } + if (stat != GLP_BS) + { glp_analyze_bound(P, k, &value1, &var1, &value2, &var2); + if (stat == GLP_NF) + coef1 = coef2 = coef; + else if (stat == GLP_NS) + coef1 = -DBL_MAX, coef2 = +DBL_MAX; + else if (stat == GLP_NL && P->dir == GLP_MIN || + stat == GLP_NU && P->dir == GLP_MAX) + coef1 = coef - dual, coef2 = +DBL_MAX; + else + coef1 = -DBL_MAX, coef2 = coef - dual; + if (value1 == -DBL_MAX) + { if (dual < -1e-9) + obj1 = +DBL_MAX; + else if (dual > +1e-9) + obj1 = -DBL_MAX; + else + obj1 = P->obj_val; + } + else + obj1 = P->obj_val + dual * (value1 - prim); + if (value2 == +DBL_MAX) + { if (dual < -1e-9) + obj2 = -DBL_MAX; + else if (dual > +1e-9) + obj2 = +DBL_MAX; + else + obj2 = P->obj_val; + } + else + obj2 = P->obj_val + dual * (value2 - prim); + } + else + { glp_analyze_coef(P, k, &coef1, &var1, &value1, &coef2, + &var2, &value2); + if (coef1 == -DBL_MAX) + { if (prim < -1e-9) + obj1 = +DBL_MAX; + else if (prim > +1e-9) + obj1 = -DBL_MAX; + else + obj1 = P->obj_val; + } + else + obj1 = P->obj_val + (coef1 - coef) * prim; + if (coef2 == +DBL_MAX) + { if (prim < -1e-9) + obj2 = -DBL_MAX; + else if (prim > +1e-9) + obj2 = +DBL_MAX; + else + obj2 = P->obj_val; + } + else + obj2 = P->obj_val + (coef2 - coef) * prim; + } + /*** first line ***/ + /* row/column number */ + xfprintf(fp, "%6d", numb); + /* row/column name */ + xfprintf(fp, " %-12.12s", name == NULL ? "" : name); + if (name != NULL && strlen(name) > 12) + xfprintf(fp, "%s\n%6s %12s", name+12, "", ""); + /* row/column status */ + xfprintf(fp, " %2s", + stat == GLP_BS ? "BS" : stat == GLP_NL ? "NL" : + stat == GLP_NU ? "NU" : stat == GLP_NF ? "NF" : + stat == GLP_NS ? "NS" : "??"); + /* row/column activity */ + xfprintf(fp, " %s", format(buf, prim)); + /* row slack, column objective coefficient */ + xfprintf(fp, " %s", format(buf, k <= m ? slack : coef)); + /* row/column lower bound */ + xfprintf(fp, " %s", format(buf, lb)); + /* row/column activity range */ + xfprintf(fp, " %s", format(buf, value1)); + /* row/column objective coefficient range */ + xfprintf(fp, " %s", format(buf, coef1)); + /* objective value at break point */ + xfprintf(fp, " %s", format(buf, obj1)); + /* limiting variable name */ + if (var1 != 0) + { if (var1 <= m) + limit = glp_get_row_name(P, var1); + else + limit = glp_get_col_name(P, var1 - m); + if (limit != NULL) + xfprintf(fp, " %s", limit); + } + xfprintf(fp, "\n"); + /*** second line ***/ + xfprintf(fp, "%6s %-12s %2s %13s", "", "", "", ""); + /* row/column reduced cost */ + xfprintf(fp, " %s", format(buf, dual)); + /* row/column upper bound */ + xfprintf(fp, " %s", format(buf, ub)); + /* row/column activity range */ + xfprintf(fp, " %s", format(buf, value2)); + /* row/column objective coefficient range */ + xfprintf(fp, " %s", format(buf, coef2)); + /* objective value at break point */ + xfprintf(fp, " %s", format(buf, obj2)); + /* limiting variable name */ + if (var2 != 0) + { if (var2 <= m) + limit = glp_get_row_name(P, var2); + else + limit = glp_get_col_name(P, var2 - m); + if (limit != NULL) + xfprintf(fp, " %s", limit); + } + xfprintf(fp, "\n"); + xfprintf(fp, "\n"); + /* print 10 items per page */ + count = (count + 1) % 10; + } + xfprintf(fp, "End of report\n"); +#if 0 /* FIXME */ + xfflush(fp); +#endif + if (glp_ioerr(fp)) + { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); + ret = 4; + goto done; + } + ret = 0; +done: if (fp != NULL) glp_close(fp); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/prsol.c b/resources/3rdparty/glpk-4.65/src/api/prsol.c new file mode 100644 index 000000000..d785dc2e9 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/prsol.c @@ -0,0 +1,202 @@ +/* prsol.c (write basic solution in printable format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "prob.h" + +#define xfprintf glp_format + +int glp_print_sol(glp_prob *P, const char *fname) +{ /* write basic solution in printable format */ + glp_file *fp; + GLPROW *row; + GLPCOL *col; + int i, j, t, ae_ind, re_ind, ret; + double ae_max, re_max; + xprintf("Writing basic solution to '%s'...\n", fname); + fp = glp_open(fname, "w"); + if (fp == NULL) + { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + xfprintf(fp, "%-12s%s\n", "Problem:", + P->name == NULL ? "" : P->name); + xfprintf(fp, "%-12s%d\n", "Rows:", P->m); + xfprintf(fp, "%-12s%d\n", "Columns:", P->n); + xfprintf(fp, "%-12s%d\n", "Non-zeros:", P->nnz); + t = glp_get_status(P); + xfprintf(fp, "%-12s%s\n", "Status:", + t == GLP_OPT ? "OPTIMAL" : + t == GLP_FEAS ? "FEASIBLE" : + t == GLP_INFEAS ? "INFEASIBLE (INTERMEDIATE)" : + t == GLP_NOFEAS ? "INFEASIBLE (FINAL)" : + t == GLP_UNBND ? "UNBOUNDED" : + t == GLP_UNDEF ? "UNDEFINED" : "???"); + xfprintf(fp, "%-12s%s%s%.10g (%s)\n", "Objective:", + P->obj == NULL ? "" : P->obj, + P->obj == NULL ? "" : " = ", P->obj_val, + P->dir == GLP_MIN ? "MINimum" : + P->dir == GLP_MAX ? "MAXimum" : "???"); + xfprintf(fp, "\n"); + xfprintf(fp, " No. Row name St Activity Lower bound " + " Upper bound Marginal\n"); + xfprintf(fp, "------ ------------ -- ------------- ------------- " + "------------- -------------\n"); + for (i = 1; i <= P->m; i++) + { row = P->row[i]; + xfprintf(fp, "%6d ", i); + if (row->name == NULL || strlen(row->name) <= 12) + xfprintf(fp, "%-12s ", row->name == NULL ? "" : row->name); + else + xfprintf(fp, "%s\n%20s", row->name, ""); + xfprintf(fp, "%s ", + row->stat == GLP_BS ? "B " : + row->stat == GLP_NL ? "NL" : + row->stat == GLP_NU ? "NU" : + row->stat == GLP_NF ? "NF" : + row->stat == GLP_NS ? "NS" : "??"); + xfprintf(fp, "%13.6g ", + fabs(row->prim) <= 1e-9 ? 0.0 : row->prim); + if (row->type == GLP_LO || row->type == GLP_DB || + row->type == GLP_FX) + xfprintf(fp, "%13.6g ", row->lb); + else + xfprintf(fp, "%13s ", ""); + if (row->type == GLP_UP || row->type == GLP_DB) + xfprintf(fp, "%13.6g ", row->ub); + else + xfprintf(fp, "%13s ", row->type == GLP_FX ? "=" : ""); + if (row->stat != GLP_BS) + { if (fabs(row->dual) <= 1e-9) + xfprintf(fp, "%13s", "< eps"); + else + xfprintf(fp, "%13.6g ", row->dual); + } + xfprintf(fp, "\n"); + } + xfprintf(fp, "\n"); + xfprintf(fp, " No. Column name St Activity Lower bound " + " Upper bound Marginal\n"); + xfprintf(fp, "------ ------------ -- ------------- ------------- " + "------------- -------------\n"); + for (j = 1; j <= P->n; j++) + { col = P->col[j]; + xfprintf(fp, "%6d ", j); + if (col->name == NULL || strlen(col->name) <= 12) + xfprintf(fp, "%-12s ", col->name == NULL ? "" : col->name); + else + xfprintf(fp, "%s\n%20s", col->name, ""); + xfprintf(fp, "%s ", + col->stat == GLP_BS ? "B " : + col->stat == GLP_NL ? "NL" : + col->stat == GLP_NU ? "NU" : + col->stat == GLP_NF ? "NF" : + col->stat == GLP_NS ? "NS" : "??"); + xfprintf(fp, "%13.6g ", + fabs(col->prim) <= 1e-9 ? 0.0 : col->prim); + if (col->type == GLP_LO || col->type == GLP_DB || + col->type == GLP_FX) + xfprintf(fp, "%13.6g ", col->lb); + else + xfprintf(fp, "%13s ", ""); + if (col->type == GLP_UP || col->type == GLP_DB) + xfprintf(fp, "%13.6g ", col->ub); + else + xfprintf(fp, "%13s ", col->type == GLP_FX ? "=" : ""); + if (col->stat != GLP_BS) + { if (fabs(col->dual) <= 1e-9) + xfprintf(fp, "%13s", "< eps"); + else + xfprintf(fp, "%13.6g ", col->dual); + } + xfprintf(fp, "\n"); + } + xfprintf(fp, "\n"); + xfprintf(fp, "Karush-Kuhn-Tucker optimality conditions:\n"); + xfprintf(fp, "\n"); + glp_check_kkt(P, GLP_SOL, GLP_KKT_PE, &ae_max, &ae_ind, &re_max, + &re_ind); + xfprintf(fp, "KKT.PE: max.abs.err = %.2e on row %d\n", + ae_max, ae_ind); + xfprintf(fp, " max.rel.err = %.2e on row %d\n", + re_max, re_ind); + xfprintf(fp, "%8s%s\n", "", + re_max <= 1e-9 ? "High quality" : + re_max <= 1e-6 ? "Medium quality" : + re_max <= 1e-3 ? "Low quality" : "PRIMAL SOLUTION IS WRONG"); + xfprintf(fp, "\n"); + glp_check_kkt(P, GLP_SOL, GLP_KKT_PB, &ae_max, &ae_ind, &re_max, + &re_ind); + xfprintf(fp, "KKT.PB: max.abs.err = %.2e on %s %d\n", + ae_max, ae_ind <= P->m ? "row" : "column", + ae_ind <= P->m ? ae_ind : ae_ind - P->m); + xfprintf(fp, " max.rel.err = %.2e on %s %d\n", + re_max, re_ind <= P->m ? "row" : "column", + re_ind <= P->m ? re_ind : re_ind - P->m); + xfprintf(fp, "%8s%s\n", "", + re_max <= 1e-9 ? "High quality" : + re_max <= 1e-6 ? "Medium quality" : + re_max <= 1e-3 ? "Low quality" : "PRIMAL SOLUTION IS INFEASIBL" + "E"); + xfprintf(fp, "\n"); + glp_check_kkt(P, GLP_SOL, GLP_KKT_DE, &ae_max, &ae_ind, &re_max, + &re_ind); + xfprintf(fp, "KKT.DE: max.abs.err = %.2e on column %d\n", + ae_max, ae_ind == 0 ? 0 : ae_ind - P->m); + xfprintf(fp, " max.rel.err = %.2e on column %d\n", + re_max, re_ind == 0 ? 0 : re_ind - P->m); + xfprintf(fp, "%8s%s\n", "", + re_max <= 1e-9 ? "High quality" : + re_max <= 1e-6 ? "Medium quality" : + re_max <= 1e-3 ? "Low quality" : "DUAL SOLUTION IS WRONG"); + xfprintf(fp, "\n"); + glp_check_kkt(P, GLP_SOL, GLP_KKT_DB, &ae_max, &ae_ind, &re_max, + &re_ind); + xfprintf(fp, "KKT.DB: max.abs.err = %.2e on %s %d\n", + ae_max, ae_ind <= P->m ? "row" : "column", + ae_ind <= P->m ? ae_ind : ae_ind - P->m); + xfprintf(fp, " max.rel.err = %.2e on %s %d\n", + re_max, re_ind <= P->m ? "row" : "column", + re_ind <= P->m ? re_ind : re_ind - P->m); + xfprintf(fp, "%8s%s\n", "", + re_max <= 1e-9 ? "High quality" : + re_max <= 1e-6 ? "Medium quality" : + re_max <= 1e-3 ? "Low quality" : "DUAL SOLUTION IS INFEASIBLE") + ; + xfprintf(fp, "\n"); + xfprintf(fp, "End of output\n"); +#if 0 /* FIXME */ + xfflush(fp); +#endif + if (glp_ioerr(fp)) + { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + ret = 0; +done: if (fp != NULL) glp_close(fp); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/rdasn.c b/resources/3rdparty/glpk-4.65/src/api/rdasn.c new file mode 100644 index 000000000..05dcb9fc2 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/rdasn.c @@ -0,0 +1,164 @@ +/* rdasn.c (read assignment problem data in DIMACS format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "dimacs.h" +#include "glpk.h" +#include "misc.h" + +#define error dmx_error +#define warning dmx_warning +#define read_char dmx_read_char +#define read_designator dmx_read_designator +#define read_field dmx_read_field +#define end_of_line dmx_end_of_line +#define check_int dmx_check_int + +/*********************************************************************** +* NAME +* +* glp_read_asnprob - read assignment problem data in DIMACS format +* +* SYNOPSIS +* +* int glp_read_asnprob(glp_graph *G, int v_set, int a_cost, +* const char *fname); +* +* DESCRIPTION +* +* The routine glp_read_asnprob reads assignment problem data in DIMACS +* format from a text file. +* +* RETURNS +* +* If the operation was successful, the routine returns zero. Otherwise +* it prints an error message and returns non-zero. */ + +int glp_read_asnprob(glp_graph *G, int v_set, int a_cost, const char + *fname) +{ DMX _csa, *csa = &_csa; + glp_vertex *v; + glp_arc *a; + int nv, na, n1, i, j, k, ret = 0; + double cost; + char *flag = NULL; + if (v_set >= 0 && v_set > G->v_size - (int)sizeof(int)) + xerror("glp_read_asnprob: v_set = %d; invalid offset\n", + v_set); + if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) + xerror("glp_read_asnprob: a_cost = %d; invalid offset\n", + a_cost); + glp_erase_graph(G, G->v_size, G->a_size); + if (setjmp(csa->jump)) + { ret = 1; + goto done; + } + csa->fname = fname; + csa->fp = NULL; + csa->count = 0; + csa->c = '\n'; + csa->field[0] = '\0'; + csa->empty = csa->nonint = 0; + xprintf("Reading assignment problem data from '%s'...\n", fname); + csa->fp = glp_open(fname, "r"); + if (csa->fp == NULL) + { xprintf("Unable to open '%s' - %s\n", fname, get_err_msg()); + longjmp(csa->jump, 1); + } + /* read problem line */ + read_designator(csa); + if (strcmp(csa->field, "p") != 0) + error(csa, "problem line missing or invalid"); + read_field(csa); + if (strcmp(csa->field, "asn") != 0) + error(csa, "wrong problem designator; 'asn' expected"); + read_field(csa); + if (!(str2int(csa->field, &nv) == 0 && nv >= 0)) + error(csa, "number of nodes missing or invalid"); + read_field(csa); + if (!(str2int(csa->field, &na) == 0 && na >= 0)) + error(csa, "number of arcs missing or invalid"); + if (nv > 0) glp_add_vertices(G, nv); + end_of_line(csa); + /* read node descriptor lines */ + flag = xcalloc(1+nv, sizeof(char)); + memset(&flag[1], 0, nv * sizeof(char)); + n1 = 0; + for (;;) + { read_designator(csa); + if (strcmp(csa->field, "n") != 0) break; + read_field(csa); + if (str2int(csa->field, &i) != 0) + error(csa, "node number missing or invalid"); + if (!(1 <= i && i <= nv)) + error(csa, "node number %d out of range", i); + if (flag[i]) + error(csa, "duplicate descriptor of node %d", i); + flag[i] = 1, n1++; + end_of_line(csa); + } + xprintf( + "Assignment problem has %d + %d = %d node%s and %d arc%s\n", + n1, nv - n1, nv, nv == 1 ? "" : "s", na, na == 1 ? "" : "s"); + if (v_set >= 0) + { for (i = 1; i <= nv; i++) + { v = G->v[i]; + k = (flag[i] ? 0 : 1); + memcpy((char *)v->data + v_set, &k, sizeof(int)); + } + } + /* read arc descriptor lines */ + for (k = 1; k <= na; k++) + { if (k > 1) read_designator(csa); + if (strcmp(csa->field, "a") != 0) + error(csa, "wrong line designator; 'a' expected"); + read_field(csa); + if (str2int(csa->field, &i) != 0) + error(csa, "starting node number missing or invalid"); + if (!(1 <= i && i <= nv)) + error(csa, "starting node number %d out of range", i); + if (!flag[i]) + error(csa, "node %d cannot be a starting node", i); + read_field(csa); + if (str2int(csa->field, &j) != 0) + error(csa, "ending node number missing or invalid"); + if (!(1 <= j && j <= nv)) + error(csa, "ending node number %d out of range", j); + if (flag[j]) + error(csa, "node %d cannot be an ending node", j); + read_field(csa); + if (str2num(csa->field, &cost) != 0) + error(csa, "arc cost missing or invalid"); + check_int(csa, cost); + a = glp_add_arc(G, i, j); + if (a_cost >= 0) + memcpy((char *)a->data + a_cost, &cost, sizeof(double)); + end_of_line(csa); + } + xprintf("%d lines were read\n", csa->count); +done: if (ret) glp_erase_graph(G, G->v_size, G->a_size); + if (csa->fp != NULL) glp_close(csa->fp); + if (flag != NULL) xfree(flag); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/rdcc.c b/resources/3rdparty/glpk-4.65/src/api/rdcc.c new file mode 100644 index 000000000..c63d60d86 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/rdcc.c @@ -0,0 +1,162 @@ +/* rdcc.c (read graph in DIMACS clique/coloring format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "dimacs.h" +#include "glpk.h" +#include "misc.h" + +#define error dmx_error +#define warning dmx_warning +#define read_char dmx_read_char +#define read_designator dmx_read_designator +#define read_field dmx_read_field +#define end_of_line dmx_end_of_line +#define check_int dmx_check_int + +/*********************************************************************** +* NAME +* +* glp_read_ccdata - read graph in DIMACS clique/coloring format +* +* SYNOPSIS +* +* int glp_read_ccdata(glp_graph *G, int v_wgt, const char *fname); +* +* DESCRIPTION +* +* The routine glp_read_ccdata reads an (undirected) graph in DIMACS +* clique/coloring format from a text file. +* +* RETURNS +* +* If the operation was successful, the routine returns zero. Otherwise +* it prints an error message and returns non-zero. */ + +int glp_read_ccdata(glp_graph *G, int v_wgt, const char *fname) +{ DMX _csa, *csa = &_csa; + glp_vertex *v; + int i, j, k, nv, ne, ret = 0; + double w; + char *flag = NULL; + if (v_wgt >= 0 && v_wgt > G->v_size - (int)sizeof(double)) + xerror("glp_read_ccdata: v_wgt = %d; invalid offset\n", + v_wgt); + glp_erase_graph(G, G->v_size, G->a_size); + if (setjmp(csa->jump)) + { ret = 1; + goto done; + } + csa->fname = fname; + csa->fp = NULL; + csa->count = 0; + csa->c = '\n'; + csa->field[0] = '\0'; + csa->empty = csa->nonint = 0; + xprintf("Reading graph from '%s'...\n", fname); + csa->fp = glp_open(fname, "r"); + if (csa->fp == NULL) + { xprintf("Unable to open '%s' - %s\n", fname, get_err_msg()); + longjmp(csa->jump, 1); + } + /* read problem line */ + read_designator(csa); + if (strcmp(csa->field, "p") != 0) + error(csa, "problem line missing or invalid"); + read_field(csa); + if (strcmp(csa->field, "edge") != 0) + error(csa, "wrong problem designator; 'edge' expected"); + read_field(csa); + if (!(str2int(csa->field, &nv) == 0 && nv >= 0)) + error(csa, "number of vertices missing or invalid"); + read_field(csa); + if (!(str2int(csa->field, &ne) == 0 && ne >= 0)) + error(csa, "number of edges missing or invalid"); + xprintf("Graph has %d vert%s and %d edge%s\n", + nv, nv == 1 ? "ex" : "ices", ne, ne == 1 ? "" : "s"); + if (nv > 0) glp_add_vertices(G, nv); + end_of_line(csa); + /* read node descriptor lines */ + flag = xcalloc(1+nv, sizeof(char)); + memset(&flag[1], 0, nv * sizeof(char)); + if (v_wgt >= 0) + { w = 1.0; + for (i = 1; i <= nv; i++) + { v = G->v[i]; + memcpy((char *)v->data + v_wgt, &w, sizeof(double)); + } + } + for (;;) + { read_designator(csa); + if (strcmp(csa->field, "n") != 0) break; + read_field(csa); + if (str2int(csa->field, &i) != 0) + error(csa, "vertex number missing or invalid"); + if (!(1 <= i && i <= nv)) + error(csa, "vertex number %d out of range", i); + if (flag[i]) + error(csa, "duplicate descriptor of vertex %d", i); + read_field(csa); + if (str2num(csa->field, &w) != 0) + error(csa, "vertex weight missing or invalid"); + check_int(csa, w); + if (v_wgt >= 0) + { v = G->v[i]; + memcpy((char *)v->data + v_wgt, &w, sizeof(double)); + } + flag[i] = 1; + end_of_line(csa); + } + xfree(flag), flag = NULL; + /* read edge descriptor lines */ + for (k = 1; k <= ne; k++) + { if (k > 1) read_designator(csa); + if (strcmp(csa->field, "e") != 0) + error(csa, "wrong line designator; 'e' expected"); + read_field(csa); + if (str2int(csa->field, &i) != 0) + error(csa, "first vertex number missing or invalid"); + if (!(1 <= i && i <= nv)) + error(csa, "first vertex number %d out of range", i); + read_field(csa); + if (str2int(csa->field, &j) != 0) + error(csa, "second vertex number missing or invalid"); + if (!(1 <= j && j <= nv)) + error(csa, "second vertex number %d out of range", j); + glp_add_arc(G, i, j); + end_of_line(csa); + } + xprintf("%d lines were read\n", csa->count); +done: if (ret) glp_erase_graph(G, G->v_size, G->a_size); + if (csa->fp != NULL) glp_close(csa->fp); + if (flag != NULL) xfree(flag); + return ret; +} + +/**********************************************************************/ + +int glp_read_graph(glp_graph *G, const char *fname) +{ return + glp_read_ccdata(G, -1, fname); +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/rdcnf.c b/resources/3rdparty/glpk-4.65/src/api/rdcnf.c new file mode 100644 index 000000000..acab50fe7 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/rdcnf.c @@ -0,0 +1,136 @@ +/* rdcnf.c (read CNF-SAT problem data in DIMACS format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2010-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "dimacs.h" +#include "misc.h" +#include "prob.h" + +#define xfprintf glp_format +#define error dmx_error +#define warning dmx_warning +#define read_char dmx_read_char +#define read_designator dmx_read_designator +#define read_field dmx_read_field +#define end_of_line dmx_end_of_line +#define check_int dmx_check_int + +int glp_read_cnfsat(glp_prob *P, const char *fname) +{ /* read CNF-SAT problem data in DIMACS format */ + DMX _csa, *csa = &_csa; + int m, n, i, j, len, neg, rhs, ret = 0, *ind = NULL; + double *val = NULL; + char *map = NULL; +#if 0 /* 04/IV-2016 */ + if (P == NULL || P->magic != GLP_PROB_MAGIC) + xerror("glp_read_cnfsat: P = %p; invalid problem object\n", + P); +#endif + if (fname == NULL) + xerror("glp_read_cnfsat: fname = %p; invalid parameter\n", + fname); + glp_erase_prob(P); + if (setjmp(csa->jump)) + { ret = 1; + goto done; + } + csa->fname = fname; + csa->fp = NULL; + csa->count = 0; + csa->c = '\n'; + csa->field[0] = '\0'; + csa->empty = csa->nonint = 0; + xprintf("Reading CNF-SAT problem data from '%s'...\n", fname); + csa->fp = glp_open(fname, "r"); + if (csa->fp == NULL) + { xprintf("Unable to open '%s' - %s\n", fname, get_err_msg()); + longjmp(csa->jump, 1); + } + /* read problem line */ + read_designator(csa); + if (strcmp(csa->field, "p") != 0) + error(csa, "problem line missing or invalid"); + read_field(csa); + if (strcmp(csa->field, "cnf") != 0) + error(csa, "wrong problem designator; 'cnf' expected\n"); + read_field(csa); + if (!(str2int(csa->field, &n) == 0 && n >= 0)) + error(csa, "number of variables missing or invalid\n"); + read_field(csa); + if (!(str2int(csa->field, &m) == 0 && m >= 0)) + error(csa, "number of clauses missing or invalid\n"); + xprintf("Instance has %d variable%s and %d clause%s\n", + n, n == 1 ? "" : "s", m, m == 1 ? "" : "s"); + end_of_line(csa); + if (m > 0) + glp_add_rows(P, m); + if (n > 0) + { glp_add_cols(P, n); + for (j = 1; j <= n; j++) + glp_set_col_kind(P, j, GLP_BV); + } + /* allocate working arrays */ + ind = xcalloc(1+n, sizeof(int)); + val = xcalloc(1+n, sizeof(double)); + map = xcalloc(1+n, sizeof(char)); + for (j = 1; j <= n; j++) map[j] = 0; + /* read clauses */ + for (i = 1; i <= m; i++) + { /* read i-th clause */ + len = 0, rhs = 1; + for (;;) + { /* skip white-space characters */ + while (csa->c == ' ' || csa->c == '\n') + read_char(csa); + /* read term */ + read_field(csa); + if (str2int(csa->field, &j) != 0) + error(csa, "variable number missing or invalid\n"); + if (j > 0) + neg = 0; + else if (j < 0) + neg = 1, j = -j, rhs--; + else + break; + if (!(1 <= j && j <= n)) + error(csa, "variable number out of range\n"); + if (map[j]) + error(csa, "duplicate variable number\n"); + len++, ind[len] = j, val[len] = (neg ? -1.0 : +1.0); + map[j] = 1; + } + glp_set_row_bnds(P, i, GLP_LO, (double)rhs, 0.0); + glp_set_mat_row(P, i, len, ind, val); + while (len > 0) map[ind[len--]] = 0; + } + xprintf("%d lines were read\n", csa->count); + /* problem data has been successfully read */ + glp_sort_matrix(P); +done: if (csa->fp != NULL) glp_close(csa->fp); + if (ind != NULL) xfree(ind); + if (val != NULL) xfree(val); + if (map != NULL) xfree(map); + if (ret) glp_erase_prob(P); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/rdipt.c b/resources/3rdparty/glpk-4.65/src/api/rdipt.c new file mode 100644 index 000000000..aaf8e9d4b --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/rdipt.c @@ -0,0 +1,185 @@ +/* rdipt.c (read interior-point solution in GLPK format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2010-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "dimacs.h" +#include "env.h" +#include "misc.h" +#include "prob.h" + +/*********************************************************************** +* NAME +* +* glp_read_ipt - read interior-point solution in GLPK format +* +* SYNOPSIS +* +* int glp_read_ipt(glp_prob *P, const char *fname); +* +* DESCRIPTION +* +* The routine glp_read_ipt reads interior-point solution from a text +* file in GLPK format. +* +* RETURNS +* +* If the operation was successful, the routine returns zero. Otherwise +* it prints an error message and returns non-zero. */ + +int glp_read_ipt(glp_prob *P, const char *fname) +{ DMX dmx_, *dmx = &dmx_; + int i, j, k, m, n, sst, ret = 1; + char *stat = NULL; + double obj, *prim = NULL, *dual = NULL; +#if 0 /* 04/IV-2016 */ + if (P == NULL || P->magic != GLP_PROB_MAGIC) + xerror("glp_read_ipt: P = %p; invalid problem object\n", P); +#endif + if (fname == NULL) + xerror("glp_read_ipt: fname = %d; invalid parameter\n", fname); + if (setjmp(dmx->jump)) + goto done; + dmx->fname = fname; + dmx->fp = NULL; + dmx->count = 0; + dmx->c = '\n'; + dmx->field[0] = '\0'; + dmx->empty = dmx->nonint = 0; + xprintf("Reading interior-point solution from '%s'...\n", fname); + dmx->fp = glp_open(fname, "r"); + if (dmx->fp == NULL) + { xprintf("Unable to open '%s' - %s\n", fname, get_err_msg()); + goto done; + } + /* read solution line */ + dmx_read_designator(dmx); + if (strcmp(dmx->field, "s") != 0) + dmx_error(dmx, "solution line missing or invalid"); + dmx_read_field(dmx); + if (strcmp(dmx->field, "ipt") != 0) + dmx_error(dmx, "wrong solution designator; 'ipt' expected"); + dmx_read_field(dmx); + if (!(str2int(dmx->field, &m) == 0 && m >= 0)) + dmx_error(dmx, "number of rows missing or invalid"); + if (m != P->m) + dmx_error(dmx, "number of rows mismatch"); + dmx_read_field(dmx); + if (!(str2int(dmx->field, &n) == 0 && n >= 0)) + dmx_error(dmx, "number of columns missing or invalid"); + if (n != P->n) + dmx_error(dmx, "number of columns mismatch"); + dmx_read_field(dmx); + if (strcmp(dmx->field, "o") == 0) + sst = GLP_OPT; + else if (strcmp(dmx->field, "i") == 0) + sst = GLP_INFEAS; + else if (strcmp(dmx->field, "n") == 0) + sst = GLP_NOFEAS; + else if (strcmp(dmx->field, "u") == 0) + sst = GLP_UNDEF; + else + dmx_error(dmx, "solution status missing or invalid"); + dmx_read_field(dmx); + if (str2num(dmx->field, &obj) != 0) + dmx_error(dmx, "objective value missing or invalid"); + dmx_end_of_line(dmx); + /* allocate working arrays */ + stat = xalloc(1+m+n, sizeof(stat[0])); + for (k = 1; k <= m+n; k++) + stat[k] = '?'; + prim = xalloc(1+m+n, sizeof(prim[0])); + dual = xalloc(1+m+n, sizeof(dual[0])); + /* read solution descriptor lines */ + for (;;) + { dmx_read_designator(dmx); + if (strcmp(dmx->field, "i") == 0) + { /* row solution descriptor */ + dmx_read_field(dmx); + if (str2int(dmx->field, &i) != 0) + dmx_error(dmx, "row number missing or invalid"); + if (!(1 <= i && i <= m)) + dmx_error(dmx, "row number out of range"); + if (stat[i] != '?') + dmx_error(dmx, "duplicate row solution descriptor"); + stat[i] = GLP_BS; + dmx_read_field(dmx); + if (str2num(dmx->field, &prim[i]) != 0) + dmx_error(dmx, "row primal value missing or invalid"); + dmx_read_field(dmx); + if (str2num(dmx->field, &dual[i]) != 0) + dmx_error(dmx, "row dual value missing or invalid"); + dmx_end_of_line(dmx); + } + else if (strcmp(dmx->field, "j") == 0) + { /* column solution descriptor */ + dmx_read_field(dmx); + if (str2int(dmx->field, &j) != 0) + dmx_error(dmx, "column number missing or invalid"); + if (!(1 <= j && j <= n)) + dmx_error(dmx, "column number out of range"); + if (stat[m+j] != '?') + dmx_error(dmx, "duplicate column solution descriptor"); + stat[m+j] = GLP_BS; + dmx_read_field(dmx); + if (str2num(dmx->field, &prim[m+j]) != 0) + dmx_error(dmx, "column primal value missing or invalid"); + dmx_read_field(dmx); + if (str2num(dmx->field, &dual[m+j]) != 0) + dmx_error(dmx, "column dual value missing or invalid"); + dmx_end_of_line(dmx); + } + else if (strcmp(dmx->field, "e") == 0) + break; + else + dmx_error(dmx, "line designator missing or invalid"); + dmx_end_of_line(dmx); + } + /* store solution components into problem object */ + for (k = 1; k <= m+n; k++) + { if (stat[k] == '?') + dmx_error(dmx, "incomplete interior-point solution"); + } + P->ipt_stat = sst; + P->ipt_obj = obj; + for (i = 1; i <= m; i++) + { P->row[i]->pval = prim[i]; + P->row[i]->dval = dual[i]; + } + for (j = 1; j <= n; j++) + { P->col[j]->pval = prim[m+j]; + P->col[j]->dval = dual[m+j]; + } + /* interior-point solution has been successfully read */ + xprintf("%d lines were read\n", dmx->count); + ret = 0; +done: if (dmx->fp != NULL) + glp_close(dmx->fp); + if (stat != NULL) + xfree(stat); + if (prim != NULL) + xfree(prim); + if (dual != NULL) + xfree(dual); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/rdmaxf.c b/resources/3rdparty/glpk-4.65/src/api/rdmaxf.c new file mode 100644 index 000000000..a45405c9e --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/rdmaxf.c @@ -0,0 +1,163 @@ +/* rdmaxf.c (read maximum flow problem data in DIMACS format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "dimacs.h" +#include "glpk.h" +#include "misc.h" + +#define error dmx_error +#define warning dmx_warning +#define read_char dmx_read_char +#define read_designator dmx_read_designator +#define read_field dmx_read_field +#define end_of_line dmx_end_of_line +#define check_int dmx_check_int + +/*********************************************************************** +* NAME +* +* glp_read_maxflow - read maximum flow problem data in DIMACS format +* +* SYNOPSIS +* +* int glp_read_maxflow(glp_graph *G, int *s, int *t, int a_cap, +* const char *fname); +* +* DESCRIPTION +* +* The routine glp_read_maxflow reads maximum flow problem data in +* DIMACS format from a text file. +* +* RETURNS +* +* If the operation was successful, the routine returns zero. Otherwise +* it prints an error message and returns non-zero. */ + +int glp_read_maxflow(glp_graph *G, int *_s, int *_t, int a_cap, + const char *fname) +{ DMX _csa, *csa = &_csa; + glp_arc *a; + int i, j, k, s, t, nv, na, ret = 0; + double cap; + if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) + xerror("glp_read_maxflow: a_cap = %d; invalid offset\n", + a_cap); + glp_erase_graph(G, G->v_size, G->a_size); + if (setjmp(csa->jump)) + { ret = 1; + goto done; + } + csa->fname = fname; + csa->fp = NULL; + csa->count = 0; + csa->c = '\n'; + csa->field[0] = '\0'; + csa->empty = csa->nonint = 0; + xprintf("Reading maximum flow problem data from '%s'...\n", + fname); + csa->fp = glp_open(fname, "r"); + if (csa->fp == NULL) + { xprintf("Unable to open '%s' - %s\n", fname, get_err_msg()); + longjmp(csa->jump, 1); + } + /* read problem line */ + read_designator(csa); + if (strcmp(csa->field, "p") != 0) + error(csa, "problem line missing or invalid"); + read_field(csa); + if (strcmp(csa->field, "max") != 0) + error(csa, "wrong problem designator; 'max' expected"); + read_field(csa); + if (!(str2int(csa->field, &nv) == 0 && nv >= 2)) + error(csa, "number of nodes missing or invalid"); + read_field(csa); + if (!(str2int(csa->field, &na) == 0 && na >= 0)) + error(csa, "number of arcs missing or invalid"); + xprintf("Flow network has %d node%s and %d arc%s\n", + nv, nv == 1 ? "" : "s", na, na == 1 ? "" : "s"); + if (nv > 0) glp_add_vertices(G, nv); + end_of_line(csa); + /* read node descriptor lines */ + s = t = 0; + for (;;) + { read_designator(csa); + if (strcmp(csa->field, "n") != 0) break; + read_field(csa); + if (str2int(csa->field, &i) != 0) + error(csa, "node number missing or invalid"); + if (!(1 <= i && i <= nv)) + error(csa, "node number %d out of range", i); + read_field(csa); + if (strcmp(csa->field, "s") == 0) + { if (s > 0) + error(csa, "only one source node allowed"); + s = i; + } + else if (strcmp(csa->field, "t") == 0) + { if (t > 0) + error(csa, "only one sink node allowed"); + t = i; + } + else + error(csa, "wrong node designator; 's' or 't' expected"); + if (s > 0 && s == t) + error(csa, "source and sink nodes must be distinct"); + end_of_line(csa); + } + if (s == 0) + error(csa, "source node descriptor missing\n"); + if (t == 0) + error(csa, "sink node descriptor missing\n"); + if (_s != NULL) *_s = s; + if (_t != NULL) *_t = t; + /* read arc descriptor lines */ + for (k = 1; k <= na; k++) + { if (k > 1) read_designator(csa); + if (strcmp(csa->field, "a") != 0) + error(csa, "wrong line designator; 'a' expected"); + read_field(csa); + if (str2int(csa->field, &i) != 0) + error(csa, "starting node number missing or invalid"); + if (!(1 <= i && i <= nv)) + error(csa, "starting node number %d out of range", i); + read_field(csa); + if (str2int(csa->field, &j) != 0) + error(csa, "ending node number missing or invalid"); + if (!(1 <= j && j <= nv)) + error(csa, "ending node number %d out of range", j); + read_field(csa); + if (!(str2num(csa->field, &cap) == 0 && cap >= 0.0)) + error(csa, "arc capacity missing or invalid"); + check_int(csa, cap); + a = glp_add_arc(G, i, j); + if (a_cap >= 0) + memcpy((char *)a->data + a_cap, &cap, sizeof(double)); + end_of_line(csa); + } + xprintf("%d lines were read\n", csa->count); +done: if (ret) glp_erase_graph(G, G->v_size, G->a_size); + if (csa->fp != NULL) glp_close(csa->fp); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/rdmcf.c b/resources/3rdparty/glpk-4.65/src/api/rdmcf.c new file mode 100644 index 000000000..bab1ec794 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/rdmcf.c @@ -0,0 +1,186 @@ +/* rdmcf.c (read min-cost flow problem data in DIMACS format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "dimacs.h" +#include "glpk.h" +#include "misc.h" + +#define error dmx_error +#define warning dmx_warning +#define read_char dmx_read_char +#define read_designator dmx_read_designator +#define read_field dmx_read_field +#define end_of_line dmx_end_of_line +#define check_int dmx_check_int + +/*********************************************************************** +* NAME +* +* glp_read_mincost - read min-cost flow problem data in DIMACS format +* +* SYNOPSIS +* +* int glp_read_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap, +* int a_cost, const char *fname); +* +* DESCRIPTION +* +* The routine glp_read_mincost reads minimum cost flow problem data in +* DIMACS format from a text file. +* +* RETURNS +* +* If the operation was successful, the routine returns zero. Otherwise +* it prints an error message and returns non-zero. */ + +int glp_read_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap, + int a_cost, const char *fname) +{ DMX _csa, *csa = &_csa; + glp_vertex *v; + glp_arc *a; + int i, j, k, nv, na, ret = 0; + double rhs, low, cap, cost; + char *flag = NULL; + if (v_rhs >= 0 && v_rhs > G->v_size - (int)sizeof(double)) + xerror("glp_read_mincost: v_rhs = %d; invalid offset\n", + v_rhs); + if (a_low >= 0 && a_low > G->a_size - (int)sizeof(double)) + xerror("glp_read_mincost: a_low = %d; invalid offset\n", + a_low); + if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) + xerror("glp_read_mincost: a_cap = %d; invalid offset\n", + a_cap); + if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) + xerror("glp_read_mincost: a_cost = %d; invalid offset\n", + a_cost); + glp_erase_graph(G, G->v_size, G->a_size); + if (setjmp(csa->jump)) + { ret = 1; + goto done; + } + csa->fname = fname; + csa->fp = NULL; + csa->count = 0; + csa->c = '\n'; + csa->field[0] = '\0'; + csa->empty = csa->nonint = 0; + xprintf("Reading min-cost flow problem data from '%s'...\n", + fname); + csa->fp = glp_open(fname, "r"); + if (csa->fp == NULL) + { xprintf("Unable to open '%s' - %s\n", fname, get_err_msg()); + longjmp(csa->jump, 1); + } + /* read problem line */ + read_designator(csa); + if (strcmp(csa->field, "p") != 0) + error(csa, "problem line missing or invalid"); + read_field(csa); + if (strcmp(csa->field, "min") != 0) + error(csa, "wrong problem designator; 'min' expected"); + read_field(csa); + if (!(str2int(csa->field, &nv) == 0 && nv >= 0)) + error(csa, "number of nodes missing or invalid"); + read_field(csa); + if (!(str2int(csa->field, &na) == 0 && na >= 0)) + error(csa, "number of arcs missing or invalid"); + xprintf("Flow network has %d node%s and %d arc%s\n", + nv, nv == 1 ? "" : "s", na, na == 1 ? "" : "s"); + if (nv > 0) glp_add_vertices(G, nv); + end_of_line(csa); + /* read node descriptor lines */ + flag = xcalloc(1+nv, sizeof(char)); + memset(&flag[1], 0, nv * sizeof(char)); + if (v_rhs >= 0) + { rhs = 0.0; + for (i = 1; i <= nv; i++) + { v = G->v[i]; + memcpy((char *)v->data + v_rhs, &rhs, sizeof(double)); + } + } + for (;;) + { read_designator(csa); + if (strcmp(csa->field, "n") != 0) break; + read_field(csa); + if (str2int(csa->field, &i) != 0) + error(csa, "node number missing or invalid"); + if (!(1 <= i && i <= nv)) + error(csa, "node number %d out of range", i); + if (flag[i]) + error(csa, "duplicate descriptor of node %d", i); + read_field(csa); + if (str2num(csa->field, &rhs) != 0) + error(csa, "node supply/demand missing or invalid"); + check_int(csa, rhs); + if (v_rhs >= 0) + { v = G->v[i]; + memcpy((char *)v->data + v_rhs, &rhs, sizeof(double)); + } + flag[i] = 1; + end_of_line(csa); + } + xfree(flag), flag = NULL; + /* read arc descriptor lines */ + for (k = 1; k <= na; k++) + { if (k > 1) read_designator(csa); + if (strcmp(csa->field, "a") != 0) + error(csa, "wrong line designator; 'a' expected"); + read_field(csa); + if (str2int(csa->field, &i) != 0) + error(csa, "starting node number missing or invalid"); + if (!(1 <= i && i <= nv)) + error(csa, "starting node number %d out of range", i); + read_field(csa); + if (str2int(csa->field, &j) != 0) + error(csa, "ending node number missing or invalid"); + if (!(1 <= j && j <= nv)) + error(csa, "ending node number %d out of range", j); + read_field(csa); + if (!(str2num(csa->field, &low) == 0 && low >= 0.0)) + error(csa, "lower bound of arc flow missing or invalid"); + check_int(csa, low); + read_field(csa); + if (!(str2num(csa->field, &cap) == 0 && cap >= low)) + error(csa, "upper bound of arc flow missing or invalid"); + check_int(csa, cap); + read_field(csa); + if (str2num(csa->field, &cost) != 0) + error(csa, "per-unit cost of arc flow missing or invalid"); + check_int(csa, cost); + a = glp_add_arc(G, i, j); + if (a_low >= 0) + memcpy((char *)a->data + a_low, &low, sizeof(double)); + if (a_cap >= 0) + memcpy((char *)a->data + a_cap, &cap, sizeof(double)); + if (a_cost >= 0) + memcpy((char *)a->data + a_cost, &cost, sizeof(double)); + end_of_line(csa); + } + xprintf("%d lines were read\n", csa->count); +done: if (ret) glp_erase_graph(G, G->v_size, G->a_size); + if (csa->fp != NULL) glp_close(csa->fp); + if (flag != NULL) xfree(flag); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/rdmip.c b/resources/3rdparty/glpk-4.65/src/api/rdmip.c new file mode 100644 index 000000000..7aec26b32 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/rdmip.c @@ -0,0 +1,172 @@ +/* rdmip.c (read MIP solution in GLPK format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2010-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "dimacs.h" +#include "env.h" +#include "misc.h" +#include "prob.h" + +/*********************************************************************** +* NAME +* +* glp_read_mip - read MIP solution in GLPK format +* +* SYNOPSIS +* +* int glp_read_mip(glp_prob *P, const char *fname); +* +* DESCRIPTION +* +* The routine glp_read_mip reads MIP solution from a text file in GLPK +* format. +* +* RETURNS +* +* If the operation was successful, the routine returns zero. Otherwise +* it prints an error message and returns non-zero. */ + +int glp_read_mip(glp_prob *P, const char *fname) +{ DMX dmx_, *dmx = &dmx_; + int i, j, k, m, n, sst, ret = 1; + char *stat = NULL; + double obj, *prim = NULL; +#if 0 /* 04/IV-2016 */ + if (P == NULL || P->magic != GLP_PROB_MAGIC) + xerror("glp_read_mip: P = %p; invalid problem object\n", P); +#endif + if (fname == NULL) + xerror("glp_read_mip: fname = %d; invalid parameter\n", fname); + if (setjmp(dmx->jump)) + goto done; + dmx->fname = fname; + dmx->fp = NULL; + dmx->count = 0; + dmx->c = '\n'; + dmx->field[0] = '\0'; + dmx->empty = dmx->nonint = 0; + xprintf("Reading MIP solution from '%s'...\n", fname); + dmx->fp = glp_open(fname, "r"); + if (dmx->fp == NULL) + { xprintf("Unable to open '%s' - %s\n", fname, get_err_msg()); + goto done; + } + /* read solution line */ + dmx_read_designator(dmx); + if (strcmp(dmx->field, "s") != 0) + dmx_error(dmx, "solution line missing or invalid"); + dmx_read_field(dmx); + if (strcmp(dmx->field, "mip") != 0) + dmx_error(dmx, "wrong solution designator; 'mip' expected"); + dmx_read_field(dmx); + if (!(str2int(dmx->field, &m) == 0 && m >= 0)) + dmx_error(dmx, "number of rows missing or invalid"); + if (m != P->m) + dmx_error(dmx, "number of rows mismatch"); + dmx_read_field(dmx); + if (!(str2int(dmx->field, &n) == 0 && n >= 0)) + dmx_error(dmx, "number of columns missing or invalid"); + if (n != P->n) + dmx_error(dmx, "number of columns mismatch"); + dmx_read_field(dmx); + if (strcmp(dmx->field, "o") == 0) + sst = GLP_OPT; + else if (strcmp(dmx->field, "f") == 0) + sst = GLP_FEAS; + else if (strcmp(dmx->field, "n") == 0) + sst = GLP_NOFEAS; + else if (strcmp(dmx->field, "u") == 0) + sst = GLP_UNDEF; + else + dmx_error(dmx, "solution status missing or invalid"); + dmx_read_field(dmx); + if (str2num(dmx->field, &obj) != 0) + dmx_error(dmx, "objective value missing or invalid"); + dmx_end_of_line(dmx); + /* allocate working arrays */ + stat = xalloc(1+m+n, sizeof(stat[0])); + for (k = 1; k <= m+n; k++) + stat[k] = '?'; + prim = xalloc(1+m+n, sizeof(prim[0])); + /* read solution descriptor lines */ + for (;;) + { dmx_read_designator(dmx); + if (strcmp(dmx->field, "i") == 0) + { /* row solution descriptor */ + dmx_read_field(dmx); + if (str2int(dmx->field, &i) != 0) + dmx_error(dmx, "row number missing or invalid"); + if (!(1 <= i && i <= m)) + dmx_error(dmx, "row number out of range"); + if (stat[i] != '?') + dmx_error(dmx, "duplicate row solution descriptor"); + stat[i] = GLP_BS; + dmx_read_field(dmx); + if (str2num(dmx->field, &prim[i]) != 0) + dmx_error(dmx, "row value missing or invalid"); + dmx_end_of_line(dmx); + } + else if (strcmp(dmx->field, "j") == 0) + { /* column solution descriptor */ + dmx_read_field(dmx); + if (str2int(dmx->field, &j) != 0) + dmx_error(dmx, "column number missing or invalid"); + if (!(1 <= j && j <= n)) + dmx_error(dmx, "column number out of range"); + if (stat[m+j] != '?') + dmx_error(dmx, "duplicate column solution descriptor"); + stat[m+j] = GLP_BS; + dmx_read_field(dmx); + if (str2num(dmx->field, &prim[m+j]) != 0) + dmx_error(dmx, "column value missing or invalid"); + dmx_end_of_line(dmx); + } + else if (strcmp(dmx->field, "e") == 0) + break; + else + dmx_error(dmx, "line designator missing or invalid"); + dmx_end_of_line(dmx); + } + /* store solution components into problem object */ + for (k = 1; k <= m+n; k++) + { if (stat[k] == '?') + dmx_error(dmx, "incomplete MIP solution"); + } + P->mip_stat = sst; + P->mip_obj = obj; + for (i = 1; i <= m; i++) + P->row[i]->mipx = prim[i]; + for (j = 1; j <= n; j++) + P->col[j]->mipx = prim[m+j]; + /* MIP solution has been successfully read */ + xprintf("%d lines were read\n", dmx->count); + ret = 0; +done: if (dmx->fp != NULL) + glp_close(dmx->fp); + if (stat != NULL) + xfree(stat); + if (prim != NULL) + xfree(prim); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/rdprob.c b/resources/3rdparty/glpk-4.65/src/api/rdprob.c new file mode 100644 index 000000000..1ad544a59 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/rdprob.c @@ -0,0 +1,377 @@ +/* rdprob.c (read problem data in GLPK format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2010-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "dimacs.h" +#include "misc.h" +#include "prob.h" + +#define xfprintf glp_format +#define error dmx_error +#define warning dmx_warning +#define read_char dmx_read_char +#define read_designator dmx_read_designator +#define read_field dmx_read_field +#define end_of_line dmx_end_of_line +#define check_int dmx_check_int + +/*********************************************************************** +* NAME +* +* glp_read_prob - read problem data in GLPK format +* +* SYNOPSIS +* +* int glp_read_prob(glp_prob *P, int flags, const char *fname); +* +* The routine glp_read_prob reads problem data in GLPK LP/MIP format +* from a text file. +* +* RETURNS +* +* If the operation was successful, the routine returns zero. Otherwise +* it prints an error message and returns non-zero. */ + +int glp_read_prob(glp_prob *P, int flags, const char *fname) +{ DMX _csa, *csa = &_csa; + int mip, m, n, nnz, ne, i, j, k, type, kind, ret, *ln = NULL, + *ia = NULL, *ja = NULL; + double lb, ub, temp, *ar = NULL; + char *rf = NULL, *cf = NULL; +#if 0 /* 04/IV-2016 */ + if (P == NULL || P->magic != GLP_PROB_MAGIC) + xerror("glp_read_prob: P = %p; invalid problem object\n", + P); +#endif + if (flags != 0) + xerror("glp_read_prob: flags = %d; invalid parameter\n", + flags); + if (fname == NULL) + xerror("glp_read_prob: fname = %d; invalid parameter\n", + fname); + glp_erase_prob(P); + if (setjmp(csa->jump)) + { ret = 1; + goto done; + } + csa->fname = fname; + csa->fp = NULL; + csa->count = 0; + csa->c = '\n'; + csa->field[0] = '\0'; + csa->empty = csa->nonint = 0; + xprintf("Reading problem data from '%s'...\n", fname); + csa->fp = glp_open(fname, "r"); + if (csa->fp == NULL) + { xprintf("Unable to open '%s' - %s\n", fname, get_err_msg()); + longjmp(csa->jump, 1); + } + /* read problem line */ + read_designator(csa); + if (strcmp(csa->field, "p") != 0) + error(csa, "problem line missing or invalid"); + read_field(csa); + if (strcmp(csa->field, "lp") == 0) + mip = 0; + else if (strcmp(csa->field, "mip") == 0) + mip = 1; + else + error(csa, "wrong problem designator; 'lp' or 'mip' expected"); + read_field(csa); + if (strcmp(csa->field, "min") == 0) + glp_set_obj_dir(P, GLP_MIN); + else if (strcmp(csa->field, "max") == 0) + glp_set_obj_dir(P, GLP_MAX); + else + error(csa, "objective sense missing or invalid"); + read_field(csa); + if (!(str2int(csa->field, &m) == 0 && m >= 0)) + error(csa, "number of rows missing or invalid"); + read_field(csa); + if (!(str2int(csa->field, &n) == 0 && n >= 0)) + error(csa, "number of columns missing or invalid"); + read_field(csa); + if (!(str2int(csa->field, &nnz) == 0 && nnz >= 0)) + error(csa, "number of constraint coefficients missing or inval" + "id"); + if (m > 0) + { glp_add_rows(P, m); + for (i = 1; i <= m; i++) + glp_set_row_bnds(P, i, GLP_FX, 0.0, 0.0); + } + if (n > 0) + { glp_add_cols(P, n); + for (j = 1; j <= n; j++) + { if (!mip) + glp_set_col_bnds(P, j, GLP_LO, 0.0, 0.0); + else + glp_set_col_kind(P, j, GLP_BV); + } + } + end_of_line(csa); + /* allocate working arrays */ + rf = xcalloc(1+m, sizeof(char)); + memset(rf, 0, 1+m); + cf = xcalloc(1+n, sizeof(char)); + memset(cf, 0, 1+n); + ln = xcalloc(1+nnz, sizeof(int)); + ia = xcalloc(1+nnz, sizeof(int)); + ja = xcalloc(1+nnz, sizeof(int)); + ar = xcalloc(1+nnz, sizeof(double)); + /* read descriptor lines */ + ne = 0; + for (;;) + { read_designator(csa); + if (strcmp(csa->field, "i") == 0) + { /* row descriptor */ + read_field(csa); + if (str2int(csa->field, &i) != 0) + error(csa, "row number missing or invalid"); + if (!(1 <= i && i <= m)) + error(csa, "row number out of range"); + read_field(csa); + if (strcmp(csa->field, "f") == 0) + type = GLP_FR; + else if (strcmp(csa->field, "l") == 0) + type = GLP_LO; + else if (strcmp(csa->field, "u") == 0) + type = GLP_UP; + else if (strcmp(csa->field, "d") == 0) + type = GLP_DB; + else if (strcmp(csa->field, "s") == 0) + type = GLP_FX; + else + error(csa, "row type missing or invalid"); + if (type == GLP_LO || type == GLP_DB || type == GLP_FX) + { read_field(csa); + if (str2num(csa->field, &lb) != 0) + error(csa, "row lower bound/fixed value missing or in" + "valid"); + } + else + lb = 0.0; + if (type == GLP_UP || type == GLP_DB) + { read_field(csa); + if (str2num(csa->field, &ub) != 0) + error(csa, "row upper bound missing or invalid"); + } + else + ub = 0.0; + if (rf[i] & 0x01) + error(csa, "duplicate row descriptor"); + glp_set_row_bnds(P, i, type, lb, ub), rf[i] |= 0x01; + } + else if (strcmp(csa->field, "j") == 0) + { /* column descriptor */ + read_field(csa); + if (str2int(csa->field, &j) != 0) + error(csa, "column number missing or invalid"); + if (!(1 <= j && j <= n)) + error(csa, "column number out of range"); + if (!mip) + kind = GLP_CV; + else + { read_field(csa); + if (strcmp(csa->field, "c") == 0) + kind = GLP_CV; + else if (strcmp(csa->field, "i") == 0) + kind = GLP_IV; + else if (strcmp(csa->field, "b") == 0) + { kind = GLP_IV; + type = GLP_DB, lb = 0.0, ub = 1.0; + goto skip; + } + else + error(csa, "column kind missing or invalid"); + } + read_field(csa); + if (strcmp(csa->field, "f") == 0) + type = GLP_FR; + else if (strcmp(csa->field, "l") == 0) + type = GLP_LO; + else if (strcmp(csa->field, "u") == 0) + type = GLP_UP; + else if (strcmp(csa->field, "d") == 0) + type = GLP_DB; + else if (strcmp(csa->field, "s") == 0) + type = GLP_FX; + else + error(csa, "column type missing or invalid"); + if (type == GLP_LO || type == GLP_DB || type == GLP_FX) + { read_field(csa); + if (str2num(csa->field, &lb) != 0) + error(csa, "column lower bound/fixed value missing or" + " invalid"); + } + else + lb = 0.0; + if (type == GLP_UP || type == GLP_DB) + { read_field(csa); + if (str2num(csa->field, &ub) != 0) + error(csa, "column upper bound missing or invalid"); + } + else + ub = 0.0; +skip: if (cf[j] & 0x01) + error(csa, "duplicate column descriptor"); + glp_set_col_kind(P, j, kind); + glp_set_col_bnds(P, j, type, lb, ub), cf[j] |= 0x01; + } + else if (strcmp(csa->field, "a") == 0) + { /* coefficient descriptor */ + read_field(csa); + if (str2int(csa->field, &i) != 0) + error(csa, "row number missing or invalid"); + if (!(0 <= i && i <= m)) + error(csa, "row number out of range"); + read_field(csa); + if (str2int(csa->field, &j) != 0) + error(csa, "column number missing or invalid"); + if (!((i == 0 ? 0 : 1) <= j && j <= n)) + error(csa, "column number out of range"); + read_field(csa); + if (i == 0) + { if (str2num(csa->field, &temp) != 0) + error(csa, "objective %s missing or invalid", + j == 0 ? "constant term" : "coefficient"); + if (cf[j] & 0x10) + error(csa, "duplicate objective %s", + j == 0 ? "constant term" : "coefficient"); + glp_set_obj_coef(P, j, temp), cf[j] |= 0x10; + } + else + { if (str2num(csa->field, &temp) != 0) + error(csa, "constraint coefficient missing or invalid" + ); + if (ne == nnz) + error(csa, "too many constraint coefficient descripto" + "rs"); + ln[++ne] = csa->count; + ia[ne] = i, ja[ne] = j, ar[ne] = temp; + } + } + else if (strcmp(csa->field, "n") == 0) + { /* symbolic name descriptor */ + read_field(csa); + if (strcmp(csa->field, "p") == 0) + { /* problem name */ + read_field(csa); + if (P->name != NULL) + error(csa, "duplicate problem name"); + glp_set_prob_name(P, csa->field); + } + else if (strcmp(csa->field, "z") == 0) + { /* objective name */ + read_field(csa); + if (P->obj != NULL) + error(csa, "duplicate objective name"); + glp_set_obj_name(P, csa->field); + } + else if (strcmp(csa->field, "i") == 0) + { /* row name */ + read_field(csa); + if (str2int(csa->field, &i) != 0) + error(csa, "row number missing or invalid"); + if (!(1 <= i && i <= m)) + error(csa, "row number out of range"); + read_field(csa); + if (P->row[i]->name != NULL) + error(csa, "duplicate row name"); + glp_set_row_name(P, i, csa->field); + } + else if (strcmp(csa->field, "j") == 0) + { /* column name */ + read_field(csa); + if (str2int(csa->field, &j) != 0) + error(csa, "column number missing or invalid"); + if (!(1 <= j && j <= n)) + error(csa, "column number out of range"); + read_field(csa); + if (P->col[j]->name != NULL) + error(csa, "duplicate column name"); + glp_set_col_name(P, j, csa->field); + } + else + error(csa, "object designator missing or invalid"); + } + else if (strcmp(csa->field, "e") == 0) + break; + else + error(csa, "line designator missing or invalid"); + end_of_line(csa); + } + if (ne < nnz) + error(csa, "too few constraint coefficient descriptors"); + xassert(ne == nnz); + k = glp_check_dup(m, n, ne, ia, ja); + xassert(0 <= k && k <= nnz); + if (k > 0) + { csa->count = ln[k]; + error(csa, "duplicate constraint coefficient"); + } + glp_load_matrix(P, ne, ia, ja, ar); + /* print some statistics */ + if (P->name != NULL) + xprintf("Problem: %s\n", P->name); + if (P->obj != NULL) + xprintf("Objective: %s\n", P->obj); + xprintf("%d row%s, %d column%s, %d non-zero%s\n", + m, m == 1 ? "" : "s", n, n == 1 ? "" : "s", nnz, nnz == 1 ? + "" : "s"); + if (glp_get_num_int(P) > 0) + { int ni = glp_get_num_int(P); + int nb = glp_get_num_bin(P); + if (ni == 1) + { if (nb == 0) + xprintf("One variable is integer\n"); + else + xprintf("One variable is binary\n"); + } + else + { xprintf("%d integer variables, ", ni); + if (nb == 0) + xprintf("none"); + else if (nb == 1) + xprintf("one"); + else if (nb == ni) + xprintf("all"); + else + xprintf("%d", nb); + xprintf(" of which %s binary\n", nb == 1 ? "is" : "are"); + } + } + xprintf("%d lines were read\n", csa->count); + /* problem data has been successfully read */ + glp_sort_matrix(P); + ret = 0; +done: if (csa->fp != NULL) glp_close(csa->fp); + if (rf != NULL) xfree(rf); + if (cf != NULL) xfree(cf); + if (ln != NULL) xfree(ln); + if (ia != NULL) xfree(ia); + if (ja != NULL) xfree(ja); + if (ar != NULL) xfree(ar); + if (ret) glp_erase_prob(P); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/rdsol.c b/resources/3rdparty/glpk-4.65/src/api/rdsol.c new file mode 100644 index 000000000..d85a25626 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/rdsol.c @@ -0,0 +1,225 @@ +/* rdsol.c (read basic solution in GLPK format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2010-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "dimacs.h" +#include "env.h" +#include "misc.h" +#include "prob.h" + +/*********************************************************************** +* NAME +* +* glp_read_sol - read basic solution in GLPK format +* +* SYNOPSIS +* +* int glp_read_sol(glp_prob *P, const char *fname); +* +* DESCRIPTION +* +* The routine glp_read_sol reads basic solution from a text file in +* GLPK format. +* +* RETURNS +* +* If the operation was successful, the routine returns zero. Otherwise +* it prints an error message and returns non-zero. */ + +int glp_read_sol(glp_prob *P, const char *fname) +{ DMX dmx_, *dmx = &dmx_; + int i, j, k, m, n, pst, dst, ret = 1; + char *stat = NULL; + double obj, *prim = NULL, *dual = NULL; +#if 0 /* 04/IV-2016 */ + if (P == NULL || P->magic != GLP_PROB_MAGIC) + xerror("glp_read_sol: P = %p; invalid problem object\n", P); +#endif + if (fname == NULL) + xerror("glp_read_sol: fname = %d; invalid parameter\n", fname); + if (setjmp(dmx->jump)) + goto done; + dmx->fname = fname; + dmx->fp = NULL; + dmx->count = 0; + dmx->c = '\n'; + dmx->field[0] = '\0'; + dmx->empty = dmx->nonint = 0; + xprintf("Reading basic solution from '%s'...\n", fname); + dmx->fp = glp_open(fname, "r"); + if (dmx->fp == NULL) + { xprintf("Unable to open '%s' - %s\n", fname, get_err_msg()); + goto done; + } + /* read solution line */ + dmx_read_designator(dmx); + if (strcmp(dmx->field, "s") != 0) + dmx_error(dmx, "solution line missing or invalid"); + dmx_read_field(dmx); + if (strcmp(dmx->field, "bas") != 0) + dmx_error(dmx, "wrong solution designator; 'bas' expected"); + dmx_read_field(dmx); + if (!(str2int(dmx->field, &m) == 0 && m >= 0)) + dmx_error(dmx, "number of rows missing or invalid"); + if (m != P->m) + dmx_error(dmx, "number of rows mismatch"); + dmx_read_field(dmx); + if (!(str2int(dmx->field, &n) == 0 && n >= 0)) + dmx_error(dmx, "number of columns missing or invalid"); + if (n != P->n) + dmx_error(dmx, "number of columns mismatch"); + dmx_read_field(dmx); + if (strcmp(dmx->field, "u") == 0) + pst = GLP_UNDEF; + else if (strcmp(dmx->field, "f") == 0) + pst = GLP_FEAS; + else if (strcmp(dmx->field, "i") == 0) + pst = GLP_INFEAS; + else if (strcmp(dmx->field, "n") == 0) + pst = GLP_NOFEAS; + else + dmx_error(dmx, "primal solution status missing or invalid"); + dmx_read_field(dmx); + if (strcmp(dmx->field, "u") == 0) + dst = GLP_UNDEF; + else if (strcmp(dmx->field, "f") == 0) + dst = GLP_FEAS; + else if (strcmp(dmx->field, "i") == 0) + dst = GLP_INFEAS; + else if (strcmp(dmx->field, "n") == 0) + dst = GLP_NOFEAS; + else + dmx_error(dmx, "dual solution status missing or invalid"); + dmx_read_field(dmx); + if (str2num(dmx->field, &obj) != 0) + dmx_error(dmx, "objective value missing or invalid"); + dmx_end_of_line(dmx); + /* allocate working arrays */ + stat = xalloc(1+m+n, sizeof(stat[0])); + for (k = 1; k <= m+n; k++) + stat[k] = '?'; + prim = xalloc(1+m+n, sizeof(prim[0])); + dual = xalloc(1+m+n, sizeof(dual[0])); + /* read solution descriptor lines */ + for (;;) + { dmx_read_designator(dmx); + if (strcmp(dmx->field, "i") == 0) + { /* row solution descriptor */ + dmx_read_field(dmx); + if (str2int(dmx->field, &i) != 0) + dmx_error(dmx, "row number missing or invalid"); + if (!(1 <= i && i <= m)) + dmx_error(dmx, "row number out of range"); + if (stat[i] != '?') + dmx_error(dmx, "duplicate row solution descriptor"); + dmx_read_field(dmx); + if (strcmp(dmx->field, "b") == 0) + stat[i] = GLP_BS; + else if (strcmp(dmx->field, "l") == 0) + stat[i] = GLP_NL; + else if (strcmp(dmx->field, "u") == 0) + stat[i] = GLP_NU; + else if (strcmp(dmx->field, "f") == 0) + stat[i] = GLP_NF; + else if (strcmp(dmx->field, "s") == 0) + stat[i] = GLP_NS; + else + dmx_error(dmx, "row status missing or invalid"); + dmx_read_field(dmx); + if (str2num(dmx->field, &prim[i]) != 0) + dmx_error(dmx, "row primal value missing or invalid"); + dmx_read_field(dmx); + if (str2num(dmx->field, &dual[i]) != 0) + dmx_error(dmx, "row dual value missing or invalid"); + dmx_end_of_line(dmx); + } + else if (strcmp(dmx->field, "j") == 0) + { /* column solution descriptor */ + dmx_read_field(dmx); + if (str2int(dmx->field, &j) != 0) + dmx_error(dmx, "column number missing or invalid"); + if (!(1 <= j && j <= n)) + dmx_error(dmx, "column number out of range"); + if (stat[m+j] != '?') + dmx_error(dmx, "duplicate column solution descriptor"); + dmx_read_field(dmx); + if (strcmp(dmx->field, "b") == 0) + stat[m+j] = GLP_BS; + else if (strcmp(dmx->field, "l") == 0) + stat[m+j] = GLP_NL; + else if (strcmp(dmx->field, "u") == 0) + stat[m+j] = GLP_NU; + else if (strcmp(dmx->field, "f") == 0) + stat[m+j] = GLP_NF; + else if (strcmp(dmx->field, "s") == 0) + stat[m+j] = GLP_NS; + else + dmx_error(dmx, "column status missing or invalid"); + dmx_read_field(dmx); + if (str2num(dmx->field, &prim[m+j]) != 0) + dmx_error(dmx, "column primal value missing or invalid"); + dmx_read_field(dmx); + if (str2num(dmx->field, &dual[m+j]) != 0) + dmx_error(dmx, "column dual value missing or invalid"); + dmx_end_of_line(dmx); + } + else if (strcmp(dmx->field, "e") == 0) + break; + else + dmx_error(dmx, "line designator missing or invalid"); + dmx_end_of_line(dmx); + } + /* store solution components into problem object */ + for (k = 1; k <= m+n; k++) + { if (stat[k] == '?') + dmx_error(dmx, "incomplete basic solution"); + } + P->pbs_stat = pst; + P->dbs_stat = dst; + P->obj_val = obj; + P->it_cnt = 0; + P->some = 0; + for (i = 1; i <= m; i++) + { glp_set_row_stat(P, i, stat[i]); + P->row[i]->prim = prim[i]; + P->row[i]->dual = dual[i]; + } + for (j = 1; j <= n; j++) + { glp_set_col_stat(P, j, stat[m+j]); + P->col[j]->prim = prim[m+j]; + P->col[j]->dual = dual[m+j]; + } + /* basic solution has been successfully read */ + xprintf("%d lines were read\n", dmx->count); + ret = 0; +done: if (dmx->fp != NULL) + glp_close(dmx->fp); + if (stat != NULL) + xfree(stat); + if (prim != NULL) + xfree(prim); + if (dual != NULL) + xfree(dual); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpnet05.c b/resources/3rdparty/glpk-4.65/src/api/rmfgen.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpnet05.c rename to resources/3rdparty/glpk-4.65/src/api/rmfgen.c index ea7ca6300..a1ba27bb6 100644 --- a/resources/3rdparty/glpk-4.57/src/glpnet05.c +++ b/resources/3rdparty/glpk-4.65/src/api/rmfgen.c @@ -1,4 +1,4 @@ -/* glpnet05.c (Goldfarb's maximum flow problem generator) */ +/* rmfgen.c (Goldfarb's maximum flow problem generator) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). diff --git a/resources/3rdparty/glpk-4.65/src/api/strong.c b/resources/3rdparty/glpk-4.65/src/api/strong.c new file mode 100644 index 000000000..9ddcacfbc --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/strong.c @@ -0,0 +1,110 @@ +/* strong.c (find all strongly connected components of graph) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "glpk.h" +#include "mc13d.h" + +/*********************************************************************** +* NAME +* +* glp_strong_comp - find all strongly connected components of graph +* +* SYNOPSIS +* +* int glp_strong_comp(glp_graph *G, int v_num); +* +* DESCRIPTION +* +* The routine glp_strong_comp finds all strongly connected components +* of the specified graph. +* +* The parameter v_num specifies an offset of the field of type int +* in the vertex data block, to which the routine stores the number of +* a strongly connected component containing that vertex. If v_num < 0, +* no component numbers are stored. +* +* The components are numbered in arbitrary order from 1 to nc, where +* nc is the total number of components found, 0 <= nc <= |V|. However, +* the component numbering has the property that for every arc (i->j) +* in the graph the condition num(i) >= num(j) holds. +* +* RETURNS +* +* The routine returns nc, the total number of components found. */ + +int glp_strong_comp(glp_graph *G, int v_num) +{ glp_vertex *v; + glp_arc *a; + int i, k, last, n, na, nc, *icn, *ip, *lenr, *ior, *ib, *lowl, + *numb, *prev; + if (v_num >= 0 && v_num > G->v_size - (int)sizeof(int)) + xerror("glp_strong_comp: v_num = %d; invalid offset\n", + v_num); + n = G->nv; + if (n == 0) + { nc = 0; + goto done; + } + na = G->na; + icn = xcalloc(1+na, sizeof(int)); + ip = xcalloc(1+n, sizeof(int)); + lenr = xcalloc(1+n, sizeof(int)); + ior = xcalloc(1+n, sizeof(int)); + ib = xcalloc(1+n, sizeof(int)); + lowl = xcalloc(1+n, sizeof(int)); + numb = xcalloc(1+n, sizeof(int)); + prev = xcalloc(1+n, sizeof(int)); + k = 1; + for (i = 1; i <= n; i++) + { v = G->v[i]; + ip[i] = k; + for (a = v->out; a != NULL; a = a->t_next) + icn[k++] = a->head->i; + lenr[i] = k - ip[i]; + } + xassert(na == k-1); + nc = mc13d(n, icn, ip, lenr, ior, ib, lowl, numb, prev); + if (v_num >= 0) + { xassert(ib[1] == 1); + for (k = 1; k <= nc; k++) + { last = (k < nc ? ib[k+1] : n+1); + xassert(ib[k] < last); + for (i = ib[k]; i < last; i++) + { v = G->v[ior[i]]; + memcpy((char *)v->data + v_num, &k, sizeof(int)); + } + } + } + xfree(icn); + xfree(ip); + xfree(lenr); + xfree(ior); + xfree(ib); + xfree(lowl); + xfree(numb); + xfree(prev); +done: return nc; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/topsort.c b/resources/3rdparty/glpk-4.65/src/api/topsort.c new file mode 100644 index 000000000..971937f2e --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/topsort.c @@ -0,0 +1,123 @@ +/* topsort.c (topological sorting of acyclic digraph) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2010-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "glpk.h" + +/*********************************************************************** +* NAME +* +* glp_top_sort - topological sorting of acyclic digraph +* +* SYNOPSIS +* +* int glp_top_sort(glp_graph *G, int v_num); +* +* DESCRIPTION +* +* The routine glp_top_sort performs topological sorting of vertices of +* the specified acyclic digraph. +* +* The parameter v_num specifies an offset of the field of type int in +* the vertex data block, to which the routine stores the vertex number +* assigned. If v_num < 0, vertex numbers are not stored. +* +* The vertices are numbered from 1 to n, where n is the total number +* of vertices in the graph. The vertex numbering has the property that +* for every arc (i->j) in the graph the condition num(i) < num(j) +* holds. Special case num(i) = 0 means that vertex i is not assigned a +* number, because the graph is *not* acyclic. +* +* RETURNS +* +* If the graph is acyclic and therefore all the vertices have been +* assigned numbers, the routine glp_top_sort returns zero. Otherwise, +* if the graph is not acyclic, the routine returns the number of +* vertices which have not been numbered, i.e. for which num(i) = 0. */ + +static int top_sort(glp_graph *G, int num[]) +{ glp_arc *a; + int i, j, cnt, top, *stack, *indeg; + /* allocate working arrays */ + indeg = xcalloc(1+G->nv, sizeof(int)); + stack = xcalloc(1+G->nv, sizeof(int)); + /* determine initial indegree of each vertex; push into the stack + the vertices having zero indegree */ + top = 0; + for (i = 1; i <= G->nv; i++) + { num[i] = indeg[i] = 0; + for (a = G->v[i]->in; a != NULL; a = a->h_next) + indeg[i]++; + if (indeg[i] == 0) + stack[++top] = i; + } + /* assign numbers to vertices in the sorted order */ + cnt = 0; + while (top > 0) + { /* pull vertex i from the stack */ + i = stack[top--]; + /* it has zero indegree in the current graph */ + xassert(indeg[i] == 0); + /* so assign it a next number */ + xassert(num[i] == 0); + num[i] = ++cnt; + /* remove vertex i from the current graph, update indegree of + its adjacent vertices, and push into the stack new vertices + whose indegree becomes zero */ + for (a = G->v[i]->out; a != NULL; a = a->t_next) + { j = a->head->i; + /* there exists arc (i->j) in the graph */ + xassert(indeg[j] > 0); + indeg[j]--; + if (indeg[j] == 0) + stack[++top] = j; + } + } + /* free working arrays */ + xfree(indeg); + xfree(stack); + return G->nv - cnt; +} + +int glp_top_sort(glp_graph *G, int v_num) +{ glp_vertex *v; + int i, cnt, *num; + if (v_num >= 0 && v_num > G->v_size - (int)sizeof(int)) + xerror("glp_top_sort: v_num = %d; invalid offset\n", v_num); + if (G->nv == 0) + { cnt = 0; + goto done; + } + num = xcalloc(1+G->nv, sizeof(int)); + cnt = top_sort(G, num); + if (v_num >= 0) + { for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + memcpy((char *)v->data + v_num, &num[i], sizeof(int)); + } + } + xfree(num); +done: return cnt; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpapi18.c b/resources/3rdparty/glpk-4.65/src/api/wcliqex.c similarity index 95% rename from resources/3rdparty/glpk-4.57/src/glpapi18.c rename to resources/3rdparty/glpk-4.65/src/api/wcliqex.c index 07ab490d5..53c2d5215 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi18.c +++ b/resources/3rdparty/glpk-4.65/src/api/wcliqex.c @@ -1,10 +1,9 @@ -/* glpapi18.c (maximum clique problem) */ +/* wcliqex.c (find maximum weight clique with exact algorithm) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +22,7 @@ ***********************************************************************/ #include "env.h" -#include "prob.h" +#include "glpk.h" #include "wclique.h" static void set_edge(int nv, unsigned char a[], int i, int j) diff --git a/resources/3rdparty/glpk-4.65/src/api/weak.c b/resources/3rdparty/glpk-4.65/src/api/weak.c new file mode 100644 index 000000000..027c09c14 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/weak.c @@ -0,0 +1,150 @@ +/* weak.c (find all weakly connected components of graph) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "glpk.h" + +/*********************************************************************** +* NAME +* +* glp_weak_comp - find all weakly connected components of graph +* +* SYNOPSIS +* +* int glp_weak_comp(glp_graph *G, int v_num); +* +* DESCRIPTION +* +* The routine glp_weak_comp finds all weakly connected components of +* the specified graph. +* +* The parameter v_num specifies an offset of the field of type int +* in the vertex data block, to which the routine stores the number of +* a (weakly) connected component containing that vertex. If v_num < 0, +* no component numbers are stored. +* +* The components are numbered in arbitrary order from 1 to nc, where +* nc is the total number of components found, 0 <= nc <= |V|. +* +* RETURNS +* +* The routine returns nc, the total number of components found. */ + +int glp_weak_comp(glp_graph *G, int v_num) +{ glp_vertex *v; + glp_arc *a; + int f, i, j, nc, nv, pos1, pos2, *prev, *next, *list; + if (v_num >= 0 && v_num > G->v_size - (int)sizeof(int)) + xerror("glp_weak_comp: v_num = %d; invalid offset\n", v_num); + nv = G->nv; + if (nv == 0) + { nc = 0; + goto done; + } + /* allocate working arrays */ + prev = xcalloc(1+nv, sizeof(int)); + next = xcalloc(1+nv, sizeof(int)); + list = xcalloc(1+nv, sizeof(int)); + /* if vertex i is unlabelled, prev[i] is the index of previous + unlabelled vertex, and next[i] is the index of next unlabelled + vertex; if vertex i is labelled, then prev[i] < 0, and next[i] + is the connected component number */ + /* initially all vertices are unlabelled */ + f = 1; + for (i = 1; i <= nv; i++) + prev[i] = i - 1, next[i] = i + 1; + next[nv] = 0; + /* main loop (until all vertices have been labelled) */ + nc = 0; + while (f != 0) + { /* take an unlabelled vertex */ + i = f; + /* and remove it from the list of unlabelled vertices */ + f = next[i]; + if (f != 0) prev[f] = 0; + /* label the vertex; it begins a new component */ + prev[i] = -1, next[i] = ++nc; + /* breadth first search */ + list[1] = i, pos1 = pos2 = 1; + while (pos1 <= pos2) + { /* dequeue vertex i */ + i = list[pos1++]; + /* consider all arcs incoming to vertex i */ + for (a = G->v[i]->in; a != NULL; a = a->h_next) + { /* vertex j is adjacent to vertex i */ + j = a->tail->i; + if (prev[j] >= 0) + { /* vertex j is unlabelled */ + /* remove it from the list of unlabelled vertices */ + if (prev[j] == 0) + f = next[j]; + else + next[prev[j]] = next[j]; + if (next[j] == 0) + ; + else + prev[next[j]] = prev[j]; + /* label the vertex */ + prev[j] = -1, next[j] = nc; + /* and enqueue it for further consideration */ + list[++pos2] = j; + } + } + /* consider all arcs outgoing from vertex i */ + for (a = G->v[i]->out; a != NULL; a = a->t_next) + { /* vertex j is adjacent to vertex i */ + j = a->head->i; + if (prev[j] >= 0) + { /* vertex j is unlabelled */ + /* remove it from the list of unlabelled vertices */ + if (prev[j] == 0) + f = next[j]; + else + next[prev[j]] = next[j]; + if (next[j] == 0) + ; + else + prev[next[j]] = prev[j]; + /* label the vertex */ + prev[j] = -1, next[j] = nc; + /* and enqueue it for further consideration */ + list[++pos2] = j; + } + } + } + } + /* store component numbers */ + if (v_num >= 0) + { for (i = 1; i <= nv; i++) + { v = G->v[i]; + memcpy((char *)v->data + v_num, &next[i], sizeof(int)); + } + } + /* free working arrays */ + xfree(prev); + xfree(next); + xfree(list); +done: return nc; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/wrasn.c b/resources/3rdparty/glpk-4.65/src/api/wrasn.c new file mode 100644 index 000000000..81433da86 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/wrasn.c @@ -0,0 +1,107 @@ +/* wrasn.c (write assignment problem data in DIMACS format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "glpk.h" + +#define xfprintf glp_format + +/*********************************************************************** +* NAME +* +* glp_write_asnprob - write assignment problem data in DIMACS format +* +* SYNOPSIS +* +* int glp_write_asnprob(glp_graph *G, int v_set, int a_cost, +* const char *fname); +* +* DESCRIPTION +* +* The routine glp_write_asnprob writes assignment problem data in +* DIMACS format to a text file. +* +* RETURNS +* +* If the operation was successful, the routine returns zero. Otherwise +* it prints an error message and returns non-zero. */ + +int glp_write_asnprob(glp_graph *G, int v_set, int a_cost, const char + *fname) +{ glp_file *fp; + glp_vertex *v; + glp_arc *a; + int i, k, count = 0, ret; + double cost; + if (v_set >= 0 && v_set > G->v_size - (int)sizeof(int)) + xerror("glp_write_asnprob: v_set = %d; invalid offset\n", + v_set); + if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) + xerror("glp_write_asnprob: a_cost = %d; invalid offset\n", + a_cost); + xprintf("Writing assignment problem data to '%s'...\n", fname); + fp = glp_open(fname, "w"); + if (fp == NULL) + { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + xfprintf(fp, "c %s\n", + G->name == NULL ? "unknown" : G->name), count++; + xfprintf(fp, "p asn %d %d\n", G->nv, G->na), count++; + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + if (v_set >= 0) + memcpy(&k, (char *)v->data + v_set, sizeof(int)); + else + k = (v->out != NULL ? 0 : 1); + if (k == 0) + xfprintf(fp, "n %d\n", i), count++; + } + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + for (a = v->out; a != NULL; a = a->t_next) + { if (a_cost >= 0) + memcpy(&cost, (char *)a->data + a_cost, sizeof(double)); + else + cost = 1.0; + xfprintf(fp, "a %d %d %.*g\n", + a->tail->i, a->head->i, DBL_DIG, cost), count++; + } + } + xfprintf(fp, "c eof\n"), count++; +#if 0 /* FIXME */ + xfflush(fp); +#endif + if (glp_ioerr(fp)) + { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + xprintf("%d lines were written\n", count); + ret = 0; +done: if (fp != NULL) glp_close(fp); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/wrcc.c b/resources/3rdparty/glpk-4.65/src/api/wrcc.c new file mode 100644 index 000000000..2069c8ac2 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/wrcc.c @@ -0,0 +1,102 @@ +/* wrcc.c (write graph in DIMACS clique/coloring format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "glpk.h" + +#define xfprintf glp_format + +/*********************************************************************** +* NAME +* +* glp_write_ccdata - write graph in DIMACS clique/coloring format +* +* SYNOPSIS +* +* int glp_write_ccdata(glp_graph *G, int v_wgt, const char *fname); +* +* DESCRIPTION +* +* The routine glp_write_ccdata writes the specified graph in DIMACS +* clique/coloring format to a text file. +* +* RETURNS +* +* If the operation was successful, the routine returns zero. Otherwise +* it prints an error message and returns non-zero. */ + +int glp_write_ccdata(glp_graph *G, int v_wgt, const char *fname) +{ glp_file *fp; + glp_vertex *v; + glp_arc *e; + int i, count = 0, ret; + double w; + if (v_wgt >= 0 && v_wgt > G->v_size - (int)sizeof(double)) + xerror("glp_write_ccdata: v_wgt = %d; invalid offset\n", + v_wgt); + xprintf("Writing graph to '%s'\n", fname); + fp = glp_open(fname, "w"); + if (fp == NULL) + { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + xfprintf(fp, "c %s\n", + G->name == NULL ? "unknown" : G->name), count++; + xfprintf(fp, "p edge %d %d\n", G->nv, G->na), count++; + if (v_wgt >= 0) + { for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + memcpy(&w, (char *)v->data + v_wgt, sizeof(double)); + if (w != 1.0) + xfprintf(fp, "n %d %.*g\n", i, DBL_DIG, w), count++; + } + } + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + for (e = v->out; e != NULL; e = e->t_next) + xfprintf(fp, "e %d %d\n", e->tail->i, e->head->i), count++; + } + xfprintf(fp, "c eof\n"), count++; +#if 0 /* FIXME */ + xfflush(fp); +#endif + if (glp_ioerr(fp)) + { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + xprintf("%d lines were written\n", count); + ret = 0; +done: if (fp != NULL) glp_close(fp); + return ret; +} + +/**********************************************************************/ + +int glp_write_graph(glp_graph *G, const char *fname) +{ return + glp_write_ccdata(G, -1, fname); +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/wrcnf.c b/resources/3rdparty/glpk-4.65/src/api/wrcnf.c new file mode 100644 index 000000000..c7974386d --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/wrcnf.c @@ -0,0 +1,87 @@ +/* wrcnf.c (write CNF-SAT problem data in DIMACS format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2010-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "prob.h" + +#define xfprintf glp_format + +int glp_write_cnfsat(glp_prob *P, const char *fname) +{ /* write CNF-SAT problem data in DIMACS format */ + glp_file *fp = NULL; + GLPAIJ *aij; + int i, j, len, count = 0, ret; + char s[50]; +#if 0 /* 04/IV-2016 */ + if (P == NULL || P->magic != GLP_PROB_MAGIC) + xerror("glp_write_cnfsat: P = %p; invalid problem object\n", + P); +#endif + if (glp_check_cnfsat(P) != 0) + { xprintf("glp_write_cnfsat: problem object does not encode CNF-" + "SAT instance\n"); + ret = 1; + goto done; + } + xprintf("Writing CNF-SAT problem data to '%s'...\n", fname); + fp = glp_open(fname, "w"); + if (fp == NULL) + { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + xfprintf(fp, "c %s\n", + P->name == NULL ? "unknown" : P->name), count++; + xfprintf(fp, "p cnf %d %d\n", P->n, P->m), count++; + for (i = 1; i <= P->m; i++) + { len = 0; + for (aij = P->row[i]->ptr; aij != NULL; aij = aij->r_next) + { j = aij->col->j; + if (aij->val < 0.0) j = -j; + sprintf(s, "%d", j); + if (len > 0 && len + 1 + strlen(s) > 72) + xfprintf(fp, "\n"), count++, len = 0; + xfprintf(fp, "%s%s", len == 0 ? "" : " ", s); + if (len > 0) len++; + len += strlen(s); + } + if (len > 0 && len + 1 + 1 > 72) + xfprintf(fp, "\n"), count++, len = 0; + xfprintf(fp, "%s0\n", len == 0 ? "" : " "), count++; + } + xfprintf(fp, "c eof\n"), count++; +#if 0 /* FIXME */ + xfflush(fp); +#endif + if (glp_ioerr(fp)) + { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + xprintf("%d lines were written\n", count); + ret = 0; +done: if (fp != NULL) glp_close(fp); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/wript.c b/resources/3rdparty/glpk-4.65/src/api/wript.c new file mode 100644 index 000000000..f2ca802c7 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/wript.c @@ -0,0 +1,124 @@ +/* wript.c (write interior-point solution in GLPK format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2010-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "prob.h" + +/*********************************************************************** +* NAME +* +* glp_write_ipt - write interior-point solution in GLPK format +* +* SYNOPSIS +* +* int glp_write_ipt(glp_prob *P, const char *fname); +* +* DESCRIPTION +* +* The routine glp_write_ipt writes interior-point solution to a text +* file in GLPK format. +* +* RETURNS +* +* If the operation was successful, the routine returns zero. Otherwise +* it prints an error message and returns non-zero. */ + +int glp_write_ipt(glp_prob *P, const char *fname) +{ glp_file *fp; + GLPROW *row; + GLPCOL *col; + int i, j, count, ret = 1; + char *s; +#if 0 /* 04/IV-2016 */ + if (P == NULL || P->magic != GLP_PROB_MAGIC) + xerror("glp_write_ipt: P = %p; invalid problem object\n", P); +#endif + if (fname == NULL) + xerror("glp_write_ipt: fname = %d; invalid parameter\n", fname) + ; + xprintf("Writing interior-point solution to '%s'...\n", fname); + fp = glp_open(fname, "w"), count = 0; + if (fp == NULL) + { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); + goto done; + } + /* write comment lines */ + glp_format(fp, "c %-12s%s\n", "Problem:", + P->name == NULL ? "" : P->name), count++; + glp_format(fp, "c %-12s%d\n", "Rows:", P->m), count++; + glp_format(fp, "c %-12s%d\n", "Columns:", P->n), count++; + glp_format(fp, "c %-12s%d\n", "Non-zeros:", P->nnz), count++; + switch (P->ipt_stat) + { case GLP_OPT: s = "OPTIMAL"; break; + case GLP_INFEAS: s = "INFEASIBLE (INTERMEDIATE)"; break; + case GLP_NOFEAS: s = "INFEASIBLE (FINAL)"; break; + case GLP_UNDEF: s = "UNDEFINED"; break; + default: s = "???"; break; + } + glp_format(fp, "c %-12s%s\n", "Status:", s), count++; + switch (P->dir) + { case GLP_MIN: s = "MINimum"; break; + case GLP_MAX: s = "MAXimum"; break; + default: s = "???"; break; + } + glp_format(fp, "c %-12s%s%s%.10g (%s)\n", "Objective:", + P->obj == NULL ? "" : P->obj, + P->obj == NULL ? "" : " = ", P->ipt_obj, s), count++; + glp_format(fp, "c\n"), count++; + /* write solution line */ + glp_format(fp, "s ipt %d %d ", P->m, P->n), count++; + switch (P->ipt_stat) + { case GLP_OPT: glp_format(fp, "o"); break; + case GLP_INFEAS: glp_format(fp, "i"); break; + case GLP_NOFEAS: glp_format(fp, "n"); break; + case GLP_UNDEF: glp_format(fp, "u"); break; + default: glp_format(fp, "?"); break; + } + glp_format(fp, " %.*g\n", DBL_DIG, P->ipt_obj); + /* write row solution descriptor lines */ + for (i = 1; i <= P->m; i++) + { row = P->row[i]; + glp_format(fp, "i %d %.*g %.*g\n", i, DBL_DIG, row->pval, + DBL_DIG, row->dval), count++; + } + /* write column solution descriptor lines */ + for (j = 1; j <= P->n; j++) + { col = P->col[j]; + glp_format(fp, "j %d %.*g %.*g\n", j, DBL_DIG, col->pval, + DBL_DIG, col->dval), count++; + } + /* write end line */ + glp_format(fp, "e o f\n"), count++; + if (glp_ioerr(fp)) + { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); + goto done; + } + /* interior-point solution has been successfully written */ + xprintf("%d lines were written\n", count); + ret = 0; +done: if (fp != NULL) + glp_close(fp); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/wrmaxf.c b/resources/3rdparty/glpk-4.65/src/api/wrmaxf.c new file mode 100644 index 000000000..d3101ca89 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/wrmaxf.c @@ -0,0 +1,104 @@ +/* wrmaxf.c (write maximum flow problem data in DIMACS format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "glpk.h" + +#define xfprintf glp_format + +/*********************************************************************** +* NAME +* +* glp_write_maxflow - write maximum flow problem data in DIMACS format +* +* SYNOPSIS +* +* int glp_write_maxflow(glp_graph *G, int s, int t, int a_cap, +* const char *fname); +* +* DESCRIPTION +* +* The routine glp_write_maxflow writes maximum flow problem data in +* DIMACS format to a text file. +* +* RETURNS +* +* If the operation was successful, the routine returns zero. Otherwise +* it prints an error message and returns non-zero. */ + +int glp_write_maxflow(glp_graph *G, int s, int t, int a_cap, + const char *fname) +{ glp_file *fp; + glp_vertex *v; + glp_arc *a; + int i, count = 0, ret; + double cap; + if (!(1 <= s && s <= G->nv)) + xerror("glp_write_maxflow: s = %d; source node number out of r" + "ange\n", s); + if (!(1 <= t && t <= G->nv)) + xerror("glp_write_maxflow: t = %d: sink node number out of ran" + "ge\n", t); + if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) + xerror("glp_write_mincost: a_cap = %d; invalid offset\n", + a_cap); + xprintf("Writing maximum flow problem data to '%s'...\n", + fname); + fp = glp_open(fname, "w"); + if (fp == NULL) + { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + xfprintf(fp, "c %s\n", + G->name == NULL ? "unknown" : G->name), count++; + xfprintf(fp, "p max %d %d\n", G->nv, G->na), count++; + xfprintf(fp, "n %d s\n", s), count++; + xfprintf(fp, "n %d t\n", t), count++; + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + for (a = v->out; a != NULL; a = a->t_next) + { if (a_cap >= 0) + memcpy(&cap, (char *)a->data + a_cap, sizeof(double)); + else + cap = 1.0; + xfprintf(fp, "a %d %d %.*g\n", + a->tail->i, a->head->i, DBL_DIG, cap), count++; + } + } + xfprintf(fp, "c eof\n"), count++; +#if 0 /* FIXME */ + xfflush(fp); +#endif + if (glp_ioerr(fp)) + { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + xprintf("%d lines were written\n", count); + ret = 0; +done: if (fp != NULL) glp_close(fp); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/wrmcf.c b/resources/3rdparty/glpk-4.65/src/api/wrmcf.c new file mode 100644 index 000000000..0da37f421 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/wrmcf.c @@ -0,0 +1,122 @@ +/* wrmcf.c (write min-cost flow problem data in DIMACS format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "glpk.h" + +#define xfprintf glp_format + +/*********************************************************************** +* NAME +* +* glp_write_mincost - write min-cost flow probl. data in DIMACS format +* +* SYNOPSIS +* +* int glp_write_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap, +* int a_cost, const char *fname); +* +* DESCRIPTION +* +* The routine glp_write_mincost writes minimum cost flow problem data +* in DIMACS format to a text file. +* +* RETURNS +* +* If the operation was successful, the routine returns zero. Otherwise +* it prints an error message and returns non-zero. */ + +int glp_write_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap, + int a_cost, const char *fname) +{ glp_file *fp; + glp_vertex *v; + glp_arc *a; + int i, count = 0, ret; + double rhs, low, cap, cost; + if (v_rhs >= 0 && v_rhs > G->v_size - (int)sizeof(double)) + xerror("glp_write_mincost: v_rhs = %d; invalid offset\n", + v_rhs); + if (a_low >= 0 && a_low > G->a_size - (int)sizeof(double)) + xerror("glp_write_mincost: a_low = %d; invalid offset\n", + a_low); + if (a_cap >= 0 && a_cap > G->a_size - (int)sizeof(double)) + xerror("glp_write_mincost: a_cap = %d; invalid offset\n", + a_cap); + if (a_cost >= 0 && a_cost > G->a_size - (int)sizeof(double)) + xerror("glp_write_mincost: a_cost = %d; invalid offset\n", + a_cost); + xprintf("Writing min-cost flow problem data to '%s'...\n", + fname); + fp = glp_open(fname, "w"); + if (fp == NULL) + { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + xfprintf(fp, "c %s\n", + G->name == NULL ? "unknown" : G->name), count++; + xfprintf(fp, "p min %d %d\n", G->nv, G->na), count++; + if (v_rhs >= 0) + { for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + memcpy(&rhs, (char *)v->data + v_rhs, sizeof(double)); + if (rhs != 0.0) + xfprintf(fp, "n %d %.*g\n", i, DBL_DIG, rhs), count++; + } + } + for (i = 1; i <= G->nv; i++) + { v = G->v[i]; + for (a = v->out; a != NULL; a = a->t_next) + { if (a_low >= 0) + memcpy(&low, (char *)a->data + a_low, sizeof(double)); + else + low = 0.0; + if (a_cap >= 0) + memcpy(&cap, (char *)a->data + a_cap, sizeof(double)); + else + cap = 1.0; + if (a_cost >= 0) + memcpy(&cost, (char *)a->data + a_cost, sizeof(double)); + else + cost = 0.0; + xfprintf(fp, "a %d %d %.*g %.*g %.*g\n", + a->tail->i, a->head->i, DBL_DIG, low, DBL_DIG, cap, + DBL_DIG, cost), count++; + } + } + xfprintf(fp, "c eof\n"), count++; +#if 0 /* FIXME */ + xfflush(fp); +#endif + if (glp_ioerr(fp)) + { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + xprintf("%d lines were written\n", count); + ret = 0; +done: if (fp != NULL) glp_close(fp); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/wrmip.c b/resources/3rdparty/glpk-4.65/src/api/wrmip.c new file mode 100644 index 000000000..407a5fec6 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/wrmip.c @@ -0,0 +1,122 @@ +/* wrmip.c (write MIP solution in GLPK format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2010-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "prob.h" + +/*********************************************************************** +* NAME +* +* glp_write_mip - write MIP solution in GLPK format +* +* SYNOPSIS +* +* int glp_write_mip(glp_prob *P, const char *fname); +* +* DESCRIPTION +* +* The routine glp_write_mip writes MIP solution to a text file in GLPK +* format. +* +* RETURNS +* +* If the operation was successful, the routine returns zero. Otherwise +* it prints an error message and returns non-zero. */ + +int glp_write_mip(glp_prob *P, const char *fname) +{ glp_file *fp; + GLPROW *row; + GLPCOL *col; + int i, j, count, ret = 1; + char *s; +#if 0 /* 04/IV-2016 */ + if (P == NULL || P->magic != GLP_PROB_MAGIC) + xerror("glp_write_mip: P = %p; invalid problem object\n", P); +#endif + if (fname == NULL) + xerror("glp_write_mip: fname = %d; invalid parameter\n", fname) + ; + xprintf("Writing MIP solution to '%s'...\n", fname); + fp = glp_open(fname, "w"), count = 0; + if (fp == NULL) + { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); + goto done; + } + /* write comment lines */ + glp_format(fp, "c %-12s%s\n", "Problem:", + P->name == NULL ? "" : P->name), count++; + glp_format(fp, "c %-12s%d\n", "Rows:", P->m), count++; + glp_format(fp, "c %-12s%d\n", "Columns:", P->n), count++; + glp_format(fp, "c %-12s%d\n", "Non-zeros:", P->nnz), count++; + switch (P->mip_stat) + { case GLP_OPT: s = "INTEGER OPTIMAL"; break; + case GLP_FEAS: s = "INTEGER NON-OPTIMAL"; break; + case GLP_NOFEAS: s = "INTEGER EMPTY"; break; + case GLP_UNDEF: s = "INTEGER UNDEFINED"; break; + default: s = "???"; break; + } + glp_format(fp, "c %-12s%s\n", "Status:", s), count++; + switch (P->dir) + { case GLP_MIN: s = "MINimum"; break; + case GLP_MAX: s = "MAXimum"; break; + default: s = "???"; break; + } + glp_format(fp, "c %-12s%s%s%.10g (%s)\n", "Objective:", + P->obj == NULL ? "" : P->obj, + P->obj == NULL ? "" : " = ", P->mip_obj, s), count++; + glp_format(fp, "c\n"), count++; + /* write solution line */ + glp_format(fp, "s mip %d %d ", P->m, P->n), count++; + switch (P->mip_stat) + { case GLP_OPT: glp_format(fp, "o"); break; + case GLP_FEAS: glp_format(fp, "f"); break; + case GLP_NOFEAS: glp_format(fp, "n"); break; + case GLP_UNDEF: glp_format(fp, "u"); break; + default: glp_format(fp, "?"); break; + } + glp_format(fp, " %.*g\n", DBL_DIG, P->mip_obj); + /* write row solution descriptor lines */ + for (i = 1; i <= P->m; i++) + { row = P->row[i]; + glp_format(fp, "i %d %.*g\n", i, DBL_DIG, row->mipx), count++; + } + /* write column solution descriptor lines */ + for (j = 1; j <= P->n; j++) + { col = P->col[j]; + glp_format(fp, "j %d %.*g\n", j, DBL_DIG, col->mipx), count++; + } + /* write end line */ + glp_format(fp, "e o f\n"), count++; + if (glp_ioerr(fp)) + { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); + goto done; + } + /* MIP solution has been successfully written */ + xprintf("%d lines were written\n", count); + ret = 0; +done: if (fp != NULL) + glp_close(fp); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/wrprob.c b/resources/3rdparty/glpk-4.65/src/api/wrprob.c new file mode 100644 index 000000000..99983d35f --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/wrprob.c @@ -0,0 +1,166 @@ +/* wrprob.c (write problem data in GLPK format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2010-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "prob.h" + +#define xfprintf glp_format + +/*********************************************************************** +* NAME +* +* glp_write_prob - write problem data in GLPK format +* +* SYNOPSIS +* +* int glp_write_prob(glp_prob *P, int flags, const char *fname); +* +* The routine glp_write_prob writes problem data in GLPK LP/MIP format +* to a text file. +* +* RETURNS +* +* If the operation was successful, the routine returns zero. Otherwise +* it prints an error message and returns non-zero. */ + +int glp_write_prob(glp_prob *P, int flags, const char *fname) +{ glp_file *fp; + GLPROW *row; + GLPCOL *col; + GLPAIJ *aij; + int mip, i, j, count, ret; +#if 0 /* 04/IV-2016 */ + if (P == NULL || P->magic != GLP_PROB_MAGIC) + xerror("glp_write_prob: P = %p; invalid problem object\n", + P); +#endif + if (flags != 0) + xerror("glp_write_prob: flags = %d; invalid parameter\n", + flags); + if (fname == NULL) + xerror("glp_write_prob: fname = %d; invalid parameter\n", + fname); + xprintf("Writing problem data to '%s'...\n", fname); + fp = glp_open(fname, "w"), count = 0; + if (fp == NULL) + { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + /* write problem line */ + mip = (glp_get_num_int(P) > 0); + xfprintf(fp, "p %s %s %d %d %d\n", !mip ? "lp" : "mip", + P->dir == GLP_MIN ? "min" : P->dir == GLP_MAX ? "max" : "???", + P->m, P->n, P->nnz), count++; + if (P->name != NULL) + xfprintf(fp, "n p %s\n", P->name), count++; + if (P->obj != NULL) + xfprintf(fp, "n z %s\n", P->obj), count++; + /* write row descriptors */ + for (i = 1; i <= P->m; i++) + { row = P->row[i]; + if (row->type == GLP_FX && row->lb == 0.0) + goto skip1; + xfprintf(fp, "i %d ", i), count++; + if (row->type == GLP_FR) + xfprintf(fp, "f\n"); + else if (row->type == GLP_LO) + xfprintf(fp, "l %.*g\n", DBL_DIG, row->lb); + else if (row->type == GLP_UP) + xfprintf(fp, "u %.*g\n", DBL_DIG, row->ub); + else if (row->type == GLP_DB) + xfprintf(fp, "d %.*g %.*g\n", DBL_DIG, row->lb, DBL_DIG, + row->ub); + else if (row->type == GLP_FX) + xfprintf(fp, "s %.*g\n", DBL_DIG, row->lb); + else + xassert(row != row); +skip1: if (row->name != NULL) + xfprintf(fp, "n i %d %s\n", i, row->name), count++; + } + /* write column descriptors */ + for (j = 1; j <= P->n; j++) + { col = P->col[j]; + if (!mip && col->type == GLP_LO && col->lb == 0.0) + goto skip2; + if (mip && col->kind == GLP_IV && col->type == GLP_DB && + col->lb == 0.0 && col->ub == 1.0) + goto skip2; + xfprintf(fp, "j %d ", j), count++; + if (mip) + { if (col->kind == GLP_CV) + xfprintf(fp, "c "); + else if (col->kind == GLP_IV) + xfprintf(fp, "i "); + else + xassert(col != col); + } + if (col->type == GLP_FR) + xfprintf(fp, "f\n"); + else if (col->type == GLP_LO) + xfprintf(fp, "l %.*g\n", DBL_DIG, col->lb); + else if (col->type == GLP_UP) + xfprintf(fp, "u %.*g\n", DBL_DIG, col->ub); + else if (col->type == GLP_DB) + xfprintf(fp, "d %.*g %.*g\n", DBL_DIG, col->lb, DBL_DIG, + col->ub); + else if (col->type == GLP_FX) + xfprintf(fp, "s %.*g\n", DBL_DIG, col->lb); + else + xassert(col != col); +skip2: if (col->name != NULL) + xfprintf(fp, "n j %d %s\n", j, col->name), count++; + } + /* write objective coefficient descriptors */ + if (P->c0 != 0.0) + xfprintf(fp, "a 0 0 %.*g\n", DBL_DIG, P->c0), count++; + for (j = 1; j <= P->n; j++) + { col = P->col[j]; + if (col->coef != 0.0) + xfprintf(fp, "a 0 %d %.*g\n", j, DBL_DIG, col->coef), + count++; + } + /* write constraint coefficient descriptors */ + for (i = 1; i <= P->m; i++) + { row = P->row[i]; + for (aij = row->ptr; aij != NULL; aij = aij->r_next) + xfprintf(fp, "a %d %d %.*g\n", i, aij->col->j, DBL_DIG, + aij->val), count++; + } + /* write end line */ + xfprintf(fp, "e o f\n"), count++; +#if 0 /* FIXME */ + xfflush(fp); +#endif + if (glp_ioerr(fp)) + { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); + ret = 1; + goto done; + } + xprintf("%d lines were written\n", count); + ret = 0; +done: if (fp != NULL) glp_close(fp); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/api/wrsol.c b/resources/3rdparty/glpk-4.65/src/api/wrsol.c new file mode 100644 index 000000000..66c692337 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/api/wrsol.c @@ -0,0 +1,174 @@ +/* wrsol.c (write basic solution in GLPK format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2010-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "prob.h" + +/*********************************************************************** +* NAME +* +* glp_write_sol - write basic solution in GLPK format +* +* SYNOPSIS +* +* int glp_write_sol(glp_prob *P, const char *fname); +* +* DESCRIPTION +* +* The routine glp_write_sol writes basic solution to a text file in +* GLPK format. +* +* RETURNS +* +* If the operation was successful, the routine returns zero. Otherwise +* it prints an error message and returns non-zero. */ + +int glp_write_sol(glp_prob *P, const char *fname) +{ glp_file *fp; + GLPROW *row; + GLPCOL *col; + int i, j, count, ret = 1; + char *s; +#if 0 /* 04/IV-2016 */ + if (P == NULL || P->magic != GLP_PROB_MAGIC) + xerror("glp_write_sol: P = %p; invalid problem object\n", P); +#endif + if (fname == NULL) + xerror("glp_write_sol: fname = %d; invalid parameter\n", fname) + ; + xprintf("Writing basic solution to '%s'...\n", fname); + fp = glp_open(fname, "w"), count = 0; + if (fp == NULL) + { xprintf("Unable to create '%s' - %s\n", fname, get_err_msg()); + goto done; + } + /* write comment lines */ + glp_format(fp, "c %-12s%s\n", "Problem:", + P->name == NULL ? "" : P->name), count++; + glp_format(fp, "c %-12s%d\n", "Rows:", P->m), count++; + glp_format(fp, "c %-12s%d\n", "Columns:", P->n), count++; + glp_format(fp, "c %-12s%d\n", "Non-zeros:", P->nnz), count++; + switch (glp_get_status(P)) + { case GLP_OPT: s = "OPTIMAL"; break; + case GLP_FEAS: s = "FEASIBLE"; break; + case GLP_INFEAS: s = "INFEASIBLE (INTERMEDIATE)"; break; + case GLP_NOFEAS: s = "INFEASIBLE (FINAL)"; break; + case GLP_UNBND: s = "UNBOUNDED"; break; + case GLP_UNDEF: s = "UNDEFINED"; break; + default: s = "???"; break; + } + glp_format(fp, "c %-12s%s\n", "Status:", s), count++; + switch (P->dir) + { case GLP_MIN: s = "MINimum"; break; + case GLP_MAX: s = "MAXimum"; break; + default: s = "???"; break; + } + glp_format(fp, "c %-12s%s%s%.10g (%s)\n", "Objective:", + P->obj == NULL ? "" : P->obj, + P->obj == NULL ? "" : " = ", P->obj_val, s), count++; + glp_format(fp, "c\n"), count++; + /* write solution line */ + glp_format(fp, "s bas %d %d ", P->m, P->n), count++; + switch (P->pbs_stat) + { case GLP_UNDEF: glp_format(fp, "u"); break; + case GLP_FEAS: glp_format(fp, "f"); break; + case GLP_INFEAS: glp_format(fp, "i"); break; + case GLP_NOFEAS: glp_format(fp, "n"); break; + default: glp_format(fp, "?"); break; + } + glp_format(fp, " "); + switch (P->dbs_stat) + { case GLP_UNDEF: glp_format(fp, "u"); break; + case GLP_FEAS: glp_format(fp, "f"); break; + case GLP_INFEAS: glp_format(fp, "i"); break; + case GLP_NOFEAS: glp_format(fp, "n"); break; + default: glp_format(fp, "?"); break; + } + glp_format(fp, " %.*g\n", DBL_DIG, P->obj_val); + /* write row solution descriptor lines */ + for (i = 1; i <= P->m; i++) + { row = P->row[i]; + glp_format(fp, "i %d ", i), count++; + switch (row->stat) + { case GLP_BS: + glp_format(fp, "b"); + break; + case GLP_NL: + glp_format(fp, "l"); + break; + case GLP_NU: + glp_format(fp, "u"); + break; + case GLP_NF: + glp_format(fp, "f"); + break; + case GLP_NS: + glp_format(fp, "s"); + break; + default: + xassert(row != row); + } + glp_format(fp, " %.*g %.*g\n", DBL_DIG, row->prim, DBL_DIG, + row->dual); + } + /* write column solution descriptor lines */ + for (j = 1; j <= P->n; j++) + { col = P->col[j]; + glp_format(fp, "j %d ", j), count++; + switch (col->stat) + { case GLP_BS: + glp_format(fp, "b"); + break; + case GLP_NL: + glp_format(fp, "l"); + break; + case GLP_NU: + glp_format(fp, "u"); + break; + case GLP_NF: + glp_format(fp, "f"); + break; + case GLP_NS: + glp_format(fp, "s"); + break; + default: + xassert(col != col); + } + glp_format(fp, " %.*g %.*g\n", DBL_DIG, col->prim, DBL_DIG, + col->dual); + } + /* write end line */ + glp_format(fp, "e o f\n"), count++; + if (glp_ioerr(fp)) + { xprintf("Write error on '%s' - %s\n", fname, get_err_msg()); + goto done; + } + /* basic solution has been successfully written */ + xprintf("%d lines were written\n", count); + ret = 0; +done: if (fp != NULL) + glp_close(fp); + return ret; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/bflib/btf.c b/resources/3rdparty/glpk-4.65/src/bflib/btf.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/btf.c rename to resources/3rdparty/glpk-4.65/src/bflib/btf.c diff --git a/resources/3rdparty/glpk-4.57/src/bflib/btf.h b/resources/3rdparty/glpk-4.65/src/bflib/btf.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/btf.h rename to resources/3rdparty/glpk-4.65/src/bflib/btf.h diff --git a/resources/3rdparty/glpk-4.57/src/bflib/btfint.c b/resources/3rdparty/glpk-4.65/src/bflib/btfint.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/btfint.c rename to resources/3rdparty/glpk-4.65/src/bflib/btfint.c diff --git a/resources/3rdparty/glpk-4.57/src/bflib/btfint.h b/resources/3rdparty/glpk-4.65/src/bflib/btfint.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/btfint.h rename to resources/3rdparty/glpk-4.65/src/bflib/btfint.h diff --git a/resources/3rdparty/glpk-4.57/src/bflib/fhv.c b/resources/3rdparty/glpk-4.65/src/bflib/fhv.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/fhv.c rename to resources/3rdparty/glpk-4.65/src/bflib/fhv.c diff --git a/resources/3rdparty/glpk-4.57/src/bflib/fhv.h b/resources/3rdparty/glpk-4.65/src/bflib/fhv.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/fhv.h rename to resources/3rdparty/glpk-4.65/src/bflib/fhv.h diff --git a/resources/3rdparty/glpk-4.57/src/bflib/fhvint.c b/resources/3rdparty/glpk-4.65/src/bflib/fhvint.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/fhvint.c rename to resources/3rdparty/glpk-4.65/src/bflib/fhvint.c diff --git a/resources/3rdparty/glpk-4.57/src/bflib/fhvint.h b/resources/3rdparty/glpk-4.65/src/bflib/fhvint.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/fhvint.h rename to resources/3rdparty/glpk-4.65/src/bflib/fhvint.h diff --git a/resources/3rdparty/glpk-4.57/src/bflib/ifu.c b/resources/3rdparty/glpk-4.65/src/bflib/ifu.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/ifu.c rename to resources/3rdparty/glpk-4.65/src/bflib/ifu.c diff --git a/resources/3rdparty/glpk-4.57/src/bflib/ifu.h b/resources/3rdparty/glpk-4.65/src/bflib/ifu.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/ifu.h rename to resources/3rdparty/glpk-4.65/src/bflib/ifu.h diff --git a/resources/3rdparty/glpk-4.57/src/bflib/luf.c b/resources/3rdparty/glpk-4.65/src/bflib/luf.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/luf.c rename to resources/3rdparty/glpk-4.65/src/bflib/luf.c diff --git a/resources/3rdparty/glpk-4.57/src/bflib/luf.h b/resources/3rdparty/glpk-4.65/src/bflib/luf.h similarity index 99% rename from resources/3rdparty/glpk-4.57/src/bflib/luf.h rename to resources/3rdparty/glpk-4.65/src/bflib/luf.h index d9264095a..5634a7530 100644 --- a/resources/3rdparty/glpk-4.57/src/bflib/luf.h +++ b/resources/3rdparty/glpk-4.65/src/bflib/luf.h @@ -82,7 +82,7 @@ struct LUF /*--------------------------------------------------------------*/ /* matrix F in column-wise format */ /* during the factorization process this object is constructed - by columns */ + * by columns */ int fc_ref; /* reference number of sparse vector in SVA, which is the first * column of matrix F */ diff --git a/resources/3rdparty/glpk-4.57/src/bflib/lufint.c b/resources/3rdparty/glpk-4.65/src/bflib/lufint.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/lufint.c rename to resources/3rdparty/glpk-4.65/src/bflib/lufint.c diff --git a/resources/3rdparty/glpk-4.57/src/bflib/lufint.h b/resources/3rdparty/glpk-4.65/src/bflib/lufint.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/lufint.h rename to resources/3rdparty/glpk-4.65/src/bflib/lufint.h diff --git a/resources/3rdparty/glpk-4.57/src/bflib/scf.c b/resources/3rdparty/glpk-4.65/src/bflib/scf.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/scf.c rename to resources/3rdparty/glpk-4.65/src/bflib/scf.c diff --git a/resources/3rdparty/glpk-4.57/src/bflib/scf.h b/resources/3rdparty/glpk-4.65/src/bflib/scf.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/scf.h rename to resources/3rdparty/glpk-4.65/src/bflib/scf.h diff --git a/resources/3rdparty/glpk-4.57/src/bflib/scfint.c b/resources/3rdparty/glpk-4.65/src/bflib/scfint.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/scfint.c rename to resources/3rdparty/glpk-4.65/src/bflib/scfint.c diff --git a/resources/3rdparty/glpk-4.57/src/bflib/scfint.h b/resources/3rdparty/glpk-4.65/src/bflib/scfint.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/scfint.h rename to resources/3rdparty/glpk-4.65/src/bflib/scfint.h diff --git a/resources/3rdparty/glpk-4.57/src/bflib/sgf.c b/resources/3rdparty/glpk-4.65/src/bflib/sgf.c similarity index 98% rename from resources/3rdparty/glpk-4.57/src/bflib/sgf.c rename to resources/3rdparty/glpk-4.65/src/bflib/sgf.c index 4000c8a55..1c1f49a63 100644 --- a/resources/3rdparty/glpk-4.57/src/bflib/sgf.c +++ b/resources/3rdparty/glpk-4.65/src/bflib/sgf.c @@ -59,7 +59,12 @@ * used. However, processing row and column singletons by the routines * sgf_minimize_nuc and sgf_singl_phase is more efficient. */ -void sgf_reduce_nuc(LUF *luf, int *k1_, int *k2_, int cnt[/*1+n*/], +#if 1 /* 21/II-2016 */ +/* Normally this routine returns zero. If the matrix is structurally +* singular, the routine returns non-zero. */ +#endif + +int sgf_reduce_nuc(LUF *luf, int *k1_, int *k2_, int cnt[/*1+n*/], int list[/*1+n*/]) { int n = luf->n; SVA *sva = luf->sva; @@ -91,15 +96,14 @@ void sgf_reduce_nuc(LUF *luf, int *k1_, int *k2_, int cnt[/*1+n*/], while (ns > 0) { /* column singleton is in j-th column of V */ j = list[ns--]; -#if 1 /* 25/IX-2015 */ +#if 1 /* 21/II-2016 */ if (cnt[j] == 0) { /* j-th column in the current nucleus is actually empty */ /* this happened because on a previous step in the nucleus * there were two or more identical column singletons (that * means structural singularity), so removing one of them * from the nucleus made other columns empty */ - /* do not remove empty column from the nucleus */ - continue; + return 1; } #endif /* find i-th row of V containing column singleton */ @@ -149,12 +153,11 @@ void sgf_reduce_nuc(LUF *luf, int *k1_, int *k2_, int cnt[/*1+n*/], while (ns > 0) { /* row singleton is in i-th row of V */ i = list[ns--]; -#if 1 /* 25/IX-2015 */ +#if 1 /* 21/II-2016 */ if (cnt[i] == 0) { /* i-th row in the current nucleus is actually empty */ /* (see comments above for similar case of empty column) */ - /* do not remove empty row from the nucleus */ - continue; + return 2; } #endif /* find j-th column of V containing row singleton */ @@ -183,7 +186,7 @@ void sgf_reduce_nuc(LUF *luf, int *k1_, int *k2_, int cnt[/*1+n*/], /* nucleus ends at k2-th row/column of U */ xassert(k1 < k2); done: *k1_ = k1, *k2_ = k2; - return; + return 0; } /*********************************************************************** @@ -1294,6 +1297,11 @@ int sgf_dense_phase(LUF *luf, int k, int updat) * returns k (information on linearly dependent rows/columns in this * case is provided by matrices P and Q). */ +#if 1 /* 21/II-2016 */ +/* If the matrix A is structurally singular, the routine returns -1. +* NOTE: This case can be detected only if the singl flag is set. */ +#endif + int sgf_factorize(SGF *sgf, int singl) { LUF *luf = sgf->luf; int n = luf->n; @@ -1335,7 +1343,12 @@ int sgf_factorize(SGF *sgf, int singl) } else { /* minimize nucleus size */ +#if 0 /* 21/II-2016 */ sgf_reduce_nuc(luf, &k1, &k2, rs_prev, rs_next); +#else + if (sgf_reduce_nuc(luf, &k1, &k2, rs_prev, rs_next)) + return -1; +#endif #ifdef GLP_DEBUG xprintf("n = %d; k1 = %d; k2 = %d\n", n, k1, k2); #endif diff --git a/resources/3rdparty/glpk-4.57/src/bflib/sgf.h b/resources/3rdparty/glpk-4.65/src/bflib/sgf.h similarity index 99% rename from resources/3rdparty/glpk-4.57/src/bflib/sgf.h rename to resources/3rdparty/glpk-4.65/src/bflib/sgf.h index 04d528cb7..4f744610e 100644 --- a/resources/3rdparty/glpk-4.57/src/bflib/sgf.h +++ b/resources/3rdparty/glpk-4.65/src/bflib/sgf.h @@ -169,7 +169,7 @@ struct SGF /* remove j-th column of matrix V from active set C[len] */ #define sgf_reduce_nuc _glp_sgf_reduce_nuc -void sgf_reduce_nuc(LUF *luf, int *k1, int *k2, int cnt[/*1+n*/], +int sgf_reduce_nuc(LUF *luf, int *k1, int *k2, int cnt[/*1+n*/], int list[/*1+n*/]); /* initial reordering to minimize nucleus size */ diff --git a/resources/3rdparty/glpk-4.57/src/bflib/sva.c b/resources/3rdparty/glpk-4.65/src/bflib/sva.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/sva.c rename to resources/3rdparty/glpk-4.65/src/bflib/sva.c diff --git a/resources/3rdparty/glpk-4.57/src/bflib/sva.h b/resources/3rdparty/glpk-4.65/src/bflib/sva.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bflib/sva.h rename to resources/3rdparty/glpk-4.65/src/bflib/sva.h diff --git a/resources/3rdparty/glpk-4.57/src/colamd/COPYING b/resources/3rdparty/glpk-4.65/src/colamd/COPYING similarity index 100% rename from resources/3rdparty/glpk-4.57/src/colamd/COPYING rename to resources/3rdparty/glpk-4.65/src/colamd/COPYING diff --git a/resources/3rdparty/glpk-4.57/src/colamd/README b/resources/3rdparty/glpk-4.65/src/colamd/README similarity index 100% rename from resources/3rdparty/glpk-4.57/src/colamd/README rename to resources/3rdparty/glpk-4.65/src/colamd/README diff --git a/resources/3rdparty/glpk-4.57/src/colamd/colamd.c b/resources/3rdparty/glpk-4.65/src/colamd/colamd.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/colamd/colamd.c rename to resources/3rdparty/glpk-4.65/src/colamd/colamd.c diff --git a/resources/3rdparty/glpk-4.57/src/colamd/colamd.h b/resources/3rdparty/glpk-4.65/src/colamd/colamd.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/colamd/colamd.h rename to resources/3rdparty/glpk-4.65/src/colamd/colamd.h diff --git a/resources/3rdparty/glpk-4.57/src/bfd.c b/resources/3rdparty/glpk-4.65/src/draft/bfd.c similarity index 94% rename from resources/3rdparty/glpk-4.57/src/bfd.c rename to resources/3rdparty/glpk-4.65/src/draft/bfd.c index 9e70619dc..dece376ca 100644 --- a/resources/3rdparty/glpk-4.57/src/bfd.c +++ b/resources/3rdparty/glpk-4.65/src/draft/bfd.c @@ -358,6 +358,24 @@ void bfd_ftran(BFD *bfd, double x[]) return; } +#if 1 /* 30/III-2016 */ +void bfd_ftran_s(BFD *bfd, FVS *x) +{ /* sparse version of bfd_ftran */ + /* (sparse mode is not implemented yet) */ + int n = x->n; + int *ind = x->ind; + double *vec = x->vec; + int j, nnz = 0; + bfd_ftran(bfd, vec); + for (j = n; j >= 1; j--) + { if (vec[j] != 0.0) + ind[++nnz] = j; + } + x->nnz = nnz; + return; +} +#endif + void bfd_btran(BFD *bfd, double x[]) { /* perform backward transformation (solve system B'* x = b) */ #ifdef GLP_DEBUG @@ -399,6 +417,24 @@ void bfd_btran(BFD *bfd, double x[]) return; } +#if 1 /* 30/III-2016 */ +void bfd_btran_s(BFD *bfd, FVS *x) +{ /* sparse version of bfd_btran */ + /* (sparse mode is not implemented yet) */ + int n = x->n; + int *ind = x->ind; + double *vec = x->vec; + int j, nnz = 0; + bfd_btran(bfd, vec); + for (j = n; j >= 1; j--) + { if (vec[j] != 0.0) + ind[++nnz] = j; + } + x->nnz = nnz; + return; +} +#endif + int bfd_update(BFD *bfd, int j, int len, const int ind[], const double val[]) { /* update LP basis factorization */ diff --git a/resources/3rdparty/glpk-4.57/src/bfd.h b/resources/3rdparty/glpk-4.65/src/draft/bfd.h similarity index 90% rename from resources/3rdparty/glpk-4.57/src/bfd.h rename to resources/3rdparty/glpk-4.65/src/draft/bfd.h index 1e18e561d..0ef4c0238 100644 --- a/resources/3rdparty/glpk-4.57/src/bfd.h +++ b/resources/3rdparty/glpk-4.65/src/draft/bfd.h @@ -25,6 +25,10 @@ #ifndef BFD_H #define BFD_H +#if 1 /* 30/III-2016 */ +#include "fvs.h" +#endif + typedef struct BFD BFD; /* return codes: */ @@ -69,10 +73,22 @@ double bfd_condest(BFD *bfd); void bfd_ftran(BFD *bfd, double x[]); /* perform forward transformation (solve system B*x = b) */ +#if 1 /* 30/III-2016 */ +#define bfd_ftran_s _glp_bfd_ftran_s +void bfd_ftran_s(BFD *bfd, FVS *x); +/* sparse version of bfd_ftran */ +#endif + #define bfd_btran _glp_bfd_btran void bfd_btran(BFD *bfd, double x[]); /* perform backward transformation (solve system B'*x = b) */ +#if 1 /* 30/III-2016 */ +#define bfd_btran_s _glp_bfd_btran_s +void bfd_btran_s(BFD *bfd, FVS *x); +/* sparse version of bfd_btran */ +#endif + #define bfd_update _glp_bfd_update int bfd_update(BFD *bfd, int j, int len, const int ind[], const double val[]); diff --git a/resources/3rdparty/glpk-4.57/src/bfx.c b/resources/3rdparty/glpk-4.65/src/draft/bfx.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/bfx.c rename to resources/3rdparty/glpk-4.65/src/draft/bfx.c diff --git a/resources/3rdparty/glpk-4.57/src/bfx.h b/resources/3rdparty/glpk-4.65/src/draft/bfx.h similarity index 99% rename from resources/3rdparty/glpk-4.57/src/bfx.h rename to resources/3rdparty/glpk-4.65/src/draft/bfx.h index 7d0aedaad..c67d5ea44 100644 --- a/resources/3rdparty/glpk-4.57/src/bfx.h +++ b/resources/3rdparty/glpk-4.65/src/draft/bfx.h @@ -25,7 +25,7 @@ #ifndef BFX_H #define BFX_H -#include "glpgmp.h" +#include "mygmp.h" typedef struct BFX BFX; diff --git a/resources/3rdparty/glpk-4.57/src/draft.h b/resources/3rdparty/glpk-4.65/src/draft/draft.h similarity index 55% rename from resources/3rdparty/glpk-4.57/src/draft.h rename to resources/3rdparty/glpk-4.65/src/draft/draft.h index b453acd48..cefd21248 100644 --- a/resources/3rdparty/glpk-4.57/src/draft.h +++ b/resources/3rdparty/glpk-4.65/src/draft/draft.h @@ -5,6 +5,9 @@ #ifndef DRAFT_H #define DRAFT_H +#if 1 /* 28/III-2016 */ +#define GLP_UNDOC 1 +#endif #include "glpk.h" #if 1 /* 28/XI-2009 */ @@ -14,19 +17,6 @@ int _glp_analyze_row(glp_prob *P, int len, const int ind[], /* simulate one iteration of dual simplex method */ #endif -#if 1 /* 08/XII-2009 */ -void _glp_mpl_init_rand(glp_tran *tran, int seed); -#endif - -#define glp_skpgen _glp_skpgen -void glp_skpgen(int n, int r, int type, int v, int s, int a[], - int *b, int c[]); -/* Pisinger's 0-1 single knapsack problem generator */ - -#if 1 /* 28/V-2010 */ -int _glp_intopt1(glp_prob *P, const glp_iocp *parm); -#endif - #endif /* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpapi06.c b/resources/3rdparty/glpk-4.65/src/draft/glpapi06.c similarity index 96% rename from resources/3rdparty/glpk-4.57/src/glpapi06.c rename to resources/3rdparty/glpk-4.65/src/draft/glpapi06.c index 715e1954e..a31e39681 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi06.c +++ b/resources/3rdparty/glpk-4.65/src/draft/glpapi06.c @@ -4,7 +4,7 @@ * This code is part of GLPK (GNU Linear Programming Kit). * * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* 2009, 2010, 2011, 2013, 2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,8 +23,8 @@ ***********************************************************************/ #include "env.h" -#include "glpios.h" -#include "glpnpp.h" +#include "ios.h" +#include "npp.h" #if 0 /* 07/XI-2015 */ #include "glpspx.h" #else @@ -369,8 +369,10 @@ int glp_simplex(glp_prob *P, const glp_smcp *parm) glp_smcp _parm; int i, j, ret; /* check problem object */ +#if 0 /* 04/IV-2016 */ if (P == NULL || P->magic != GLP_PROB_MAGIC) xerror("glp_simplex: P = %p; invalid problem object\n", P); +#endif if (P->tree != NULL && P->tree->reason != 0) xerror("glp_simplex: operation not allowed\n"); /* check control parameters */ @@ -393,6 +395,9 @@ int glp_simplex(glp_prob *P, const glp_smcp *parm) xerror("glp_simplex: pricing = %d; invalid parameter\n", parm->pricing); if (!(parm->r_test == GLP_RT_STD || +#if 1 /* 16/III-2016 */ + parm->r_test == GLP_RT_FLIP || +#endif parm->r_test == GLP_RT_HAR)) xerror("glp_simplex: r_test = %d; invalid parameter\n", parm->r_test); @@ -411,7 +416,11 @@ int glp_simplex(glp_prob *P, const glp_smcp *parm) if (parm->tm_lim < 0) xerror("glp_simplex: tm_lim = %d; invalid parameter\n", parm->tm_lim); +#if 0 /* 15/VII-2017 */ if (parm->out_frq < 1) +#else + if (parm->out_frq < 0) +#endif xerror("glp_simplex: out_frq = %d; invalid parameter\n", parm->out_frq); if (parm->out_dly < 0) @@ -420,6 +429,17 @@ int glp_simplex(glp_prob *P, const glp_smcp *parm) if (!(parm->presolve == GLP_ON || parm->presolve == GLP_OFF)) xerror("glp_simplex: presolve = %d; invalid parameter\n", parm->presolve); +#if 1 /* 11/VII-2017 */ + if (!(parm->excl == GLP_ON || parm->excl == GLP_OFF)) + xerror("glp_simplex: excl = %d; invalid parameter\n", + parm->excl); + if (!(parm->shift == GLP_ON || parm->shift == GLP_OFF)) + xerror("glp_simplex: shift = %d; invalid parameter\n", + parm->shift); + if (!(parm->aorn == GLP_USE_AT || parm->aorn == GLP_USE_NT)) + xerror("glp_simplex: aorn = %d; invalid parameter\n", + parm->aorn); +#endif /* basic solution is currently undefined */ P->pbs_stat = P->dbs_stat = GLP_UNDEF; P->obj_val = 0.0; @@ -495,9 +515,18 @@ void glp_init_smcp(glp_smcp *parm) parm->obj_ul = +DBL_MAX; parm->it_lim = INT_MAX; parm->tm_lim = INT_MAX; +#if 0 /* 15/VII-2017 */ parm->out_frq = 500; +#else + parm->out_frq = 5000; /* 5 seconds */ +#endif parm->out_dly = 0; parm->presolve = GLP_OFF; +#if 1 /* 11/VII-2017 */ + parm->excl = GLP_ON; + parm->shift = GLP_ON; + parm->aorn = GLP_USE_NT; +#endif return; } diff --git a/resources/3rdparty/glpk-4.57/src/glpapi07.c b/resources/3rdparty/glpk-4.65/src/draft/glpapi07.c similarity index 92% rename from resources/3rdparty/glpk-4.57/src/glpapi07.c rename to resources/3rdparty/glpk-4.65/src/draft/glpapi07.c index 5258a4dec..9ac294bdd 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi07.c +++ b/resources/3rdparty/glpk-4.65/src/draft/glpapi07.c @@ -4,7 +4,7 @@ * This code is part of GLPK (GNU Linear Programming Kit). * * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* 2009, 2010, 2011, 2013, 2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -267,6 +267,19 @@ int glp_exact(glp_prob *lp, const glp_smcp *parm) if (parm == NULL) parm = &_parm, glp_init_smcp((glp_smcp *)parm); /* check control parameters */ +#if 1 /* 25/XI-2017 */ + switch (parm->msg_lev) + { case GLP_MSG_OFF: + case GLP_MSG_ERR: + case GLP_MSG_ON: + case GLP_MSG_ALL: + case GLP_MSG_DBG: + break; + default: + xerror("glp_exact: msg_lev = %d; invalid parameter\n", + parm->msg_lev); + } +#endif if (parm->it_lim < 0) xerror("glp_exact: it_lim = %d; invalid parameter\n", parm->it_lim); @@ -275,7 +288,12 @@ int glp_exact(glp_prob *lp, const glp_smcp *parm) parm->tm_lim); /* the problem must have at least one row and one column */ if (!(m > 0 && n > 0)) +#if 0 /* 25/XI-2017 */ { xprintf("glp_exact: problem has no rows/columns\n"); +#else + { if (parm->msg_lev >= GLP_MSG_ERR) + xprintf("glp_exact: problem has no rows/columns\n"); +#endif return GLP_EFAIL; } #if 1 @@ -297,12 +315,22 @@ int glp_exact(glp_prob *lp, const glp_smcp *parm) ub = lp->col[k-m]->ub; } if (type == GLP_DB && lb >= ub) +#if 0 /* 25/XI-2017 */ { xprintf("glp_exact: %s %d has invalid bounds\n", k <= m ? "row" : "column", k <= m ? k : k-m); +#else + { if (parm->msg_lev >= GLP_MSG_ERR) + xprintf("glp_exact: %s %d has invalid bounds\n", + k <= m ? "row" : "column", k <= m ? k : k-m); +#endif return GLP_EBOUND; } } /* create the simplex solver workspace */ +#if 1 /* 25/XI-2017 */ + if (parm->msg_lev >= GLP_MSG_ALL) + { +#endif xprintf("glp_exact: %d rows, %d columns, %d non-zeros\n", m, n, nnz); #ifdef HAVE_GMP @@ -311,22 +339,33 @@ int glp_exact(glp_prob *lp, const glp_smcp *parm) xprintf("GLPK bignum module is being used\n"); xprintf("(Consider installing GNU MP to attain a much better perf" "ormance.)\n"); +#endif +#if 1 /* 25/XI-2017 */ + } #endif ssx = ssx_create(m, n, nnz); /* load LP problem data into the workspace */ load_data(ssx, lp); /* load current LP basis into the workspace */ if (load_basis(ssx, lp)) +#if 0 /* 25/XI-2017 */ { xprintf("glp_exact: initial LP basis is invalid\n"); +#else + { if (parm->msg_lev >= GLP_MSG_ERR) + xprintf("glp_exact: initial LP basis is invalid\n"); +#endif ret = GLP_EBADB; goto done; } - /* inherit some control parameters from the LP object */ #if 0 + /* inherit some control parameters from the LP object */ ssx->it_lim = lpx_get_int_parm(lp, LPX_K_ITLIM); ssx->it_cnt = lpx_get_int_parm(lp, LPX_K_ITCNT); ssx->tm_lim = lpx_get_real_parm(lp, LPX_K_TMLIM); #else +#if 1 /* 25/XI-2017 */ + ssx->msg_lev = parm->msg_lev; +#endif ssx->it_lim = parm->it_lim; ssx->it_cnt = lp->it_cnt; ssx->tm_lim = (double)parm->tm_lim / 1000.0; @@ -340,8 +379,8 @@ int glp_exact(glp_prob *lp, const glp_smcp *parm) #endif /* solve LP */ ret = ssx_driver(ssx); - /* copy back some statistics to the LP object */ #if 0 + /* copy back some statistics to the LP object */ lpx_set_int_parm(lp, LPX_K_ITLIM, ssx->it_lim); lpx_set_int_parm(lp, LPX_K_ITCNT, ssx->it_cnt); lpx_set_real_parm(lp, LPX_K_TMLIM, ssx->tm_lim); @@ -449,6 +488,10 @@ int glp_exact(glp_prob *lp, const glp_smcp *parm) lp->obj_val = sum; done: /* delete the simplex solver workspace */ ssx_delete(ssx); +#if 1 /* 23/XI-2015 */ + xassert(gmp_pool_count() == 0); + gmp_free_mem(); +#endif /* return to the application program */ return ret; } diff --git a/resources/3rdparty/glpk-4.57/src/glpapi08.c b/resources/3rdparty/glpk-4.65/src/draft/glpapi08.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpapi08.c rename to resources/3rdparty/glpk-4.65/src/draft/glpapi08.c index e7fc62e8f..652292cbb 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi08.c +++ b/resources/3rdparty/glpk-4.65/src/draft/glpapi08.c @@ -24,7 +24,7 @@ #include "env.h" #include "glpipm.h" -#include "glpnpp.h" +#include "npp.h" /*********************************************************************** * NAME diff --git a/resources/3rdparty/glpk-4.57/src/glpapi09.c b/resources/3rdparty/glpk-4.65/src/draft/glpapi09.c similarity index 98% rename from resources/3rdparty/glpk-4.57/src/glpapi09.c rename to resources/3rdparty/glpk-4.65/src/draft/glpapi09.c index a864e9b18..0d3ab57b5 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi09.c +++ b/resources/3rdparty/glpk-4.65/src/draft/glpapi09.c @@ -4,7 +4,7 @@ * This code is part of GLPK (GNU Linear Programming Kit). * * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* 2009, 2010, 2011, 2013, 2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -24,8 +24,8 @@ #include "draft.h" #include "env.h" -#include "glpios.h" -#include "glpnpp.h" +#include "ios.h" +#include "npp.h" /*********************************************************************** * NAME @@ -379,10 +379,14 @@ static int preprocess_and_solve_mip(glp_prob *P, const glp_iocp *parm) xprintf("Solving LP relaxation...\n"); glp_init_smcp(&smcp); smcp.msg_lev = parm->msg_lev; + /* respect time limit */ + smcp.tm_lim = parm->tm_lim; mip->it_cnt = P->it_cnt; ret = glp_simplex(mip, &smcp); P->it_cnt = mip->it_cnt; - if (ret != 0) + if (ret == GLP_ETMLIM) + goto done; + else if (ret != 0) { if (parm->msg_lev >= GLP_MSG_ERR) xprintf("glp_intopt: cannot solve LP relaxation\n"); ret = GLP_EFAIL; @@ -442,9 +446,11 @@ int glp_intopt(glp_prob *P, const glp_iocp *parm) { /* solve MIP problem with the branch-and-bound method */ glp_iocp _parm; int i, j, ret; +#if 0 /* 04/IV-2016 */ /* check problem object */ if (P == NULL || P->magic != GLP_PROB_MAGIC) xerror("glp_intopt: P = %p; invalid problem object\n", P); +#endif if (P->tree != NULL) xerror("glp_intopt: operation not allowed\n"); /* check control parameters */ @@ -679,6 +685,13 @@ void glp_init_iocp(glp_iocp *parm) parm->use_sol = GLP_OFF; parm->save_sol = NULL; parm->alien = GLP_OFF; +#endif +#if 0 /* 20/I-2018 */ +#if 1 /* 16/III-2016; not documented--should not be used */ + parm->flip = GLP_OFF; +#endif +#else + parm->flip = GLP_ON; #endif return; } diff --git a/resources/3rdparty/glpk-4.57/src/glpapi10.c b/resources/3rdparty/glpk-4.65/src/draft/glpapi10.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/glpapi10.c rename to resources/3rdparty/glpk-4.65/src/draft/glpapi10.c diff --git a/resources/3rdparty/glpk-4.57/src/glpapi12.c b/resources/3rdparty/glpk-4.65/src/draft/glpapi12.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpapi12.c rename to resources/3rdparty/glpk-4.65/src/draft/glpapi12.c index 120953048..020c89811 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi12.c +++ b/resources/3rdparty/glpk-4.65/src/draft/glpapi12.c @@ -1799,10 +1799,12 @@ void glp_analyze_bound(glp_prob *P, int k, double *value1, int *var1, GLPCOL *col; int m, n, stat, kase, p, len, piv, *ind; double x, new_x, ll, uu, xx, delta, *val; +#if 0 /* 04/IV-2016 */ /* sanity checks */ if (P == NULL || P->magic != GLP_PROB_MAGIC) xerror("glp_analyze_bound: P = %p; invalid problem object\n", P); +#endif m = P->m, n = P->n; if (!(P->pbs_stat == GLP_FEAS && P->dbs_stat == GLP_FEAS)) xerror("glp_analyze_bound: optimal basic solution required\n"); @@ -1964,10 +1966,12 @@ void glp_analyze_coef(glp_prob *P, int k, double *coef1, int *var1, *cind, *rind; double lb, ub, coef, x, lim_coef, new_x, d, delta, ll, uu, xx, *rval, *cval; +#if 0 /* 04/IV-2016 */ /* sanity checks */ if (P == NULL || P->magic != GLP_PROB_MAGIC) xerror("glp_analyze_coef: P = %p; invalid problem object\n", P); +#endif m = P->m, n = P->n; if (!(P->pbs_stat == GLP_FEAS && P->dbs_stat == GLP_FEAS)) xerror("glp_analyze_coef: optimal basic solution required\n"); diff --git a/resources/3rdparty/glpk-4.57/src/glpapi13.c b/resources/3rdparty/glpk-4.65/src/draft/glpapi13.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpapi13.c rename to resources/3rdparty/glpk-4.65/src/draft/glpapi13.c index a4ad10b66..1181b3975 100644 --- a/resources/3rdparty/glpk-4.57/src/glpapi13.c +++ b/resources/3rdparty/glpk-4.65/src/draft/glpapi13.c @@ -4,7 +4,7 @@ * This code is part of GLPK (GNU Linear Programming Kit). * * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* 2009, 2010, 2011, 2013, 2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +23,7 @@ ***********************************************************************/ #include "env.h" -#include "glpios.h" +#include "ios.h" /*********************************************************************** * NAME @@ -457,7 +457,11 @@ int glp_ios_pool_size(glp_tree *tree) if (tree->reason != GLP_ICUTGEN) xerror("glp_ios_pool_size: operation not allowed\n"); xassert(tree->local != NULL); +#ifdef NEW_LOCAL /* 02/II-2018 */ + return tree->local->m; +#else return tree->local->size; +#endif } /**********************************************************************/ diff --git a/resources/3rdparty/glpk-4.57/src/glphbm.c b/resources/3rdparty/glpk-4.65/src/draft/glphbm.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glphbm.c rename to resources/3rdparty/glpk-4.65/src/draft/glphbm.c index 100ece6e2..8b33c172f 100644 --- a/resources/3rdparty/glpk-4.57/src/glphbm.c +++ b/resources/3rdparty/glpk-4.65/src/draft/glphbm.c @@ -4,7 +4,7 @@ * This code is part of GLPK (GNU Linear Programming Kit). * * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* 2009, 2010, 2011, 2013, 2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -341,7 +341,11 @@ HBM *hbm_read_mat(const char *fname) dsa->fp = fopen(dsa->fname, "r"); if (dsa->fp == NULL) { xprintf("hbm_read_mat: unable to open '%s' - %s\n", +#if 0 /* 29/I-2017 */ dsa->fname, strerror(errno)); +#else + dsa->fname, xstrerr(errno)); +#endif goto fail; } dsa->seqn = 0; diff --git a/resources/3rdparty/glpk-4.57/src/glphbm.h b/resources/3rdparty/glpk-4.65/src/draft/glphbm.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/glphbm.h rename to resources/3rdparty/glpk-4.65/src/draft/glphbm.h diff --git a/resources/3rdparty/glpk-4.57/src/glpios01.c b/resources/3rdparty/glpk-4.65/src/draft/glpios01.c similarity index 95% rename from resources/3rdparty/glpk-4.57/src/glpios01.c rename to resources/3rdparty/glpk-4.65/src/draft/glpios01.c index da1b9479f..cb1a0dabd 100644 --- a/resources/3rdparty/glpk-4.57/src/glpios01.c +++ b/resources/3rdparty/glpk-4.65/src/draft/glpios01.c @@ -4,7 +4,7 @@ * This code is part of GLPK (GNU Linear Programming Kit). * * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* 2009, 2010, 2011, 2013, 2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +23,7 @@ ***********************************************************************/ #include "env.h" -#include "glpios.h" +#include "ios.h" #include "misc.h" static int lpx_eval_tab_row(glp_prob *lp, int k, int ind[], @@ -125,13 +125,16 @@ glp_tree *ios_create_tree(glp_prob *mip, const glp_iocp *parm) tree->pred_type = NULL; tree->pred_lb = tree->pred_ub = NULL; tree->pred_stat = NULL; - /* cut generator */ + /* cut generators */ tree->local = ios_create_pool(tree); /*tree->first_attempt = 1;*/ /*tree->max_added_cuts = 0;*/ /*tree->min_eff = 0.0;*/ /*tree->miss = 0;*/ /*tree->just_selected = 0;*/ +#ifdef NEW_COVER /* 13/II-2018 */ + tree->cov_gen = NULL; +#endif tree->mir_gen = NULL; tree->clq_gen = NULL; /*tree->round = 0;*/ @@ -1336,6 +1339,15 @@ int ios_solve_node(glp_tree *tree) xassert(tree != tree); } parm.meth = GLP_DUALP; +#if 1 /* 16/III-2016 */ + if (tree->parm->flip) + parm.r_test = GLP_RT_FLIP; +#endif + /* respect time limit */ + if (tree->parm->tm_lim < INT_MAX) + parm.tm_lim = tree->parm->tm_lim - (glp_time() - tree->tm_beg); + if (parm.tm_lim < 0) + parm.tm_lim = 0; if (tree->parm->msg_lev < GLP_MSG_DBG) parm.out_dly = tree->parm->out_dly; else @@ -1356,6 +1368,13 @@ int ios_solve_node(glp_tree *tree) } /* try to solve/re-optimize the LP relaxation */ ret = glp_simplex(mip, &parm); +#if 1 /* 21/II-2016 by Chris */ + if (ret == GLP_EFAIL) + { /* retry with a new basis */ + glp_adv_basis(mip, 0); + ret = glp_simplex(mip, &parm); + } +#endif tree->curr->solved++; #if 0 xprintf("ret = %d; status = %d; pbs = %d; dbs = %d; some = %d\n", @@ -1368,6 +1387,15 @@ int ios_solve_node(glp_tree *tree) /**********************************************************************/ +#ifdef NEW_LOCAL /* 02/II-2018 */ +IOSPOOL *ios_create_pool(glp_tree *tree) +{ /* create cut pool */ + IOSPOOL *pool; + pool = glp_create_prob(); + glp_add_cols(pool, tree->mip->n); + return pool; +} +#else IOSPOOL *ios_create_pool(glp_tree *tree) { /* create cut pool */ IOSPOOL *pool; @@ -1382,7 +1410,23 @@ IOSPOOL *ios_create_pool(glp_tree *tree) pool->ord = 0, pool->curr = NULL; return pool; } +#endif +#ifdef NEW_LOCAL /* 02/II-2018 */ +int ios_add_row(glp_tree *tree, IOSPOOL *pool, + const char *name, int klass, int flags, int len, const int ind[], + const double val[], int type, double rhs) +{ /* add row (constraint) to the cut pool */ + int i; + i = glp_add_rows(pool, 1); + glp_set_row_name(pool, i, name); + pool->row[i]->klass = klass; + xassert(flags == 0); + glp_set_mat_row(pool, i, len, ind, val); + glp_set_row_bnds(pool, i, type, rhs, rhs); + return i; +} +#else int ios_add_row(glp_tree *tree, IOSPOOL *pool, const char *name, int klass, int flags, int len, const int ind[], const double val[], int type, double rhs) @@ -1441,7 +1485,14 @@ int ios_add_row(glp_tree *tree, IOSPOOL *pool, pool->size++; return pool->size; } +#endif +#ifdef NEW_LOCAL /* 02/II-2018 */ +IOSCUT *ios_find_row(IOSPOOL *pool, int i) +{ /* find row (constraint) in the cut pool */ + xassert(0); +} +#else IOSCUT *ios_find_row(IOSPOOL *pool, int i) { /* find row (constraint) in the cut pool */ /* (smart linear search) */ @@ -1493,7 +1544,14 @@ IOSCUT *ios_find_row(IOSPOOL *pool, int i) xassert(pool->curr != NULL); return pool->curr; } +#endif +#ifdef NEW_LOCAL /* 02/II-2018 */ +void ios_del_row(glp_tree *tree, IOSPOOL *pool, int i) +{ /* remove row (constraint) from the cut pool */ + xassert(0); +} +#else void ios_del_row(glp_tree *tree, IOSPOOL *pool, int i) { /* remove row (constraint) from the cut pool */ IOSCUT *cut; @@ -1537,7 +1595,22 @@ void ios_del_row(glp_tree *tree, IOSPOOL *pool, int i) pool->size--; return; } +#endif +#ifdef NEW_LOCAL /* 02/II-2018 */ +void ios_clear_pool(glp_tree *tree, IOSPOOL *pool) +{ /* remove all rows (constraints) from the cut pool */ + if (pool->m > 0) + { int i, *num; + num = talloc(1+pool->m, int); + for (i = 1; i <= pool->m; i++) + num[i] = i; + glp_del_rows(pool, pool->m, num); + tfree(num); + } + return; +} +#else void ios_clear_pool(glp_tree *tree, IOSPOOL *pool) { /* remove all rows (constraints) from the cut pool */ xassert(pool != NULL); @@ -1558,7 +1631,16 @@ void ios_clear_pool(glp_tree *tree, IOSPOOL *pool) pool->ord = 0, pool->curr = NULL; return; } +#endif +#ifdef NEW_LOCAL /* 02/II-2018 */ +void ios_delete_pool(glp_tree *tree, IOSPOOL *pool) +{ /* delete cut pool */ + xassert(pool != NULL); + glp_delete_prob(pool); + return; +} +#else void ios_delete_pool(glp_tree *tree, IOSPOOL *pool) { /* delete cut pool */ xassert(pool != NULL); @@ -1566,9 +1648,10 @@ void ios_delete_pool(glp_tree *tree, IOSPOOL *pool) xfree(pool); return; } +#endif #if 1 /* 11/VII-2013 */ -#include "glpnpp.h" +#include "npp.h" void ios_process_sol(glp_tree *T) { /* process integer feasible solution just found */ diff --git a/resources/3rdparty/glpk-4.57/src/glpios02.c b/resources/3rdparty/glpk-4.65/src/draft/glpios02.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpios02.c rename to resources/3rdparty/glpk-4.65/src/draft/glpios02.c index 43cff57e1..a73458aad 100644 --- a/resources/3rdparty/glpk-4.57/src/glpios02.c +++ b/resources/3rdparty/glpk-4.65/src/draft/glpios02.c @@ -4,7 +4,7 @@ * This code is part of GLPK (GNU Linear Programming Kit). * * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* 2009, 2010, 2011, 2013, 2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +23,7 @@ ***********************************************************************/ #include "env.h" -#include "glpios.h" +#include "ios.h" /*********************************************************************** * prepare_row_info - prepare row info to determine implied bounds diff --git a/resources/3rdparty/glpk-4.57/src/glpios03.c b/resources/3rdparty/glpk-4.65/src/draft/glpios03.c similarity index 90% rename from resources/3rdparty/glpk-4.57/src/glpios03.c rename to resources/3rdparty/glpk-4.65/src/draft/glpios03.c index 29ea32e2c..21d6a0007 100644 --- a/resources/3rdparty/glpk-4.57/src/glpios03.c +++ b/resources/3rdparty/glpk-4.65/src/draft/glpios03.c @@ -4,7 +4,7 @@ * This code is part of GLPK (GNU Linear Programming Kit). * * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* 2009, 2010, 2011, 2013, 2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +23,7 @@ ***********************************************************************/ #include "env.h" -#include "glpios.h" +#include "ios.h" /*********************************************************************** * show_progress - display current progress of the search @@ -72,7 +72,10 @@ static void show_progress(glp_tree *T, int bingo) else if (temp == +DBL_MAX) sprintf(best_bound, "%17s", "+inf"); else + { if (fabs(temp) < 1e-9) + temp = 0; sprintf(best_bound, "%17.9e", temp); + } } /* choose the relation sign between global bounds */ if (T->mip->dir == GLP_MIN) @@ -633,62 +636,107 @@ done: tfree(x); return ret; } -#if 0 -#define round_heur round_heur2 -static int round_heur(glp_tree *T) -{ glp_prob *lp; - int *ind, ret, i, j, len; - double *val; - lp = glp_create_prob(); - ind = talloc(1+T->mip->n, int); - val = talloc(1+T->mip->n, double); - glp_add_rows(lp, T->orig_m); - glp_add_cols(lp, T->n); - for (i = 1; i <= T->orig_m; i++) - { glp_set_row_bnds(lp, i, - T->orig_type[i], T->orig_lb[i], T->orig_ub[i]); - len = glp_get_mat_row(T->mip, i, ind, val); - glp_set_mat_row(lp, i, len, ind, val); - } - for (j = 1; j <= T->n; j++) - { GLPCOL *col = T->mip->col[j]; - glp_set_obj_coef(lp, j, col->coef); - if (col->kind == GLP_IV) - { /* integer variable */ - glp_set_col_bnds(lp, j, GLP_FX, floor(col->prim + .5), 0); - } - else - { glp_set_col_bnds(lp, j, T->orig_type[T->orig_m+j], - T->orig_lb[T->orig_m+j], T->orig_ub[T->orig_m+j]); +/**********************************************************************/ + +#if 1 /* 08/III-2016 */ +static void gmi_gen(glp_tree *T) +{ /* generate Gomory's mixed integer cuts */ + glp_prob *P, *pool; + P = T->mip; + pool = glp_create_prob(); + glp_add_cols(pool, P->n); + glp_gmi_gen(P, pool, 50); + if (pool->m > 0) + { int i, len, *ind; + double *val; + ind = xcalloc(1+P->n, sizeof(int)); + val = xcalloc(1+P->n, sizeof(double)); + for (i = 1; i <= pool->m; i++) + { len = glp_get_mat_row(pool, i, ind, val); + glp_ios_add_row(T, NULL, GLP_RF_GMI, 0, len, ind, val, + GLP_LO, pool->row[i]->lb); } + xfree(ind); + xfree(val); } -glp_term_out(GLP_OFF); - glp_adv_basis(lp, 0); - ret = glp_simplex(lp, NULL); -glp_term_out(GLP_ON); - if (ret != 0) - { ret = 1; - goto done; + glp_delete_prob(pool); + return; +} +#endif + +#ifdef NEW_COVER /* 13/II-2018 */ +static void cov_gen(glp_tree *T) +{ /* generate cover cuts */ + glp_prob *P, *pool; + if (T->cov_gen == NULL) + return; + P = T->mip; + pool = glp_create_prob(); + glp_add_cols(pool, P->n); + glp_cov_gen1(P, T->cov_gen, pool); + if (pool->m > 0) + { int i, len, *ind; + double *val; + ind = xcalloc(1+P->n, sizeof(int)); + val = xcalloc(1+P->n, sizeof(double)); + for (i = 1; i <= pool->m; i++) + { len = glp_get_mat_row(pool, i, ind, val); + glp_ios_add_row(T, NULL, GLP_RF_COV, 0, len, ind, val, + GLP_UP, pool->row[i]->ub); + } + xfree(ind); + xfree(val); } - if (glp_get_status(lp) != GLP_OPT) - { ret = 2; - goto done; + glp_delete_prob(pool); + return; +} +#endif + +#if 1 /* 08/III-2016 */ +static void mir_gen(glp_tree *T) +{ /* generate mixed integer rounding cuts */ + glp_prob *P, *pool; + P = T->mip; + pool = glp_create_prob(); + glp_add_cols(pool, P->n); + glp_mir_gen(P, T->mir_gen, pool); + if (pool->m > 0) + { int i, len, *ind; + double *val; + ind = xcalloc(1+P->n, sizeof(int)); + val = xcalloc(1+P->n, sizeof(double)); + for (i = 1; i <= pool->m; i++) + { len = glp_get_mat_row(pool, i, ind, val); + glp_ios_add_row(T, NULL, GLP_RF_MIR, 0, len, ind, val, + GLP_UP, pool->row[i]->ub); + } + xfree(ind); + xfree(val); } - for (j = 1; j <= lp->n; j++) - val[j] = lp->col[j]->prim; - if (glp_ios_heur_sol(T, val) == 0) - ret = 0; - else - ret = 3; -done: glp_delete_prob(lp); + glp_delete_prob(pool); + return; +} +#endif + +#if 1 /* 08/III-2016 */ +static void clq_gen(glp_tree *T, glp_cfg *G) +{ /* generate clique cut from conflict graph */ + glp_prob *P = T->mip; + int n = P->n; + int len, *ind; + double *val; + ind = talloc(1+n, int); + val = talloc(1+n, double); + len = glp_clq_cut(T->mip, G, ind, val); + if (len > 0) + glp_ios_add_row(T, NULL, GLP_RF_CLQ, 0, len, ind, val, GLP_UP, + val[0]); tfree(ind); tfree(val); - return ret; + return; } #endif -/**********************************************************************/ - static void generate_cuts(glp_tree *T) { /* generate generic cuts with built-in generators */ if (!(T->parm->mir_cuts == GLP_ON || @@ -711,16 +759,27 @@ static void generate_cuts(glp_tree *T) /* generate and add to POOL all cuts violated by x* */ if (T->parm->gmi_cuts == GLP_ON) { if (T->curr->changed < 7) +#if 0 /* 08/III-2016 */ ios_gmi_gen(T); +#else + gmi_gen(T); +#endif } if (T->parm->mir_cuts == GLP_ON) { xassert(T->mir_gen != NULL); +#if 0 /* 08/III-2016 */ ios_mir_gen(T, T->mir_gen); +#else + mir_gen(T); +#endif } if (T->parm->cov_cuts == GLP_ON) { /* cover cuts works well along with mir cuts */ - /*if (T->round <= 5)*/ - ios_cov_gen(T); +#ifdef NEW_COVER /* 13/II-2018 */ + cov_gen(T); +#else + ios_cov_gen(T); +#endif } if (T->parm->clq_cuts == GLP_ON) { if (T->clq_gen != NULL) @@ -731,7 +790,11 @@ static void generate_cuts(glp_tree *T) { if (T->curr->level == 0 && T->curr->changed < 500 || T->curr->level > 0 && T->curr->changed < 50) #endif +#if 0 /* 08/III-2016 */ ios_clq_gen(T, T->clq_gen); +#else + clq_gen(T, T->clq_gen); +#endif } } done: return; @@ -851,8 +914,19 @@ int ios_driver(glp_tree *T) #else double ttt = T->tm_beg; #endif +#if 1 /* 27/II-2016 by Chris */ + int root_done = 0; +#endif #if 0 ((glp_iocp *)T->parm)->msg_lev = GLP_MSG_DBG; +#endif +#if 1 /* 16/III-2016 */ + if (((glp_iocp *)T->parm)->flip) +#if 0 /* 20/I-2018 */ + xprintf("WARNING: LONG-STEP DUAL SIMPLEX WILL BE USED\n"); +#else + xprintf("Long-step dual simplex will be used\n"); +#endif #endif /* on entry to the B&B driver it is assumed that the active list contains the only active (i.e. root) subproblem, which is the @@ -939,17 +1013,29 @@ loop: /* main loop starts here */ { if (T->parm->msg_lev >= GLP_MSG_ALL) xprintf("MIR cuts enabled\n"); xassert(T->mir_gen == NULL); +#if 0 /* 06/III-2016 */ T->mir_gen = ios_mir_init(T); +#else + T->mir_gen = glp_mir_init(T->mip); +#endif } if (T->parm->cov_cuts == GLP_ON) { if (T->parm->msg_lev >= GLP_MSG_ALL) xprintf("Cover cuts enabled\n"); +#ifdef NEW_COVER /* 13/II-2018 */ + xassert(T->cov_gen == NULL); + T->cov_gen = glp_cov_init(T->mip); +#endif } if (T->parm->clq_cuts == GLP_ON) { xassert(T->clq_gen == NULL); if (T->parm->msg_lev >= GLP_MSG_ALL) xprintf("Clique cuts enabled\n"); +#if 0 /* 08/III-2016 */ T->clq_gen = ios_clq_init(T); +#else + T->clq_gen = glp_cfg_init(T->mip); +#endif } } #if 1 /* 18/VII-2013 */ @@ -1014,13 +1100,21 @@ more: /* minor loop starts here */ if (T->parm->pp_tech == GLP_PP_NONE) ; else if (T->parm->pp_tech == GLP_PP_ROOT) +#if 0 /* 27/II-2016 by Chris */ { if (T->curr->level == 0) +#else + { if (!root_done) +#endif { if (ios_preprocess_node(T, 100)) goto fath; } } else if (T->parm->pp_tech == GLP_PP_ALL) +#if 0 /* 27/II-2016 by Chris */ { if (ios_preprocess_node(T, T->curr->level == 0 ? 100 : 10)) +#else + { if (ios_preprocess_node(T, !root_done ? 100 : 10)) +#endif goto fath; } else @@ -1034,7 +1128,9 @@ more: /* minor loop starts here */ if (T->parm->msg_lev >= GLP_MSG_DBG) xprintf("Solving LP relaxation...\n"); ret = ios_solve_node(T); - if (!(ret == 0 || ret == GLP_EOBJLL || ret == GLP_EOBJUL)) + if (ret == GLP_ETMLIM) + goto done; + else if (!(ret == 0 || ret == GLP_EOBJLL || ret == GLP_EOBJUL)) { if (T->parm->msg_lev >= GLP_MSG_ERR) xprintf("ios_driver: unable to solve current LP relaxation;" " glp_simplex returned %d\n", ret); @@ -1193,7 +1289,11 @@ more: /* minor loop starts here */ } } /* try to find solution with the feasibility pump heuristic */ +#if 0 /* 27/II-2016 by Chris */ if (T->parm->fp_heur) +#else + if (T->parm->fp_heur && !root_done) +#endif { xassert(T->reason == 0); T->reason = GLP_IHEUR; ios_feas_pump(T); @@ -1208,7 +1308,11 @@ more: /* minor loop starts here */ } #if 1 /* 25/V-2013 */ /* try to find solution with the proximity search heuristic */ +#if 0 /* 27/II-2016 by Chris */ if (T->parm->ps_heur) +#else + if (T->parm->ps_heur && !root_done) +#endif { xassert(T->reason == 0); T->reason = GLP_IHEUR; ios_proxy_heur(T); @@ -1240,7 +1344,11 @@ more: /* minor loop starts here */ #endif /* it's time to generate cutting planes */ xassert(T->local != NULL); +#ifdef NEW_LOCAL /* 02/II-2018 */ + xassert(T->local->m == 0); +#else xassert(T->local->size == 0); +#endif /* let the application program generate some cuts; note that it can add cuts either to the local cut pool or directly to the current subproblem */ @@ -1263,14 +1371,22 @@ more: /* minor loop starts here */ bad_cut = 0; } old_obj = T->curr->lp_obj; +#if 0 /* 27/II-2016 by Chris */ if (bad_cut == 0 || (T->curr->level == 0 && bad_cut <= 3)) +#else + if (bad_cut == 0 || (!root_done && bad_cut <= 3)) +#endif #endif /* try to generate generic cuts with built-in generators (as suggested by Prof. Fischetti et al. the built-in cuts are not generated at each branching node; an intense attempt of generating new cuts is only made at the root node, and then a moderate effort is spent after each backtracking step) */ +#if 0 /* 27/II-2016 by Chris */ if (T->curr->level == 0 || pred_p == 0) +#else + if (!root_done || pred_p == 0) +#endif { xassert(T->reason == 0); T->reason = GLP_ICUTGEN; generate_cuts(T); @@ -1278,7 +1394,11 @@ more: /* minor loop starts here */ } /* if the local cut pool is not empty, select useful cuts and add them to the current subproblem */ +#ifdef NEW_LOCAL /* 02/II-2018 */ + if (T->local->m > 0) +#else if (T->local->size > 0) +#endif { xassert(T->reason == 0); T->reason = GLP_ICUTGEN; ios_process_cuts(T); @@ -1294,8 +1414,16 @@ more: /* minor loop starts here */ } /* no cuts were generated; remove inactive cuts */ remove_cuts(T); +#if 0 /* 27/II-2016 by Chris */ if (T->parm->msg_lev >= GLP_MSG_ALL && T->curr->level == 0) +#else + if (T->parm->msg_lev >= GLP_MSG_ALL && !root_done) +#endif display_cut_info(T); +#if 1 /* 27/II-2016 by Chris */ + /* the first node will not be treated as root any more */ + if (!root_done) root_done = 1; +#endif /* update history information used on pseudocost branching */ if (T->pcost != NULL) ios_pcost_update(T); /* it's time to perform branching */ @@ -1362,9 +1490,21 @@ done: /* display progress of the search on exit from the solver */ if (T->parm->msg_lev >= GLP_MSG_ON) show_progress(T, 0); if (T->mir_gen != NULL) +#if 0 /* 06/III-2016 */ ios_mir_term(T->mir_gen), T->mir_gen = NULL; +#else + glp_mir_free(T->mir_gen), T->mir_gen = NULL; +#endif +#ifdef NEW_COVER /* 13/II-2018 */ + if (T->cov_gen != NULL) + glp_cov_free(T->cov_gen), T->cov_gen = NULL; +#endif if (T->clq_gen != NULL) +#if 0 /* 08/III-2016 */ ios_clq_term(T->clq_gen), T->clq_gen = NULL; +#else + glp_cfg_free(T->clq_gen), T->clq_gen = NULL; +#endif /* return to the calling program */ return ret; } diff --git a/resources/3rdparty/glpk-4.57/src/glpios07.c b/resources/3rdparty/glpk-4.65/src/draft/glpios07.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpios07.c rename to resources/3rdparty/glpk-4.65/src/draft/glpios07.c index 3ea515b67..f750e571b 100644 --- a/resources/3rdparty/glpk-4.57/src/glpios07.c +++ b/resources/3rdparty/glpk-4.65/src/draft/glpios07.c @@ -4,7 +4,7 @@ * This code is part of GLPK (GNU Linear Programming Kit). * * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* 2009, 2010, 2011, 2013, 2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +23,7 @@ ***********************************************************************/ #include "env.h" -#include "glpios.h" +#include "ios.h" /*---------------------------------------------------------------------- -- COVER INEQUALITIES diff --git a/resources/3rdparty/glpk-4.57/src/glpios09.c b/resources/3rdparty/glpk-4.65/src/draft/glpios09.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpios09.c rename to resources/3rdparty/glpk-4.65/src/draft/glpios09.c index d87578cbc..d80ed9a3a 100644 --- a/resources/3rdparty/glpk-4.57/src/glpios09.c +++ b/resources/3rdparty/glpk-4.65/src/draft/glpios09.c @@ -4,7 +4,7 @@ * This code is part of GLPK (GNU Linear Programming Kit). * * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* 2009, 2010, 2011, 2013, 2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +23,7 @@ ***********************************************************************/ #include "env.h" -#include "glpios.h" +#include "ios.h" /*********************************************************************** * NAME diff --git a/resources/3rdparty/glpk-4.57/src/glpios11.c b/resources/3rdparty/glpk-4.65/src/draft/glpios11.c similarity index 63% rename from resources/3rdparty/glpk-4.57/src/glpios11.c rename to resources/3rdparty/glpk-4.65/src/draft/glpios11.c index a9f4854d8..09fccef6b 100644 --- a/resources/3rdparty/glpk-4.57/src/glpios11.c +++ b/resources/3rdparty/glpk-4.65/src/draft/glpios11.c @@ -4,9 +4,9 @@ * This code is part of GLPK (GNU Linear Programming Kit). * * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied -* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights -* reserved. E-mail: . +* 2009, 2010, 2011, 2013, 2017, 2018 Andrew Makhorin, Department for +* Applied Informatics, Moscow Aviation Institute, Moscow, Russia. All +* rights reserved. E-mail: . * * GLPK is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ #include "draft.h" #include "env.h" -#include "glpios.h" +#include "ios.h" /*********************************************************************** * NAME @@ -66,7 +66,7 @@ struct info /* lower bound to objective degradation */ }; -static int fcmp(const void *arg1, const void *arg2) +static int CDECL fcmp(const void *arg1, const void *arg2) { const struct info *info1 = arg1, *info2 = arg2; if (info1->deg == 0.0 && info2->deg == 0.0) { if (info1->eff > info2->eff) return -1; @@ -81,6 +81,138 @@ static int fcmp(const void *arg1, const void *arg2) static double parallel(IOSCUT *a, IOSCUT *b, double work[]); +#ifdef NEW_LOCAL /* 02/II-2018 */ +void ios_process_cuts(glp_tree *T) +{ IOSPOOL *pool; + IOSCUT *cut; + GLPAIJ *aij; + struct info *info; + int k, kk, max_cuts, len, ret, *ind; + double *val, *work, rhs; + /* the current subproblem must exist */ + xassert(T->curr != NULL); + /* the pool must exist and be non-empty */ + pool = T->local; + xassert(pool != NULL); + xassert(pool->m > 0); + /* allocate working arrays */ + info = xcalloc(1+pool->m, sizeof(struct info)); + ind = xcalloc(1+T->n, sizeof(int)); + val = xcalloc(1+T->n, sizeof(double)); + work = xcalloc(1+T->n, sizeof(double)); + for (k = 1; k <= T->n; k++) work[k] = 0.0; + /* build the list of cuts stored in the cut pool */ + for (k = 1; k <= pool->m; k++) + info[k].cut = pool->row[k], info[k].flag = 0; + /* estimate efficiency of all cuts in the cut pool */ + for (k = 1; k <= pool->m; k++) + { double temp, dy, dz; + cut = info[k].cut; + /* build the vector of cut coefficients and compute its + Euclidean norm */ + len = 0; temp = 0.0; + for (aij = cut->ptr; aij != NULL; aij = aij->r_next) + { xassert(1 <= aij->col->j && aij->col->j <= T->n); + len++, ind[len] = aij->col->j, val[len] = aij->val; + temp += aij->val * aij->val; + } + if (temp < DBL_EPSILON * DBL_EPSILON) temp = DBL_EPSILON; + /* transform the cut to express it only through non-basic + (auxiliary and structural) variables */ + len = glp_transform_row(T->mip, len, ind, val); + /* determine change in the cut value and in the objective + value for the adjacent basis by simulating one step of the + dual simplex */ + switch (cut->type) + { case GLP_LO: rhs = cut->lb; break; + case GLP_UP: rhs = cut->ub; break; + default: xassert(cut != cut); + } + ret = _glp_analyze_row(T->mip, len, ind, val, cut->type, + rhs, 1e-9, NULL, NULL, NULL, NULL, &dy, &dz); + /* determine normalized residual and lower bound to objective + degradation */ + if (ret == 0) + { info[k].eff = fabs(dy) / sqrt(temp); + /* if some reduced costs violates (slightly) their zero + bounds (i.e. have wrong signs) due to round-off errors, + dz also may have wrong sign being close to zero */ + if (T->mip->dir == GLP_MIN) + { if (dz < 0.0) dz = 0.0; + info[k].deg = + dz; + } + else /* GLP_MAX */ + { if (dz > 0.0) dz = 0.0; + info[k].deg = - dz; + } + } + else if (ret == 1) + { /* the constraint is not violated at the current point */ + info[k].eff = info[k].deg = 0.0; + } + else if (ret == 2) + { /* no dual feasible adjacent basis exists */ + info[k].eff = 1.0; + info[k].deg = DBL_MAX; + } + else + xassert(ret != ret); + /* if the degradation is too small, just ignore it */ + if (info[k].deg < 0.01) info[k].deg = 0.0; + } + /* sort the list of cuts by decreasing objective degradation and + then by decreasing efficacy */ + qsort(&info[1], pool->m, sizeof(struct info), fcmp); + /* only first (most efficient) max_cuts in the list are qualified + as candidates to be added to the current subproblem */ + max_cuts = (T->curr->level == 0 ? 90 : 10); + if (max_cuts > pool->m) max_cuts = pool->m; + /* add cuts to the current subproblem */ +#if 0 + xprintf("*** adding cuts ***\n"); +#endif + for (k = 1; k <= max_cuts; k++) + { int i, len; + /* if this cut seems to be inefficient, skip it */ + if (info[k].deg < 0.01 && info[k].eff < 0.01) continue; + /* if the angle between this cut and every other cut included + in the current subproblem is small, skip this cut */ + for (kk = 1; kk < k; kk++) + { if (info[kk].flag) + { if (parallel(info[k].cut, info[kk].cut, work) > 0.90) + break; + } + } + if (kk < k) continue; + /* add this cut to the current subproblem */ +#if 0 + xprintf("eff = %g; deg = %g\n", info[k].eff, info[k].deg); +#endif + cut = info[k].cut, info[k].flag = 1; + i = glp_add_rows(T->mip, 1); + if (cut->name != NULL) + glp_set_row_name(T->mip, i, cut->name); + xassert(T->mip->row[i]->origin == GLP_RF_CUT); + T->mip->row[i]->klass = cut->klass; + len = 0; + for (aij = cut->ptr; aij != NULL; aij = aij->r_next) + len++, ind[len] = aij->col->j, val[len] = aij->val; + glp_set_mat_row(T->mip, i, len, ind, val); + switch (cut->type) + { case GLP_LO: rhs = cut->lb; break; + case GLP_UP: rhs = cut->ub; break; + default: xassert(cut != cut); + } + glp_set_row_bnds(T->mip, i, cut->type, rhs, rhs); + } + /* free working arrays */ + xfree(info); + xfree(ind); + xfree(val); + xfree(work); + return; +} +#else void ios_process_cuts(glp_tree *T) { IOSPOOL *pool; IOSCUT *cut; @@ -203,6 +335,7 @@ void ios_process_cuts(glp_tree *T) xfree(work); return; } +#endif #if 0 /*********************************************************************** @@ -261,6 +394,25 @@ static double efficacy(glp_tree *T, IOSCUT *cut) * i.e. with disjoint support, while requirement cos phi <= 0.999 means * only avoiding duplicate (parallel) cuts [1]. */ +#ifdef NEW_LOCAL /* 02/II-2018 */ +static double parallel(IOSCUT *a, IOSCUT *b, double work[]) +{ GLPAIJ *aij; + double s = 0.0, sa = 0.0, sb = 0.0, temp; + for (aij = a->ptr; aij != NULL; aij = aij->r_next) + { work[aij->col->j] = aij->val; + sa += aij->val * aij->val; + } + for (aij = b->ptr; aij != NULL; aij = aij->r_next) + { s += work[aij->col->j] * aij->val; + sb += aij->val * aij->val; + } + for (aij = a->ptr; aij != NULL; aij = aij->r_next) + work[aij->col->j] = 0.0; + temp = sqrt(sa) * sqrt(sb); + if (temp < DBL_EPSILON * DBL_EPSILON) temp = DBL_EPSILON; + return s / temp; +} +#else static double parallel(IOSCUT *a, IOSCUT *b, double work[]) { IOSAIJ *aij; double s = 0.0, sa = 0.0, sb = 0.0, temp; @@ -278,5 +430,6 @@ static double parallel(IOSCUT *a, IOSCUT *b, double work[]) if (temp < DBL_EPSILON * DBL_EPSILON) temp = DBL_EPSILON; return s / temp; } +#endif /* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpios12.c b/resources/3rdparty/glpk-4.65/src/draft/glpios12.c similarity index 98% rename from resources/3rdparty/glpk-4.57/src/glpios12.c rename to resources/3rdparty/glpk-4.65/src/draft/glpios12.c index d5cf302a8..bec6fa2c4 100644 --- a/resources/3rdparty/glpk-4.57/src/glpios12.c +++ b/resources/3rdparty/glpk-4.65/src/draft/glpios12.c @@ -4,7 +4,7 @@ * This code is part of GLPK (GNU Linear Programming Kit). * * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* 2009, 2010, 2011, 2013, 2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +23,7 @@ ***********************************************************************/ #include "env.h" -#include "glpios.h" +#include "ios.h" /*********************************************************************** * NAME diff --git a/resources/3rdparty/glpk-4.57/src/glpipm.c b/resources/3rdparty/glpk-4.65/src/draft/glpipm.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/glpipm.c rename to resources/3rdparty/glpk-4.65/src/draft/glpipm.c diff --git a/resources/3rdparty/glpk-4.57/src/glpipm.h b/resources/3rdparty/glpk-4.65/src/draft/glpipm.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/glpipm.h rename to resources/3rdparty/glpk-4.65/src/draft/glpipm.h diff --git a/resources/3rdparty/glpk-4.57/src/glpmat.c b/resources/3rdparty/glpk-4.65/src/draft/glpmat.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/glpmat.c rename to resources/3rdparty/glpk-4.65/src/draft/glpmat.c diff --git a/resources/3rdparty/glpk-4.57/src/glpmat.h b/resources/3rdparty/glpk-4.65/src/draft/glpmat.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/glpmat.h rename to resources/3rdparty/glpk-4.65/src/draft/glpmat.h diff --git a/resources/3rdparty/glpk-4.57/src/glprgr.c b/resources/3rdparty/glpk-4.65/src/draft/glprgr.c similarity index 96% rename from resources/3rdparty/glpk-4.57/src/glprgr.c rename to resources/3rdparty/glpk-4.65/src/draft/glprgr.c index b4b616b1b..fbff6b8d4 100644 --- a/resources/3rdparty/glpk-4.57/src/glprgr.c +++ b/resources/3rdparty/glpk-4.65/src/draft/glprgr.c @@ -4,7 +4,7 @@ * This code is part of GLPK (GNU Linear Programming Kit). * * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* 2009, 2010, 2011, 2013, 2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -101,7 +101,11 @@ int rgr_write_bmp16(const char *fname, int m, int n, const char map[]) fp = fopen(fname, "wb"); if (fp == NULL) { xprintf("rgr_write_bmp16: unable to create '%s' - %s\n", +#if 0 /* 29/I-2017 */ fname, strerror(errno)); +#else + fname, xstrerr(errno)); +#endif ret = 1; goto fini; } @@ -155,7 +159,11 @@ int rgr_write_bmp16(const char *fname, int m, int n, const char map[]) fflush(fp); if (ferror(fp)) { xprintf("rgr_write_bmp16: write error on '%s' - %s\n", +#if 0 /* 29/I-2017 */ fname, strerror(errno)); +#else + fname, xstrerr(errno)); +#endif ret = 1; } fini: if (fp != NULL) fclose(fp); diff --git a/resources/3rdparty/glpk-4.57/src/glprgr.h b/resources/3rdparty/glpk-4.65/src/draft/glprgr.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/glprgr.h rename to resources/3rdparty/glpk-4.65/src/draft/glprgr.h diff --git a/resources/3rdparty/glpk-4.57/src/glpscl.c b/resources/3rdparty/glpk-4.65/src/draft/glpscl.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/glpscl.c rename to resources/3rdparty/glpk-4.65/src/draft/glpscl.c diff --git a/resources/3rdparty/glpk-4.57/src/glpspm.c b/resources/3rdparty/glpk-4.65/src/draft/glpspm.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/glpspm.c rename to resources/3rdparty/glpk-4.65/src/draft/glpspm.c diff --git a/resources/3rdparty/glpk-4.57/src/glpspm.h b/resources/3rdparty/glpk-4.65/src/draft/glpspm.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/glpspm.h rename to resources/3rdparty/glpk-4.65/src/draft/glpspm.h diff --git a/resources/3rdparty/glpk-4.57/src/glpssx.h b/resources/3rdparty/glpk-4.65/src/draft/glpssx.h similarity index 97% rename from resources/3rdparty/glpk-4.57/src/glpssx.h rename to resources/3rdparty/glpk-4.65/src/draft/glpssx.h index 1b55d7a3d..3b52b3cc5 100644 --- a/resources/3rdparty/glpk-4.57/src/glpssx.h +++ b/resources/3rdparty/glpk-4.65/src/draft/glpssx.h @@ -4,7 +4,7 @@ * This code is part of GLPK (GNU Linear Programming Kit). * * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* 2009, 2010, 2011, 2013, 2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -27,6 +27,9 @@ #include "bfx.h" #include "env.h" +#if 1 /* 25/XI-2017 */ +#include "glpk.h" +#endif typedef struct SSX SSX; @@ -305,6 +308,14 @@ struct SSX /* actual change of xN[q] in the adjacent basis (it has the same sign as q_dir) */ /*--------------------------------------------------------------------*/ +#if 1 /* 25/XI-2017 */ + int msg_lev; + /* verbosity level: + GLP_MSG_OFF no output + GLP_MSG_ERR report errors and warnings + GLP_MSG_ON normal output + GLP_MSG_ALL highest verbosity */ +#endif int it_lim; /* simplex iterations limit; if this value is positive, it is decreased by one each time when one simplex iteration has been diff --git a/resources/3rdparty/glpk-4.57/src/glpssx01.c b/resources/3rdparty/glpk-4.65/src/draft/glpssx01.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/glpssx01.c rename to resources/3rdparty/glpk-4.65/src/draft/glpssx01.c diff --git a/resources/3rdparty/glpk-4.57/src/glpssx02.c b/resources/3rdparty/glpk-4.65/src/draft/glpssx02.c similarity index 93% rename from resources/3rdparty/glpk-4.57/src/glpssx02.c rename to resources/3rdparty/glpk-4.65/src/draft/glpssx02.c index 4b3ea97d6..81db1350d 100644 --- a/resources/3rdparty/glpk-4.57/src/glpssx02.c +++ b/resources/3rdparty/glpk-4.65/src/draft/glpssx02.c @@ -4,7 +4,7 @@ * This code is part of GLPK (GNU Linear Programming Kit). * * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* 2009, 2010, 2011, 2013, 2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -132,10 +132,16 @@ int ssx_phase_I(SSX *ssx) ssx_eval_pi(ssx); ssx_eval_cbar(ssx); /* display initial progress of the search */ +#if 1 /* 25/XI-2017 */ + if (ssx->msg_lev >= GLP_MSG_ON) +#endif show_progress(ssx, 1); /* main loop starts here */ for (;;) { /* display current progress of the search */ +#if 1 /* 25/XI-2017 */ + if (ssx->msg_lev >= GLP_MSG_ON) +#endif #if 0 if (utime() - ssx->tm_lag >= ssx->out_frq - 0.001) #else @@ -243,6 +249,9 @@ int ssx_phase_I(SSX *ssx) ssx->it_cnt++; } /* display final progress of the search */ +#if 1 /* 25/XI-2017 */ + if (ssx->msg_lev >= GLP_MSG_ON) +#endif show_progress(ssx, 1); /* restore components of the original problem, which were changed by the routine */ @@ -282,10 +291,16 @@ int ssx_phase_I(SSX *ssx) int ssx_phase_II(SSX *ssx) { int ret; /* display initial progress of the search */ +#if 1 /* 25/XI-2017 */ + if (ssx->msg_lev >= GLP_MSG_ON) +#endif show_progress(ssx, 2); /* main loop starts here */ for (;;) { /* display current progress of the search */ +#if 1 /* 25/XI-2017 */ + if (ssx->msg_lev >= GLP_MSG_ON) +#endif #if 0 if (utime() - ssx->tm_lag >= ssx->out_frq - 0.001) #else @@ -347,6 +362,9 @@ int ssx_phase_II(SSX *ssx) ssx->it_cnt++; } /* display final progress of the search */ +#if 1 /* 25/XI-2017 */ + if (ssx->msg_lev >= GLP_MSG_ON) +#endif show_progress(ssx, 2); /* return to the calling program */ return ret; @@ -381,7 +399,12 @@ int ssx_driver(SSX *ssx) ssx->tm_beg = xtime(); /* factorize the initial basis matrix */ if (ssx_factorize(ssx)) +#if 0 /* 25/XI-2017 */ { xprintf("Initial basis matrix is singular\n"); +#else + { if (ssx->msg_lev >= GLP_MSG_ERR) + xprintf("Initial basis matrix is singular\n"); +#endif ret = 7; goto done; } @@ -419,14 +442,23 @@ int ssx_driver(SSX *ssx) ret = 0; break; case 1: +#if 1 /* 25/XI-2017 */ + if (ssx->msg_lev >= GLP_MSG_ALL) +#endif xprintf("PROBLEM HAS NO FEASIBLE SOLUTION\n"); ret = 1; break; case 2: +#if 1 /* 25/XI-2017 */ + if (ssx->msg_lev >= GLP_MSG_ALL) +#endif xprintf("ITERATIONS LIMIT EXCEEDED; SEARCH TERMINATED\n"); ret = 3; break; case 3: +#if 1 /* 25/XI-2017 */ + if (ssx->msg_lev >= GLP_MSG_ALL) +#endif xprintf("TIME LIMIT EXCEEDED; SEARCH TERMINATED\n"); ret = 5; break; @@ -446,18 +478,30 @@ skip: /* compute simplex multipliers */ ret = ssx_phase_II(ssx); switch (ret) { case 0: +#if 1 /* 25/XI-2017 */ + if (ssx->msg_lev >= GLP_MSG_ALL) +#endif xprintf("OPTIMAL SOLUTION FOUND\n"); ret = 0; break; case 1: +#if 1 /* 25/XI-2017 */ + if (ssx->msg_lev >= GLP_MSG_ALL) +#endif xprintf("PROBLEM HAS UNBOUNDED SOLUTION\n"); ret = 2; break; case 2: +#if 1 /* 25/XI-2017 */ + if (ssx->msg_lev >= GLP_MSG_ALL) +#endif xprintf("ITERATIONS LIMIT EXCEEDED; SEARCH TERMINATED\n"); ret = 4; break; case 3: +#if 1 /* 25/XI-2017 */ + if (ssx->msg_lev >= GLP_MSG_ALL) +#endif xprintf("TIME LIMIT EXCEEDED; SEARCH TERMINATED\n"); ret = 6; break; diff --git a/resources/3rdparty/glpk-4.57/src/glpios.h b/resources/3rdparty/glpk-4.65/src/draft/ios.h similarity index 87% rename from resources/3rdparty/glpk-4.57/src/glpios.h rename to resources/3rdparty/glpk-4.65/src/draft/ios.h index 07ee9810e..1cb07ee04 100644 --- a/resources/3rdparty/glpk-4.57/src/glpios.h +++ b/resources/3rdparty/glpk-4.65/src/draft/ios.h @@ -1,10 +1,10 @@ -/* glpios.h (integer optimization suite) */ +/* ios.h (integer optimization suite) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* 2009, 2010, 2011, 2013, 2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -22,19 +22,32 @@ * along with GLPK. If not, see . ***********************************************************************/ -#ifndef GLPIOS_H -#define GLPIOS_H +#ifndef IOS_H +#define IOS_H #include "prob.h" +#if 1 /* 02/II-2018 */ +#define NEW_LOCAL 1 +#endif + +#if 1 /* 15/II-2018 */ +#define NEW_COVER 1 +#endif + typedef struct IOSLOT IOSLOT; typedef struct IOSNPD IOSNPD; typedef struct IOSBND IOSBND; typedef struct IOSTAT IOSTAT; typedef struct IOSROW IOSROW; typedef struct IOSAIJ IOSAIJ; +#ifdef NEW_LOCAL /* 02/II-2018 */ +typedef glp_prob IOSPOOL; +typedef GLPROW IOSCUT; +#else typedef struct IOSPOOL IOSPOOL; typedef struct IOSCUT IOSCUT; +#endif struct glp_tree { /* branch-and-bound tree */ @@ -148,10 +161,14 @@ struct glp_tree /* built-in cut generators segment */ IOSPOOL *local; /* local cut pool */ - void *mir_gen; +#if 1 /* 13/II-2018 */ + glp_cov *cov_gen; + /* pointer to working area used by the cover cut generator */ +#endif + glp_mir *mir_gen; /* pointer to working area used by the MIR cut generator */ - void *clq_gen; - /* pointer to working area used by the clique cut generator */ + glp_cfg *clq_gen; + /* pointer to conflict graph used by the clique cut generator */ /*--------------------------------------------------------------*/ void *pcost; /* pointer to working area used on pseudocost branching */ @@ -163,18 +180,10 @@ struct glp_tree /* control parameters and statistics */ const glp_iocp *parm; /* copy of control parameters passed to the solver */ -#if 0 /* 10/VI-2013 */ - glp_long tm_beg; -#else double tm_beg; -#endif /* starting time of the search, in seconds; the total time of the search is the difference between xtime() and tm_beg */ -#if 0 /* 10/VI-2013 */ - glp_long tm_lag; -#else double tm_lag; -#endif /* the most recent time, in seconds, at which the progress of the the search was displayed */ int sol_cnt; @@ -364,6 +373,7 @@ struct IOSAIJ /* pointer to next coefficient for the same row */ }; +#ifndef NEW_LOCAL /* 02/II-2018 */ struct IOSPOOL { /* cut pool */ int size; @@ -377,7 +387,9 @@ struct IOSPOOL IOSCUT *curr; /* pointer to the current cut */ }; +#endif +#ifndef NEW_LOCAL /* 02/II-2018 */ struct IOSCUT { /* cut (cutting plane constraint) */ char *name; @@ -398,6 +410,7 @@ struct IOSCUT IOSCUT *next; /* pointer to next cut */ }; +#endif #define ios_create_tree _glp_ios_create_tree glp_tree *ios_create_tree(glp_prob *mip, const glp_iocp *parm); @@ -487,96 +500,10 @@ int ios_preprocess_node(glp_tree *tree, int max_pass); int ios_driver(glp_tree *tree); /* branch-and-bound driver */ -/**********************************************************************/ - -typedef struct IOSVEC IOSVEC; - -struct IOSVEC -{ /* sparse vector v = (v[j]) */ - int n; - /* dimension, n >= 0 */ - int nnz; - /* number of non-zero components, 0 <= nnz <= n */ - int *pos; /* int pos[1+n]; */ - /* pos[j] = k, 1 <= j <= n, is position of (non-zero) v[j] in the - arrays ind and val, where 1 <= k <= nnz; pos[j] = 0 means that - v[j] is structural zero */ - int *ind; /* int ind[1+n]; */ - /* ind[k] = j, 1 <= k <= nnz, is index of v[j] */ - double *val; /* double val[1+n]; */ - /* val[k], 1 <= k <= nnz, is a numeric value of v[j] */ -}; - -#define ios_create_vec _glp_ios_create_vec -IOSVEC *ios_create_vec(int n); -/* create sparse vector */ - -#define ios_check_vec _glp_ios_check_vec -void ios_check_vec(IOSVEC *v); -/* check that sparse vector has correct representation */ - -#define ios_get_vj _glp_ios_get_vj -double ios_get_vj(IOSVEC *v, int j); -/* retrieve component of sparse vector */ - -#define ios_set_vj _glp_ios_set_vj -void ios_set_vj(IOSVEC *v, int j, double val); -/* set/change component of sparse vector */ - -#define ios_clear_vec _glp_ios_clear_vec -void ios_clear_vec(IOSVEC *v); -/* set all components of sparse vector to zero */ - -#define ios_clean_vec _glp_ios_clean_vec -void ios_clean_vec(IOSVEC *v, double eps); -/* remove zero or small components from sparse vector */ - -#define ios_copy_vec _glp_ios_copy_vec -void ios_copy_vec(IOSVEC *x, IOSVEC *y); -/* copy sparse vector (x := y) */ - -#define ios_linear_comb _glp_ios_linear_comb -void ios_linear_comb(IOSVEC *x, double a, IOSVEC *y); -/* compute linear combination (x := x + a * y) */ - -#define ios_delete_vec _glp_ios_delete_vec -void ios_delete_vec(IOSVEC *v); -/* delete sparse vector */ - -/**********************************************************************/ - -#define ios_gmi_gen _glp_ios_gmi_gen -void ios_gmi_gen(glp_tree *tree); -/* generate Gomory's mixed integer cuts */ - -#define ios_mir_init _glp_ios_mir_init -void *ios_mir_init(glp_tree *tree); -/* initialize MIR cut generator */ - -#define ios_mir_gen _glp_ios_mir_gen -void ios_mir_gen(glp_tree *tree, void *gen); -/* generate MIR cuts */ - -#define ios_mir_term _glp_ios_mir_term -void ios_mir_term(void *gen); -/* terminate MIR cut generator */ - #define ios_cov_gen _glp_ios_cov_gen void ios_cov_gen(glp_tree *tree); /* generate mixed cover cuts */ -#define ios_clq_init _glp_ios_clq_init -void *ios_clq_init(glp_tree *tree); -/* initialize clique cut generator */ - -#define ios_clq_gen _glp_ios_clq_gen -void ios_clq_gen(glp_tree *tree, void *gen); -/* generate clique cuts */ - -#define ios_clq_term _glp_ios_clq_term -void ios_clq_term(void *gen); -/* terminate clique cut generator */ - #define ios_pcost_init _glp_ios_pcost_init void *ios_pcost_init(glp_tree *tree); /* initialize working data used on pseudocost branching */ diff --git a/resources/3rdparty/glpk-4.57/src/lux.c b/resources/3rdparty/glpk-4.65/src/draft/lux.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/lux.c rename to resources/3rdparty/glpk-4.65/src/draft/lux.c diff --git a/resources/3rdparty/glpk-4.57/src/lux.h b/resources/3rdparty/glpk-4.65/src/draft/lux.h similarity index 99% rename from resources/3rdparty/glpk-4.57/src/lux.h rename to resources/3rdparty/glpk-4.65/src/draft/lux.h index 6efce3636..8767bb8ef 100644 --- a/resources/3rdparty/glpk-4.57/src/lux.h +++ b/resources/3rdparty/glpk-4.65/src/draft/lux.h @@ -26,7 +26,7 @@ #define LUX_H #include "dmp.h" -#include "glpgmp.h" +#include "mygmp.h" /*********************************************************************** * The structure LUX defines LU-factorization of a square matrix A, diff --git a/resources/3rdparty/glpk-4.57/src/env/alloc.c b/resources/3rdparty/glpk-4.65/src/env/alloc.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/env/alloc.c rename to resources/3rdparty/glpk-4.65/src/env/alloc.c diff --git a/resources/3rdparty/glpk-4.57/src/env/dlsup.c b/resources/3rdparty/glpk-4.65/src/env/dlsup.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/env/dlsup.c rename to resources/3rdparty/glpk-4.65/src/env/dlsup.c diff --git a/resources/3rdparty/glpk-4.57/src/env/env.c b/resources/3rdparty/glpk-4.65/src/env/env.c similarity index 78% rename from resources/3rdparty/glpk-4.57/src/env/env.c rename to resources/3rdparty/glpk-4.65/src/env/env.c index 2cc67a3b9..5b901f35e 100644 --- a/resources/3rdparty/glpk-4.57/src/env/env.c +++ b/resources/3rdparty/glpk-4.65/src/env/env.c @@ -3,7 +3,7 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000-2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2000-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -21,6 +21,10 @@ * along with GLPK. If not, see . ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "glpk.h" #include "env.h" @@ -65,8 +69,10 @@ int glp_init_env(void) if (env == NULL) return 2; memset(env, 0, sizeof(ENV)); +#if 0 /* 14/I-2017 */ sprintf(env->version, "%d.%d", GLP_MAJOR_VERSION, GLP_MINOR_VERSION); +#endif env->self = env; env->term_buf = malloc(TBUF_SIZE); if (env->term_buf == NULL) @@ -77,6 +83,9 @@ int glp_init_env(void) env->term_hook = NULL; env->term_info = NULL; env->tee_file = NULL; +#if 1 /* 23/XI-2015 */ + env->err_st = 0; +#endif env->err_file = NULL; env->err_line = 0; env->err_hook = NULL; @@ -92,6 +101,11 @@ int glp_init_env(void) env->mem_ptr = NULL; env->mem_count = env->mem_cpeak = 0; env->mem_total = env->mem_tpeak = 0; +#if 1 /* 23/XI-2015 */ + env->gmp_pool = NULL; + env->gmp_size = 0; + env->gmp_work = NULL; +#endif env->h_odbc = env->h_mysql = NULL; /* save pointer to the environment block */ tls_set_ptr(env); @@ -162,10 +176,75 @@ ENV *get_env_ptr(void) * the form "X.Y", where X is the major version number, and Y is the * minor version number, for example, "4.16". */ +#define str(s) # s +#define xstr(s) str(s) + const char *glp_version(void) +#if 0 /* 14/I-2017 */ { ENV *env = get_env_ptr(); return env->version; } +#else /* suggested by Heinrich */ +{ return + xstr(GLP_MAJOR_VERSION) "." xstr(GLP_MINOR_VERSION); +} +#endif + +/*********************************************************************** +* NAME +* +* glp_config - determine library configuration +* +* SYNOPSIS +* +* const char *glp_config(const char *option); +* +* DESCRIPTION +* +* The routine glp_config determines some options which were specified +* on configuring the GLPK library. +* +* RETURNS +* +* The routine glp_config returns a pointer to a null-terminating +* string depending on the option inquired. +* +* For option = "TLS" the routine returns the thread local storage +* class specifier used (e.g. "_Thread_local") if the GLPK library was +* configured to run in multi-threaded environment, or NULL otherwise. +* +* For option = "ODBC_DLNAME" the routine returns the name of ODBC +* shared library if this option was enabled, or NULL otherwise. +* +* For option = "MYSQL_DLNAME" the routine returns the name of MySQL +* shared library if this option was enabled, or NULL otherwise. */ + +const char *glp_config(const char *option) +{ const char *s; + if (strcmp(option, "TLS") == 0) +#ifndef TLS + s = NULL; +#else + s = xstr(TLS); +#endif + else if (strcmp(option, "ODBC_DLNAME") == 0) +#ifndef ODBC_DLNAME + s = NULL; +#else + s = ODBC_DLNAME; +#endif + else if (strcmp(option, "MYSQL_DLNAME") == 0) +#ifndef MYSQL_DLNAME + s = NULL; +#else + s = MYSQL_DLNAME; +#endif + else + { /* invalid option is always disabled */ + s = NULL; + } + return s; +} /*********************************************************************** * NAME diff --git a/resources/3rdparty/glpk-4.57/src/env/env.h b/resources/3rdparty/glpk-4.65/src/env/env.h similarity index 94% rename from resources/3rdparty/glpk-4.57/src/env/env.h rename to resources/3rdparty/glpk-4.65/src/env/env.h index 7d26a21ee..67214ef6d 100644 --- a/resources/3rdparty/glpk-4.57/src/env/env.h +++ b/resources/3rdparty/glpk-4.65/src/env/env.h @@ -3,7 +3,7 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000-2015 Andrew Makhorin, Department for Applied +* Copyright (C) 2000-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -44,8 +44,10 @@ typedef struct MBD MBD; struct ENV { /* GLPK environment block */ +#if 0 /* 14/I-2007 */ char version[7+1]; /* version string returned by the routine glp_version */ +#endif ENV *self; /* pointer to this block to check its validity */ /*--------------------------------------------------------------*/ @@ -92,6 +94,16 @@ struct ENV * the sum of the size field over all memory block descriptors */ size_t mem_tpeak; /* peak value of mem_total */ +#if 1 /* 23/XI-2015 */ + /*--------------------------------------------------------------*/ + /* bignum module working area */ + void *gmp_pool; /* DMP *gmp_pool; */ + /* working memory pool */ + int gmp_size; + /* size of working array */ + unsigned short *gmp_work; /* ushort gmp_work[gmp_size]; */ + /* working array */ +#endif /*--------------------------------------------------------------*/ /* dynamic linking support (optional) */ void *h_odbc; diff --git a/resources/3rdparty/glpk-4.57/src/env/error.c b/resources/3rdparty/glpk-4.65/src/env/error.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/env/error.c rename to resources/3rdparty/glpk-4.65/src/env/error.c diff --git a/resources/3rdparty/glpk-4.65/src/env/stdc.c b/resources/3rdparty/glpk-4.65/src/env/stdc.c new file mode 100644 index 000000000..59331e22a --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/env/stdc.c @@ -0,0 +1,98 @@ +/* stdc.c (replacements for standard non-thread-safe functions) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2017 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +/* portable ANSI C version ********************************************/ + +#if !defined(TLS) + +#define ENABLE_NON_SAFE +#include "stdc.h" + +struct tm *xgmtime(const time_t *timer) +{ return + gmtime(timer); +} + +char *xstrerr(int errnum) +{ return + strerror(errnum); +} + +char *xstrtok(char *s1, const char *s2) +{ return + strtok(s1, s2); +} + +/* MS Windows version *************************************************/ + +#elif defined(__WOE__) + +#include "stdc.h" + +struct tm *xgmtime(const time_t *timer) +{ static TLS struct tm result; + gmtime_s(&result, timer); + return &result; +} + +char *xstrerr(int errnum) +{ static TLS char s[1023+1]; + strerror_s(s, sizeof(s), errnum); + return s; +} + +char *xstrtok(char *s1, const char *s2) +{ static TLS char *ptr; + return strtok_s(s1, s2, &ptr); +} + +/* GNU/Linux version **************************************************/ + +#else + +#include "stdc.h" + +struct tm *xgmtime(const time_t *timer) +{ static TLS struct tm result; + gmtime_r(timer, &result); + return &result; +} + +char *xstrerr(int errnum) +{ static TLS char s[1023+1]; + strerror_r(errnum, s, sizeof(s)); + return s; +} + +char *xstrtok(char *s1, const char *s2) +{ static TLS char *ptr; + return strtok_r(s1, s2, &ptr); +} + +#endif + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/env/stdc.h b/resources/3rdparty/glpk-4.65/src/env/stdc.h similarity index 64% rename from resources/3rdparty/glpk-4.57/src/env/stdc.h rename to resources/3rdparty/glpk-4.65/src/env/stdc.h index 9ffdcd942..a376f2c9e 100644 --- a/resources/3rdparty/glpk-4.57/src/env/stdc.h +++ b/resources/3rdparty/glpk-4.65/src/env/stdc.h @@ -3,7 +3,7 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000-2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2000-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -37,6 +37,37 @@ #include #include +#ifndef ENABLE_NON_SAFE /* 29/I-2017 */ +/* disable using non-thread-safe functions directly */ +#undef gmtime +#define gmtime ??? +#undef strerror +#define strerror ??? +#undef strtok +#define strtok ??? +#endif + +#if 1 /* 29/I-2017 */ +/* provide replacements for these functions on a per-thread basis */ +#define xgmtime _glp_xgmtime +struct tm *xgmtime(const time_t *); +#define xstrerr _glp_xstrerr +char *xstrerr(int); +#define xstrtok _glp_xstrtok +char *xstrtok(char *, const char *); +#endif + +#if 1 /* 06/II-2018 */ +#ifdef HAVE_CONFIG_H +#include +#endif +#ifndef __WOE__ +#define CDECL +#else +#define CDECL __cdecl +#endif +#endif + #endif /* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/env/stdout.c b/resources/3rdparty/glpk-4.65/src/env/stdout.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/env/stdout.c rename to resources/3rdparty/glpk-4.65/src/env/stdout.c diff --git a/resources/3rdparty/glpk-4.57/src/env/stream.c b/resources/3rdparty/glpk-4.65/src/env/stream.c similarity index 95% rename from resources/3rdparty/glpk-4.57/src/env/stream.c rename to resources/3rdparty/glpk-4.65/src/env/stream.c index 8879616e2..906e5b04e 100644 --- a/resources/3rdparty/glpk-4.57/src/env/stream.c +++ b/resources/3rdparty/glpk-4.65/src/env/stream.c @@ -3,7 +3,7 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2008-2014 Andrew Makhorin, Department for Applied +* Copyright (C) 2008-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -122,7 +122,11 @@ glp_file *glp_open(const char *name, const char *mode) if (ext == NULL || strcmp(ext, ".gz") != 0) { file = fopen(name, mode); if (file == NULL) +#if 0 /* 29/I-2017 */ { put_err_msg(strerror(errno)); +#else + { put_err_msg(xstrerr(errno)); +#endif return NULL; } } @@ -138,7 +142,11 @@ glp_file *glp_open(const char *name, const char *mode) #endif file = gzopen(name, mode); if (file == NULL) +#if 0 /* 29/I-2017 */ { put_err_msg(strerror(errno)); +#else + { put_err_msg(xstrerr(errno)); +#endif return NULL; } } @@ -238,7 +246,11 @@ int glp_read(glp_file *f, void *buf, int nnn) { cnt = fread(f->base, 1, f->size, (FILE *)(f->file)); if (ferror((FILE *)(f->file))) { f->flag |= IOERR; +#if 0 /* 29/I-2017 */ put_err_msg(strerror(errno)); +#else + put_err_msg(xstrerr(errno)); +#endif return EOF; } } @@ -250,7 +262,11 @@ int glp_read(glp_file *f, void *buf, int nnn) { f->flag |= IOERR; msg = gzerror((gzFile)(f->file), &errnum); if (errnum == Z_ERRNO) +#if 0 /* 29/I-2017 */ put_err_msg(strerror(errno)); +#else + put_err_msg(xstrerr(errno)); +#endif else put_err_msg(msg); return EOF; @@ -322,7 +338,11 @@ static int do_flush(glp_file *f) { if ((int)fwrite(f->base, 1, f->cnt, (FILE *)(f->file)) != f->cnt) { f->flag |= IOERR; +#if 0 /* 29/I-2017 */ put_err_msg(strerror(errno)); +#else + put_err_msg(xstrerr(errno)); +#endif return EOF; } } @@ -333,7 +353,11 @@ static int do_flush(glp_file *f) { f->flag |= IOERR; msg = gzerror((gzFile)(f->file), &errnum); if (errnum == Z_ERRNO) +#if 0 /* 29/I-2017 */ put_err_msg(strerror(errno)); +#else + put_err_msg(xstrerr(errno)); +#endif else put_err_msg(msg); return EOF; @@ -450,7 +474,11 @@ int glp_close(glp_file *f) else if (!(f->flag & IOGZIP)) { if (fclose((FILE *)(f->file)) != 0) { if (ret == 0) +#if 0 /* 29/I-2017 */ { put_err_msg(strerror(errno)); +#else + { put_err_msg(xstrerr(errno)); +#endif ret = EOF; } } @@ -462,7 +490,11 @@ int glp_close(glp_file *f) ; else if (errnum == Z_ERRNO) { if (ret == 0) +#if 0 /* 29/I-2017 */ { put_err_msg(strerror(errno)); +#else + { put_err_msg(xstrerr(errno)); +#endif ret = EOF; } } diff --git a/resources/3rdparty/glpk-4.57/src/env/time.c b/resources/3rdparty/glpk-4.65/src/env/time.c similarity index 77% rename from resources/3rdparty/glpk-4.57/src/env/time.c rename to resources/3rdparty/glpk-4.65/src/env/time.c index e5aac0b0b..1ffb28e98 100644 --- a/resources/3rdparty/glpk-4.57/src/env/time.c +++ b/resources/3rdparty/glpk-4.65/src/env/time.c @@ -3,9 +3,9 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000-2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2000-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights -* reserved. E-mail: . +* reserved. E-mail: . * * GLPK is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by @@ -42,12 +42,13 @@ * The routine glp_time returns the current universal time (UTC), in * milliseconds, elapsed since 00:00:00 GMT January 1, 1970. */ -#define EPOCH 2440588 /* jday(1, 1, 1970) */ +#define EPOCH 2440588 /* = jday(1, 1, 1970) */ /* POSIX version ******************************************************/ #if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY) +#if 0 /* 29/VI-2017 */ #include #include @@ -57,7 +58,11 @@ double glp_time(void) int j; double t; gettimeofday(&tv, NULL); +#if 0 /* 29/I-2017 */ tm = gmtime(&tv.tv_sec); +#else + tm = xgmtime(&tv.tv_sec); +#endif j = jday(tm->tm_mday, tm->tm_mon + 1, 1900 + tm->tm_year); xassert(j >= 0); t = ((((double)(j - EPOCH) * 24.0 + (double)tm->tm_hour) * 60.0 + @@ -65,6 +70,18 @@ double glp_time(void) (double)(tv.tv_usec / 1000); return t; } +#else +#include + +double glp_time(void) +{ struct timeval tv; + double t; + gettimeofday(&tv, NULL); + t = (double)tv.tv_sec + (double)(tv.tv_usec) / 1e6; + xassert(0.0 <= t && t < 4294967296.0); + return 1000.0 * t; +} +#endif /* MS Windows version *************************************************/ @@ -97,7 +114,11 @@ double glp_time(void) int j; double t; timer = time(NULL); +#if 0 /* 29/I-2017 */ tm = gmtime(&timer); +#else + tm = xgmtime(&timer); +#endif j = jday(tm->tm_mday, tm->tm_mon + 1, 1900 + tm->tm_year); xassert(j >= 0); t = ((((double)(j - EPOCH) * 24.0 + (double)tm->tm_hour) * 60.0 + @@ -126,34 +147,4 @@ double glp_difftime(double t1, double t0) (t1 - t0) / 1000.0; } -/**********************************************************************/ - -#ifdef GLP_TEST -#include - -int main(void) -{ int ttt, ss, mm, hh, day, month, year; - double t; - t = glp_time(); - xprintf("t = %.f\n", t); - assert(floor(t) == t); - ttt = (int)fmod(t, 1000.0); - t = (t - (double)ttt) / 1000.0; - assert(floor(t) == t); - ss = (int)fmod(t, 60.0); - t = (t - (double)ss) / 60.0; - assert(floor(t) == t); - mm = (int)fmod(t, 60.0); - t = (t - (double)mm) / 60.0; - assert(floor(t) == t); - hh = (int)fmod(t, 24.0); - t = (t - (double)hh) / 24.0; - assert(floor(t) == t); - assert(jdate((int)t + EPOCH, &day, &month, &year) == 0); - printf("%04d-%02d-%02d %02d:%02d:%02d.%03d\n", - year, month, day, hh, mm, ss, ttt); - return 0; -} -#endif - /* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/env/tls.c b/resources/3rdparty/glpk-4.65/src/env/tls.c similarity index 50% rename from resources/3rdparty/glpk-4.57/src/env/tls.c rename to resources/3rdparty/glpk-4.65/src/env/tls.c index 3ffa11437..4062ee4ce 100644 --- a/resources/3rdparty/glpk-4.57/src/env/tls.c +++ b/resources/3rdparty/glpk-4.65/src/env/tls.c @@ -3,7 +3,7 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2001-2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2001-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -21,11 +21,22 @@ * along with GLPK. If not, see . ***********************************************************************/ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "env.h" +#ifndef TLS static void *tls = NULL; -/* NOTE: in a re-entrant version of the package this variable should be - * placed in the Thread Local Storage (TLS) */ +#else +static TLS void *tls = NULL; +/* this option allows running multiple independent instances of GLPK in + * different threads of a multi-threaded application, in which case the + * variable tls should be placed in the Thread Local Storage (TLS); + * it is assumed that the macro TLS is previously defined to something + * like '__thread', '_Thread_local', etc. */ +#endif /*********************************************************************** * NAME @@ -69,4 +80,49 @@ void *tls_get_ptr(void) return ptr; } +/**********************************************************************/ + +#ifdef __WOE__ + +/*** Author: Heinrich Schuchardt ***/ + +#pragma comment(lib, "user32.lib") + +#include + +#define VISTA 0x06 + +/* This is the main entry point of the DLL. */ + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID + lpvReserved) +{ DWORD version; + DWORD major_version; +#ifdef TLS + switch (fdwReason) + { case DLL_PROCESS_ATTACH: + /* @TODO: + * GetVersion is deprecated but the version help functions are + * not available in Visual Studio 2010. So lets use it until + * we remove the outdated Build files. */ + version = GetVersion(); + major_version = version & 0xff; + if (major_version < VISTA) + { MessageBoxA(NULL, + "The GLPK library called by this application is configur" + "ed to use thread local storage which is not fully suppo" + "rted by your version of Microsoft Windows.\n\n" + "Microsoft Windows Vista or a later version of Windows i" + "s required to run this application.", + "GLPK", MB_OK | MB_ICONERROR); + return FALSE; + } + break; + } +#endif /* TLS */ + return TRUE; +} + +#endif /* __WOE__ */ + /* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpk.h b/resources/3rdparty/glpk-4.65/src/glpk.h similarity index 90% rename from resources/3rdparty/glpk-4.57/src/glpk.h rename to resources/3rdparty/glpk-4.65/src/glpk.h index ed5be77fc..f4e250f90 100644 --- a/resources/3rdparty/glpk-4.57/src/glpk.h +++ b/resources/3rdparty/glpk-4.65/src/glpk.h @@ -1,12 +1,11 @@ -/* glpk.h (GLPK API) */ +/* glpk.h */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013, 2014, 2015 Andrew Makhorin, Department for -* Applied Informatics, Moscow Aviation Institute, Moscow, Russia. All -* rights reserved. E-mail: . +* Copyright (C) 2000-2018 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . * * GLPK is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by @@ -34,7 +33,7 @@ extern "C" { /* library version numbers: */ #define GLP_MAJOR_VERSION 4 -#define GLP_MINOR_VERSION 57 +#define GLP_MINOR_VERSION 65 typedef struct glp_prob glp_prob; /* LP/MIP problem object */ @@ -107,7 +106,7 @@ typedef struct } glp_bfcp; typedef struct -{ /* simplex method control parameters */ +{ /* simplex solver control parameters */ int msg_lev; /* message level: */ #define GLP_MSG_OFF 0 /* no output */ #define GLP_MSG_ERR 1 /* warning and error messages only */ @@ -124,17 +123,27 @@ typedef struct int r_test; /* ratio test technique: */ #define GLP_RT_STD 0x11 /* standard (textbook) */ #define GLP_RT_HAR 0x22 /* Harris' two-pass ratio test */ - double tol_bnd; /* spx.tol_bnd */ - double tol_dj; /* spx.tol_dj */ - double tol_piv; /* spx.tol_piv */ - double obj_ll; /* spx.obj_ll */ - double obj_ul; /* spx.obj_ul */ - int it_lim; /* spx.it_lim */ - int tm_lim; /* spx.tm_lim (milliseconds) */ - int out_frq; /* spx.out_frq */ - int out_dly; /* spx.out_dly (milliseconds) */ +#if 1 /* 16/III-2016 */ +#define GLP_RT_FLIP 0x33 /* long-step (flip-flop) ratio test */ +#endif + double tol_bnd; /* primal feasibility tolerance */ + double tol_dj; /* dual feasibility tolerance */ + double tol_piv; /* pivot tolerance */ + double obj_ll; /* lower objective limit */ + double obj_ul; /* upper objective limit */ + int it_lim; /* simplex iteration limit */ + int tm_lim; /* time limit, ms */ + int out_frq; /* display output frequency, ms */ + int out_dly; /* display output delay, ms */ int presolve; /* enable/disable using LP presolver */ - double foo_bar[36]; /* (reserved) */ +#if 1 /* 11/VII-2017 (not documented yet) */ + int excl; /* exclude fixed non-basic variables */ + int shift; /* shift bounds of variables to zero */ + int aorn; /* option to use A or N: */ +#define GLP_USE_AT 1 /* use A matrix in row-wise format */ +#define GLP_USE_NT 2 /* use N matrix in row-wise format */ + double foo_bar[33]; /* (reserved) */ +#endif } glp_smcp; typedef struct @@ -194,7 +203,10 @@ typedef struct const char *save_sol; /* filename to save every new solution */ int alien; /* use alien solver */ #endif - double foo_bar[24]; /* (reserved) */ +#if 1 /* 16/III-2016; not documented--should not be used */ + int flip; /* use long-step dual simplex */ +#endif + double foo_bar[23]; /* (reserved) */ } glp_iocp; typedef struct @@ -284,6 +296,11 @@ typedef struct /* (reserved for use in the future) */ } glp_cpxcp; +#if 1 /* 10/XII-2017 */ +typedef struct glp_prep glp_prep; +/* LP/MIP preprocessor workspace */ +#endif + typedef struct glp_tran glp_tran; /* MathProg translator workspace */ @@ -653,6 +670,30 @@ void glp_analyze_coef(glp_prob *P, int k, double *coef1, int *var1, double *value1, double *coef2, int *var2, double *value2); /* analyze objective coefficient at basic variable */ +#if 1 /* 10/XII-2017 */ +glp_prep *glp_npp_alloc_wksp(void); +/* allocate the preprocessor workspace */ + +void glp_npp_load_prob(glp_prep *prep, glp_prob *P, int sol, + int names); +/* load original problem instance */ + +int glp_npp_preprocess1(glp_prep *prep, int hard); +/* perform basic LP/MIP preprocessing */ + +void glp_npp_build_prob(glp_prep *prep, glp_prob *Q); +/* build resultant problem instance */ + +void glp_npp_postprocess(glp_prep *prep, glp_prob *Q); +/* postprocess solution to resultant problem */ + +void glp_npp_obtain_sol(glp_prep *prep, glp_prob *P); +/* obtain solution to original problem */ + +void glp_npp_free_wksp(glp_prep *prep); +/* free the preprocessor workspace */ +#endif + int glp_ios_reason(glp_tree *T); /* determine reason for calling the callback routine */ @@ -722,6 +763,51 @@ int glp_ios_heur_sol(glp_tree *T, const double x[]); void glp_ios_terminate(glp_tree *T); /* terminate the solution process */ +#ifdef GLP_UNDOC +int glp_gmi_cut(glp_prob *P, int j, int ind[], double val[], double + phi[]); +/* generate Gomory's mixed integer cut (core routine) */ + +int glp_gmi_gen(glp_prob *P, glp_prob *pool, int max_cuts); +/* generate Gomory's mixed integer cuts */ + +typedef struct glp_cov glp_cov; +/* cover cur generator workspace */ + +glp_cov *glp_cov_init(glp_prob *P); +/* create and initialize cover cut generator */ + +void glp_cov_gen1(glp_prob *P, glp_cov *cov, glp_prob *pool); +/* generate locally valid simple cover cuts */ + +void glp_cov_free(glp_cov *cov); +/* delete cover cut generator workspace */ + +typedef struct glp_mir glp_mir; +/* MIR cut generator workspace */ + +glp_mir *glp_mir_init(glp_prob *P); +/* create and initialize MIR cut generator */ + +int glp_mir_gen(glp_prob *P, glp_mir *mir, glp_prob *pool); +/* generate mixed integer rounding (MIR) cuts */ + +void glp_mir_free(glp_mir *mir); +/* delete MIR cut generator workspace */ + +typedef struct glp_cfg glp_cfg; +/* conflict graph descriptor */ + +glp_cfg *glp_cfg_init(glp_prob *P); +/* create and initialize conflict graph */ + +void glp_cfg_free(glp_cfg *G); +/* delete conflict graph descriptor */ + +int glp_clq_cut(glp_prob *P, glp_cfg *G, int ind[], double val[]); +/* generate clique cut from conflict graph */ +#endif /* GLP_UNDOC */ + void glp_init_mpscp(glp_mpscp *parm); /* initialize MPS format control parameters */ @@ -751,6 +837,9 @@ int glp_write_prob(glp_prob *P, int flags, const char *fname); glp_tran *glp_mpl_alloc_wksp(void); /* allocate the MathProg translator workspace */ +void glp_mpl_init_rand(glp_tran *tran, int seed); +/* initialize pseudo-random number generator */ + int glp_mpl_read_model(glp_tran *tran, const char *fname, int skip); /* read and translate model section */ @@ -769,9 +858,6 @@ int glp_mpl_postsolve(glp_tran *tran, glp_prob *prob, int sol); void glp_mpl_free_wksp(glp_tran *tran); /* free the MathProg translator workspace */ -int glp_main(int argc, const char *argv[]); -/* stand-alone LP/MIP solver */ - int glp_read_cnfsat(glp_prob *P, const char *fname); /* read CNF-SAT problem data in DIMACS format */ @@ -793,6 +879,9 @@ int glp_init_env(void); const char *glp_version(void); /* determine library version */ +const char *glp_config(const char *option); +/* determine library configuration */ + int glp_free_env(void); /* free GLPK environment */ @@ -861,6 +950,12 @@ void glp_mem_usage(int *count, int *cpeak, size_t *total, size_t *tpeak); /* get memory usage information */ +double glp_time(void); +/* determine current universal time */ + +double glp_difftime(double t1, double t0); +/* compute difference between two time values */ + typedef struct glp_graph glp_graph; typedef struct glp_vertex glp_vertex; typedef struct glp_arc glp_arc; diff --git a/resources/3rdparty/glpk-4.57/src/cglib/cfg.c b/resources/3rdparty/glpk-4.65/src/intopt/cfg.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/cglib/cfg.c rename to resources/3rdparty/glpk-4.65/src/intopt/cfg.c diff --git a/resources/3rdparty/glpk-4.57/src/cglib/cfg.h b/resources/3rdparty/glpk-4.65/src/intopt/cfg.h similarity index 97% rename from resources/3rdparty/glpk-4.57/src/cglib/cfg.h rename to resources/3rdparty/glpk-4.65/src/intopt/cfg.h index bbf2454ca..d478f6c08 100644 --- a/resources/3rdparty/glpk-4.57/src/cglib/cfg.h +++ b/resources/3rdparty/glpk-4.65/src/intopt/cfg.h @@ -40,11 +40,19 @@ * Since the conflict graph may be dense, it is stored as an union of * its cliques rather than explicitly. */ +#if 0 /* 08/III-2016 */ typedef struct CFG CFG; +#else +typedef struct glp_cfg CFG; +#endif typedef struct CFGVLE CFGVLE; typedef struct CFGCLE CFGCLE; +#if 0 /* 08/III-2016 */ struct CFG +#else +struct glp_cfg +#endif { /* conflict graph descriptor */ int n; /* number of *all* variables (columns) in corresponding MIP */ diff --git a/resources/3rdparty/glpk-4.57/src/cglib/cfg1.c b/resources/3rdparty/glpk-4.65/src/intopt/cfg1.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/cglib/cfg1.c rename to resources/3rdparty/glpk-4.65/src/intopt/cfg1.c index 0dbfbeb06..80a2e8346 100644 --- a/resources/3rdparty/glpk-4.57/src/cglib/cfg1.c +++ b/resources/3rdparty/glpk-4.65/src/intopt/cfg1.c @@ -3,7 +3,7 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2012-2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2012-2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -197,7 +197,7 @@ struct term { int ind; double val; }; /* term a[j] * z[j] used to sort a[j]'s */ -static int fcmp(const void *e1, const void *e2) +static int CDECL fcmp(const void *e1, const void *e2) { /* auxiliary routine called from qsort */ const struct term *t1 = e1, *t2 = e2; if (t1->val > t2->val) diff --git a/resources/3rdparty/glpk-4.65/src/intopt/cfg2.c b/resources/3rdparty/glpk-4.65/src/intopt/cfg2.c new file mode 100644 index 000000000..85c0705ee --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/intopt/cfg2.c @@ -0,0 +1,91 @@ +/* cfg2.c (conflict graph) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2015-2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "cfg.h" +#include "env.h" +#include "prob.h" + +/*********************************************************************** +* NAME +* +* glp_cfg_init - create and initialize conflict graph +* +* SYNOPSIS +* +* glp_cfg *glp_cfg_init(glp_prob *P); +* +* DESCRIPTION +* +* This routine creates and initializes the conflict graph for the +* specified problem object. +* +* RETURNS +* +* The routine returns a pointer to the conflict graph descriptor. +* However, if the conflict graph is empty (no conflicts have been +* found), the routine returns NULL. */ + +glp_cfg *glp_cfg_init(glp_prob *P) +{ glp_cfg *G; + int j, n1, n2; + xprintf("Constructing conflict graph...\n"); + G = cfg_build_graph(P); + n1 = n2 = 0; + for (j = 1; j <= P->n; j++) + { if (G->pos[j]) + n1 ++; + if (G->neg[j]) + n2++; + } + if (n1 == 0 && n2 == 0) + { xprintf("No conflicts found\n"); + cfg_delete_graph(G); + G = NULL; + } + else + xprintf("Conflict graph has %d + %d = %d vertices\n", + n1, n2, G->nv); + return G; +} + +/*********************************************************************** +* NAME +* +* glp_cfg_free - delete conflict graph descriptor +* +* SYNOPSIS +* +* void glp_cfg_free(glp_cfg *G); +* +* DESCRIPTION +* +* This routine deletes the conflict graph descriptor and frees all the +* memory allocated to it. */ + +void glp_cfg_free(glp_cfg *G) +{ xassert(G != NULL); + cfg_delete_graph(G); + return; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpios08.c b/resources/3rdparty/glpk-4.65/src/intopt/clqcut.c similarity index 67% rename from resources/3rdparty/glpk-4.57/src/glpios08.c rename to resources/3rdparty/glpk-4.65/src/intopt/clqcut.c index d165492f7..d3db5b395 100644 --- a/resources/3rdparty/glpk-4.57/src/glpios08.c +++ b/resources/3rdparty/glpk-4.65/src/intopt/clqcut.c @@ -1,9 +1,9 @@ -/* glpios08.c (clique cut generator) */ +/* clqcut.c (clique cut generator) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2008, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2008-2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,48 +23,48 @@ #include "cfg.h" #include "env.h" -#include "glpios.h" +#include "prob.h" -void *ios_clq_init(glp_tree *T) -{ /* initialize clique cut generator */ - glp_prob *P = T->mip; - CFG *G; - int j, n1, n2; - xprintf("Constructing conflict graph...\n"); - G = cfg_build_graph(P); - n1 = n2 = 0; - for (j = 1; j <= P->n; j++) - { if (G->pos[j]) - n1 ++; - if (G->neg[j]) - n2++; - } - if (n1 == 0 && n2 == 0) - { xprintf("No conflicts found\n"); - cfg_delete_graph(G); - G = NULL; - } - else - xprintf("Conflict graph has %d + %d = %d vertices\n", - n1, n2, G->nv); - return G; -} +/*********************************************************************** +* NAME +* +* glp_clq_cut - generate clique cut from conflict graph +* +* SYNOPSIS +* +* int glp_clq_cut(glp_prob *P, glp_cfg *G, int ind[], double val[]); +* +* DESCRIPTION +* +* This routine attempts to generate a clique cut. +* +* The cut generated by the routine is the following inequality: +* +* sum a[j] * x[j] <= b, +* +* which is expected to be violated at the current basic solution. +* +* If the cut has been successfully generated, the routine stores its +* non-zero coefficients a[j] and corresponding column indices j in the +* array locations val[1], ..., val[len] and ind[1], ..., ind[len], +* where 1 <= len <= n is the number of non-zero coefficients. The +* right-hand side value b is stored in val[0], and ind[0] is set to 0. +* +* RETURNS +* +* If the cut has been successfully generated, the routine returns +* len, the number of non-zero coefficients in the cut, 1 <= len <= n. +* Otherwise, the routine returns a non-positive value. */ -void ios_clq_gen(glp_tree *T, void *G_) -{ /* attempt to generate clique cut */ - glp_prob *P = T->mip; - int n = P->n; - CFG *G = G_; +int glp_clq_cut(glp_prob *P, glp_cfg *G, int ind[], double val[]) +{ int n = P->n; int *pos = G->pos; int *neg = G->neg; int nv = G->nv; int *ref = G->ref; - int j, k, v, len, *ind; - double rhs, sum, *val; + int j, k, v, len; + double rhs, sum; xassert(G->n == n); - /* allocate working arrays */ - ind = talloc(1+n, int); - val = talloc(1+n, double); /* find maximum weight clique in conflict graph */ len = cfg_find_clique(P, G, ind, &sum); #ifdef GLP_DEBUG @@ -73,7 +73,7 @@ void ios_clq_gen(glp_tree *T, void *G_) #endif /* check if clique inequality is violated */ if (sum < 1.07) - goto skip; + return 0; /* expand clique to maximal one */ len = cfg_expand_clique(G, len, ind); #ifdef GLP_DEBUG @@ -127,21 +127,8 @@ void ios_clq_gen(glp_tree *T, void *G_) val[len] = val[j]; } } - /* add cut inequality to local cut pool */ - glp_ios_add_row(T, NULL, GLP_RF_CLQ, 0, len, ind, val, GLP_UP, - rhs); -skip: /* free working arrays */ - tfree(ind); - tfree(val); - return; -} - -void ios_clq_term(void *G_) -{ /* terminate clique cut generator */ - CFG *G = G_; - xassert(G != NULL); - cfg_delete_graph(G); - return; + ind[0] = 0, val[0] = rhs; + return len; } /* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/intopt/covgen.c b/resources/3rdparty/glpk-4.65/src/intopt/covgen.c new file mode 100644 index 000000000..427c3aa81 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/intopt/covgen.c @@ -0,0 +1,885 @@ +/* covgen.c */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2017-2018 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "fvs.h" +#include "ks.h" +#include "prob.h" + +struct glp_cov +{ /* cover cut generator working area */ + int n; + /* number of columns (variables) */ + glp_prob *set; + /* set of globally valid 0-1 knapsack inequalities chosen from + * the root problem; each inequality is either original row or + * its relaxation (surrogate 0-1 knapsack) which is constructed + * by substitution of lower/upper single/variable bounds for + * continuous and general integer (non-binary) variables */ +}; + +struct bnd +{ /* simple or variable bound */ + /* if z = 0, it is a simple bound x >= or <= b; if b = -DBL_MAX + * (b = +DBL_MAX), x has no lower (upper) bound; otherwise, if + * z != 0, it is a variable bound x >= or <= a * z + b */ + int z; + /* number of binary variable or 0 */ + double a, b; + /* bound parameters */ +}; + +struct csa +{ /* common storage area */ + glp_prob *P; + /* original (root) MIP */ + struct bnd *l; /* struct bnd l[1+P->n]; */ + /* lower simple/variable bounds of variables */ + struct bnd *u; /* struct bnd u[1+P->n]; */ + /* upper simple/variable bounds of variables */ + glp_prob *set; + /* see struct glp_cov above */ +}; + +/*********************************************************************** +* init_bounds - initialize bounds of variables with simple bounds +* +* This routine initializes lower and upper bounds of all variables +* with simple bounds specified in the original mip. */ + +static void init_bounds(struct csa *csa) +{ glp_prob *P = csa->P; + struct bnd *l = csa->l, *u = csa->u; + int j; + for (j = 1; j <= P->n; j++) + { l[j].z = u[j].z = 0; + l[j].a = u[j].a = 0; + l[j].b = glp_get_col_lb(P, j); + u[j].b = glp_get_col_ub(P, j); + } + return; +} + +/*********************************************************************** +* check_vb - check variable bound +* +* This routine checks if the specified i-th row has the form +* +* a1 * x + a2 * z >= or <= rhs, (1) +* +* where x is a non-fixed continuous or general integer variable, and +* z is a binary variable. If it is, the routine converts the row to +* the following variable lower/upper bound (VLB/VUB) of x: +* +* x >= or <= a * z + b, (2) +* +* where a = - a2 / a1, b = rhs / a1. Note that the inequality type is +* changed to opposite one when a1 < 0. +* +* If the row is identified as a variable bound, the routine returns +* GLP_LO for VLB or GLP_UP for VUB and provides the reference numbers +* of variables x and z and values of a and b. Otherwise, the routine +* returns zero. */ + +static int check_vb(struct csa *csa, int i, int *x, int *z, double *a, + double *b) +{ glp_prob *P = csa->P; + GLPROW *row; + GLPAIJ *a1, *a2; + int type; + double rhs; + xassert(1 <= i && i <= P->m); + row = P->row[i]; + /* check row type */ + switch (row->type) + { case GLP_LO: + case GLP_UP: + break; + default: + return 0; + } + /* take first term of the row */ + a1 = row->ptr; + if (a1 == NULL) + return 0; + /* take second term of the row */ + a2 = a1->r_next; + if (a2 == NULL) + return 0; + /* there should be exactly two terms in the row */ + if (a2->r_next != NULL) + return 0; + /* if first term is a binary variable, swap the terms */ + if (glp_get_col_kind(P, a1->col->j) == GLP_BV) + { GLPAIJ *a; + a = a1, a1 = a2, a2 = a; + } + /* now first term should be a non-fixed continuous or general + * integer variable */ + if (a1->col->type == GLP_FX) + return 0; + if (glp_get_col_kind(P, a1->col->j) == GLP_BV) + return 0; + /* and second term should be a binary variable */ + if (glp_get_col_kind(P, a2->col->j) != GLP_BV) + return 0; + /* VLB/VUB row has been identified */ + switch (row->type) + { case GLP_LO: + type = a1->val > 0 ? GLP_LO : GLP_UP; + rhs = row->lb; + break; + case GLP_UP: + type = a1->val > 0 ? GLP_UP : GLP_LO; + rhs = row->ub; + break; + default: + xassert(type != type); + } + *x = a1->col->j; + *z = a2->col->j; + *a = - a2->val / a1->val; + *b = rhs / a1->val; + return type; +} + +/*********************************************************************** +* set_vb - set variable bound +* +* This routine sets lower or upper variable bound specified as +* +* x >= a * z + b (type = GLP_LO) +* +* x <= a * z + b (type = GLP_UP) */ + +static void set_vb(struct csa *csa, int type, int x, int z, double a, + double b) +{ glp_prob *P = csa->P; + struct bnd *l = csa->l, *u = csa->u; + xassert(glp_get_col_type(P, x) != GLP_FX); + xassert(glp_get_col_kind(P, x) != GLP_BV); + xassert(glp_get_col_kind(P, z) == GLP_BV); + xassert(a != 0); + switch (type) + { case GLP_LO: + /* FIXME: check existing simple lower bound? */ + l[x].z = z, l[x].a = a, l[x].b = b; + break; + case GLP_UP: + /* FIXME: check existing simple upper bound? */ + u[x].z = z, u[x].a = a, u[x].b = b; + break; + default: + xassert(type != type); + } + return; +} + +/*********************************************************************** +* obtain_vbs - obtain and set variable bounds +* +* This routine walks thru all rows of the original mip, identifies +* rows specifying variable lower/upper bounds, and sets these bounds +* for corresponding (non-binary) variables. */ + +static void obtain_vbs(struct csa *csa) +{ glp_prob *P = csa->P; + int i, x, z, type, save; + double a, b; + for (i = 1; i <= P->m; i++) + { switch (P->row[i]->type) + { case GLP_FR: + break; + case GLP_LO: + case GLP_UP: + type = check_vb(csa, i, &x, &z, &a, &b); + if (type) + set_vb(csa, type, x, z, a, b); + break; + case GLP_DB: + case GLP_FX: + /* double-side inequality l <= ... <= u and equality + * ... = l = u are considered as two single inequalities + * ... >= l and ... <= u */ + save = P->row[i]->type; + P->row[i]->type = GLP_LO; + type = check_vb(csa, i, &x, &z, &a, &b); + if (type) + set_vb(csa, type, x, z, a, b); + P->row[i]->type = GLP_UP; + type = check_vb(csa, i, &x, &z, &a, &b); + if (type) + set_vb(csa, type, x, z, a, b); + P->row[i]->type = save; + break; + default: + xassert(P != P); + } + } + return; +} + +/*********************************************************************** +* add_term - add term to sparse vector +* +* This routine computes the following linear combination: +* +* v := v + a * e[j], +* +* where v is a sparse vector in full storage format, a is a non-zero +* scalar, e[j] is j-th column of unity matrix. */ + +static void add_term(FVS *v, int j, double a) +{ xassert(1 <= j && j <= v->n); + xassert(a != 0); + if (v->vec[j] == 0) + { /* create j-th component */ + v->nnz++; + xassert(v->nnz <= v->n); + v->ind[v->nnz] = j; + } + /* perform addition */ + v->vec[j] += a; + if (fabs(v->vec[j]) < 1e-9 * (1 + fabs(a))) + { /* remove j-th component */ + v->vec[j] = DBL_MIN; + } + return; +} + +/*********************************************************************** +* build_ks - build "0-1 knapsack" inequality +* +* Given an inequality of "not greater" type: +* +* sum{j in 1..n} a[j]*x[j] <= b, (1) +* +* this routine attempts to transform it to equivalent or relaxed "0-1 +* knapsack" inequality that contains only binary variables. +* +* If x[j] is a binary variable, the term a[j]*x[j] is not changed. +* Otherwise, if x[j] is a continuous or integer non-binary variable, +* it is replaced by its lower (if a[j] > 0) or upper (if a[j] < 0) +* single or variable bound. In the latter case, if x[j] is a non-fixed +* variable, this results in a relaxation of original inequality known +* as "surrogate knapsack". Thus, if the specified inequality is valid +* for the original mip, the resulting inequality is also valid. +* +* Note that in both source and resulting inequalities coefficients +* a[j] can have any sign. +* +* On entry to the routine the source inequality is specified by the +* parameters n, ind (contains original numbers of x[j]), a, and b. The +* parameter v is a working sparse vector whose components are assumed +* to be zero. +* +* On exit the routine stores the resulting "0-1 knapsack" inequality +* in the parameters ind, a, and b, and returns n which is the number +* of terms in the resulting inequality. Zero content of the vector v +* is restored before exit. +* +* If the resulting inequality cannot be constructed due to missing +* lower/upper bounds of some variable, the routine returns a negative +* value. */ + +static int build_ks(struct csa *csa, int n, int ind[], double a[], + double *b, FVS *v) +{ glp_prob *P = csa->P; + struct bnd *l = csa->l, *u = csa->u; + int j, k; + /* check that v = 0 */ +#ifdef GLP_DEBUG + fvs_check_vec(v); +#endif + xassert(v->nnz == 0); + /* walk thru terms of original inequality */ + for (j = 1; j <= n; j++) + { /* process term a[j]*x[j] */ + k = ind[j]; /* original number of x[j] in mip */ + if (glp_get_col_kind(P, k) == GLP_BV) + { /* x[j] is a binary variable */ + /* include its term into resulting inequality */ + add_term(v, k, a[j]); + } + else if (a[j] > 0) + { /* substitute x[j] by its lower bound */ + if (l[k].b == -DBL_MAX) + { /* x[j] has no lower bound */ + n = -1; + goto skip; + } + else if (l[k].z == 0) + { /* x[j] has simple lower bound */ + *b -= a[j] * l[k].b; + } + else + { /* x[j] has variable lower bound (a * z + b) */ + add_term(v, l[k].z, a[j] * l[k].a); + *b -= a[j] * l[k].b; + } + } + else /* a[j] < 0 */ + { /* substitute x[j] by its upper bound */ + if (u[k].b == +DBL_MAX) + { /* x[j] has no upper bound */ + n = -1; + goto skip; + } + else if (u[k].z == 0) + { /* x[j] has simple upper bound */ + *b -= a[j] * u[k].b; + } + else + { /* x[j] has variable upper bound (a * z + b) */ + add_term(v, u[k].z, a[j] * u[k].a); + *b -= a[j] * u[k].b; + } + } + } + /* replace tiny coefficients by exact zeros (see add_term) */ + fvs_adjust_vec(v, 2 * DBL_MIN); + /* copy terms of resulting inequality */ + xassert(v->nnz <= n); + n = v->nnz; + for (j = 1; j <= n; j++) + { ind[j] = v->ind[j]; + a[j] = v->vec[ind[j]]; + } +skip: /* restore zero content of v */ + fvs_clear_vec(v); + return n; +} + +/*********************************************************************** +* can_be_active - check if inequality can be active +* +* This routine checks if the specified "0-1 knapsack" inequality +* +* sum{j in 1..n} a[j]*x[j] <= b +* +* can be active. If so, the routine returns true, otherwise false. */ + +static int can_be_active(int n, const double a[], double b) +{ int j; + double s; + s = 0; + for (j = 1; j <= n; j++) + { if (a[j] > 0) + s += a[j]; + } + return s > b + .001 * (1 + fabs(b)); +} + +/*********************************************************************** +* is_sos_ineq - check if inequality is packing (SOS) constraint +* +* This routine checks if the specified "0-1 knapsack" inequality +* +* sum{j in 1..n} a[j]*x[j] <= b (1) +* +* is equivalent to packing inequality (Padberg calls such inequalities +* special ordered set or SOS constraints) +* +* sum{j in J'} x[j] - sum{j in J"} x[j] <= 1 - |J"|. (2) +* +* If so, the routine returns true, otherwise false. +* +* Note that if X is a set of feasible binary points satisfying to (2), +* its convex hull conv(X) equals to the set of feasible points of LP +* relaxation of (2), which is a n-dimensional simplex, so inequalities +* (2) are useless for generating cover cuts (due to unimodularity). +* +* ALGORITHM +* +* First, we make all a[j] positive by complementing x[j] = 1 - x'[j] +* in (1). This is performed implicitly (i.e. actually the array a is +* not changed), but b is replaced by b - sum{j : a[j] < 0}. +* +* Then we find two smallest coefficients a[p] = min{j in 1..n} a[j] +* and a[q] = min{j in 1..n : j != p} a[j]. It is obvious that if +* a[p] + a[q] > b, then a[i] + a[j] > b for all i != j, from which it +* follows that x[i] + x[j] <= 1 for all i != j. But the latter means +* that the original inequality (with all a[j] > 0) is equivalent to +* packing inequality +* +* sum{j in 1..n} x[j] <= 1. (3) +* +* Returning to original (uncomplemented) variables x'[j] = 1 - x[j] +* we have that the original inequality is equivalent to (2), where +* J' = {j : a[j] > 0} and J" = {j : a[j] < 0}. */ + +static int is_sos_ineq(int n, const double a[], double b) +{ int j, p, q; + xassert(n >= 2); + /* compute b := b - sum{j : a[j] < 0} */ + for (j = 1; j <= n; j++) + { if (a[j] < 0) + b -= a[j]; + } + /* find a[p] = min{j in 1..n} a[j] */ + p = 1; + for (j = 2; j <= n; j++) + { if (fabs(a[p]) > fabs(a[j])) + p = j; + } + /* find a[q] = min{j in 1..n : j != p} a[j] */ + q = 0; + for (j = 1; j <= n; j++) + { if (j != p) + { if (q == 0 || fabs(a[q]) > fabs(a[j])) + q = j; + } + } + xassert(q != 0); + /* check condition a[p] + a[q] > b */ + return fabs(a[p]) + fabs(a[q]) > b + .001 * (1 + fabs(b)); +} + +/*********************************************************************** +* process_ineq - basic inequality processing +* +* This routine performs basic processing of an inequality of "not +* greater" type +* +* sum{j in 1..n} a[j]*x[j] <= b +* +* specified by the parameters, n, ind, a, and b. +* +* If the inequality can be transformed to "0-1 knapsack" ineqiality +* suitable for generating cover cuts, the routine adds it to the set +* of "0-1 knapsack" inequalities. +* +* Note that the arrays ind and a are not saved on exit. */ + +static void process_ineq(struct csa *csa, int n, int ind[], double a[], + double b, FVS *v) +{ int i; + /* attempt to transform the specified inequality to equivalent or + * relaxed "0-1 knapsack" inequality */ + n = build_ks(csa, n, ind, a, &b, v); + if (n <= 1) + { /* uninteresting inequality (in principle, such inequalities + * should be removed by the preprocessor) */ + goto done; + } + if (!can_be_active(n, a, b)) + { /* inequality is redundant (i.e. cannot be active) */ + goto done; + } + if (is_sos_ineq(n, a, b)) + { /* packing (SOS) inequality is useless for generating cover + * cuts; currently such inequalities are just ignored */ + goto done; + } + /* add resulting "0-1 knapsack" inequality to the set */ + i = glp_add_rows(csa->set, 1); + glp_set_mat_row(csa->set, i, n, ind, a); + glp_set_row_bnds(csa->set, i, GLP_UP, b, b); +done: return; +} + +/**********************************************************************/ + +glp_cov *glp_cov_init(glp_prob *P) +{ /* create and initialize cover cut generator */ + glp_cov *cov; + struct csa csa; + int i, k, len, *ind; + double rhs, *val; + FVS fvs; + csa.P = P; + csa.l = talloc(1+P->n, struct bnd); + csa.u = talloc(1+P->n, struct bnd); + csa.set = glp_create_prob(); + glp_add_cols(csa.set, P->n); + /* initialize bounds of variables with simple bounds */ + init_bounds(&csa); + /* obtain and set variable bounds */ + obtain_vbs(&csa); + /* allocate working arrays */ + ind = talloc(1+P->n, int); + val = talloc(1+P->n, double); + fvs_alloc_vec(&fvs, P->n); + /* process all rows of the root mip */ + for (i = 1; i <= P->m; i++) + { switch (P->row[i]->type) + { case GLP_FR: + break; + case GLP_LO: + /* obtain row of ">=" type */ + len = glp_get_mat_row(P, i, ind, val); + rhs = P->row[i]->lb; + /* transforms it to row of "<=" type */ + for (k = 1; k <= len; k++) + val[k] = - val[k]; + rhs = - rhs; + /* process the row */ + process_ineq(&csa, len, ind, val, rhs, &fvs); + break; + case GLP_UP: + /* obtain row of "<=" type */ + len = glp_get_mat_row(P, i, ind, val); + rhs = P->row[i]->ub; + /* and process it */ + process_ineq(&csa, len, ind, val, rhs, &fvs); + break; + case GLP_DB: + case GLP_FX: + /* double-sided inequalitiy and equality constraints are + * processed as two separate inequalities */ + /* obtain row as if it were of ">=" type */ + len = glp_get_mat_row(P, i, ind, val); + rhs = P->row[i]->lb; + /* transforms it to row of "<=" type */ + for (k = 1; k <= len; k++) + val[k] = - val[k]; + rhs = - rhs; + /* and process it */ + process_ineq(&csa, len, ind, val, rhs, &fvs); + /* obtain the same row as if it were of "<=" type */ + len = glp_get_mat_row(P, i, ind, val); + rhs = P->row[i]->ub; + /* and process it */ + process_ineq(&csa, len, ind, val, rhs, &fvs); + break; + default: + xassert(P != P); + } + } + /* free working arrays */ + tfree(ind); + tfree(val); + fvs_check_vec(&fvs); + fvs_free_vec(&fvs); + /* the set of "0-1 knapsack" inequalities has been built */ + if (csa.set->m == 0) + { /* the set is empty */ + xprintf("No 0-1 knapsack inequalities detected\n"); + cov = NULL; + glp_delete_prob(csa.set); + } + else + { /* create the cover cut generator working area */ + xprintf("Number of 0-1 knapsack inequalities = %d\n", + csa.set->m); + cov = talloc(1, glp_cov); + cov->n = P->n; + cov->set = csa.set; +#if 0 + glp_write_lp(cov->set, 0, "set.lp"); +#endif + } + tfree(csa.l); + tfree(csa.u); + return cov; +} + +/*********************************************************************** +* solve_ks - solve 0-1 knapsack problem +* +* This routine finds (sub)optimal solution to 0-1 knapsack problem: +* +* maximize z = sum{j in 1..n} c[j]x[j] (1) +* +* s.t. sum{j in 1..n} a[j]x[j] <= b (2) +* +* x[j] in {0, 1} for all j in 1..n (3) +* +* It is assumed that the instance is non-normalized, i.e. parameters +* a, b, and c may have any sign. +* +* On exit the routine stores the (sub)optimal point found in locations +* x[1], ..., x[n] and returns the optimal objective value. However, if +* the instance is infeasible, the routine returns INT_MIN. */ + +static int solve_ks(int n, const int a[], int b, const int c[], + char x[]) +{ int z; + /* surprisingly, even for some small instances (n = 50-100) + * MT1 routine takes too much time, so it is used only for tiny + * instances */ + if (n <= 16) +#if 0 + z = ks_enum(n, a, b, c, x); +#else + z = ks_mt1(n, a, b, c, x); +#endif + else + z = ks_greedy(n, a, b, c, x); + return z; +} + +/*********************************************************************** +* simple_cover - find simple cover cut +* +* Given a 0-1 knapsack inequality (which may be globally as well as +* locally valid) +* +* sum{j in 1..n} a[j]x[j] <= b, (1) +* +* where all x[j] are binary variables and all a[j] are positive, and +* a fractional point x~{j in 1..n}, which is feasible to LP relaxation +* of (1), this routine attempts to find a simple cover inequality +* +* sum{j in C} (1 - x[j]) >= 1, (2) +* +* which is valid for (1) and violated at x~. +* +* Actually, the routine finds a cover C, i.e. a subset of {1, ..., n} +* such that +* +* sum{j in C} a[j] > b, (3) +* +* and which minimizes the left-hand side of (2) at x~ +* +* zeta = sum{j in C} (1 - x~[j]). (4) +* +* On exit the routine stores the characteritic vector z{j in 1..n} +* of the cover found (i.e. z[j] = 1 means j in C, and z[j] = 0 means +* j not in C), and returns corresponding minimal value of zeta (4). +* However, if no cover is found, the routine returns DBL_MAX. +* +* ALGORITHM +* +* The separation problem (3)-(4) is converted to 0-1 knapsack problem +* as follows. +* +* First, note that the constraint (3) is equivalent to +* +* sum{j in 1..n} a[j]z[j] >= b + eps, (5) +* +* where eps > 0 is a sufficiently small number (in case of integral +* a and b we may take eps = 1). Multiplying both sides of (5) by (-1) +* gives +* +* sum{j in 1..n} (-a[j])z[j] <= - b - eps. (6) +* +* To make all coefficients in (6) positive, z[j] is complemented by +* substitution z[j] = 1 - z'[j] that finally gives +* +* sum{j in 1..n} a[j]z'[j] <= sum{j in 1..n} a[j] - b - eps. (7) +* +* Minimization of zeta (4) is equivalent to maximization of +* +* -zeta = sum{j in 1..n} (x~[j] - 1)z[j]. (8) +* +* Substitution z[j] = 1 - z'[j] gives +* +* -zeta = sum{j in 1..n} (1 - x~[j])z'[j] - zeta0, (9) +* +* where zeta0 = sum{j in 1..n} (1 - x~[j]) is a constant term. +* +* Thus, the 0-1 knapsack problem to be solved is the following: +* +* maximize +* +* -zeta = sum{j in 1..n} (1 - x~[j])z'[j] - zeta0 (10) +* +* subject to +* +* sum{j in 1..n} a[j]z'[j] <= sum{j in 1..n} a[j] - b - eps (11) +* +* z'[j] in {0,1} for all j = 1,...,n (12) +* +* (The constant term zeta0 doesn't affect the solution, so it can be +* dropped.) */ + +static double simple_cover(int n, const double a[], double b, const + double x[], char z[]) +{ int j, *aa, bb, *cc; + double max_aj, min_aj, s, eps; + xassert(n >= 3); + /* allocate working arrays */ + aa = talloc(1+n, int); + cc = talloc(1+n, int); + /* compute max{j in 1..n} a[j] and min{j in 1..n} a[j] */ + max_aj = 0, min_aj = DBL_MAX; + for (j = 1; j <= n; j++) + { xassert(a[j] > 0); + if (max_aj < a[j]) + max_aj = a[j]; + if (min_aj > a[j]) + min_aj = a[j]; + } + /* scale and round constraint parameters to make them integral; + * note that we make the resulting inequality stronger than (11), + * so a[j]'s are rounded up while rhs is rounded down */ + s = 0; + for (j = 1; j <= n; j++) + { s += a[j]; + aa[j] = ceil(a[j] / max_aj * 1000); + } + bb = floor((s - b) / max_aj * 1000) - 1; + /* scale and round obj. coefficients to make them integral; + * again we make the objective function stronger than (10), so + * the coefficients are rounded down */ + for (j = 1; j <= n; j++) + { xassert(0 <= x[j] && x[j] <= 1); + cc[j] = floor((1 - x[j]) * 1000); + } + /* solve separation problem */ + if (solve_ks(n, aa, bb, cc, z) == INT_MIN) + { /* no cover exists */ + s = DBL_MAX; + goto skip; + } + /* determine z[j] = 1 - z'[j] */ + for (j = 1; j <= n; j++) + { xassert(z[j] == 0 || z[j] == 1); + z[j] ^= 1; + } + /* check condition (11) for original (non-scaled) parameters */ + s = 0; + for (j = 1; j <= n; j++) + { if (z[j]) + s += a[j]; + } + eps = 0.01 * (min_aj >= 1 ? min_aj : 1); + if (!(s >= b + eps)) + { /* no cover found within a precision req'd */ + s = DBL_MAX; + goto skip; + } + /* compute corresponding zeta (4) for cover found */ + s = 0; + for (j = 1; j <= n; j++) + { if (z[j]) + s += 1 - x[j]; + } +skip: /* free working arrays */ + tfree(aa); + tfree(cc); + return s; +} + +/**********************************************************************/ + +void glp_cov_gen1(glp_prob *P, glp_cov *cov, glp_prob *pool) +{ /* generate locally valid simple cover cuts */ + int i, k, len, new_len, *ind; + double *val, rhs, *x, zeta; + char *z; + xassert(P->n == cov->n && P->n == cov->set->n); + xassert(glp_get_status(P) == GLP_OPT); + /* allocate working arrays */ + ind = talloc(1+P->n, int); + val = talloc(1+P->n, double); + x = talloc(1+P->n, double); + z = talloc(1+P->n, char); + /* walk thru 0-1 knapsack inequalities */ + for (i = 1; i <= cov->set->m; i++) + { /* retrieve 0-1 knapsack inequality */ + len = glp_get_mat_row(cov->set, i, ind, val); + rhs = glp_get_row_ub(cov->set, i); + xassert(rhs != +DBL_MAX); + /* FIXME: skip, if slack is too large? */ + /* substitute and eliminate binary variables which have been + * fixed in the current subproblem (this makes the inequality + * only locally valid) */ + new_len = 0; + for (k = 1; k <= len; k++) + { if (glp_get_col_type(P, ind[k]) == GLP_FX) + rhs -= val[k] * glp_get_col_prim(P, ind[k]); + else + { new_len++; + ind[new_len] = ind[k]; + val[new_len] = val[k]; + } + } + len = new_len; + /* we need at least 3 binary variables in the inequality */ + if (len <= 2) + continue; + /* obtain values of binary variables from optimal solution to + * LP relaxation of current subproblem */ + for (k = 1; k <= len; k++) + { xassert(glp_get_col_kind(P, ind[k]) == GLP_BV); + x[k] = glp_get_col_prim(P, ind[k]); + if (x[k] < 0.00001) + x[k] = 0; + else if (x[k] > 0.99999) + x[k] = 1; + /* if val[k] < 0, perform substitution x[k] = 1 - x'[k] to + * make all coefficients positive */ + if (val[k] < 0) + { ind[k] = - ind[k]; /* x[k] is complemented */ + val[k] = - val[k]; + rhs += val[k]; + x[k] = 1 - x[k]; + } + } + /* find locally valid simple cover cut */ + zeta = simple_cover(len, val, rhs, x, z); + if (zeta > 0.95) + { /* no violation or insufficient violation; see (2) */ + continue; + } + /* construct cover inequality (2) for the cover found, which + * for original binary variables x[k] is equivalent to: + * sum{k in C'} x[k] + sum{k in C"} x'[k] <= |C| - 1 + * or + * sum{k in C'} x[k] + sum{k in C"} (1 - x[k]) <= |C| - 1 + * or + * sum{k in C'} x[k] - sum{k in C"} x[k] <= |C'| - 1 + * since |C| - |C"| = |C'| */ + new_len = 0; + rhs = -1; + for (k = 1; k <= len; k++) + { if (z[k]) + { new_len++; + if (ind[k] > 0) + { ind[new_len] = +ind[k]; + val[new_len] = +1; + rhs++; + } + else /* ind[k] < 0 */ + { ind[new_len] = -ind[k]; + val[new_len] = -1; + } + } + } + len = new_len; + /* add the cover inequality to the local cut pool */ + k = glp_add_rows(pool, 1); + glp_set_mat_row(pool, k, len, ind, val); + glp_set_row_bnds(pool, k, GLP_UP, rhs, rhs); + } + /* free working arrays */ + tfree(ind); + tfree(val); + tfree(x); + tfree(z); + return; +} + +/**********************************************************************/ + +void glp_cov_free(glp_cov *cov) +{ /* delete cover cut generator workspace */ + xassert(cov != NULL); + glp_delete_prob(cov->set); + tfree(cov); + return; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpios10.c b/resources/3rdparty/glpk-4.65/src/intopt/fpump.c similarity index 97% rename from resources/3rdparty/glpk-4.57/src/glpios10.c rename to resources/3rdparty/glpk-4.65/src/intopt/fpump.c index e67625795..0bdd6d4e5 100644 --- a/resources/3rdparty/glpk-4.57/src/glpios10.c +++ b/resources/3rdparty/glpk-4.65/src/intopt/fpump.c @@ -1,10 +1,9 @@ -/* glpios10.c (feasibility pump heuristic) */ +/* fpump.c (feasibility pump heuristic) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2009-2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +22,7 @@ ***********************************************************************/ #include "env.h" -#include "glpios.h" +#include "ios.h" #include "rng.h" /*********************************************************************** @@ -56,7 +55,7 @@ struct VAR /* sorting key */ }; -static int fcmp(const void *x, const void *y) +static int CDECL fcmp(const void *x, const void *y) { /* comparison routine */ const struct VAR *vx = x, *vy = y; if (vx->d > vy->d) @@ -307,12 +306,18 @@ skip: /* check if the time limit has been exhausted */ if (ret != 0) { if (T->parm->msg_lev >= GLP_MSG_ERR) xprintf("Warning: glp_simplex returned %d\n", ret); +#if 1 /* 17/III-2016: fix memory leak */ + xfree(x); +#endif goto done; } ret = glp_get_status(lp); if (ret != GLP_OPT) { if (T->parm->msg_lev >= GLP_MSG_ERR) xprintf("Warning: glp_get_status returned %d\n", ret); +#if 1 /* 17/III-2016: fix memory leak */ + xfree(x); +#endif goto done; } for (j = 1; j <= n; j++) diff --git a/resources/3rdparty/glpk-4.57/src/glpios05.c b/resources/3rdparty/glpk-4.65/src/intopt/gmicut.c similarity index 50% rename from resources/3rdparty/glpk-4.57/src/glpios05.c rename to resources/3rdparty/glpk-4.65/src/intopt/gmicut.c index 18ae0cbbb..4ef0b746c 100644 --- a/resources/3rdparty/glpk-4.57/src/glpios05.c +++ b/resources/3rdparty/glpk-4.65/src/intopt/gmicut.c @@ -1,10 +1,9 @@ -/* glpios05.c (Gomory's mixed integer cut generator) */ +/* gmicut.c (Gomory's mixed integer cut generator) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2002-2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,71 +22,139 @@ ***********************************************************************/ #include "env.h" -#include "glpios.h" +#include "prob.h" /*********************************************************************** * NAME * -* ios_gmi_gen - generate Gomory's mixed integer cuts. +* glp_gmi_cut - generate Gomory's mixed integer cut (core routine) * * SYNOPSIS * -* #include "glpios.h" -* void ios_gmi_gen(glp_tree *tree, IOSPOOL *pool); +* int glp_gmi_cut(glp_prob *P, int j, int ind[], double val[], double +* phi[]); * * DESCRIPTION * -* The routine ios_gmi_gen generates Gomory's mixed integer cuts for -* the current point and adds them to the cut pool. */ - -#define MAXCUTS 50 -/* maximal number of cuts to be generated for one round */ - -struct worka -{ /* Gomory's cut generator working area */ - int *ind; /* int ind[1+n]; */ - double *val; /* double val[1+n]; */ - double *phi; /* double phi[1+m+n]; */ -}; +* This routine attempts to generate a Gomory's mixed integer cut for +* specified integer column (structural variable), whose primal value +* in current basic solution is integer infeasible (fractional). +* +* On entry to the routine the basic solution contained in the problem +* object P should be optimal, and the basis factorization should be +* valid. The parameter j should specify the ordinal number of column +* (structural variable x[j]), for which the cut should be generated, +* 1 <= j <= n, where n is the number of columns in the problem object. +* This column should be integer, non-fixed, and basic, and its primal +* value should be fractional. +* +* The cut generated by the routine is the following inequality: +* +* sum a[j] * x[j] >= b, +* +* which is expected to be violated at the current basic solution. +* +* If the cut has been successfully generated, the routine stores its +* non-zero coefficients a[j] and corresponding column indices j in the +* array locations val[1], ..., val[len] and ind[1], ..., ind[len], +* where 1 <= len <= n is the number of non-zero coefficients. The +* right-hand side value b is stored in val[0], and ind[0] is set to 0. +* +* The working array phi should have 1+m+n locations (location phi[0] +* is not used), where m and n is the number of rows and columns in the +* problem object, resp. +* +* RETURNS +* +* If the cut has been successfully generated, the routine returns +* len, the number of non-zero coefficients in the cut, 1 <= len <= n. +* +* Otherwise, the routine returns one of the following codes: +* +* -1 current basis factorization is not valid; +* +* -2 current basic solution is not optimal; +* +* -3 column ordinal number j is out of range; +* +* -4 variable x[j] is not of integral kind; +* +* -5 variable x[j] is either fixed or non-basic; +* +* -6 primal value of variable x[j] in basic solution is too close +* to nearest integer; +* +* -7 some coefficients in the simplex table row corresponding to +* variable x[j] are too large in magnitude; +* +* -8 some free (unbounded) variables have non-zero coefficients in +* the simplex table row corresponding to variable x[j]. +* +* ALGORITHM +* +* See glpk/doc/notes/gomory (in Russian). */ #define f(x) ((x) - floor(x)) /* compute fractional part of x */ -static void gen_cut(glp_tree *tree, struct worka *worka, int j) -{ /* this routine tries to generate Gomory's mixed integer cut for - specified structural variable x[m+j] of integer kind, which is - basic and has fractional value in optimal solution to current - LP relaxation */ - glp_prob *mip = tree->mip; - int m = mip->m; - int n = mip->n; - int *ind = worka->ind; - double *val = worka->val; - double *phi = worka->phi; +int glp_gmi_cut(glp_prob *P, int j, + int ind[/*1+n*/], double val[/*1+n*/], double phi[/*1+m+n*/]) +{ int m = P->m; + int n = P->n; + GLPROW *row; + GLPCOL *col; + GLPAIJ *aij; int i, k, len, kind, stat; double lb, ub, alfa, beta, ksi, phi1, rhs; + /* sanity checks */ + if (!(P->m == 0 || P->valid)) + { /* current basis factorization is not valid */ + return -1; + } + if (!(P->pbs_stat == GLP_FEAS && P->dbs_stat == GLP_FEAS)) + { /* current basic solution is not optimal */ + return -2; + } + if (!(1 <= j && j <= n)) + { /* column ordinal number is out of range */ + return -3; + } + col = P->col[j]; + if (col->kind != GLP_IV) + { /* x[j] is not of integral kind */ + return -4; + } + if (col->type == GLP_FX || col->stat != GLP_BS) + { /* x[j] is either fixed or non-basic */ + return -5; + } + if (fabs(col->prim - floor(col->prim + 0.5)) < 0.001) + { /* primal value of x[j] is too close to nearest integer */ + return -6; + } /* compute row of the simplex tableau, which (row) corresponds - to specified basic variable xB[i] = x[m+j]; see (23) */ - len = glp_eval_tab_row(mip, m+j, ind, val); + * to specified basic variable xB[i] = x[j]; see (23) */ + len = glp_eval_tab_row(P, m+j, ind, val); /* determine beta[i], which a value of xB[i] in optimal solution - to current LP relaxation; note that this value is the same as - if it would be computed with formula (27); it is assumed that - beta[i] is fractional enough */ - beta = mip->col[j]->prim; + * to current LP relaxation; note that this value is the same as + * if it would be computed with formula (27); it is assumed that + * beta[i] is fractional enough */ + beta = P->col[j]->prim; /* compute cut coefficients phi and right-hand side rho, which - correspond to formula (30); dense format is used, because rows - of the simplex tableau is usually dense */ - for (k = 1; k <= m+n; k++) phi[k] = 0.0; + * correspond to formula (30); dense format is used, because rows + * of the simplex tableau are usually dense */ + for (k = 1; k <= m+n; k++) + phi[k] = 0.0; rhs = f(beta); /* initial value of rho; see (28), (32) */ for (j = 1; j <= len; j++) { /* determine original number of non-basic variable xN[j] */ k = ind[j]; xassert(1 <= k && k <= m+n); /* determine the kind, bounds and current status of xN[j] in - optimal solution to LP relaxation */ + * optimal solution to LP relaxation */ if (k <= m) { /* auxiliary variable */ - GLPROW *row = mip->row[k]; + row = P->row[k]; kind = GLP_CV; lb = row->lb; ub = row->ub; @@ -95,7 +162,7 @@ static void gen_cut(glp_tree *tree, struct worka *worka, int j) } else { /* structural variable */ - GLPCOL *col = mip->col[k-m]; + col = P->col[k-m]; kind = col->kind; lb = col->lb; ub = col->ub; @@ -105,17 +172,18 @@ static void gen_cut(glp_tree *tree, struct worka *worka, int j) xassert(stat != GLP_BS); /* determine row coefficient ksi[i,j] at xN[j]; see (23) */ ksi = val[j]; - /* if ksi[i,j] is too large in the magnitude, do not generate - the cut */ - if (fabs(ksi) > 1e+05) goto fini; - /* if ksi[i,j] is too small in the magnitude, skip it */ - if (fabs(ksi) < 1e-10) goto skip; + /* if ksi[i,j] is too large in magnitude, report failure */ + if (fabs(ksi) > 1e+05) + return -7; + /* if ksi[i,j] is too small in magnitude, skip it */ + if (fabs(ksi) < 1e-10) + goto skip; /* compute row coefficient alfa[i,j] at y[j]; see (26) */ switch (stat) { case GLP_NF: /* xN[j] is free (unbounded) having non-zero ksi[i,j]; - do not generate the cut */ - goto fini; + * report failure */ + return -8; case GLP_NL: /* xN[j] has active lower bound */ alfa = - ksi; @@ -154,7 +222,7 @@ static void gen_cut(glp_tree *tree, struct worka *worka, int j) xassert(kind != kind); } /* compute cut coefficient phi[j] at xN[j] and update right- - hand side rho; see (31), (32) */ + * hand side rho; see (31), (32) */ switch (stat) { case GLP_NL: /* xN[j] has active lower bound */ @@ -172,31 +240,30 @@ static void gen_cut(glp_tree *tree, struct worka *worka, int j) skip: ; } /* now the cut has the form sum_k phi[k] * x[k] >= rho, where cut - coefficients are stored in the array phi in dense format; - x[1,...,m] are auxiliary variables, x[m+1,...,m+n] are struc- - tural variables; see (30) */ + * coefficients are stored in the array phi in dense format; + * x[1,...,m] are auxiliary variables, x[m+1,...,m+n] are struc- + * tural variables; see (30) */ /* eliminate auxiliary variables in order to express the cut only - through structural variables; see (33) */ + * through structural variables; see (33) */ for (i = 1; i <= m; i++) - { GLPROW *row; - GLPAIJ *aij; - if (fabs(phi[i]) < 1e-10) continue; + { if (fabs(phi[i]) < 1e-10) + continue; /* auxiliary variable x[i] has non-zero cut coefficient */ - row = mip->row[i]; - /* x[i] cannot be fixed */ + row = P->row[i]; + /* x[i] cannot be fixed variable */ xassert(row->type != GLP_FX); /* substitute x[i] = sum_j a[i,j] * x[m+j] */ for (aij = row->ptr; aij != NULL; aij = aij->r_next) phi[m+aij->col->j] += phi[i] * aij->val; } /* convert the final cut to sparse format and substitute fixed - (structural) variables */ + * (structural) variables */ len = 0; for (j = 1; j <= n; j++) - { GLPCOL *col; - if (fabs(phi[m+j]) < 1e-10) continue; + { if (fabs(phi[m+j]) < 1e-10) + continue; /* structural variable x[m+j] has non-zero cut coefficient */ - col = mip->col[j]; + col = P->col[j]; if (col->type == GLP_FX) { /* eliminate x[m+j] */ rhs -= phi[m+j] * col->lb; @@ -207,76 +274,11 @@ skip: ; val[len] = phi[m+j]; } } - if (fabs(rhs) < 1e-12) rhs = 0.0; - /* if the cut inequality seems to be badly scaled, reject it to - avoid numeric difficulties */ - for (k = 1; k <= len; k++) - { if (fabs(val[k]) < 1e-03) goto fini; - if (fabs(val[k]) > 1e+03) goto fini; - } - /* add the cut to the cut pool for further consideration */ -#if 0 - ios_add_cut_row(tree, pool, GLP_RF_GMI, len, ind, val, GLP_LO, - rhs); -#else - glp_ios_add_row(tree, NULL, GLP_RF_GMI, 0, len, ind, val, GLP_LO, - rhs); -#endif -fini: return; -} - -struct var { int j; double f; }; - -static int fcmp(const void *p1, const void *p2) -{ const struct var *v1 = p1, *v2 = p2; - if (v1->f > v2->f) return -1; - if (v1->f < v2->f) return +1; - return 0; -} - -void ios_gmi_gen(glp_tree *tree) -{ /* main routine to generate Gomory's cuts */ - glp_prob *mip = tree->mip; - int m = mip->m; - int n = mip->n; - struct var *var; - int k, nv, j, size; - struct worka _worka, *worka = &_worka; - /* allocate working arrays */ - var = xcalloc(1+n, sizeof(struct var)); - worka->ind = xcalloc(1+n, sizeof(int)); - worka->val = xcalloc(1+n, sizeof(double)); - worka->phi = xcalloc(1+m+n, sizeof(double)); - /* build the list of integer structural variables, which are - basic and have fractional value in optimal solution to current - LP relaxation */ - nv = 0; - for (j = 1; j <= n; j++) - { GLPCOL *col = mip->col[j]; - double frac; - if (col->kind != GLP_IV) continue; - if (col->type == GLP_FX) continue; - if (col->stat != GLP_BS) continue; - frac = f(col->prim); - if (!(0.05 <= frac && frac <= 0.95)) continue; - /* add variable to the list */ - nv++, var[nv].j = j, var[nv].f = frac; - } - /* order the list by descending fractionality */ - qsort(&var[1], nv, sizeof(struct var), fcmp); - /* try to generate cuts by one for each variable in the list, but - not more than MAXCUTS cuts */ - size = glp_ios_pool_size(tree); - for (k = 1; k <= nv; k++) - { if (glp_ios_pool_size(tree) - size >= MAXCUTS) break; - gen_cut(tree, worka, var[k].j); - } - /* free working arrays */ - xfree(var); - xfree(worka->ind); - xfree(worka->val); - xfree(worka->phi); - return; + if (fabs(rhs) < 1e-12) + rhs = 0.0; + ind[0] = 0, val[0] = rhs; + /* the cut has been successfully generated */ + return len; } /* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/intopt/gmigen.c b/resources/3rdparty/glpk-4.65/src/intopt/gmigen.c new file mode 100644 index 000000000..627682cbd --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/intopt/gmigen.c @@ -0,0 +1,142 @@ +/* gmigen.c (Gomory's mixed integer cuts generator) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2002-2018 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "prob.h" + +/*********************************************************************** +* NAME +* +* glp_gmi_gen - generate Gomory's mixed integer cuts +* +* SYNOPSIS +* +* int glp_gmi_gen(glp_prob *P, glp_prob *pool, int max_cuts); +* +* DESCRIPTION +* +* This routine attempts to generate Gomory's mixed integer cuts for +* integer variables, whose primal values in current basic solution are +* integer infeasible (fractional). +* +* On entry to the routine the basic solution contained in the problem +* object P should be optimal, and the basis factorization should be +* valid. +* +* The cutting plane inequalities generated by the routine are added to +* the specified cut pool. +* +* The parameter max_cuts specifies the maximal number of cuts to be +* generated. Note that the number of cuts cannot exceed the number of +* basic variables, which is the number of rows in the problem object. +* +* RETURNS +* +* The routine returns the number of cuts that have been generated and +* added to the cut pool. */ + +#define f(x) ((x) - floor(x)) +/* compute fractional part of x */ + +struct var { int j; double f; }; + +static int CDECL fcmp(const void *p1, const void *p2) +{ const struct var *v1 = p1, *v2 = p2; + if (v1->f > v2->f) return -1; + if (v1->f < v2->f) return +1; + return 0; +} + +int glp_gmi_gen(glp_prob *P, glp_prob *pool, int max_cuts) +{ int m = P->m; + int n = P->n; + GLPCOL *col; + struct var *var; + int i, j, k, t, len, nv, nnn, *ind; + double frac, *val, *phi; + /* sanity checks */ + if (!(P->m == 0 || P->valid)) + xerror("glp_gmi_gen: basis factorization does not exist\n"); + if (!(P->pbs_stat == GLP_FEAS && P->dbs_stat == GLP_FEAS)) + xerror("glp_gmi_gen: optimal basic solution required\n"); + if (pool->n != n) + xerror("glp_gmi_gen: cut pool has wrong number of columns\n"); + /* allocate working arrays */ + var = xcalloc(1+n, sizeof(struct var)); + ind = xcalloc(1+n, sizeof(int)); + val = xcalloc(1+n, sizeof(double)); + phi = xcalloc(1+m+n, sizeof(double)); + /* build the list of integer structural variables, which are + * basic and have integer infeasible (fractional) primal values + * in optimal solution to specified LP */ + nv = 0; + for (j = 1; j <= n; j++) + { col = P->col[j]; + if (col->kind != GLP_IV) + continue; + if (col->type == GLP_FX) + continue; + if (col->stat != GLP_BS) + continue; + frac = f(col->prim); + if (!(0.05 <= frac && frac <= 0.95)) + continue; + /* add variable to the list */ + nv++, var[nv].j = j, var[nv].f = frac; + } + /* sort the list by descending fractionality */ + qsort(&var[1], nv, sizeof(struct var), fcmp); + /* try to generate cuts by one for each variable in the list, but + * not more than max_cuts cuts */ + nnn = 0; + for (t = 1; t <= nv; t++) + { len = glp_gmi_cut(P, var[t].j, ind, val, phi); + if (len < 1) + goto skip; + /* if the cut inequality seems to be badly scaled, reject it + * to avoid numerical difficulties */ + for (k = 1; k <= len; k++) + { if (fabs(val[k]) < 1e-03) + goto skip; + if (fabs(val[k]) > 1e+03) + goto skip; + } + /* add the cut to the cut pool for further consideration */ + i = glp_add_rows(pool, 1); + glp_set_row_bnds(pool, i, GLP_LO, val[0], 0); + glp_set_mat_row(pool, i, len, ind, val); + /* one cut has been generated */ + nnn++; + if (nnn == max_cuts) + break; +skip: ; + } + /* free working arrays */ + xfree(var); + xfree(ind); + xfree(val); + xfree(phi); + return nnn; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpios06.c b/resources/3rdparty/glpk-4.65/src/intopt/mirgen.c similarity index 85% rename from resources/3rdparty/glpk-4.57/src/glpios06.c rename to resources/3rdparty/glpk-4.65/src/intopt/mirgen.c index 53f8dcfc7..45a0a55dc 100644 --- a/resources/3rdparty/glpk-4.57/src/glpios06.c +++ b/resources/3rdparty/glpk-4.65/src/intopt/mirgen.c @@ -1,10 +1,9 @@ -/* glpios06.c (MIR cut generator) */ +/* mirgen.c (mixed integer rounding cuts generator) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2007-2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -22,15 +21,40 @@ * along with GLPK. If not, see . ***********************************************************************/ +#if 1 /* 29/II-2016 by Chris */ +/*---------------------------------------------------------------------- +Subject: Mir cut generation performance improvement +From: Chris Matrakidis +To: Andrew Makhorin , help-glpk + +Andrew, + +I noticed that mir cut generation takes considerable time on some large +problems (like rocII-4-11 from miplib). The attached patch makes two +improvements that considerably improve performance in such instances: +1. A lot of time was spent on generating a temporary vector in function +aggregate_row. It is a lot faster to reuse an existing vector. +2. A search for an element in the same function was done in row order, +where using the elements in the order they are in the column is more +efficient. This changes the generated cuts in some cases, but seems +neutral overall (0.3% less cuts in a test set of 64 miplib instances). + +Best Regards, + +Chris Matrakidis +----------------------------------------------------------------------*/ +#endif + #include "env.h" -#include "glpios.h" +#include "prob.h" +#include "spv.h" -#define _MIR_DEBUG 0 +#define MIR_DEBUG 0 #define MAXAGGR 5 -/* maximal number of rows which can be aggregated */ +/* maximal number of rows that can be aggregated */ -struct MIR +struct glp_mir { /* MIR cut generator working area */ /*--------------------------------------------------------------*/ /* global information valid for the root subproblem */ @@ -74,7 +98,7 @@ struct MIR int *agg_row; /* int agg_row[1+MAXAGGR]; */ /* agg_row[k], 1 <= k <= agg_cnt, is the row number used to build aggregated constraint */ - IOSVEC *agg_vec; /* IOSVEC agg_vec[1:m+n]; */ + SPV *agg_vec; /* SPV agg_vec[1:m+n]; */ /* sparse vector of aggregated constraint coefficients, a[k] */ double agg_rhs; /* right-hand side of the aggregated constraint, b */ @@ -91,13 +115,13 @@ struct MIR derived from aggregated constraint by substituting bounds; note that due to substitution of variable bounds there may be additional terms in the modified constraint */ - IOSVEC *mod_vec; /* IOSVEC mod_vec[1:m+n]; */ + SPV *mod_vec; /* SPV mod_vec[1:m+n]; */ /* sparse vector of modified constraint coefficients, a'[k] */ double mod_rhs; /* right-hand side of the modified constraint, b' */ /*--------------------------------------------------------------*/ /* cutting plane sum alpha[k] * x[k] <= beta */ - IOSVEC *cut_vec; /* IOSVEC cut_vec[1:m+n]; */ + SPV *cut_vec; /* SPV cut_vec[1:m+n]; */ /* sparse vector of cutting plane coefficients, alpha[k] */ double cut_rhs; /* right-hand size of the cutting plane, beta */ @@ -106,26 +130,23 @@ struct MIR /*********************************************************************** * NAME * -* ios_mir_init - initialize MIR cut generator +* glp_mir_init - create and initialize MIR cut generator * * SYNOPSIS * -* #include "glpios.h" -* void *ios_mir_init(glp_tree *tree); +* glp_mir *glp_mir_init(glp_prob *P); * * DESCRIPTION * -* The routine ios_mir_init initializes the MIR cut generator assuming -* that the current subproblem is the root subproblem. +* This routine creates and initializes the MIR cut generator for the +* specified problem object. * * RETURNS * -* The routine ios_mir_init returns a pointer to the MIR cut generator -* working area. */ +* The routine returns a pointer to the MIR cut generator workspace. */ -static void set_row_attrib(glp_tree *tree, struct MIR *mir) +static void set_row_attrib(glp_prob *mip, glp_mir *mir) { /* set global row attributes */ - glp_prob *mip = tree->mip; int m = mir->m; int k; for (k = 1; k <= m; k++) @@ -151,9 +172,8 @@ static void set_row_attrib(glp_tree *tree, struct MIR *mir) return; } -static void set_col_attrib(glp_tree *tree, struct MIR *mir) +static void set_col_attrib(glp_prob *mip, glp_mir *mir) { /* set global column attributes */ - glp_prob *mip = tree->mip; int m = mir->m; int n = mir->n; int k; @@ -186,9 +206,8 @@ static void set_col_attrib(glp_tree *tree, struct MIR *mir) return; } -static void set_var_bounds(glp_tree *tree, struct MIR *mir) +static void set_var_bounds(glp_prob *mip, glp_mir *mir) { /* set variable bounds */ - glp_prob *mip = tree->mip; int m = mir->m; GLPAIJ *aij; int i, k1, k2; @@ -249,9 +268,8 @@ static void set_var_bounds(glp_tree *tree, struct MIR *mir) return; } -static void mark_useless_rows(glp_tree *tree, struct MIR *mir) +static void mark_useless_rows(glp_prob *mip, glp_mir *mir) { /* mark rows which should not be used */ - glp_prob *mip = tree->mip; int m = mir->m; GLPAIJ *aij; int i, k, nv; @@ -289,17 +307,16 @@ static void mark_useless_rows(glp_tree *tree, struct MIR *mir) return; } -void *ios_mir_init(glp_tree *tree) -{ /* initialize MIR cut generator */ - glp_prob *mip = tree->mip; +glp_mir *glp_mir_init(glp_prob *mip) +{ /* create and initialize MIR cut generator */ int m = mip->m; int n = mip->n; - struct MIR *mir; -#if _MIR_DEBUG + glp_mir *mir; +#if MIR_DEBUG xprintf("ios_mir_init: warning: debug mode enabled\n"); #endif /* allocate working area */ - mir = xmalloc(sizeof(struct MIR)); + mir = xmalloc(sizeof(glp_mir)); mir->m = m; mir->n = n; mir->skip = xcalloc(1+m, sizeof(char)); @@ -310,39 +327,45 @@ void *ios_mir_init(glp_tree *tree) mir->vub = xcalloc(1+m+n, sizeof(int)); mir->x = xcalloc(1+m+n, sizeof(double)); mir->agg_row = xcalloc(1+MAXAGGR, sizeof(int)); - mir->agg_vec = ios_create_vec(m+n); + mir->agg_vec = spv_create_vec(m+n); mir->subst = xcalloc(1+m+n, sizeof(char)); - mir->mod_vec = ios_create_vec(m+n); - mir->cut_vec = ios_create_vec(m+n); + mir->mod_vec = spv_create_vec(m+n); + mir->cut_vec = spv_create_vec(m+n); /* set global row attributes */ - set_row_attrib(tree, mir); + set_row_attrib(mip, mir); /* set global column attributes */ - set_col_attrib(tree, mir); + set_col_attrib(mip, mir); /* set variable bounds */ - set_var_bounds(tree, mir); + set_var_bounds(mip, mir); /* mark rows which should not be used */ - mark_useless_rows(tree, mir); + mark_useless_rows(mip, mir); return mir; } /*********************************************************************** * NAME * -* ios_mir_gen - generate MIR cuts +* glp_mir_gen - generate mixed integer rounding (MIR) cuts * * SYNOPSIS * -* #include "glpios.h" -* void ios_mir_gen(glp_tree *tree, void *gen, IOSPOOL *pool); +* int glp_mir_gen(glp_prob *P, glp_mir *mir, glp_prob *pool); * * DESCRIPTION * -* The routine ios_mir_gen generates MIR cuts for the current point and -* adds them to the cut pool. */ +* This routine attempts to generate mixed integer rounding (MIR) cuts +* for current basic solution to the specified problem object. +* +* The cutting plane inequalities generated by the routine are added to +* the specified cut pool. +* +* RETURNS +* +* The routine returns the number of cuts that have been generated and +* added to the cut pool. */ -static void get_current_point(glp_tree *tree, struct MIR *mir) +static void get_current_point(glp_prob *mip, glp_mir *mir) { /* obtain current point */ - glp_prob *mip = tree->mip; int m = mir->m; int n = mir->n; int k; @@ -353,8 +376,8 @@ static void get_current_point(glp_tree *tree, struct MIR *mir) return; } -#if _MIR_DEBUG -static void check_current_point(struct MIR *mir) +#if MIR_DEBUG +static void check_current_point(glp_mir *mir) { /* check current point */ int m = mir->m; int n = mir->n; @@ -394,9 +417,8 @@ static void check_current_point(struct MIR *mir) } #endif -static void initial_agg_row(glp_tree *tree, struct MIR *mir, int i) +static void initial_agg_row(glp_prob *mip, glp_mir *mir, int i) { /* use original i-th row as initial aggregated constraint */ - glp_prob *mip = tree->mip; int m = mir->m; GLPAIJ *aij; xassert(1 <= i && i <= m); @@ -408,19 +430,19 @@ static void initial_agg_row(glp_tree *tree, struct MIR *mir, int i) mir->agg_row[1] = i; /* use x[i] - sum a[i,j] * x[m+j] = 0, where x[i] is auxiliary variable of row i, x[m+j] are structural variables */ - ios_clear_vec(mir->agg_vec); - ios_set_vj(mir->agg_vec, i, 1.0); + spv_clear_vec(mir->agg_vec); + spv_set_vj(mir->agg_vec, i, 1.0); for (aij = mip->row[i]->ptr; aij != NULL; aij = aij->r_next) - ios_set_vj(mir->agg_vec, m + aij->col->j, - aij->val); + spv_set_vj(mir->agg_vec, m + aij->col->j, - aij->val); mir->agg_rhs = 0.0; -#if _MIR_DEBUG - ios_check_vec(mir->agg_vec); +#if MIR_DEBUG + spv_check_vec(mir->agg_vec); #endif return; } -#if _MIR_DEBUG -static void check_agg_row(struct MIR *mir) +#if MIR_DEBUG +static void check_agg_row(glp_mir *mir) { /* check aggregated constraint */ int m = mir->m; int n = mir->n; @@ -445,7 +467,7 @@ static void check_agg_row(struct MIR *mir) } #endif -static void subst_fixed_vars(struct MIR *mir) +static void subst_fixed_vars(glp_mir *mir) { /* substitute fixed variables into aggregated constraint */ int m = mir->m; int n = mir->n; @@ -461,14 +483,14 @@ static void subst_fixed_vars(struct MIR *mir) } } /* remove terms corresponding to fixed variables */ - ios_clean_vec(mir->agg_vec, DBL_EPSILON); -#if _MIR_DEBUG - ios_check_vec(mir->agg_vec); + spv_clean_vec(mir->agg_vec, DBL_EPSILON); +#if MIR_DEBUG + spv_check_vec(mir->agg_vec); #endif return; } -static void bound_subst_heur(struct MIR *mir) +static void bound_subst_heur(glp_mir *mir) { /* bound substitution heuristic */ int m = mir->m; int n = mir->n; @@ -518,16 +540,16 @@ static void bound_subst_heur(struct MIR *mir) return; } -static void build_mod_row(struct MIR *mir) +static void build_mod_row(glp_mir *mir) { /* substitute bounds and build modified constraint */ int m = mir->m; int n = mir->n; int j, jj, k, kk; /* initially modified constraint is aggregated constraint */ - ios_copy_vec(mir->mod_vec, mir->agg_vec); + spv_copy_vec(mir->mod_vec, mir->agg_vec); mir->mod_rhs = mir->agg_rhs; -#if _MIR_DEBUG - ios_check_vec(mir->mod_vec); +#if MIR_DEBUG + spv_check_vec(mir->mod_vec); #endif /* substitute bounds for continuous variables; note that due to substitution of variable bounds additional terms may appear in @@ -549,7 +571,7 @@ static void build_mod_row(struct MIR *mir) xassert(mir->isint[kk]); jj = mir->mod_vec->pos[kk]; if (jj == 0) - { ios_set_vj(mir->mod_vec, kk, 1.0); + { spv_set_vj(mir->mod_vec, kk, 1.0); jj = mir->mod_vec->pos[kk]; mir->mod_vec->val[jj] = 0.0; } @@ -570,7 +592,7 @@ static void build_mod_row(struct MIR *mir) xassert(mir->isint[kk]); jj = mir->mod_vec->pos[kk]; if (jj == 0) - { ios_set_vj(mir->mod_vec, kk, 1.0); + { spv_set_vj(mir->mod_vec, kk, 1.0); jj = mir->mod_vec->pos[kk]; mir->mod_vec->val[jj] = 0.0; } @@ -582,8 +604,8 @@ static void build_mod_row(struct MIR *mir) else xassert(k != k); } -#if _MIR_DEBUG - ios_check_vec(mir->mod_vec); +#if MIR_DEBUG + spv_check_vec(mir->mod_vec); #endif /* substitute bounds for integer variables */ for (j = 1; j <= mir->mod_vec->nnz; j++) @@ -605,14 +627,14 @@ static void build_mod_row(struct MIR *mir) mir->mod_vec->val[j] = - mir->mod_vec->val[j]; } } -#if _MIR_DEBUG - ios_check_vec(mir->mod_vec); +#if MIR_DEBUG + spv_check_vec(mir->mod_vec); #endif return; } -#if _MIR_DEBUG -static void check_mod_row(struct MIR *mir) +#if MIR_DEBUG +static void check_mod_row(glp_mir *mir) { /* check modified constraint */ int m = mir->m; int n = mir->n; @@ -776,7 +798,7 @@ static int cmir_ineq(const int n, const double a[], const double b, struct vset { int j; double v; }; -static int cmir_cmp(const void *p1, const void *p2) +static int CDECL cmir_cmp(const void *p1, const void *p2) { const struct vset *v1 = p1, *v2 = p2; if (v1->v < v2->v) return -1; if (v1->v > v2->v) return +1; @@ -870,19 +892,19 @@ done: /* free working arrays */ return r_best; } -static double generate(struct MIR *mir) +static double generate(glp_mir *mir) { /* try to generate violated c-MIR cut for modified constraint */ int m = mir->m; int n = mir->n; int j, k, kk, nint; double s, *u, *x, *alpha, r_best = 0.0, b, beta, gamma; - ios_copy_vec(mir->cut_vec, mir->mod_vec); + spv_copy_vec(mir->cut_vec, mir->mod_vec); mir->cut_rhs = mir->mod_rhs; /* remove small terms, which can appear due to substitution of variable bounds */ - ios_clean_vec(mir->cut_vec, DBL_EPSILON); -#if _MIR_DEBUG - ios_check_vec(mir->cut_vec); + spv_clean_vec(mir->cut_vec, DBL_EPSILON); +#if MIR_DEBUG + spv_check_vec(mir->cut_vec); #endif /* remove positive continuous terms to obtain MK relaxation */ for (j = 1; j <= mir->cut_vec->nnz; j++) @@ -891,9 +913,9 @@ static double generate(struct MIR *mir) if (!mir->isint[k] && mir->cut_vec->val[j] > 0.0) mir->cut_vec->val[j] = 0.0; } - ios_clean_vec(mir->cut_vec, 0.0); -#if _MIR_DEBUG - ios_check_vec(mir->cut_vec); + spv_clean_vec(mir->cut_vec, 0.0); +#if MIR_DEBUG + spv_check_vec(mir->cut_vec); #endif /* move integer terms to the beginning of the sparse vector and determine the number of integer variables */ @@ -915,8 +937,8 @@ static double generate(struct MIR *mir) mir->cut_vec->val[j] = temp; } } -#if _MIR_DEBUG - ios_check_vec(mir->cut_vec); +#if MIR_DEBUG + spv_check_vec(mir->cut_vec); #endif /* if there is no integer variable, nothing to generate */ if (nint == 0) goto done; @@ -937,7 +959,15 @@ static double generate(struct MIR *mir) x[j] = mir->ub[k] - mir->x[k]; else xassert(k != k); +#if 0 /* 06/III-2016; notorious bug reported many times */ xassert(x[j] >= -0.001); +#else + if (x[j] < -0.001) + { xprintf("glp_mir_gen: warning: x[%d] = %g\n", j, x[j]); + r_best = 0.0; + goto skip; + } +#endif if (x[j] < 0.0) x[j] = 0.0; } /* compute s = - sum of continuous terms */ @@ -966,7 +996,15 @@ static double generate(struct MIR *mir) } else xassert(k != k); +#if 0 /* 06/III-2016; notorious bug reported many times */ xassert(x >= -0.001); +#else + if (x < -0.001) + { xprintf("glp_mir_gen: warning: x = %g\n", x); + r_best = 0.0; + goto skip; + } +#endif if (x < 0.0) x = 0.0; s -= mir->cut_vec->val[j] * x; } @@ -986,8 +1024,8 @@ static double generate(struct MIR *mir) if (k <= m+n) mir->cut_vec->val[j] *= gamma; } mir->cut_rhs = beta; -#if _MIR_DEBUG - ios_check_vec(mir->cut_vec); +#if MIR_DEBUG + spv_check_vec(mir->cut_vec); #endif skip: /* free working arrays */ xfree(u); @@ -996,8 +1034,8 @@ skip: /* free working arrays */ done: return r_best; } -#if _MIR_DEBUG -static void check_raw_cut(struct MIR *mir, double r_best) +#if MIR_DEBUG +static void check_raw_cut(glp_mir *mir, double r_best) { /* check raw cut before back bound substitution */ int m = mir->m; int n = mir->n; @@ -1040,7 +1078,7 @@ static void check_raw_cut(struct MIR *mir, double r_best) } #endif -static void back_subst(struct MIR *mir) +static void back_subst(glp_mir *mir) { /* back substitution of original bounds */ int m = mir->m; int n = mir->n; @@ -1088,7 +1126,7 @@ static void back_subst(struct MIR *mir) xassert(jj != 0); #else if (jj == 0) - { ios_set_vj(mir->cut_vec, kk, 1.0); + { spv_set_vj(mir->cut_vec, kk, 1.0); jj = mir->cut_vec->pos[kk]; xassert(jj != 0); mir->cut_vec->val[jj] = 0.0; @@ -1110,7 +1148,7 @@ static void back_subst(struct MIR *mir) { /* x'[k] = ub[k] * x[kk] - x[k] */ jj = mir->cut_vec->pos[kk]; if (jj == 0) - { ios_set_vj(mir->cut_vec, kk, 1.0); + { spv_set_vj(mir->cut_vec, kk, 1.0); jj = mir->cut_vec->pos[kk]; xassert(jj != 0); mir->cut_vec->val[jj] = 0.0; @@ -1123,14 +1161,14 @@ static void back_subst(struct MIR *mir) else xassert(k != k); } -#if _MIR_DEBUG - ios_check_vec(mir->cut_vec); +#if MIR_DEBUG + spv_check_vec(mir->cut_vec); #endif return; } -#if _MIR_DEBUG -static void check_cut_row(struct MIR *mir, double r_best) +#if MIR_DEBUG +static void check_cut_row(glp_mir *mir, double r_best) { /* check the cut after back bound substitution or elimination of auxiliary variables */ int m = mir->m; @@ -1156,9 +1194,8 @@ static void check_cut_row(struct MIR *mir, double r_best) } #endif -static void subst_aux_vars(glp_tree *tree, struct MIR *mir) +static void subst_aux_vars(glp_prob *mip, glp_mir *mir) { /* final substitution to eliminate auxiliary variables */ - glp_prob *mip = tree->mip; int m = mir->m; int n = mir->n; GLPAIJ *aij; @@ -1171,7 +1208,7 @@ static void subst_aux_vars(glp_tree *tree, struct MIR *mir) { kk = m + aij->col->j; /* structural */ jj = mir->cut_vec->pos[kk]; if (jj == 0) - { ios_set_vj(mir->cut_vec, kk, 1.0); + { spv_set_vj(mir->cut_vec, kk, 1.0); jj = mir->cut_vec->pos[kk]; mir->cut_vec->val[jj] = 0.0; } @@ -1179,11 +1216,11 @@ static void subst_aux_vars(glp_tree *tree, struct MIR *mir) } mir->cut_vec->val[j] = 0.0; } - ios_clean_vec(mir->cut_vec, 0.0); + spv_clean_vec(mir->cut_vec, 0.0); return; } -static void add_cut(glp_tree *tree, struct MIR *mir) +static void add_cut(glp_mir *mir, glp_prob *pool) { /* add constructed cut inequality to the cut pool */ int m = mir->m; int n = mir->n; @@ -1196,25 +1233,38 @@ static void add_cut(glp_tree *tree, struct MIR *mir) xassert(m+1 <= k && k <= m+n); len++, ind[len] = k - m, val[len] = mir->cut_vec->val[j]; } +#if 0 #if 0 ios_add_cut_row(tree, pool, GLP_RF_MIR, len, ind, val, GLP_UP, mir->cut_rhs); #else glp_ios_add_row(tree, NULL, GLP_RF_MIR, 0, len, ind, val, GLP_UP, mir->cut_rhs); +#endif +#else + { int i; + i = glp_add_rows(pool, 1); + glp_set_row_bnds(pool, i, GLP_UP, 0, mir->cut_rhs); + glp_set_mat_row(pool, i, len, ind, val); + } #endif xfree(ind); xfree(val); return; } -static int aggregate_row(glp_tree *tree, struct MIR *mir) +#if 0 /* 29/II-2016 by Chris */ +static int aggregate_row(glp_prob *mip, glp_mir *mir) +#else +static int aggregate_row(glp_prob *mip, glp_mir *mir, SPV *v) +#endif { /* try to aggregate another row */ - glp_prob *mip = tree->mip; int m = mir->m; int n = mir->n; GLPAIJ *aij; - IOSVEC *v; +#if 0 /* 29/II-2016 by Chris */ + SPV *v; +#endif int ii, j, jj, k, kk, kappa = 0, ret = 0; double d1, d2, d, d_max = 0.0; /* choose appropriate structural variable in the aggregated row @@ -1272,13 +1322,29 @@ static int aggregate_row(glp_tree *tree, struct MIR *mir) xassert(!mir->isint[kappa]); /* find another row, which have not been used yet, to eliminate x[kappa] from the aggregated row */ +#if 0 /* 29/II-2016 by Chris */ for (ii = 1; ii <= m; ii++) { if (mir->skip[ii]) continue; for (aij = mip->row[ii]->ptr; aij != NULL; aij = aij->r_next) if (aij->col->j == kappa - m) break; if (aij != NULL && fabs(aij->val) >= 0.001) break; +#else + ii = 0; + for (aij = mip->col[kappa - m]->ptr; aij != NULL; + aij = aij->c_next) + { if (aij->row->i > m) continue; + if (mir->skip[aij->row->i]) continue; + if (fabs(aij->val) >= 0.001) + { ii = aij->row->i; + break; + } +#endif } +#if 0 /* 29/II-2016 by Chris */ if (ii > m) +#else + if (ii == 0) +#endif { /* nothing found */ ret = 2; goto done; @@ -1289,63 +1355,73 @@ static int aggregate_row(glp_tree *tree, struct MIR *mir) mir->agg_row[mir->agg_cnt] = ii; mir->skip[ii] = 2; /* v := new row */ +#if 0 /* 29/II-2016 by Chris */ v = ios_create_vec(m+n); - ios_set_vj(v, ii, 1.0); +#else + spv_clear_vec(v); +#endif + spv_set_vj(v, ii, 1.0); for (aij = mip->row[ii]->ptr; aij != NULL; aij = aij->r_next) - ios_set_vj(v, m + aij->col->j, - aij->val); -#if _MIR_DEBUG - ios_check_vec(v); + spv_set_vj(v, m + aij->col->j, - aij->val); +#if MIR_DEBUG + spv_check_vec(v); #endif /* perform gaussian elimination to remove x[kappa] */ j = mir->agg_vec->pos[kappa]; xassert(j != 0); jj = v->pos[kappa]; xassert(jj != 0); - ios_linear_comb(mir->agg_vec, + spv_linear_comb(mir->agg_vec, - mir->agg_vec->val[j] / v->val[jj], v); +#if 0 /* 29/II-2016 by Chris */ ios_delete_vec(v); - ios_set_vj(mir->agg_vec, kappa, 0.0); -#if _MIR_DEBUG - ios_check_vec(mir->agg_vec); +#endif + spv_set_vj(mir->agg_vec, kappa, 0.0); +#if MIR_DEBUG + spv_check_vec(mir->agg_vec); #endif done: return ret; } -void ios_mir_gen(glp_tree *tree, void *gen) +int glp_mir_gen(glp_prob *mip, glp_mir *mir, glp_prob *pool) { /* main routine to generate MIR cuts */ - glp_prob *mip = tree->mip; - struct MIR *mir = gen; int m = mir->m; int n = mir->n; - int i; + int i, nnn = 0; double r_best; +#if 1 /* 29/II-2016 by Chris */ + SPV *work; +#endif xassert(mip->m >= m); xassert(mip->n == n); /* obtain current point */ - get_current_point(tree, mir); -#if _MIR_DEBUG + get_current_point(mip, mir); +#if MIR_DEBUG /* check current point */ check_current_point(mir); #endif /* reset bound substitution flags */ memset(&mir->subst[1], '?', m+n); +#if 1 /* 29/II-2016 by Chris */ + work = spv_create_vec(m+n); +#endif /* try to generate a set of violated MIR cuts */ for (i = 1; i <= m; i++) { if (mir->skip[i]) continue; /* use original i-th row as initial aggregated constraint */ - initial_agg_row(tree, mir, i); + initial_agg_row(mip, mir, i); loop: ; -#if _MIR_DEBUG +#if MIR_DEBUG /* check aggregated row */ check_agg_row(mir); #endif /* substitute fixed variables into aggregated constraint */ subst_fixed_vars(mir); -#if _MIR_DEBUG +#if MIR_DEBUG /* check aggregated row */ check_agg_row(mir); #endif -#if _MIR_DEBUG +#if MIR_DEBUG /* check bound substitution flags */ { int k; for (k = 1; k <= m+n; k++) @@ -1356,7 +1432,7 @@ loop: ; bound_subst_heur(mir); /* substitute bounds and build modified constraint */ build_mod_row(mir); -#if _MIR_DEBUG +#if MIR_DEBUG /* check modified row */ check_mod_row(mir); #endif @@ -1364,24 +1440,24 @@ loop: ; r_best = generate(mir); if (r_best > 0.0) { /* success */ -#if _MIR_DEBUG +#if MIR_DEBUG /* check raw cut before back bound substitution */ check_raw_cut(mir, r_best); #endif /* back substitution of original bounds */ back_subst(mir); -#if _MIR_DEBUG +#if MIR_DEBUG /* check the cut after back bound substitution */ check_cut_row(mir, r_best); #endif /* final substitution to eliminate auxiliary variables */ - subst_aux_vars(tree, mir); -#if _MIR_DEBUG + subst_aux_vars(mip, mir); +#if MIR_DEBUG /* check the cut after elimination of auxiliaries */ check_cut_row(mir, r_best); #endif /* add constructed cut inequality to the cut pool */ - add_cut(tree, mir); + add_cut(mir, pool), nnn++; } /* reset bound substitution flags */ { int j, k; @@ -1396,7 +1472,11 @@ loop: ; { /* failure */ if (mir->agg_cnt < MAXAGGR) { /* try to aggregate another row */ - if (aggregate_row(tree, mir) == 0) goto loop; +#if 0 /* 29/II-2016 by Chris */ + if (aggregate_row(mip, mir) == 0) goto loop; +#else + if (aggregate_row(mip, mir, work) == 0) goto loop; +#endif } } /* unmark rows used in the aggregated constraint */ @@ -1409,27 +1489,28 @@ loop: ; } } } - return; +#if 1 /* 29/II-2016 by Chris */ + spv_delete_vec(work); +#endif + return nnn; } /*********************************************************************** * NAME * -* ios_mir_term - terminate MIR cut generator +* glp_mir_free - delete MIR cut generator workspace * * SYNOPSIS * -* #include "glpios.h" -* void ios_mir_term(void *gen); +* void glp_mir_free(glp_mir *mir); * * DESCRIPTION * -* The routine ios_mir_term deletes the MIR cut generator working area -* freeing all the memory allocated to it. */ +* This routine deletes the MIR cut generator workspace and frees all +* the memory allocated to it. */ -void ios_mir_term(void *gen) -{ struct MIR *mir = gen; - xfree(mir->skip); +void glp_mir_free(glp_mir *mir) +{ xfree(mir->skip); xfree(mir->isint); xfree(mir->lb); xfree(mir->vlb); @@ -1437,10 +1518,10 @@ void ios_mir_term(void *gen) xfree(mir->vub); xfree(mir->x); xfree(mir->agg_row); - ios_delete_vec(mir->agg_vec); + spv_delete_vec(mir->agg_vec); xfree(mir->subst); - ios_delete_vec(mir->mod_vec); - ios_delete_vec(mir->cut_vec); + spv_delete_vec(mir->mod_vec); + spv_delete_vec(mir->cut_vec); xfree(mir); return; } diff --git a/resources/3rdparty/glpk-4.57/src/glpios04.c b/resources/3rdparty/glpk-4.65/src/intopt/spv.c similarity index 72% rename from resources/3rdparty/glpk-4.57/src/glpios04.c rename to resources/3rdparty/glpk-4.65/src/intopt/spv.c index 8074f7e71..502f3cd04 100644 --- a/resources/3rdparty/glpk-4.57/src/glpios04.c +++ b/resources/3rdparty/glpk-4.65/src/intopt/spv.c @@ -1,10 +1,9 @@ -/* glpios04.c (operations on sparse vectors) */ +/* spv.c (operations on sparse vectors) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2007-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,31 +22,31 @@ ***********************************************************************/ #include "env.h" -#include "glpios.h" +#include "spv.h" /*********************************************************************** * NAME * -* ios_create_vec - create sparse vector +* spv_create_vec - create sparse vector * * SYNOPSIS * * #include "glpios.h" -* IOSVEC *ios_create_vec(int n); +* SPV *spv_create_vec(int n); * * DESCRIPTION * -* The routine ios_create_vec creates a sparse vector of dimension n, +* The routine spv_create_vec creates a sparse vector of dimension n, * which initially is a null vector. * * RETURNS * * The routine returns a pointer to the vector created. */ -IOSVEC *ios_create_vec(int n) -{ IOSVEC *v; +SPV *spv_create_vec(int n) +{ SPV *v; xassert(n >= 0); - v = xmalloc(sizeof(IOSVEC)); + v = xmalloc(sizeof(SPV)); v->n = n; v->nnz = 0; v->pos = xcalloc(1+n, sizeof(int)); @@ -60,23 +59,23 @@ IOSVEC *ios_create_vec(int n) /*********************************************************************** * NAME * -* ios_check_vec - check that sparse vector has correct representation +* spv_check_vec - check that sparse vector has correct representation * * SYNOPSIS * * #include "glpios.h" -* void ios_check_vec(IOSVEC *v); +* void spv_check_vec(SPV *v); * * DESCRIPTION * -* The routine ios_check_vec checks that a sparse vector specified by +* The routine spv_check_vec checks that a sparse vector specified by * the parameter v has correct representation. * * NOTE * * Complexity of this operation is O(n). */ -void ios_check_vec(IOSVEC *v) +void spv_check_vec(SPV *v) { int j, k, nnz; xassert(v->n >= 0); nnz = 0; @@ -95,19 +94,19 @@ void ios_check_vec(IOSVEC *v) /*********************************************************************** * NAME * -* ios_get_vj - retrieve component of sparse vector +* spv_get_vj - retrieve component of sparse vector * * SYNOPSIS * * #include "glpios.h" -* double ios_get_vj(IOSVEC *v, int j); +* double spv_get_vj(SPV *v, int j); * * RETURNS * -* The routine ios_get_vj returns j-th component of a sparse vector +* The routine spv_get_vj returns j-th component of a sparse vector * specified by the parameter v. */ -double ios_get_vj(IOSVEC *v, int j) +double spv_get_vj(SPV *v, int j) { int k; xassert(1 <= j && j <= v->n); k = v->pos[j]; @@ -118,19 +117,19 @@ double ios_get_vj(IOSVEC *v, int j) /*********************************************************************** * NAME * -* ios_set_vj - set/change component of sparse vector +* spv_set_vj - set/change component of sparse vector * * SYNOPSIS * * #include "glpios.h" -* void ios_set_vj(IOSVEC *v, int j, double val); +* void spv_set_vj(SPV *v, int j, double val); * * DESCRIPTION * -* The routine ios_set_vj assigns val to j-th component of a sparse +* The routine spv_set_vj assigns val to j-th component of a sparse * vector specified by the parameter v. */ -void ios_set_vj(IOSVEC *v, int j, double val) +void spv_set_vj(SPV *v, int j, double val) { int k; xassert(1 <= j && j <= v->n); k = v->pos[j]; @@ -161,19 +160,19 @@ void ios_set_vj(IOSVEC *v, int j, double val) /*********************************************************************** * NAME * -* ios_clear_vec - set all components of sparse vector to zero +* spv_clear_vec - set all components of sparse vector to zero * * SYNOPSIS * * #include "glpios.h" -* void ios_clear_vec(IOSVEC *v); +* void spv_clear_vec(SPV *v); * * DESCRIPTION * -* The routine ios_clear_vec sets all components of a sparse vector +* The routine spv_clear_vec sets all components of a sparse vector * specified by the parameter v to zero. */ -void ios_clear_vec(IOSVEC *v) +void spv_clear_vec(SPV *v) { int k; for (k = 1; k <= v->nnz; k++) v->pos[v->ind[k]] = 0; @@ -184,20 +183,20 @@ void ios_clear_vec(IOSVEC *v) /*********************************************************************** * NAME * -* ios_clean_vec - remove zero or small components from sparse vector +* spv_clean_vec - remove zero or small components from sparse vector * * SYNOPSIS * * #include "glpios.h" -* void ios_clean_vec(IOSVEC *v, double eps); +* void spv_clean_vec(SPV *v, double eps); * * DESCRIPTION * -* The routine ios_clean_vec removes zero components and components +* The routine spv_clean_vec removes zero components and components * whose magnitude is less than eps from a sparse vector specified by * the parameter v. If eps is 0.0, only zero components are removed. */ -void ios_clean_vec(IOSVEC *v, double eps) +void spv_clean_vec(SPV *v, double eps) { int k, nnz; nnz = 0; for (k = 1; k <= v->nnz; k++) @@ -220,23 +219,23 @@ void ios_clean_vec(IOSVEC *v, double eps) /*********************************************************************** * NAME * -* ios_copy_vec - copy sparse vector (x := y) +* spv_copy_vec - copy sparse vector (x := y) * * SYNOPSIS * * #include "glpios.h" -* void ios_copy_vec(IOSVEC *x, IOSVEC *y); +* void spv_copy_vec(SPV *x, SPV *y); * * DESCRIPTION * -* The routine ios_copy_vec copies a sparse vector specified by the +* The routine spv_copy_vec copies a sparse vector specified by the * parameter y to a sparse vector specified by the parameter x. */ -void ios_copy_vec(IOSVEC *x, IOSVEC *y) +void spv_copy_vec(SPV *x, SPV *y) { int j; xassert(x != y); xassert(x->n == y->n); - ios_clear_vec(x); + spv_clear_vec(x); x->nnz = y->nnz; memcpy(&x->ind[1], &y->ind[1], x->nnz * sizeof(int)); memcpy(&x->val[1], &y->val[1], x->nnz * sizeof(double)); @@ -248,31 +247,31 @@ void ios_copy_vec(IOSVEC *x, IOSVEC *y) /*********************************************************************** * NAME * -* ios_linear_comb - compute linear combination (x := x + a * y) +* spv_linear_comb - compute linear combination (x := x + a * y) * * SYNOPSIS * * #include "glpios.h" -* void ios_linear_comb(IOSVEC *x, double a, IOSVEC *y); +* void spv_linear_comb(SPV *x, double a, SPV *y); * * DESCRIPTION * -* The routine ios_linear_comb computes the linear combination +* The routine spv_linear_comb computes the linear combination * * x := x + a * y, * * where x and y are sparse vectors, a is a scalar. */ -void ios_linear_comb(IOSVEC *x, double a, IOSVEC *y) +void spv_linear_comb(SPV *x, double a, SPV *y) { int j, k; double xj, yj; xassert(x != y); xassert(x->n == y->n); for (k = 1; k <= y->nnz; k++) { j = y->ind[k]; - xj = ios_get_vj(x, j); + xj = spv_get_vj(x, j); yj = y->val[k]; - ios_set_vj(x, j, xj + a * yj); + spv_set_vj(x, j, xj + a * yj); } return; } @@ -280,19 +279,19 @@ void ios_linear_comb(IOSVEC *x, double a, IOSVEC *y) /*********************************************************************** * NAME * -* ios_delete_vec - delete sparse vector +* spv_delete_vec - delete sparse vector * * SYNOPSIS * * #include "glpios.h" -* void ios_delete_vec(IOSVEC *v); +* void spv_delete_vec(SPV *v); * * DESCRIPTION * -* The routine ios_delete_vec deletes a sparse vector specified by the +* The routine spv_delete_vec deletes a sparse vector specified by the * parameter v freeing all the memory allocated to this object. */ -void ios_delete_vec(IOSVEC *v) +void spv_delete_vec(SPV *v) { /* delete sparse vector */ xfree(v->pos); xfree(v->ind); diff --git a/resources/3rdparty/glpk-4.65/src/intopt/spv.h b/resources/3rdparty/glpk-4.65/src/intopt/spv.h new file mode 100644 index 000000000..d7d4699f6 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/intopt/spv.h @@ -0,0 +1,83 @@ +/* spv.h (operations on sparse vectors) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2007-2017 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#ifndef SPV_H +#define SPV_H + +typedef struct SPV SPV; + +struct SPV +{ /* sparse vector v = (v[j]) */ + int n; + /* dimension, n >= 0 */ + int nnz; + /* number of non-zero components, 0 <= nnz <= n */ + int *pos; /* int pos[1+n]; */ + /* pos[j] = k, 1 <= j <= n, is position of (non-zero) v[j] in the + * arrays ind and val, where 1 <= k <= nnz; pos[j] = 0 means that + * v[j] is structural zero */ + int *ind; /* int ind[1+n]; */ + /* ind[k] = j, 1 <= k <= nnz, is index of v[j] */ + double *val; /* double val[1+n]; */ + /* val[k], 1 <= k <= nnz, is a numeric value of v[j] */ +}; + +#define spv_create_vec _glp_spv_create_vec +SPV *spv_create_vec(int n); +/* create sparse vector */ + +#define spv_check_vec _glp_spv_check_vec +void spv_check_vec(SPV *v); +/* check that sparse vector has correct representation */ + +#define spv_get_vj _glp_spv_get_vj +double spv_get_vj(SPV *v, int j); +/* retrieve component of sparse vector */ + +#define spv_set_vj _glp_spv_set_vj +void spv_set_vj(SPV *v, int j, double val); +/* set/change component of sparse vector */ + +#define spv_clear_vec _glp_spv_clear_vec +void spv_clear_vec(SPV *v); +/* set all components of sparse vector to zero */ + +#define spv_clean_vec _glp_spv_clean_vec +void spv_clean_vec(SPV *v, double eps); +/* remove zero or small components from sparse vector */ + +#define spv_copy_vec _glp_spv_copy_vec +void spv_copy_vec(SPV *x, SPV *y); +/* copy sparse vector (x := y) */ + +#define spv_linear_comb _glp_spv_linear_comb +void spv_linear_comb(SPV *x, double a, SPV *y); +/* compute linear combination (x := x + a * y) */ + +#define spv_delete_vec _glp_spv_delete_vec +void spv_delete_vec(SPV *v); +/* delete sparse vector */ + +#endif + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/minisat/LICENSE b/resources/3rdparty/glpk-4.65/src/minisat/LICENSE similarity index 100% rename from resources/3rdparty/glpk-4.57/src/minisat/LICENSE rename to resources/3rdparty/glpk-4.65/src/minisat/LICENSE diff --git a/resources/3rdparty/glpk-4.57/src/minisat/README b/resources/3rdparty/glpk-4.65/src/minisat/README similarity index 100% rename from resources/3rdparty/glpk-4.57/src/minisat/README rename to resources/3rdparty/glpk-4.65/src/minisat/README diff --git a/resources/3rdparty/glpk-4.57/src/minisat/minisat.c b/resources/3rdparty/glpk-4.65/src/minisat/minisat.c similarity index 98% rename from resources/3rdparty/glpk-4.57/src/minisat/minisat.c rename to resources/3rdparty/glpk-4.65/src/minisat/minisat.c index f242d838a..2432d650e 100644 --- a/resources/3rdparty/glpk-4.57/src/minisat/minisat.c +++ b/resources/3rdparty/glpk-4.65/src/minisat/minisat.c @@ -1,6 +1,8 @@ /* minisat.c */ /* Modified by Andrew Makhorin , August 2011 */ +/* May 2017: Changes were made to provide 64-bit portability; thanks to + * Chris Matrakidis for patch */ /*********************************************************************** * MiniSat -- Copyright (c) 2005, Niklas Sorensson @@ -142,6 +144,7 @@ struct clause_t /*====================================================================*/ /* Encode literals in clause pointers: */ +#if 0 /* 8/I-2017 by cmatraki (64-bit portability) */ #define clause_from_lit(l) \ (clause*)((unsigned long)(l) + (unsigned long)(l) + 1) @@ -150,6 +153,16 @@ struct clause_t #define clause_read_lit(c) \ (lit)((unsigned long)(c) >> 1) +#else +#define clause_from_lit(l) \ + (clause*)((size_t)(l) + (size_t)(l) + 1) + +#define clause_is_lit(c) \ + ((size_t)(c) & 1) + +#define clause_read_lit(c) \ + (lit)((size_t)(c) >> 1) +#endif /*====================================================================*/ /* Simple helpers: */ @@ -332,8 +345,11 @@ static clause* clause_new(solver* s, lit* begin, lit* end, int learnt) c = (clause*)malloc(sizeof(clause) + sizeof(lit) * size + learnt * sizeof(float)); c->size_learnt = (size << 1) | learnt; -#if 0 /* by mao; meaningless non-portable check */ - assert(((unsigned int)c & 1) == 0); +#if 1 /* by mao & cmatraki; non-portable check that is a fundamental \ + * assumption of minisat code: bit 0 is used as a flag (zero \ + * for pointer, one for shifted int) so allocated memory should \ + * be at least 16-bit aligned */ + assert(((size_t)c & 1) == 0); #endif for (i = 0; i < size; i++) diff --git a/resources/3rdparty/glpk-4.57/src/minisat/minisat.h b/resources/3rdparty/glpk-4.65/src/minisat/minisat.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/minisat/minisat.h rename to resources/3rdparty/glpk-4.65/src/minisat/minisat.h diff --git a/resources/3rdparty/glpk-4.57/src/avl.c b/resources/3rdparty/glpk-4.65/src/misc/avl.c similarity index 98% rename from resources/3rdparty/glpk-4.57/src/avl.c rename to resources/3rdparty/glpk-4.65/src/misc/avl.c index c9b7f2203..c97cf13af 100644 --- a/resources/3rdparty/glpk-4.57/src/avl.c +++ b/resources/3rdparty/glpk-4.65/src/misc/avl.c @@ -3,8 +3,7 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2000-2013 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * diff --git a/resources/3rdparty/glpk-4.57/src/avl.h b/resources/3rdparty/glpk-4.65/src/misc/avl.h similarity index 94% rename from resources/3rdparty/glpk-4.57/src/avl.h rename to resources/3rdparty/glpk-4.65/src/misc/avl.h index c4144c293..b0aaef61e 100644 --- a/resources/3rdparty/glpk-4.57/src/avl.h +++ b/resources/3rdparty/glpk-4.65/src/misc/avl.h @@ -3,8 +3,7 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2000-2013 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * diff --git a/resources/3rdparty/glpk-4.57/src/misc/bignum.c b/resources/3rdparty/glpk-4.65/src/misc/bignum.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/bignum.c rename to resources/3rdparty/glpk-4.65/src/misc/bignum.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/bignum.h b/resources/3rdparty/glpk-4.65/src/misc/bignum.h similarity index 96% rename from resources/3rdparty/glpk-4.57/src/misc/bignum.h rename to resources/3rdparty/glpk-4.65/src/misc/bignum.h index aebac374d..8567519b7 100644 --- a/resources/3rdparty/glpk-4.57/src/misc/bignum.h +++ b/resources/3rdparty/glpk-4.65/src/misc/bignum.h @@ -1,4 +1,4 @@ -/* bignum.h (arbitrary precision arithmetic) */ +/* bignum.h (bignum arithmetic) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). diff --git a/resources/3rdparty/glpk-4.65/src/misc/dimacs.c b/resources/3rdparty/glpk-4.65/src/misc/dimacs.c new file mode 100644 index 000000000..6aa630a5e --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/misc/dimacs.c @@ -0,0 +1,147 @@ +/* dimacs.c (reading data in DIMACS format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2015 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "dimacs.h" + +void dmx_error(DMX *csa, const char *fmt, ...) +{ /* print error message and terminate processing */ + va_list arg; + xprintf("%s:%d: error: ", csa->fname, csa->count); + va_start(arg, fmt); + xvprintf(fmt, arg); + va_end(arg); + xprintf("\n"); + longjmp(csa->jump, 1); + /* no return */ +} + +void dmx_warning(DMX *csa, const char *fmt, ...) +{ /* print warning message and continue processing */ + va_list arg; + xprintf("%s:%d: warning: ", csa->fname, csa->count); + va_start(arg, fmt); + xvprintf(fmt, arg); + va_end(arg); + xprintf("\n"); + return; +} + +void dmx_read_char(DMX *csa) +{ /* read character from input text file */ + int c; + if (csa->c == '\n') csa->count++; + c = glp_getc(csa->fp); + if (c < 0) + { if (glp_ioerr(csa->fp)) + dmx_error(csa, "read error - %s", get_err_msg()); + else if (csa->c == '\n') + dmx_error(csa, "unexpected end of file"); + else + { dmx_warning(csa, "missing final end of line"); + c = '\n'; + } + } + else if (c == '\n') + ; + else if (isspace(c)) + c = ' '; + else if (iscntrl(c)) + dmx_error(csa, "invalid control character 0x%02X", c); + csa->c = c; + return; +} + +void dmx_read_designator(DMX *csa) +{ /* read one-character line designator */ + xassert(csa->c == '\n'); + dmx_read_char(csa); + for (;;) + { /* skip preceding white-space characters */ + while (csa->c == ' ') + dmx_read_char(csa); + if (csa->c == '\n') + { /* ignore empty line */ + if (!csa->empty) + { dmx_warning(csa, "empty line ignored"); + csa->empty = 1; + } + dmx_read_char(csa); + } + else if (csa->c == 'c') + { /* skip comment line */ + while (csa->c != '\n') + dmx_read_char(csa); + dmx_read_char(csa); + } + else + { /* hmm... looks like a line designator */ + csa->field[0] = (char)csa->c, csa->field[1] = '\0'; + /* check that it is followed by a white-space character */ + dmx_read_char(csa); + if (!(csa->c == ' ' || csa->c == '\n')) + dmx_error(csa, "line designator missing or invalid"); + break; + } + } + return; +} + +void dmx_read_field(DMX *csa) +{ /* read data field */ + int len = 0; + /* skip preceding white-space characters */ + while (csa->c == ' ') + dmx_read_char(csa); + /* scan data field */ + if (csa->c == '\n') + dmx_error(csa, "unexpected end of line"); + while (!(csa->c == ' ' || csa->c == '\n')) + { if (len == sizeof(csa->field)-1) + dmx_error(csa, "data field '%.15s...' too long", + csa->field); + csa->field[len++] = (char)csa->c; + dmx_read_char(csa); + } + csa->field[len] = '\0'; + return; +} + +void dmx_end_of_line(DMX *csa) +{ /* skip white-space characters until end of line */ + while (csa->c == ' ') + dmx_read_char(csa); + if (csa->c != '\n') + dmx_error(csa, "too many data fields specified"); + return; +} + +void dmx_check_int(DMX *csa, double num) +{ /* print a warning if non-integer data are detected */ + if (!csa->nonint && num != floor(num)) + { dmx_warning(csa, "non-integer data detected"); + csa->nonint = 1; + } + return; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/misc/dimacs.h b/resources/3rdparty/glpk-4.65/src/misc/dimacs.h new file mode 100644 index 000000000..42fb99961 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/misc/dimacs.h @@ -0,0 +1,81 @@ +/* dimacs.h (reading data in DIMACS format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2009-2015 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#ifndef DIMACS_H +#define DIMACS_H + +#include "env.h" + +typedef struct DMX DMX; + +struct DMX +{ /* DIMACS data reader */ + jmp_buf jump; + /* label for go to in case of error */ + const char *fname; + /* name of input text file */ + glp_file *fp; + /* stream assigned to input text file */ + int count; + /* line count */ + int c; + /* current character */ + char field[255+1]; + /* data field */ + int empty; + /* warning 'empty line ignored' was printed */ + int nonint; + /* warning 'non-integer data detected' was printed */ +}; + +#define dmx_error _glp_dmx_error +void dmx_error(DMX *csa, const char *fmt, ...); +/* print error message and terminate processing */ + +#define dmx_warning _glp_dmx_warning +void dmx_warning(DMX *csa, const char *fmt, ...); +/* print warning message and continue processing */ + +#define dmx_read_char _glp_dmx_read_char +void dmx_read_char(DMX *csa); +/* read character from input text file */ + +#define dmx_read_designator _glp_dmx_read_designator +void dmx_read_designator(DMX *csa); +/* read one-character line designator */ + +#define dmx_read_field _glp_dmx_read_field +void dmx_read_field(DMX *csa); +/* read data field */ + +#define dmx_end_of_line _glp_dmx_end_of_line +void dmx_end_of_line(DMX *csa); +/* skip white-space characters until end of line */ + +#define dmx_check_int _glp_dmx_check_int +void dmx_check_int(DMX *csa, double num); +/* print a warning if non-integer data are detected */ + +#endif + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/misc/dmp.c b/resources/3rdparty/glpk-4.65/src/misc/dmp.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/dmp.c rename to resources/3rdparty/glpk-4.65/src/misc/dmp.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/dmp.h b/resources/3rdparty/glpk-4.65/src/misc/dmp.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/dmp.h rename to resources/3rdparty/glpk-4.65/src/misc/dmp.h diff --git a/resources/3rdparty/glpk-4.57/src/misc/ffalg.c b/resources/3rdparty/glpk-4.65/src/misc/ffalg.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/ffalg.c rename to resources/3rdparty/glpk-4.65/src/misc/ffalg.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/ffalg.h b/resources/3rdparty/glpk-4.65/src/misc/ffalg.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/ffalg.h rename to resources/3rdparty/glpk-4.65/src/misc/ffalg.h diff --git a/resources/3rdparty/glpk-4.57/src/misc/fp2rat.c b/resources/3rdparty/glpk-4.65/src/misc/fp2rat.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/fp2rat.c rename to resources/3rdparty/glpk-4.65/src/misc/fp2rat.c diff --git a/resources/3rdparty/glpk-4.65/src/misc/fvs.c b/resources/3rdparty/glpk-4.65/src/misc/fvs.c new file mode 100644 index 000000000..916a1bf94 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/misc/fvs.c @@ -0,0 +1,137 @@ +/* fvs.c (sparse vector in FVS format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "fvs.h" + +void fvs_alloc_vec(FVS *x, int n) +{ /* allocate sparse vector */ + int j; + xassert(n >= 0); + x->n = n; + x->nnz = 0; + x->ind = talloc(1+n, int); + x->vec = talloc(1+n, double); + for (j = 1; j <= n; j++) + x->vec[j] = 0.0; + return; +} + +void fvs_check_vec(const FVS *x) +{ /* check sparse vector */ + /* NOTE: for testing/debugging only */ + int n = x->n; + int nnz = x->nnz; + int *ind = x->ind; + double *vec = x->vec; + char *map; + int j, k; + xassert(n >= 0); + xassert(0 <= nnz && nnz <= n); + map = talloc(1+n, char); + for (j = 1; j <= n; j++) + map[j] = (vec[j] != 0.0); + for (k = 1; k <= nnz; k++) + { j = ind[k]; + xassert(1 <= j && j <= n); + xassert(map[j]); + map[j] = 0; + } + for (j = 1; j <= n; j++) + xassert(!map[j]); + tfree(map); + return; +} + +void fvs_gather_vec(FVS *x, double eps) +{ /* gather sparse vector */ + int n = x->n; + int *ind = x->ind; + double *vec = x->vec; + int j, nnz = 0; + for (j = n; j >= 1; j--) + { if (-eps < vec[j] && vec[j] < +eps) + vec[j] = 0.0; + else + ind[++nnz] = j; + } + x->nnz = nnz; + return; +} + +void fvs_clear_vec(FVS *x) +{ /* clear sparse vector */ + int *ind = x->ind; + double *vec = x->vec; + int k; + for (k = x->nnz; k >= 1; k--) + vec[ind[k]] = 0.0; + x->nnz = 0; + return; +} + +void fvs_copy_vec(FVS *x, const FVS *y) +{ /* copy sparse vector */ + int *x_ind = x->ind; + double *x_vec = x->vec; + int *y_ind = y->ind; + double *y_vec = y->vec; + int j, k; + xassert(x != y); + xassert(x->n == y->n); + fvs_clear_vec(x); + for (k = x->nnz = y->nnz; k >= 1; k--) + { j = x_ind[k] = y_ind[k]; + x_vec[j] = y_vec[j]; + } + return; +} + +void fvs_adjust_vec(FVS *x, double eps) +{ /* replace tiny vector elements by exact zeros */ + int nnz = x->nnz; + int *ind = x->ind; + double *vec = x->vec; + int j, k, cnt = 0; + for (k = 1; k <= nnz; k++) + { j = ind[k]; + if (-eps < vec[j] && vec[j] < +eps) + vec[j] = 0.0; + else + ind[++cnt] = j; + } + x->nnz = cnt; + return; +} + +void fvs_free_vec(FVS *x) +{ /* deallocate sparse vector */ + tfree(x->ind); + tfree(x->vec); + x->n = x->nnz = -1; + x->ind = NULL; + x->vec = NULL; + return; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/misc/fvs.h b/resources/3rdparty/glpk-4.65/src/misc/fvs.h new file mode 100644 index 000000000..abfed8cc9 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/misc/fvs.h @@ -0,0 +1,76 @@ +/* fvs.h (sparse vector in FVS format) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2016 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#ifndef FVS_H +#define FVS_H + +typedef struct FVS FVS; + +struct FVS +{ /* sparse vector in FVS (Full Vector Storage) format */ + int n; + /* vector dimension (total number of elements) */ + int nnz; + /* number of non-zero elements, 0 <= nnz <= n */ + int *ind; /* int ind[1+n]; */ + /* ind[0] is not used; + * ind[k] = j, 1 <= k <= nnz, means that vec[j] != 0 + * non-zero indices in the array ind are stored in arbitrary + * order; if vec[j] = 0, its index j SHOULD NOT be presented in + * the array ind */ + double *vec; /* double vec[1+n]; */ + /* vec[0] is not used; + * vec[j], 1 <= j <= n, is a numeric value of j-th element */ +}; + +#define fvs_alloc_vec _glp_fvs_alloc_vec +void fvs_alloc_vec(FVS *x, int n); +/* allocate sparse vector */ + +#define fvs_check_vec _glp_fvs_check_vec +void fvs_check_vec(const FVS *x); +/* check sparse vector */ + +#define fvs_gather_vec _glp_fvs_gather_vec +void fvs_gather_vec(FVS *x, double eps); +/* gather sparse vector */ + +#define fvs_clear_vec _glp_fvs_clear_vec +void fvs_clear_vec(FVS *x); +/* clear sparse vector */ + +#define fvs_copy_vec _glp_fvs_copy_vec +void fvs_copy_vec(FVS *x, const FVS *y); +/* copy sparse vector */ + +#define fvs_adjust_vec _glp_fvs_adjust_vec +void fvs_adjust_vec(FVS *x, double eps); +/* replace tiny vector elements by exact zeros */ + +#define fvs_free_vec _glp_fvs_free_vec +void fvs_free_vec(FVS *x); +/* deallocate sparse vector */ + +#endif + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/misc/gcd.c b/resources/3rdparty/glpk-4.65/src/misc/gcd.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/gcd.c rename to resources/3rdparty/glpk-4.65/src/misc/gcd.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/jd.c b/resources/3rdparty/glpk-4.65/src/misc/jd.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/jd.c rename to resources/3rdparty/glpk-4.65/src/misc/jd.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/jd.h b/resources/3rdparty/glpk-4.65/src/misc/jd.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/jd.h rename to resources/3rdparty/glpk-4.65/src/misc/jd.h diff --git a/resources/3rdparty/glpk-4.57/src/misc/keller.c b/resources/3rdparty/glpk-4.65/src/misc/keller.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/keller.c rename to resources/3rdparty/glpk-4.65/src/misc/keller.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/keller.h b/resources/3rdparty/glpk-4.65/src/misc/keller.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/keller.h rename to resources/3rdparty/glpk-4.65/src/misc/keller.h diff --git a/resources/3rdparty/glpk-4.65/src/misc/ks.c b/resources/3rdparty/glpk-4.65/src/misc/ks.c new file mode 100644 index 000000000..0720cc90b --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/misc/ks.c @@ -0,0 +1,466 @@ +/* ks.c (0-1 knapsack problem) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2017-2018 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "ks.h" +#include "mt1.h" + +/*********************************************************************** +* 0-1 knapsack problem has the following formulation: +* +* maximize z = sum{j in 1..n} c[j]x[j] (1) +* +* s.t. sum{j in 1..n} a[j]x[j] <= b (2) +* +* x[j] in {0, 1} for all j in 1..n (3) +* +* In general case it is assumed that the instance is non-normalized, +* i.e. parameters a, b, and c may have any sign. +***********************************************************************/ + +/*********************************************************************** +* ks_enum - solve 0-1 knapsack problem by complete enumeration +* +* This routine finds optimal solution to 0-1 knapsack problem (1)-(3) +* by complete enumeration. It is intended mainly for testing purposes. +* +* The instance to be solved is specified by parameters n, a, b, and c. +* Note that these parameters can have any sign, i.e. normalization is +* not needed. +* +* On exit the routine stores the optimal point found in locations +* x[1], ..., x[n] and returns the optimal objective value. However, if +* the instance is infeasible, the routine returns INT_MIN. +* +* Since the complete enumeration is inefficient, this routine can be +* used only for small instances (n <= 20-30). */ + +#define N_MAX 40 + +int ks_enum(int n, const int a[/*1+n*/], int b, const int c[/*1+n*/], + char x[/*1+n*/]) +{ int j, s, z, z_best; + char x_best[1+N_MAX]; + xassert(0 <= n && n <= N_MAX); + /* initialization */ + memset(&x[1], 0, n * sizeof(char)); + z_best = INT_MIN; +loop: /* compute constraint and objective at current x */ + s = z = 0; + for (j = 1; j <= n; j++) + { if (x[j]) + s += a[j], z += c[j]; + } + /* check constraint violation */ + if (s > b) + goto next; + /* check objective function */ + if (z_best < z) + { /* better solution has been found */ + memcpy(&x_best[1], &x[1], n * sizeof(char)); + z_best = z; + } +next: /* generate next x */ + for (j = 1; j <= n; j++) + { if (!x[j]) + { x[j] = 1; + goto loop; + } + x[j] = 0; + } + /* report best (optimal) solution */ + memcpy(&x[1], &x_best[1], n * sizeof(char)); + return z_best; +} + +/*********************************************************************** +* reduce - prepare reduced instance of 0-1 knapsack +* +* Given original instance of 0-1 knapsack (1)-(3) specified by the +* parameters n, a, b, and c this routine transforms it to equivalent +* reduced instance in the same format. The reduced instance is +* normalized, i.e. the following additional conditions are met: +* +* n >= 2 (4) +* +* 1 <= a[j] <= b for all j in 1..n (5) +* +* sum{j in 1..n} a[j] >= b+1 (6) +* +* c[j] >= 1 for all j in 1..n (7) +* +* The routine creates the structure ks and stores there parameters n, +* a, b, and c of the reduced instance as well as template of solution +* to original instance. +* +* Normally the routine returns a pointer to the structure ks created. +* However, if the original instance is infeasible, the routine returns +* a null pointer. */ + +struct ks +{ int orig_n; + /* original problem dimension */ + int n; + /* reduced problem dimension */ + int *a; /* int a[1+orig_n]; */ + /* a{j in 1..n} are constraint coefficients (2) */ + int b; + /* b is constraint right-hand side (2) */ + int *c; /* int c[1+orig_n]; */ + /* c{j in 1..n} are objective coefficients (1) */ + int c0; + /* c0 is objective constant term */ + char *x; /* char x[1+orig_n]; */ + /* x{j in 1..orig_n} is solution template to original instance: + * x[j] = 0 x[j] is fixed at 0 + * x[j] = 1 x[j] is fixed at 1 + * x[j] = 0x10 x[j] = x[j'] + * x[j] = 0x11 x[j] = 1 - x[j'] + * where x[j'] is corresponding solution to reduced instance */ +}; + +static void free_ks(struct ks *ks); + +static struct ks *reduce(const int n, const int a[/*1+n*/], int b, + const int c[/*1+n*/]) +{ struct ks *ks; + int j, s; + xassert(n >= 0); + /* initially reduced instance is the same as original one */ + ks = talloc(1, struct ks); + ks->orig_n = n; + ks->n = 0; + ks->a = talloc(1+n, int); + memcpy(&ks->a[1], &a[1], n * sizeof(int)); + ks->b = b; + ks->c = talloc(1+n, int); + memcpy(&ks->c[1], &c[1], n * sizeof(int)); + ks->c0 = 0; + ks->x = talloc(1+n, char); + /* make all a[j] non-negative */ + for (j = 1; j <= n; j++) + { if (a[j] >= 0) + { /* keep original x[j] */ + ks->x[j] = 0x10; + } + else /* a[j] < 0 */ + { /* substitute x[j] = 1 - x'[j] */ + ks->x[j] = 0x11; + /* ... + a[j]x[j] + ... <= b + * ... + a[j](1 - x'[j]) + ... <= b + * ... - a[j]x'[j] + ... <= b - a[j] */ + ks->a[j] = - ks->a[j]; + ks->b += ks->a[j]; + /* z = ... + c[j]x[j] + ... + c0 = + * = ... + c[j](1 - x'[j]) + ... + c0 = + * = ... - c[j]x'[j] + ... + (c0 + c[j]) */ + ks->c0 += ks->c[j]; + ks->c[j] = - ks->c[j]; + } + } + /* now a[j] >= 0 for all j in 1..n */ + if (ks->b < 0) + { /* instance is infeasible */ + free_ks(ks); + return NULL; + } + /* build reduced instance */ + for (j = 1; j <= n; j++) + { if (ks->a[j] == 0) + { if (ks->c[j] <= 0) + { /* fix x[j] at 0 */ + ks->x[j] ^= 0x10; + } + else + { /* fix x[j] at 1 */ + ks->x[j] ^= 0x11; + ks->c0 += ks->c[j]; + } + } + else if (ks->a[j] > ks->b || ks->c[j] <= 0) + { /* fix x[j] at 0 */ + ks->x[j] ^= 0x10; + } + else + { /* include x[j] in reduced instance */ + ks->n++; + ks->a[ks->n] = ks->a[j]; + ks->c[ks->n] = ks->c[j]; + } + } + /* now conditions (5) and (7) are met */ + /* check condition (6) */ + s = 0; + for (j = 1; j <= ks->n; j++) + { xassert(1 <= ks->a[j] && ks->a[j] <= ks->b); + xassert(ks->c[j] >= 1); + s += ks->a[j]; + } + if (s <= ks->b) + { /* sum{j in 1..n} a[j] <= b */ + /* fix all remaining x[j] at 1 to obtain trivial solution */ + for (j = 1; j <= n; j++) + { if (ks->x[j] & 0x10) + ks->x[j] ^= 0x11; + } + for (j = 1; j <= ks->n; j++) + ks->c0 += ks->c[j]; + /* reduced instance is empty */ + ks->n = 0; + } + /* here n = 0 or n >= 2 due to condition (6) */ + xassert(ks->n == 0 || ks->n >= 2); + return ks; +} + +/*********************************************************************** +* restore - restore solution to original 0-1 knapsack instance +* +* Given optimal solution x{j in 1..ks->n} to the reduced 0-1 knapsack +* instance (previously prepared by the routine reduce) this routine +* constructs optimal solution to the original instance and stores it +* in the array ks->x{j in 1..ks->orig_n}. +* +* On exit the routine returns optimal objective value for the original +* instance. +* +* NOTE: This operation should be performed only once. */ + +static int restore(struct ks *ks, char x[]) +{ int j, k, z; + z = ks->c0; + for (j = 1, k = 0; j <= ks->orig_n; j++) + { if (ks->x[j] & 0x10) + { k++; + xassert(k <= ks->n); + xassert(x[k] == 0 || x[k] == 1); + if (ks->x[j] & 1) + ks->x[j] = 1 - x[k]; + else + ks->x[j] = x[k]; + if (x[k]) + z += ks->c[k]; + } + } + xassert(k == ks->n); + return z; +} + +/*********************************************************************** +* free_ks - deallocate structure ks +* +* This routine frees memory previously allocated to the structure ks +* and all its components. */ + +static void free_ks(struct ks *ks) +{ xassert(ks != NULL); + tfree(ks->a); + tfree(ks->c); + tfree(ks->x); + tfree(ks); +} + +/*********************************************************************** +* ks_mt1 - solve 0-1 knapsack problem with Martello & Toth algorithm +* +* This routine finds optimal solution to 0-1 knapsack problem (1)-(3) +* with Martello & Toth algorithm MT1. +* +* The instance to be solved is specified by parameters n, a, b, and c. +* Note that these parameters can have any sign, i.e. normalization is +* not needed. +* +* On exit the routine stores the optimal point found in locations +* x[1], ..., x[n] and returns the optimal objective value. However, if +* the instance is infeasible, the routine returns INT_MIN. +* +* REFERENCES +* +* S.Martello, P.Toth. Knapsack Problems: Algorithms and Computer Imp- +* lementations. John Wiley & Sons, 1990. */ + +struct mt +{ int j; + float r; /* r[j] = c[j] / a[j] */ +}; + +static int CDECL fcmp(const void *p1, const void *p2) +{ if (((struct mt *)p1)->r > ((struct mt *)p2)->r) + return -1; + else if (((struct mt *)p1)->r < ((struct mt *)p2)->r) + return +1; + else + return 0; +} + +static int mt1a(int n, const int a[], int b, const int c[], char x[]) +{ /* interface routine to MT1 */ + struct mt *mt; + int j, z, *p, *w, *x1, *xx, *min, *psign, *wsign, *zsign; + xassert(n >= 2); + /* allocate working arrays */ + mt = talloc(1+n, struct mt); + p = talloc(1+n+1, int); + w = talloc(1+n+1, int); + x1 = talloc(1+n+1, int); + xx = talloc(1+n+1, int); + min = talloc(1+n+1, int); + psign = talloc(1+n+1, int); + wsign = talloc(1+n+1, int); + zsign = talloc(1+n+1, int); + /* reorder items to provide c[j] / a[j] >= a[j+1] / a[j+1] */ + for (j = 1; j <= n; j++) + { mt[j].j = j; + mt[j].r = (float)c[j] / (float)a[j]; + } + qsort(&mt[1], n, sizeof(struct mt), fcmp); + /* load instance parameters */ + for (j = 1; j <= n; j++) + { p[j] = c[mt[j].j]; + w[j] = a[mt[j].j]; + } + /* find optimal solution */ + z = mt1(n, p, w, b, x1, 1, xx, min, psign, wsign, zsign); + xassert(z >= 0); + /* store optimal point found */ + for (j = 1; j <= n; j++) + { xassert(x1[j] == 0 || x1[j] == 1); + x[mt[j].j] = x1[j]; + } + /* free working arrays */ + tfree(mt); + tfree(p); + tfree(w); + tfree(x1); + tfree(xx); + tfree(min); + tfree(psign); + tfree(wsign); + tfree(zsign); + return z; +} + +int ks_mt1(int n, const int a[/*1+n*/], int b, const int c[/*1+n*/], + char x[/*1+n*/]) +{ struct ks *ks; + int j, s1, s2, z; + xassert(n >= 0); + /* prepare reduced instance */ + ks = reduce(n, a, b, c); + if (ks == NULL) + { /* original instance is infeasible */ + return INT_MIN; + } + /* find optimal solution to reduced instance */ + if (ks->n > 0) + mt1a(ks->n, ks->a, ks->b, ks->c, x); + /* restore solution to original instance */ + z = restore(ks, x); + memcpy(&x[1], &ks->x[1], n * sizeof(char)); + free_ks(ks); + /* check solution found */ + s1 = s2 = 0; + for (j = 1; j <= n; j++) + { xassert(x[j] == 0 || x[j] == 1); + if (x[j]) + s1 += a[j], s2 += c[j]; + } + xassert(s1 <= b); + xassert(s2 == z); + return z; +} + +/*********************************************************************** +* ks_greedy - solve 0-1 knapsack problem with greedy heuristic +* +* This routine finds (sub)optimal solution to 0-1 knapsack problem +* (1)-(3) with greedy heuristic. +* +* The instance to be solved is specified by parameters n, a, b, and c. +* Note that these parameters can have any sign, i.e. normalization is +* not needed. +* +* On exit the routine stores the optimal point found in locations +* x[1], ..., x[n] and returns the optimal objective value. However, if +* the instance is infeasible, the routine returns INT_MIN. */ + +static int greedy(int n, const int a[], int b, const int c[], char x[]) +{ /* core routine for normalized 0-1 knapsack instance */ + struct mt *mt; + int j, s, z; + xassert(n >= 2); + /* reorder items to provide c[j] / a[j] >= a[j+1] / a[j+1] */ + mt = talloc(1+n, struct mt); + for (j = 1; j <= n; j++) + { mt[j].j = j; + mt[j].r = (float)c[j] / (float)a[j]; + } + qsort(&mt[1], n, sizeof(struct mt), fcmp); + /* take items starting from most valuable ones until the knapsack + * is full */ + s = z = 0; + for (j = 1; j <= n; j++) + { if (s + a[mt[j].j] > b) + break; + x[mt[j].j] = 1; + s += a[mt[j].j]; + z += c[mt[j].j]; + } + /* don't take remaining items */ + for (j = j; j <= n; j++) + x[mt[j].j] = 0; + tfree(mt); + return z; +} + +int ks_greedy(int n, const int a[/*1+n*/], int b, const int c[/*1+n*/], + char x[/*1+n*/]) +{ struct ks *ks; + int j, s1, s2, z; + xassert(n >= 0); + /* prepare reduced instance */ + ks = reduce(n, a, b, c); + if (ks == NULL) + { /* original instance is infeasible */ + return INT_MIN; + } + /* find suboptimal solution to reduced instance */ + if (ks->n > 0) + greedy(ks->n, ks->a, ks->b, ks->c, x); + /* restore solution to original instance */ + z = restore(ks, x); + memcpy(&x[1], &ks->x[1], n * sizeof(char)); + free_ks(ks); + /* check solution found */ + s1 = s2 = 0; + for (j = 1; j <= n; j++) + { xassert(x[j] == 0 || x[j] == 1); + if (x[j]) + s1 += a[j], s2 += c[j]; + } + xassert(s1 <= b); + xassert(s2 == z); + return z; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/misc/ks.h b/resources/3rdparty/glpk-4.65/src/misc/ks.h new file mode 100644 index 000000000..d607dc44f --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/misc/ks.h @@ -0,0 +1,44 @@ +/* ks.h (0-1 knapsack problem) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2017-2018 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#ifndef KS_H +#define KS_H + +#define ks_enum _glp_ks_enum +int ks_enum(int n, const int a[/*1+n*/], int b, const int c[/*1+n*/], + char x[/*1+n*/]); +/* solve 0-1 knapsack problem by complete enumeration */ + +#define ks_mt1 _glp_ks_mt1 +int ks_mt1(int n, const int a[/*1+n*/], int b, const int c[/*1+n*/], + char x[/*1+n*/]); +/* solve 0-1 knapsack problem with Martello & Toth algorithm */ + +#define ks_greedy _glp_ks_greedy +int ks_greedy(int n, const int a[/*1+n*/], int b, const int c[/*1+n*/], + char x[/*1+n*/]); +/* solve 0-1 knapsack problem with greedy heuristic */ + +#endif + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/misc/mc13d.c b/resources/3rdparty/glpk-4.65/src/misc/mc13d.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/mc13d.c rename to resources/3rdparty/glpk-4.65/src/misc/mc13d.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/mc13d.h b/resources/3rdparty/glpk-4.65/src/misc/mc13d.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/mc13d.h rename to resources/3rdparty/glpk-4.65/src/misc/mc13d.h diff --git a/resources/3rdparty/glpk-4.57/src/misc/mc21a.c b/resources/3rdparty/glpk-4.65/src/misc/mc21a.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/mc21a.c rename to resources/3rdparty/glpk-4.65/src/misc/mc21a.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/mc21a.h b/resources/3rdparty/glpk-4.65/src/misc/mc21a.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/mc21a.h rename to resources/3rdparty/glpk-4.65/src/misc/mc21a.h diff --git a/resources/3rdparty/glpk-4.57/src/misc/misc.h b/resources/3rdparty/glpk-4.65/src/misc/misc.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/misc.h rename to resources/3rdparty/glpk-4.65/src/misc/misc.h diff --git a/resources/3rdparty/glpk-4.65/src/misc/mt1.c b/resources/3rdparty/glpk-4.65/src/misc/mt1.c new file mode 100644 index 000000000..63a0f80ed --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/misc/mt1.c @@ -0,0 +1,1110 @@ +/* mt1.c (0-1 knapsack problem; Martello & Toth algorithm) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* THIS CODE IS THE RESULT OF TRANSLATION OF THE FORTRAN SUBROUTINES +* MT1 FROM THE BOOK: +* +* SILVANO MARTELLO, PAOLO TOTH. KNAPSACK PROBLEMS: ALGORITHMS AND +* COMPUTER IMPLEMENTATIONS. JOHN WILEY & SONS, 1990. +* +* THE TRANSLATION HAS BEEN DONE WITH THE PERMISSION OF THE AUTHORS OF +* THE ORIGINAL FORTRAN SUBROUTINES: SILVANO MARTELLO AND PAOLO TOTH. +* +* The translation was made by Andrew Makhorin . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#line 1 "" +/* -- translated by f2c (version 20100827). + You must link the resulting object file with libf2c: + on Microsoft Windows system, link with libf2c.lib; + on Linux or Unix systems, link with .../path/to/libf2c.a -lm + or, if you install libf2c.a in a standard place, with -lf2c -lm + -- in that order, at the end of the command line, as in + cc *.o -lf2c -lm + Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., + + http://www.netlib.org/f2c/libf2c.zip +*/ + +#if 0 /* by mao */ +#include "f2c.h" +#else +#include "env.h" +#include "mt1.h" + +typedef int integer; +typedef float real; +#endif + +#line 1 "" +/*< SUBROUTINE MT1(N,P,W,C,Z,X,JDIM,JCK,XX,MIN,PSIGN,WSIGN,ZSIGN) >*/ +#if 1 /* by mao */ +static int chmt1_(int *, int *, int *, int *, int *, int *); + +static +#endif +/* Subroutine */ int mt1_(integer *n, integer *p, integer *w, integer *c__, + integer *z__, integer *x, integer *jdim, integer *jck, integer *xx, + integer *min__, integer *psign, integer *wsign, integer *zsign) +{ + /* System generated locals */ + integer i__1; + + /* Local variables */ + static real a, b; + static integer j, r__, t, j1, n1, ch, ii, jj, kk, in, ll, ip, nn, iu, ii1, + chs, lim, lim1, diff, lold, mink; + extern /* Subroutine */ int chmt1_(integer *, integer *, integer *, + integer *, integer *, integer *); + static integer profit; + + +/* THIS SUBROUTINE SOLVES THE 0-1 SINGLE KNAPSACK PROBLEM */ + +/* MAXIMIZE Z = P(1)*X(1) + ... + P(N)*X(N) */ + +/* SUBJECT TO: W(1)*X(1) + ... + W(N)*X(N) .LE. C , */ +/* X(J) = 0 OR 1 FOR J=1,...,N. */ + +/* THE PROGRAM IS INCLUDED IN THE VOLUME */ +/* S. MARTELLO, P. TOTH, "KNAPSACK PROBLEMS: ALGORITHMS */ +/* AND COMPUTER IMPLEMENTATIONS", JOHN WILEY, 1990 */ +/* AND IMPLEMENTS THE BRANCH-AND-BOUND ALGORITHM DESCRIBED IN */ +/* SECTION 2.5.2 . */ +/* THE PROGRAM DERIVES FROM AN EARLIER CODE PRESENTED IN */ +/* S. MARTELLO, P. TOTH, "ALGORITHM FOR THE SOLUTION OF THE 0-1 SINGLE */ +/* KNAPSACK PROBLEM", COMPUTING, 1978. */ + +/* THE INPUT PROBLEM MUST SATISFY THE CONDITIONS */ + +/* 1) 2 .LE. N .LE. JDIM - 1 ; */ +/* 2) P(J), W(J), C POSITIVE INTEGERS; */ +/* 3) MAX (W(J)) .LE. C ; */ +/* 4) W(1) + ... + W(N) .GT. C ; */ +/* 5) P(J)/W(J) .GE. P(J+1)/W(J+1) FOR J=1,...,N-1. */ + +/* MT1 CALLS 1 PROCEDURE: CHMT1. */ + +/* THE PROGRAM IS COMPLETELY SELF-CONTAINED AND COMMUNICATION TO IT IS */ +/* ACHIEVED SOLELY THROUGH THE PARAMETER LIST OF MT1. */ +/* NO MACHINE-DEPENDENT CONSTANT IS USED. */ +/* THE PROGRAM IS WRITTEN IN 1967 AMERICAN NATIONAL STANDARD FORTRAN */ +/* AND IS ACCEPTED BY THE PFORT VERIFIER (PFORT IS THE PORTABLE */ +/* SUBSET OF ANSI DEFINED BY THE ASSOCIATION FOR COMPUTING MACHINERY). */ +/* THE PROGRAM HAS BEEN TESTED ON A DIGITAL VAX 11/780 AND AN H.P. */ +/* 9000/840. */ + +/* MT1 NEEDS 8 ARRAYS ( P , W , X , XX , MIN , PSIGN , WSIGN */ +/* AND ZSIGN ) OF LENGTH AT LEAST N + 1 . */ + +/* MEANING OF THE INPUT PARAMETERS: */ +/* N = NUMBER OF ITEMS; */ +/* P(J) = PROFIT OF ITEM J (J=1,...,N); */ +/* W(J) = WEIGHT OF ITEM J (J=1,...,N); */ +/* C = CAPACITY OF THE KNAPSACK; */ +/* JDIM = DIMENSION OF THE 8 ARRAYS; */ +/* JCK = 1 IF CHECK ON THE INPUT DATA IS DESIRED, */ +/* = 0 OTHERWISE. */ + +/* MEANING OF THE OUTPUT PARAMETERS: */ +/* Z = VALUE OF THE OPTIMAL SOLUTION IF Z .GT. 0 , */ +/* = ERROR IN THE INPUT DATA (WHEN JCK=1) IF Z .LT. 0 : CONDI- */ +/* TION - Z IS VIOLATED; */ +/* X(J) = 1 IF ITEM J IS IN THE OPTIMAL SOLUTION, */ +/* = 0 OTHERWISE. */ + +/* ARRAYS XX, MIN, PSIGN, WSIGN AND ZSIGN ARE DUMMY. */ + +/* ALL THE PARAMETERS ARE INTEGER. ON RETURN OF MT1 ALL THE INPUT */ +/* PARAMETERS ARE UNCHANGED. */ + +/*< INTEGER P(JDIM),W(JDIM),X(JDIM),C,Z >*/ +/*< INTEGER XX(JDIM),MIN(JDIM),PSIGN(JDIM),WSIGN(JDIM),ZSIGN(JDIM) >*/ +/*< INTEGER CH,CHS,DIFF,PROFIT,R,T >*/ +/*< Z = 0 >*/ +#line 65 "" + /* Parameter adjustments */ +#line 65 "" + --zsign; +#line 65 "" + --wsign; +#line 65 "" + --psign; +#line 65 "" + --min__; +#line 65 "" + --xx; +#line 65 "" + --x; +#line 65 "" + --w; +#line 65 "" + --p; +#line 65 "" + +#line 65 "" + /* Function Body */ +#line 65 "" + *z__ = 0; +/*< IF ( JCK .EQ. 1 ) CALL CHMT1(N,P,W,C,Z,JDIM) >*/ +#line 66 "" + if (*jck == 1) { +#line 66 "" + chmt1_(n, &p[1], &w[1], c__, z__, jdim); +#line 66 "" + } +/*< IF ( Z .LT. 0 ) RETURN >*/ +#line 67 "" + if (*z__ < 0) { +#line 67 "" + return 0; +#line 67 "" + } +/* INITIALIZE. */ +/*< CH = C >*/ +#line 69 "" + ch = *c__; +/*< IP = 0 >*/ +#line 70 "" + ip = 0; +/*< CHS = CH >*/ +#line 71 "" + chs = ch; +/*< DO 10 LL=1,N >*/ +#line 72 "" + i__1 = *n; +#line 72 "" + for (ll = 1; ll <= i__1; ++ll) { +/*< IF ( W(LL) .GT. CHS ) GO TO 20 >*/ +#line 73 "" + if (w[ll] > chs) { +#line 73 "" + goto L20; +#line 73 "" + } +/*< IP = IP + P(LL) >*/ +#line 74 "" + ip += p[ll]; +/*< CHS = CHS - W(LL) >*/ +#line 75 "" + chs -= w[ll]; +/*< 10 CONTINUE >*/ +#line 76 "" +/* L10: */ +#line 76 "" + } +/*< 20 LL = LL - 1 >*/ +#line 77 "" +L20: +#line 77 "" + --ll; +/*< IF ( CHS .EQ. 0 ) GO TO 50 >*/ +#line 78 "" + if (chs == 0) { +#line 78 "" + goto L50; +#line 78 "" + } +/*< P(N+1) = 0 >*/ +#line 79 "" + p[*n + 1] = 0; +/*< W(N+1) = CH + 1 >*/ +#line 80 "" + w[*n + 1] = ch + 1; +/*< LIM = IP + CHS*P(LL+2)/W(LL+2) >*/ +#line 81 "" + lim = ip + chs * p[ll + 2] / w[ll + 2]; +/*< A = W(LL+1) - CHS >*/ +#line 82 "" + a = (real) (w[ll + 1] - chs); +/*< B = IP + P(LL+1) >*/ +#line 83 "" + b = (real) (ip + p[ll + 1]); +/*< LIM1 = B - A*FLOAT(P(LL))/FLOAT(W(LL)) >*/ +#line 84 "" + lim1 = b - a * (real) p[ll] / (real) w[ll]; +/*< IF ( LIM1 .GT. LIM ) LIM = LIM1 >*/ +#line 85 "" + if (lim1 > lim) { +#line 85 "" + lim = lim1; +#line 85 "" + } +/*< MINK = CH + 1 >*/ +#line 86 "" + mink = ch + 1; +/*< MIN(N) = MINK >*/ +#line 87 "" + min__[*n] = mink; +/*< DO 30 J=2,N >*/ +#line 88 "" + i__1 = *n; +#line 88 "" + for (j = 2; j <= i__1; ++j) { +/*< KK = N + 2 - J >*/ +#line 89 "" + kk = *n + 2 - j; +/*< IF ( W(KK) .LT. MINK ) MINK = W(KK) >*/ +#line 90 "" + if (w[kk] < mink) { +#line 90 "" + mink = w[kk]; +#line 90 "" + } +/*< MIN(KK-1) = MINK >*/ +#line 91 "" + min__[kk - 1] = mink; +/*< 30 CONTINUE >*/ +#line 92 "" +/* L30: */ +#line 92 "" + } +/*< DO 40 J=1,N >*/ +#line 93 "" + i__1 = *n; +#line 93 "" + for (j = 1; j <= i__1; ++j) { +/*< XX(J) = 0 >*/ +#line 94 "" + xx[j] = 0; +/*< 40 CONTINUE >*/ +#line 95 "" +/* L40: */ +#line 95 "" + } +/*< Z = 0 >*/ +#line 96 "" + *z__ = 0; +/*< PROFIT = 0 >*/ +#line 97 "" + profit = 0; +/*< LOLD = N >*/ +#line 98 "" + lold = *n; +/*< II = 1 >*/ +#line 99 "" + ii = 1; +/*< GO TO 170 >*/ +#line 100 "" + goto L170; +/*< 50 Z = IP >*/ +#line 101 "" +L50: +#line 101 "" + *z__ = ip; +/*< DO 60 J=1,LL >*/ +#line 102 "" + i__1 = ll; +#line 102 "" + for (j = 1; j <= i__1; ++j) { +/*< X(J) = 1 >*/ +#line 103 "" + x[j] = 1; +/*< 60 CONTINUE >*/ +#line 104 "" +/* L60: */ +#line 104 "" + } +/*< NN = LL + 1 >*/ +#line 105 "" + nn = ll + 1; +/*< DO 70 J=NN,N >*/ +#line 106 "" + i__1 = *n; +#line 106 "" + for (j = nn; j <= i__1; ++j) { +/*< X(J) = 0 >*/ +#line 107 "" + x[j] = 0; +/*< 70 CONTINUE >*/ +#line 108 "" +/* L70: */ +#line 108 "" + } +/*< RETURN >*/ +#line 109 "" + return 0; +/* TRY TO INSERT THE II-TH ITEM INTO THE CURRENT SOLUTION. */ +/*< 80 IF ( W(II) .LE. CH ) GO TO 90 >*/ +#line 111 "" +L80: +#line 111 "" + if (w[ii] <= ch) { +#line 111 "" + goto L90; +#line 111 "" + } +/*< II1 = II + 1 >*/ +#line 112 "" + ii1 = ii + 1; +/*< IF ( Z .GE. CH*P(II1)/W(II1) + PROFIT ) GO TO 280 >*/ +#line 113 "" + if (*z__ >= ch * p[ii1] / w[ii1] + profit) { +#line 113 "" + goto L280; +#line 113 "" + } +/*< II = II1 >*/ +#line 114 "" + ii = ii1; +/*< GO TO 80 >*/ +#line 115 "" + goto L80; +/* BUILD A NEW CURRENT SOLUTION. */ +/*< 90 IP = PSIGN(II) >*/ +#line 117 "" +L90: +#line 117 "" + ip = psign[ii]; +/*< CHS = CH - WSIGN(II) >*/ +#line 118 "" + chs = ch - wsign[ii]; +/*< IN = ZSIGN(II) >*/ +#line 119 "" + in = zsign[ii]; +/*< DO 100 LL=IN,N >*/ +#line 120 "" + i__1 = *n; +#line 120 "" + for (ll = in; ll <= i__1; ++ll) { +/*< IF ( W(LL) .GT. CHS ) GO TO 160 >*/ +#line 121 "" + if (w[ll] > chs) { +#line 121 "" + goto L160; +#line 121 "" + } +/*< IP = IP + P(LL) >*/ +#line 122 "" + ip += p[ll]; +/*< CHS = CHS - W(LL) >*/ +#line 123 "" + chs -= w[ll]; +/*< 100 CONTINUE >*/ +#line 124 "" +/* L100: */ +#line 124 "" + } +/*< LL = N >*/ +#line 125 "" + ll = *n; +/*< 110 IF ( Z .GE. IP + PROFIT ) GO TO 280 >*/ +#line 126 "" +L110: +#line 126 "" + if (*z__ >= ip + profit) { +#line 126 "" + goto L280; +#line 126 "" + } +/*< Z = IP + PROFIT >*/ +#line 127 "" + *z__ = ip + profit; +/*< NN = II - 1 >*/ +#line 128 "" + nn = ii - 1; +/*< DO 120 J=1,NN >*/ +#line 129 "" + i__1 = nn; +#line 129 "" + for (j = 1; j <= i__1; ++j) { +/*< X(J) = XX(J) >*/ +#line 130 "" + x[j] = xx[j]; +/*< 120 CONTINUE >*/ +#line 131 "" +/* L120: */ +#line 131 "" + } +/*< DO 130 J=II,LL >*/ +#line 132 "" + i__1 = ll; +#line 132 "" + for (j = ii; j <= i__1; ++j) { +/*< X(J) = 1 >*/ +#line 133 "" + x[j] = 1; +/*< 130 CONTINUE >*/ +#line 134 "" +/* L130: */ +#line 134 "" + } +/*< IF ( LL .EQ. N ) GO TO 150 >*/ +#line 135 "" + if (ll == *n) { +#line 135 "" + goto L150; +#line 135 "" + } +/*< NN = LL + 1 >*/ +#line 136 "" + nn = ll + 1; +/*< DO 140 J=NN,N >*/ +#line 137 "" + i__1 = *n; +#line 137 "" + for (j = nn; j <= i__1; ++j) { +/*< X(J) = 0 >*/ +#line 138 "" + x[j] = 0; +/*< 140 CONTINUE >*/ +#line 139 "" +/* L140: */ +#line 139 "" + } +/*< 150 IF ( Z .NE. LIM ) GO TO 280 >*/ +#line 140 "" +L150: +#line 140 "" + if (*z__ != lim) { +#line 140 "" + goto L280; +#line 140 "" + } +/*< RETURN >*/ +#line 141 "" + return 0; +/*< 160 IU = CHS*P(LL)/W(LL) >*/ +#line 142 "" +L160: +#line 142 "" + iu = chs * p[ll] / w[ll]; +/*< LL = LL - 1 >*/ +#line 143 "" + --ll; +/*< IF ( IU .EQ. 0 ) GO TO 110 >*/ +#line 144 "" + if (iu == 0) { +#line 144 "" + goto L110; +#line 144 "" + } +/*< IF ( Z .GE. PROFIT + IP + IU ) GO TO 280 >*/ +#line 145 "" + if (*z__ >= profit + ip + iu) { +#line 145 "" + goto L280; +#line 145 "" + } +/* SAVE THE CURRENT SOLUTION. */ +/*< 170 WSIGN(II) = CH - CHS >*/ +#line 147 "" +L170: +#line 147 "" + wsign[ii] = ch - chs; +/*< PSIGN(II) = IP >*/ +#line 148 "" + psign[ii] = ip; +/*< ZSIGN(II) = LL + 1 >*/ +#line 149 "" + zsign[ii] = ll + 1; +/*< XX(II) = 1 >*/ +#line 150 "" + xx[ii] = 1; +/*< NN = LL - 1 >*/ +#line 151 "" + nn = ll - 1; +/*< IF ( NN .LT. II) GO TO 190 >*/ +#line 152 "" + if (nn < ii) { +#line 152 "" + goto L190; +#line 152 "" + } +/*< DO 180 J=II,NN >*/ +#line 153 "" + i__1 = nn; +#line 153 "" + for (j = ii; j <= i__1; ++j) { +/*< WSIGN(J+1) = WSIGN(J) - W(J) >*/ +#line 154 "" + wsign[j + 1] = wsign[j] - w[j]; +/*< PSIGN(J+1) = PSIGN(J) - P(J) >*/ +#line 155 "" + psign[j + 1] = psign[j] - p[j]; +/*< ZSIGN(J+1) = LL + 1 >*/ +#line 156 "" + zsign[j + 1] = ll + 1; +/*< XX(J+1) = 1 >*/ +#line 157 "" + xx[j + 1] = 1; +/*< 180 CONTINUE >*/ +#line 158 "" +/* L180: */ +#line 158 "" + } +/*< 190 J1 = LL + 1 >*/ +#line 159 "" +L190: +#line 159 "" + j1 = ll + 1; +/*< DO 200 J=J1,LOLD >*/ +#line 160 "" + i__1 = lold; +#line 160 "" + for (j = j1; j <= i__1; ++j) { +/*< WSIGN(J) = 0 >*/ +#line 161 "" + wsign[j] = 0; +/*< PSIGN(J) = 0 >*/ +#line 162 "" + psign[j] = 0; +/*< ZSIGN(J) = J >*/ +#line 163 "" + zsign[j] = j; +/*< 200 CONTINUE >*/ +#line 164 "" +/* L200: */ +#line 164 "" + } +/*< LOLD = LL >*/ +#line 165 "" + lold = ll; +/*< CH = CHS >*/ +#line 166 "" + ch = chs; +/*< PROFIT = PROFIT + IP >*/ +#line 167 "" + profit += ip; +/*< IF ( LL - (N - 2) ) 240, 220, 210 >*/ +#line 168 "" + if ((i__1 = ll - (*n - 2)) < 0) { +#line 168 "" + goto L240; +#line 168 "" + } else if (i__1 == 0) { +#line 168 "" + goto L220; +#line 168 "" + } else { +#line 168 "" + goto L210; +#line 168 "" + } +/*< 210 II = N >*/ +#line 169 "" +L210: +#line 169 "" + ii = *n; +/*< GO TO 250 >*/ +#line 170 "" + goto L250; +/*< 220 IF ( CH .LT. W(N) ) GO TO 230 >*/ +#line 171 "" +L220: +#line 171 "" + if (ch < w[*n]) { +#line 171 "" + goto L230; +#line 171 "" + } +/*< CH = CH - W(N) >*/ +#line 172 "" + ch -= w[*n]; +/*< PROFIT = PROFIT + P(N) >*/ +#line 173 "" + profit += p[*n]; +/*< XX(N) = 1 >*/ +#line 174 "" + xx[*n] = 1; +/*< 230 II = N - 1 >*/ +#line 175 "" +L230: +#line 175 "" + ii = *n - 1; +/*< GO TO 250 >*/ +#line 176 "" + goto L250; +/*< 240 II = LL + 2 >*/ +#line 177 "" +L240: +#line 177 "" + ii = ll + 2; +/*< IF ( CH .GE. MIN(II-1) ) GO TO 80 >*/ +#line 178 "" + if (ch >= min__[ii - 1]) { +#line 178 "" + goto L80; +#line 178 "" + } +/* SAVE THE CURRENT OPTIMAL SOLUTION. */ +/*< 250 IF ( Z .GE. PROFIT ) GO TO 270 >*/ +#line 180 "" +L250: +#line 180 "" + if (*z__ >= profit) { +#line 180 "" + goto L270; +#line 180 "" + } +/*< Z = PROFIT >*/ +#line 181 "" + *z__ = profit; +/*< DO 260 J=1,N >*/ +#line 182 "" + i__1 = *n; +#line 182 "" + for (j = 1; j <= i__1; ++j) { +/*< X(J) = XX(J) >*/ +#line 183 "" + x[j] = xx[j]; +/*< 260 CONTINUE >*/ +#line 184 "" +/* L260: */ +#line 184 "" + } +/*< IF ( Z .EQ. LIM ) RETURN >*/ +#line 185 "" + if (*z__ == lim) { +#line 185 "" + return 0; +#line 185 "" + } +/*< 270 IF ( XX(N) .EQ. 0 ) GO TO 280 >*/ +#line 186 "" +L270: +#line 186 "" + if (xx[*n] == 0) { +#line 186 "" + goto L280; +#line 186 "" + } +/*< XX(N) = 0 >*/ +#line 187 "" + xx[*n] = 0; +/*< CH = CH + W(N) >*/ +#line 188 "" + ch += w[*n]; +/*< PROFIT = PROFIT - P(N) >*/ +#line 189 "" + profit -= p[*n]; +/* BACKTRACK. */ +/*< 280 NN = II - 1 >*/ +#line 191 "" +L280: +#line 191 "" + nn = ii - 1; +/*< IF ( NN .EQ. 0 ) RETURN >*/ +#line 192 "" + if (nn == 0) { +#line 192 "" + return 0; +#line 192 "" + } +/*< DO 290 J=1,NN >*/ +#line 193 "" + i__1 = nn; +#line 193 "" + for (j = 1; j <= i__1; ++j) { +/*< KK = II - J >*/ +#line 194 "" + kk = ii - j; +/*< IF ( XX(KK) .EQ. 1 ) GO TO 300 >*/ +#line 195 "" + if (xx[kk] == 1) { +#line 195 "" + goto L300; +#line 195 "" + } +/*< 290 CONTINUE >*/ +#line 196 "" +/* L290: */ +#line 196 "" + } +/*< RETURN >*/ +#line 197 "" + return 0; +/*< 300 R = CH >*/ +#line 198 "" +L300: +#line 198 "" + r__ = ch; +/*< CH = CH + W(KK) >*/ +#line 199 "" + ch += w[kk]; +/*< PROFIT = PROFIT - P(KK) >*/ +#line 200 "" + profit -= p[kk]; +/*< XX(KK) = 0 >*/ +#line 201 "" + xx[kk] = 0; +/*< IF ( R .LT. MIN(KK) ) GO TO 310 >*/ +#line 202 "" + if (r__ < min__[kk]) { +#line 202 "" + goto L310; +#line 202 "" + } +/*< II = KK + 1 >*/ +#line 203 "" + ii = kk + 1; +/*< GO TO 80 >*/ +#line 204 "" + goto L80; +/*< 310 NN = KK + 1 >*/ +#line 205 "" +L310: +#line 205 "" + nn = kk + 1; +/*< II = KK >*/ +#line 206 "" + ii = kk; +/* TRY TO SUBSTITUTE THE NN-TH ITEM FOR THE KK-TH. */ +/*< 320 IF ( Z .GE. PROFIT + CH*P(NN)/W(NN) ) GO TO 280 >*/ +#line 208 "" +L320: +#line 208 "" + if (*z__ >= profit + ch * p[nn] / w[nn]) { +#line 208 "" + goto L280; +#line 208 "" + } +/*< DIFF = W(NN) - W(KK) >*/ +#line 209 "" + diff = w[nn] - w[kk]; +/*< IF ( DIFF ) 370, 330, 340 >*/ +#line 210 "" + if (diff < 0) { +#line 210 "" + goto L370; +#line 210 "" + } else if (diff == 0) { +#line 210 "" + goto L330; +#line 210 "" + } else { +#line 210 "" + goto L340; +#line 210 "" + } +/*< 330 NN = NN + 1 >*/ +#line 211 "" +L330: +#line 211 "" + ++nn; +/*< GO TO 320 >*/ +#line 212 "" + goto L320; +/*< 340 IF ( DIFF .GT. R ) GO TO 330 >*/ +#line 213 "" +L340: +#line 213 "" + if (diff > r__) { +#line 213 "" + goto L330; +#line 213 "" + } +/*< IF ( Z .GE. PROFIT + P(NN) ) GO TO 330 >*/ +#line 214 "" + if (*z__ >= profit + p[nn]) { +#line 214 "" + goto L330; +#line 214 "" + } +/*< Z = PROFIT + P(NN) >*/ +#line 215 "" + *z__ = profit + p[nn]; +/*< DO 350 J=1,KK >*/ +#line 216 "" + i__1 = kk; +#line 216 "" + for (j = 1; j <= i__1; ++j) { +/*< X(J) = XX(J) >*/ +#line 217 "" + x[j] = xx[j]; +/*< 350 CONTINUE >*/ +#line 218 "" +/* L350: */ +#line 218 "" + } +/*< JJ = KK + 1 >*/ +#line 219 "" + jj = kk + 1; +/*< DO 360 J=JJ,N >*/ +#line 220 "" + i__1 = *n; +#line 220 "" + for (j = jj; j <= i__1; ++j) { +/*< X(J) = 0 >*/ +#line 221 "" + x[j] = 0; +/*< 360 CONTINUE >*/ +#line 222 "" +/* L360: */ +#line 222 "" + } +/*< X(NN) = 1 >*/ +#line 223 "" + x[nn] = 1; +/*< IF ( Z .EQ. LIM ) RETURN >*/ +#line 224 "" + if (*z__ == lim) { +#line 224 "" + return 0; +#line 224 "" + } +/*< R = R - DIFF >*/ +#line 225 "" + r__ -= diff; +/*< KK = NN >*/ +#line 226 "" + kk = nn; +/*< NN = NN + 1 >*/ +#line 227 "" + ++nn; +/*< GO TO 320 >*/ +#line 228 "" + goto L320; +/*< 370 T = R - DIFF >*/ +#line 229 "" +L370: +#line 229 "" + t = r__ - diff; +/*< IF ( T .LT. MIN(NN) ) GO TO 330 >*/ +#line 230 "" + if (t < min__[nn]) { +#line 230 "" + goto L330; +#line 230 "" + } +/*< IF ( Z .GE. PROFIT + P(NN) + T*P(NN+1)/W(NN+1)) GO TO 280 >*/ +#line 231 "" + if (*z__ >= profit + p[nn] + t * p[nn + 1] / w[nn + 1]) { +#line 231 "" + goto L280; +#line 231 "" + } +/*< CH = CH - W(NN) >*/ +#line 232 "" + ch -= w[nn]; +/*< PROFIT = PROFIT + P(NN) >*/ +#line 233 "" + profit += p[nn]; +/*< XX(NN) = 1 >*/ +#line 234 "" + xx[nn] = 1; +/*< II = NN + 1 >*/ +#line 235 "" + ii = nn + 1; +/*< WSIGN(NN) = W(NN) >*/ +#line 236 "" + wsign[nn] = w[nn]; +/*< PSIGN(NN) = P(NN) >*/ +#line 237 "" + psign[nn] = p[nn]; +/*< ZSIGN(NN) = II >*/ +#line 238 "" + zsign[nn] = ii; +/*< N1 = NN + 1 >*/ +#line 239 "" + n1 = nn + 1; +/*< DO 380 J=N1,LOLD >*/ +#line 240 "" + i__1 = lold; +#line 240 "" + for (j = n1; j <= i__1; ++j) { +/*< WSIGN(J) = 0 >*/ +#line 241 "" + wsign[j] = 0; +/*< PSIGN(J) = 0 >*/ +#line 242 "" + psign[j] = 0; +/*< ZSIGN(J) = J >*/ +#line 243 "" + zsign[j] = j; +/*< 380 CONTINUE >*/ +#line 244 "" +/* L380: */ +#line 244 "" + } +/*< LOLD = NN >*/ +#line 245 "" + lold = nn; +/*< GO TO 80 >*/ +#line 246 "" + goto L80; +/*< END >*/ +} /* mt1_ */ + +/*< SUBROUTINE CHMT1(N,P,W,C,Z,JDIM) >*/ +#if 1 /* by mao */ +static +#endif +/* Subroutine */ int chmt1_(integer *n, integer *p, integer *w, integer *c__, + integer *z__, integer *jdim) +{ + /* System generated locals */ + integer i__1; + + /* Local variables */ + static integer j; + static real r__, rr; + static integer jsw; + + +/* CHECK THE INPUT DATA. */ + +/*< INTEGER P(JDIM),W(JDIM),C,Z >*/ +/*< IF ( N .GE. 2 .AND. N .LE. JDIM - 1 ) GO TO 10 >*/ +#line 253 "" + /* Parameter adjustments */ +#line 253 "" + --w; +#line 253 "" + --p; +#line 253 "" + +#line 253 "" + /* Function Body */ +#line 253 "" + if (*n >= 2 && *n <= *jdim - 1) { +#line 253 "" + goto L10; +#line 253 "" + } +/*< Z = - 1 >*/ +#line 254 "" + *z__ = -1; +/*< RETURN >*/ +#line 255 "" + return 0; +/*< 10 IF ( C .GT. 0 ) GO TO 30 >*/ +#line 256 "" +L10: +#line 256 "" + if (*c__ > 0) { +#line 256 "" + goto L30; +#line 256 "" + } +/*< 20 Z = - 2 >*/ +#line 257 "" +L20: +#line 257 "" + *z__ = -2; +/*< RETURN >*/ +#line 258 "" + return 0; +/*< 30 JSW = 0 >*/ +#line 259 "" +L30: +#line 259 "" + jsw = 0; +/*< RR = FLOAT(P(1))/FLOAT(W(1)) >*/ +#line 260 "" + rr = (real) p[1] / (real) w[1]; +/*< DO 50 J=1,N >*/ +#line 261 "" + i__1 = *n; +#line 261 "" + for (j = 1; j <= i__1; ++j) { +/*< R = RR >*/ +#line 262 "" + r__ = rr; +/*< IF ( P(J) .LE. 0 ) GO TO 20 >*/ +#line 263 "" + if (p[j] <= 0) { +#line 263 "" + goto L20; +#line 263 "" + } +/*< IF ( W(J) .LE. 0 ) GO TO 20 >*/ +#line 264 "" + if (w[j] <= 0) { +#line 264 "" + goto L20; +#line 264 "" + } +/*< JSW = JSW + W(J) >*/ +#line 265 "" + jsw += w[j]; +/*< IF ( W(J) .LE. C ) GO TO 40 >*/ +#line 266 "" + if (w[j] <= *c__) { +#line 266 "" + goto L40; +#line 266 "" + } +/*< Z = - 3 >*/ +#line 267 "" + *z__ = -3; +/*< RETURN >*/ +#line 268 "" + return 0; +/*< 40 RR = FLOAT(P(J))/FLOAT(W(J)) >*/ +#line 269 "" +L40: +#line 269 "" + rr = (real) p[j] / (real) w[j]; +/*< IF ( RR .LE. R ) GO TO 50 >*/ +#line 270 "" + if (rr <= r__) { +#line 270 "" + goto L50; +#line 270 "" + } +/*< Z = - 5 >*/ +#line 271 "" + *z__ = -5; +/*< RETURN >*/ +#line 272 "" + return 0; +/*< 50 CONTINUE >*/ +#line 273 "" +L50: +#line 273 "" + ; +#line 273 "" + } +/*< IF ( JSW .GT. C ) RETURN >*/ +#line 274 "" + if (jsw > *c__) { +#line 274 "" + return 0; +#line 274 "" + } +/*< Z = - 4 >*/ +#line 275 "" + *z__ = -4; +/*< RETURN >*/ +#line 276 "" + return 0; +/*< END >*/ +} /* chmt1_ */ + +#if 1 /* by mao */ +int mt1(int n, int p[], int w[], int c, int x[], int jck, int xx[], + int min[], int psign[], int wsign[], int zsign[]) +{ /* solve 0-1 knapsack problem */ + int z, jdim = n+1, j, s1, s2; + mt1_(&n, &p[1], &w[1], &c, &z, &x[1], &jdim, &jck, &xx[1], + &min[1], &psign[1], &wsign[1], &zsign[1]); + /* check solution found */ + s1 = s2 = 0; + for (j = 1; j <= n; j++) + { xassert(x[j] == 0 || x[j] == 1); + if (x[j]) + s1 += p[j], s2 += w[j]; + } + xassert(s1 == z); + xassert(s2 <= c); + return z; +} +#endif + +/* eof */ diff --git a/resources/3rdparty/glpk-4.65/src/misc/mt1.f b/resources/3rdparty/glpk-4.65/src/misc/mt1.f new file mode 100644 index 000000000..82cc4a1be --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/misc/mt1.f @@ -0,0 +1,277 @@ + SUBROUTINE MT1(N,P,W,C,Z,X,JDIM,JCK,XX,MIN,PSIGN,WSIGN,ZSIGN) +C +C THIS SUBROUTINE SOLVES THE 0-1 SINGLE KNAPSACK PROBLEM +C +C MAXIMIZE Z = P(1)*X(1) + ... + P(N)*X(N) +C +C SUBJECT TO: W(1)*X(1) + ... + W(N)*X(N) .LE. C , +C X(J) = 0 OR 1 FOR J=1,...,N. +C +C THE PROGRAM IS INCLUDED IN THE VOLUME +C S. MARTELLO, P. TOTH, "KNAPSACK PROBLEMS: ALGORITHMS +C AND COMPUTER IMPLEMENTATIONS", JOHN WILEY, 1990 +C AND IMPLEMENTS THE BRANCH-AND-BOUND ALGORITHM DESCRIBED IN +C SECTION 2.5.2 . +C THE PROGRAM DERIVES FROM AN EARLIER CODE PRESENTED IN +C S. MARTELLO, P. TOTH, "ALGORITHM FOR THE SOLUTION OF THE 0-1 SINGLE +C KNAPSACK PROBLEM", COMPUTING, 1978. +C +C THE INPUT PROBLEM MUST SATISFY THE CONDITIONS +C +C 1) 2 .LE. N .LE. JDIM - 1 ; +C 2) P(J), W(J), C POSITIVE INTEGERS; +C 3) MAX (W(J)) .LE. C ; +C 4) W(1) + ... + W(N) .GT. C ; +C 5) P(J)/W(J) .GE. P(J+1)/W(J+1) FOR J=1,...,N-1. +C +C MT1 CALLS 1 PROCEDURE: CHMT1. +C +C THE PROGRAM IS COMPLETELY SELF-CONTAINED AND COMMUNICATION TO IT IS +C ACHIEVED SOLELY THROUGH THE PARAMETER LIST OF MT1. +C NO MACHINE-DEPENDENT CONSTANT IS USED. +C THE PROGRAM IS WRITTEN IN 1967 AMERICAN NATIONAL STANDARD FORTRAN +C AND IS ACCEPTED BY THE PFORT VERIFIER (PFORT IS THE PORTABLE +C SUBSET OF ANSI DEFINED BY THE ASSOCIATION FOR COMPUTING MACHINERY). +C THE PROGRAM HAS BEEN TESTED ON A DIGITAL VAX 11/780 AND AN H.P. +C 9000/840. +C +C MT1 NEEDS 8 ARRAYS ( P , W , X , XX , MIN , PSIGN , WSIGN +C AND ZSIGN ) OF LENGTH AT LEAST N + 1 . +C +C MEANING OF THE INPUT PARAMETERS: +C N = NUMBER OF ITEMS; +C P(J) = PROFIT OF ITEM J (J=1,...,N); +C W(J) = WEIGHT OF ITEM J (J=1,...,N); +C C = CAPACITY OF THE KNAPSACK; +C JDIM = DIMENSION OF THE 8 ARRAYS; +C JCK = 1 IF CHECK ON THE INPUT DATA IS DESIRED, +C = 0 OTHERWISE. +C +C MEANING OF THE OUTPUT PARAMETERS: +C Z = VALUE OF THE OPTIMAL SOLUTION IF Z .GT. 0 , +C = ERROR IN THE INPUT DATA (WHEN JCK=1) IF Z .LT. 0 : CONDI- +C TION - Z IS VIOLATED; +C X(J) = 1 IF ITEM J IS IN THE OPTIMAL SOLUTION, +C = 0 OTHERWISE. +C +C ARRAYS XX, MIN, PSIGN, WSIGN AND ZSIGN ARE DUMMY. +C +C ALL THE PARAMETERS ARE INTEGER. ON RETURN OF MT1 ALL THE INPUT +C PARAMETERS ARE UNCHANGED. +C + INTEGER P(JDIM),W(JDIM),X(JDIM),C,Z + INTEGER XX(JDIM),MIN(JDIM),PSIGN(JDIM),WSIGN(JDIM),ZSIGN(JDIM) + INTEGER CH,CHS,DIFF,PROFIT,R,T + Z = 0 + IF ( JCK .EQ. 1 ) CALL CHMT1(N,P,W,C,Z,JDIM) + IF ( Z .LT. 0 ) RETURN +C INITIALIZE. + CH = C + IP = 0 + CHS = CH + DO 10 LL=1,N + IF ( W(LL) .GT. CHS ) GO TO 20 + IP = IP + P(LL) + CHS = CHS - W(LL) + 10 CONTINUE + 20 LL = LL - 1 + IF ( CHS .EQ. 0 ) GO TO 50 + P(N+1) = 0 + W(N+1) = CH + 1 + LIM = IP + CHS*P(LL+2)/W(LL+2) + A = W(LL+1) - CHS + B = IP + P(LL+1) + LIM1 = B - A*FLOAT(P(LL))/FLOAT(W(LL)) + IF ( LIM1 .GT. LIM ) LIM = LIM1 + MINK = CH + 1 + MIN(N) = MINK + DO 30 J=2,N + KK = N + 2 - J + IF ( W(KK) .LT. MINK ) MINK = W(KK) + MIN(KK-1) = MINK + 30 CONTINUE + DO 40 J=1,N + XX(J) = 0 + 40 CONTINUE + Z = 0 + PROFIT = 0 + LOLD = N + II = 1 + GO TO 170 + 50 Z = IP + DO 60 J=1,LL + X(J) = 1 + 60 CONTINUE + NN = LL + 1 + DO 70 J=NN,N + X(J) = 0 + 70 CONTINUE + RETURN +C TRY TO INSERT THE II-TH ITEM INTO THE CURRENT SOLUTION. + 80 IF ( W(II) .LE. CH ) GO TO 90 + II1 = II + 1 + IF ( Z .GE. CH*P(II1)/W(II1) + PROFIT ) GO TO 280 + II = II1 + GO TO 80 +C BUILD A NEW CURRENT SOLUTION. + 90 IP = PSIGN(II) + CHS = CH - WSIGN(II) + IN = ZSIGN(II) + DO 100 LL=IN,N + IF ( W(LL) .GT. CHS ) GO TO 160 + IP = IP + P(LL) + CHS = CHS - W(LL) + 100 CONTINUE + LL = N + 110 IF ( Z .GE. IP + PROFIT ) GO TO 280 + Z = IP + PROFIT + NN = II - 1 + DO 120 J=1,NN + X(J) = XX(J) + 120 CONTINUE + DO 130 J=II,LL + X(J) = 1 + 130 CONTINUE + IF ( LL .EQ. N ) GO TO 150 + NN = LL + 1 + DO 140 J=NN,N + X(J) = 0 + 140 CONTINUE + 150 IF ( Z .NE. LIM ) GO TO 280 + RETURN + 160 IU = CHS*P(LL)/W(LL) + LL = LL - 1 + IF ( IU .EQ. 0 ) GO TO 110 + IF ( Z .GE. PROFIT + IP + IU ) GO TO 280 +C SAVE THE CURRENT SOLUTION. + 170 WSIGN(II) = CH - CHS + PSIGN(II) = IP + ZSIGN(II) = LL + 1 + XX(II) = 1 + NN = LL - 1 + IF ( NN .LT. II) GO TO 190 + DO 180 J=II,NN + WSIGN(J+1) = WSIGN(J) - W(J) + PSIGN(J+1) = PSIGN(J) - P(J) + ZSIGN(J+1) = LL + 1 + XX(J+1) = 1 + 180 CONTINUE + 190 J1 = LL + 1 + DO 200 J=J1,LOLD + WSIGN(J) = 0 + PSIGN(J) = 0 + ZSIGN(J) = J + 200 CONTINUE + LOLD = LL + CH = CHS + PROFIT = PROFIT + IP + IF ( LL - (N - 2) ) 240, 220, 210 + 210 II = N + GO TO 250 + 220 IF ( CH .LT. W(N) ) GO TO 230 + CH = CH - W(N) + PROFIT = PROFIT + P(N) + XX(N) = 1 + 230 II = N - 1 + GO TO 250 + 240 II = LL + 2 + IF ( CH .GE. MIN(II-1) ) GO TO 80 +C SAVE THE CURRENT OPTIMAL SOLUTION. + 250 IF ( Z .GE. PROFIT ) GO TO 270 + Z = PROFIT + DO 260 J=1,N + X(J) = XX(J) + 260 CONTINUE + IF ( Z .EQ. LIM ) RETURN + 270 IF ( XX(N) .EQ. 0 ) GO TO 280 + XX(N) = 0 + CH = CH + W(N) + PROFIT = PROFIT - P(N) +C BACKTRACK. + 280 NN = II - 1 + IF ( NN .EQ. 0 ) RETURN + DO 290 J=1,NN + KK = II - J + IF ( XX(KK) .EQ. 1 ) GO TO 300 + 290 CONTINUE + RETURN + 300 R = CH + CH = CH + W(KK) + PROFIT = PROFIT - P(KK) + XX(KK) = 0 + IF ( R .LT. MIN(KK) ) GO TO 310 + II = KK + 1 + GO TO 80 + 310 NN = KK + 1 + II = KK +C TRY TO SUBSTITUTE THE NN-TH ITEM FOR THE KK-TH. + 320 IF ( Z .GE. PROFIT + CH*P(NN)/W(NN) ) GO TO 280 + DIFF = W(NN) - W(KK) + IF ( DIFF ) 370, 330, 340 + 330 NN = NN + 1 + GO TO 320 + 340 IF ( DIFF .GT. R ) GO TO 330 + IF ( Z .GE. PROFIT + P(NN) ) GO TO 330 + Z = PROFIT + P(NN) + DO 350 J=1,KK + X(J) = XX(J) + 350 CONTINUE + JJ = KK + 1 + DO 360 J=JJ,N + X(J) = 0 + 360 CONTINUE + X(NN) = 1 + IF ( Z .EQ. LIM ) RETURN + R = R - DIFF + KK = NN + NN = NN + 1 + GO TO 320 + 370 T = R - DIFF + IF ( T .LT. MIN(NN) ) GO TO 330 + IF ( Z .GE. PROFIT + P(NN) + T*P(NN+1)/W(NN+1)) GO TO 280 + CH = CH - W(NN) + PROFIT = PROFIT + P(NN) + XX(NN) = 1 + II = NN + 1 + WSIGN(NN) = W(NN) + PSIGN(NN) = P(NN) + ZSIGN(NN) = II + N1 = NN + 1 + DO 380 J=N1,LOLD + WSIGN(J) = 0 + PSIGN(J) = 0 + ZSIGN(J) = J + 380 CONTINUE + LOLD = NN + GO TO 80 + END + SUBROUTINE CHMT1(N,P,W,C,Z,JDIM) +C +C CHECK THE INPUT DATA. +C + INTEGER P(JDIM),W(JDIM),C,Z + IF ( N .GE. 2 .AND. N .LE. JDIM - 1 ) GO TO 10 + Z = - 1 + RETURN + 10 IF ( C .GT. 0 ) GO TO 30 + 20 Z = - 2 + RETURN + 30 JSW = 0 + RR = FLOAT(P(1))/FLOAT(W(1)) + DO 50 J=1,N + R = RR + IF ( P(J) .LE. 0 ) GO TO 20 + IF ( W(J) .LE. 0 ) GO TO 20 + JSW = JSW + W(J) + IF ( W(J) .LE. C ) GO TO 40 + Z = - 3 + RETURN + 40 RR = FLOAT(P(J))/FLOAT(W(J)) + IF ( RR .LE. R ) GO TO 50 + Z = - 5 + RETURN + 50 CONTINUE + IF ( JSW .GT. C ) RETURN + Z = - 4 + RETURN + END diff --git a/resources/3rdparty/glpk-4.65/src/misc/mt1.h b/resources/3rdparty/glpk-4.65/src/misc/mt1.h new file mode 100644 index 000000000..cceebba93 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/misc/mt1.h @@ -0,0 +1,34 @@ +/* mt1.h (0-1 knapsack problem; Martello & Toth algorithm) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2017-2018 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#ifndef MT1_H +#define MT1_H + +#define mt1 _glp_mt1 +int mt1(int n, int p[], int w[], int c, int x[], int jck, int xx[], + int min[], int psign[], int wsign[], int zsign[]); +/* solve 0-1 single knapsack problem */ + +#endif + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/glpgmp.c b/resources/3rdparty/glpk-4.65/src/misc/mygmp.c similarity index 83% rename from resources/3rdparty/glpk-4.57/src/glpgmp.c rename to resources/3rdparty/glpk-4.65/src/misc/mygmp.c index 95c5159bd..89d053aec 100644 --- a/resources/3rdparty/glpk-4.57/src/glpgmp.c +++ b/resources/3rdparty/glpk-4.65/src/misc/mygmp.c @@ -1,10 +1,9 @@ -/* glpgmp.c */ +/* mygmp.c (integer and rational arithmetic) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2008-2015 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -22,52 +21,47 @@ * along with GLPK. If not, see . ***********************************************************************/ -#define _GLPSTD_STDIO -#if 1 /* 11/VI-2013 */ -#include "bignum.h" -#endif -#include "dmp.h" -#include "glpgmp.h" -#include "env.h" -#define xfault xerror +#include "mygmp.h" -#ifdef HAVE_GMP /* use GNU MP bignum library */ +#ifdef HAVE_GMP /* use GNU MP library */ -int gmp_pool_count(void) { return 0; } +/* nothing is needed */ -void gmp_free_mem(void) { return; } +#else /* use GLPK MP module */ -#else /* use GLPK bignum module */ +#include "bignum.h" +#include "dmp.h" +#include "env.h" -static DMP *gmp_pool = NULL; -static int gmp_size = 0; -static unsigned short *gmp_work = NULL; +#define gmp_pool env->gmp_pool +#define gmp_size env->gmp_size +#define gmp_work env->gmp_work void *gmp_get_atom(int size) -{ if (gmp_pool == NULL) +{ ENV *env = get_env_ptr(); + if (gmp_pool == NULL) gmp_pool = dmp_create_pool(); return dmp_get_atom(gmp_pool, size); } void gmp_free_atom(void *ptr, int size) -{ xassert(gmp_pool != NULL); +{ ENV *env = get_env_ptr(); + xassert(gmp_pool != NULL); dmp_free_atom(gmp_pool, ptr, size); return; } int gmp_pool_count(void) -{ if (gmp_pool == NULL) +{ ENV *env = get_env_ptr(); + if (gmp_pool == NULL) return 0; else -#if 0 /* 10/VI-2013 */ - return dmp_in_use(gmp_pool).lo; -#else return dmp_in_use(gmp_pool); -#endif } unsigned short *gmp_get_work(int size) -{ xassert(size > 0); +{ ENV *env = get_env_ptr(); + xassert(size > 0); if (gmp_size < size) { if (gmp_size == 0) { xassert(gmp_work == NULL); @@ -77,25 +71,29 @@ unsigned short *gmp_get_work(int size) { xassert(gmp_work != NULL); xfree(gmp_work); } - while (gmp_size < size) gmp_size += gmp_size; + while (gmp_size < size) + gmp_size += gmp_size; gmp_work = xcalloc(gmp_size, sizeof(unsigned short)); } return gmp_work; } void gmp_free_mem(void) -{ if (gmp_pool != NULL) dmp_delete_pool(gmp_pool); - if (gmp_work != NULL) xfree(gmp_work); +{ ENV *env = get_env_ptr(); + if (gmp_pool != NULL) + dmp_delete_pool(gmp_pool); + if (gmp_work != NULL) + xfree(gmp_work); gmp_pool = NULL; gmp_size = 0; gmp_work = NULL; return; } -/*====================================================================*/ +/*--------------------------------------------------------------------*/ mpz_t _mpz_init(void) -{ /* initialize x, and set its value to 0 */ +{ /* initialize x and set its value to 0 */ mpz_t x; x = gmp_get_atom(sizeof(struct mpz)); x->val = 0; @@ -175,18 +173,19 @@ double mpz_get_d(mpz_t x) deg *= 65536.0; } } - if (x->val < 0) val = - val; + if (x->val < 0) + val = - val; } return val; } double mpz_get_d_2exp(int *exp, mpz_t x) { /* convert x to a double, truncating if necessary (i.e. rounding - towards zero), and returning the exponent separately; - the return value is in the range 0.5 <= |d| < 1 and the - exponent is stored to *exp; d*2^exp is the (truncated) x value; - if x is zero, the return is 0.0 and 0 is stored to *exp; - this is similar to the standard C frexp function */ + * towards zero), and returning the exponent separately; + * the return value is in the range 0.5 <= |d| < 1 and the + * exponent is stored to *exp; d*2^exp is the (truncated) x value; + * if x is zero, the return is 0.0 and 0 is stored to *exp; + * this is similar to the standard C frexp function */ struct mpz_seg *e; int j, n, n1; double val; @@ -201,7 +200,8 @@ double mpz_get_d_2exp(int *exp, mpz_t x) val /= 65536.0, n += 16; } } - if (x->val < 0) val = - val; + if (x->val < 0) + val = - val; } val = frexp(val, &n1); *exp = n + n1; @@ -220,7 +220,7 @@ void mpz_swap(mpz_t x, mpz_t y) static void normalize(mpz_t x) { /* normalize integer x that includes removing non-significant - (leading) zeros and converting to short format, if possible */ + * (leading) zeros and converting to short format, if possible */ struct mpz_seg *es, *e; /* if the integer is in short format, it remains unchanged */ if (x->ptr == NULL) @@ -232,7 +232,8 @@ static void normalize(mpz_t x) es = NULL; for (e = x->ptr; e != NULL; e = e->next) { if (e->d[0] || e->d[1] || e->d[2] || - e->d[3] || e->d[4] || e->d[5]) es = e; + e->d[3] || e->d[4] || e->d[5]) + es = e; } /* if all segments contain zeros, the integer is zero */ if (es == NULL) @@ -251,7 +252,8 @@ static void normalize(mpz_t x) !e->d[2] && !e->d[3] && !e->d[4] && !e->d[5]) { int val; val = (int)e->d[0] + ((int)e->d[1] << 16); - if (x->val < 0) val = - val; + if (x->val < 0) + val = - val; mpz_set_si(x, val); } done: return; @@ -336,8 +338,10 @@ void mpz_add(mpz_t z, mpz_t x, mpz_t y) { /* [x] and [y] have identical signs -- addition */ t = 0; for (; ex || ey; ex = ex->next, ey = ey->next) - { if (ex == NULL) ex = &zero; - if (ey == NULL) ey = &zero; + { if (ex == NULL) + ex = &zero; + if (ey == NULL) + ey = &zero; ee = gmp_get_atom(sizeof(struct mpz_seg)); for (k = 0; k <= 5; k++) { t += (unsigned int)ex->d[k]; @@ -366,8 +370,10 @@ void mpz_add(mpz_t z, mpz_t x, mpz_t y) { /* [x] and [y] have different signs -- subtraction */ t = 1; for (; ex || ey; ex = ex->next, ey = ey->next) - { if (ex == NULL) ex = &zero; - if (ey == NULL) ey = &zero; + { if (ex == NULL) + ex = &zero; + if (ey == NULL) + ey = &zero; ee = gmp_get_atom(sizeof(struct mpz_seg)); for (k = 0; k <= 5; k++) { t += (unsigned int)ex->d[k]; @@ -387,10 +393,11 @@ void mpz_add(mpz_t z, mpz_t x, mpz_t y) sz = - sz; t = 1; for (ee = ez; ee != NULL; ee = ee->next) - for (k = 0; k <= 5; k++) - { t += (0xFFFF - (unsigned int)ee->d[k]); - ee->d[k] = (unsigned short)t; - t >>= 16; + { for (k = 0; k <= 5; k++) + { t += (0xFFFF - (unsigned int)ee->d[k]); + ee->d[k] = (unsigned short)t; + t >>= 16; + } } } } @@ -409,7 +416,8 @@ void mpz_sub(mpz_t z, mpz_t x, mpz_t y) else { y->val = - y->val; mpz_add(z, x, y); - if (y != z) y->val = - y->val; + if (y != z) + y->val = - y->val; } return; } @@ -436,8 +444,10 @@ void mpz_mul(mpz_t z, mpz_t x, mpz_t y) if (x->ptr == NULL && y->ptr == NULL) { int xval = x->val, yval = y->val, sz = +1; xassert(xval != 0x80000000 && yval != 0x80000000); - if (xval < 0) xval = - xval, sz = - sz; - if (yval < 0) yval = - yval, sz = - sz; + if (xval < 0) + xval = - xval, sz = - sz; + if (yval < 0) + yval = - yval, sz = - sz; if (xval <= 0x7FFFFFFF / yval) { mpz_set_si(z, sz * (xval * yval)); goto done; @@ -490,33 +500,44 @@ void mpz_mul(mpz_t z, mpz_t x, mpz_t y) /* determine the number of digits of [x] */ nx = n = 0; for (e = ex; e != NULL; e = e->next) - for (k = 0; k <= 5; k++) - { n++; - if (e->d[k]) nx = n; + { for (k = 0; k <= 5; k++) + { n++; + if (e->d[k]) + nx = n; + } } xassert(nx > 0); /* determine the number of digits of [y] */ ny = n = 0; for (e = ey; e != NULL; e = e->next) - for (k = 0; k <= 5; k++) - { n++; - if (e->d[k]) ny = n; + { for (k = 0; k <= 5; k++) + { n++; + if (e->d[k]) + ny = n; + } } xassert(ny > 0); /* we need working array containing at least nx+ny+ny places */ work = gmp_get_work(nx+ny+ny); /* load digits of [x] */ wx = &work[0]; - for (n = 0; n < nx; n++) wx[ny+n] = 0; + for (n = 0; n < nx; n++) + wx[ny+n] = 0; for (n = 0, e = ex; e != NULL; e = e->next) - for (k = 0; k <= 5; k++, n++) - if (e->d[k]) wx[ny+n] = e->d[k]; + { for (k = 0; k <= 5; k++, n++) + { if (e->d[k]) + wx[ny+n] = e->d[k]; + } + } /* load digits of [y] */ wy = &work[nx+ny]; for (n = 0; n < ny; n++) wy[n] = 0; for (n = 0, e = ey; e != NULL; e = e->next) - for (k = 0; k <= 5; k++, n++) - if (e->d[k]) wy[n] = e->d[k]; + { for (k = 0; k <= 5; k++, n++) + { if (e->d[k]) + wy[n] = e->d[k]; + } + } /* compute [x] * [y] */ bigmul(nx, ny, wx, wy); /* construct and normalize result */ @@ -553,20 +574,21 @@ void mpz_neg(mpz_t z, mpz_t x) void mpz_abs(mpz_t z, mpz_t x) { /* set z to the absolute value of x */ mpz_set(z, x); - if (z->val < 0) z->val = - z->val; + if (z->val < 0) + z->val = - z->val; return; } void mpz_div(mpz_t q, mpz_t r, mpz_t x, mpz_t y) { /* divide x by y, forming quotient q and/or remainder r - if q = NULL then quotient is not stored; if r = NULL then - remainder is not stored - the sign of quotient is determined as in algebra while the - sign of remainder is the same as the sign of dividend: - +26 : +7 = +3, remainder is +5 - -26 : +7 = -3, remainder is -5 - +26 : -7 = -3, remainder is +5 - -26 : -7 = +3, remainder is -5 */ + * if q = NULL then quotient is not stored; if r = NULL then + * remainder is not stored + * the sign of quotient is determined as in algebra while the + * sign of remainder is the same as the sign of dividend: + * +26 : +7 = +3, remainder is +5 + * -26 : +7 = -3, remainder is -5 + * +26 : -7 = -3, remainder is +5 + * -26 : -7 = +3, remainder is -5 */ struct mpz_seg dumx, dumy, *ex, *ey, *es, *e; int sx, sy, k, nx, ny, n; unsigned int t; @@ -574,21 +596,26 @@ void mpz_div(mpz_t q, mpz_t r, mpz_t x, mpz_t y) /* divide by zero is not allowed */ if (y->val == 0) { xassert(y->ptr == NULL); - xfault("mpz_div: divide by zero not allowed\n"); + xerror("mpz_div: divide by zero not allowed\n"); } /* if [x] = 0 then [q] = [r] = 0 */ if (x->val == 0) { xassert(x->ptr == NULL); - if (q != NULL) mpz_set_si(q, 0); - if (r != NULL) mpz_set_si(r, 0); + if (q != NULL) + mpz_set_si(q, 0); + if (r != NULL) + mpz_set_si(r, 0); goto done; } /* special case when both [x] and [y] are in short format */ if (x->ptr == NULL && y->ptr == NULL) { int xval = x->val, yval = y->val; xassert(xval != 0x80000000 && yval != 0x80000000); - if (q != NULL) mpz_set_si(q, xval / yval); - if (r != NULL) mpz_set_si(r, xval % yval); + /* FIXME: use div function */ + if (q != NULL) + mpz_set_si(q, xval / yval); + if (r != NULL) + mpz_set_si(r, xval % yval); goto done; } /* convert [x] to long format, if necessary */ @@ -638,39 +665,49 @@ void mpz_div(mpz_t q, mpz_t r, mpz_t x, mpz_t y) /* determine the number of digits of [x] */ nx = n = 0; for (e = ex; e != NULL; e = e->next) - for (k = 0; k <= 5; k++) - { n++; - if (e->d[k]) nx = n; + { for (k = 0; k <= 5; k++) + { n++; + if (e->d[k]) + nx = n; + } } xassert(nx > 0); /* determine the number of digits of [y] */ ny = n = 0; for (e = ey; e != NULL; e = e->next) - for (k = 0; k <= 5; k++) - { n++; - if (e->d[k]) ny = n; + { for (k = 0; k <= 5; k++) + { n++; + if (e->d[k]) + ny = n; + } } xassert(ny > 0); /* if nx < ny then [q] = 0 and [r] = [x] */ if (nx < ny) - { if (r != NULL) mpz_set(r, x); - if (q != NULL) mpz_set_si(q, 0); + { if (r != NULL) + mpz_set(r, x); + if (q != NULL) + mpz_set_si(q, 0); goto done; } /* we need working array containing at least nx+ny+1 places */ work = gmp_get_work(nx+ny+1); /* load digits of [x] */ wx = &work[0]; - for (n = 0; n < nx; n++) wx[n] = 0; + for (n = 0; n < nx; n++) + wx[n] = 0; for (n = 0, e = ex; e != NULL; e = e->next) - for (k = 0; k <= 5; k++, n++) + { for (k = 0; k <= 5; k++, n++) if (e->d[k]) wx[n] = e->d[k]; + } /* load digits of [y] */ wy = &work[nx+1]; - for (n = 0; n < ny; n++) wy[n] = 0; + for (n = 0; n < ny; n++) + wy[n] = 0; for (n = 0, e = ey; e != NULL; e = e->next) - for (k = 0; k <= 5; k++, n++) + { for (k = 0; k <= 5; k++, n++) if (e->d[k]) wy[n] = e->d[k]; + } /* compute quotient and remainder */ xassert(wy[ny-1] != 0); bigdiv(nx-ny, ny, wx, wy); @@ -726,7 +763,7 @@ done: return; void mpz_gcd(mpz_t z, mpz_t x, mpz_t y) { /* set z to the greatest common divisor of x and y */ /* in case of arbitrary integers GCD(x, y) = GCD(|x|, |y|), and, - in particular, GCD(0, 0) = 0 */ + * in particular, GCD(0, 0) = 0 */ mpz_t u, v, r; mpz_init(u); mpz_init(v); @@ -747,7 +784,7 @@ void mpz_gcd(mpz_t z, mpz_t x, mpz_t y) int mpz_cmp(mpz_t x, mpz_t y) { /* compare x and y; return a positive value if x > y, zero if - x = y, or a nefative value if x < y */ + * x = y, or a nefative value if x < y */ static struct mpz_seg zero = { { 0, 0, 0, 0, 0, 0 }, NULL }; struct mpz_seg dumx, dumy, *ex, *ey; int cc, sx, sy, k; @@ -820,11 +857,15 @@ int mpz_cmp(mpz_t x, mpz_t y) xassert(sx > 0 && sy > 0 || sx < 0 && sy < 0); cc = 0; for (; ex || ey; ex = ex->next, ey = ey->next) - { if (ex == NULL) ex = &zero; - if (ey == NULL) ey = &zero; + { if (ex == NULL) + ex = &zero; + if (ey == NULL) + ey = &zero; for (k = 0; k <= 5; k++) - { if (ex->d[k] > ey->d[k]) cc = +1; - if (ex->d[k] < ey->d[k]) cc = -1; + { if (ex->d[k] > ey->d[k]) + cc = +1; + if (ex->d[k] < ey->d[k]) + cc = -1; } } if (sx < 0) cc = - cc; @@ -840,16 +881,16 @@ int mpz_sgn(mpz_t x) int mpz_out_str(void *_fp, int base, mpz_t x) { /* output x on stream fp, as a string in given base; the base - may vary from 2 to 36; - return the number of bytes written, or if an error occurred, - return 0 */ + * may vary from 2 to 36; + * return the number of bytes written, or if an error occurred, + * return 0 */ FILE *fp = _fp; mpz_t b, y, r; int n, j, nwr = 0; unsigned char *d; static char *set = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if (!(2 <= base && base <= 36)) - xfault("mpz_out_str: base = %d; invalid base\n", base); + xerror("mpz_out_str: base = %d; invalid base\n", base); mpz_init(b); mpz_set_si(b, base); mpz_init(y); @@ -868,12 +909,14 @@ int mpz_out_str(void *_fp, int base, mpz_t x) d[j] = (unsigned char)r->val; } /* output the integer to the stream */ - if (fp == NULL) fp = stdout; + if (fp == NULL) + fp = stdout; if (mpz_sgn(x) < 0) fputc('-', fp), nwr++; for (j = n-1; j >= 0; j--) fputc(set[d[j]], fp), nwr++; - if (ferror(fp)) nwr = 0; + if (ferror(fp)) + nwr = 0; mpz_clear(b); mpz_clear(y); mpz_clear(r); @@ -881,7 +924,7 @@ int mpz_out_str(void *_fp, int base, mpz_t x) return nwr; } -/*====================================================================*/ +/*--------------------------------------------------------------------*/ mpq_t _mpq_init(void) { /* initialize x, and set its value to 0/1 */ @@ -907,7 +950,7 @@ void mpq_clear(mpq_t x) void mpq_canonicalize(mpq_t x) { /* remove any factors that are common to the numerator and - denominator of x, and make the denominator positive */ + * denominator of x, and make the denominator positive */ mpz_t f; xassert(x->q.val != 0); if (x->q.val < 0) @@ -936,7 +979,7 @@ void mpq_set(mpq_t z, mpq_t x) void mpq_set_si(mpq_t x, int p, unsigned int q) { /* set the value of x to p/q */ if (q == 0) - xfault("mpq_set_si: zero denominator not allowed\n"); + xerror("mpq_set_si: zero denominator not allowed\n"); mpz_set_si(&x->p, p); xassert(q <= 0x7FFFFFFF); mpz_set_si(&x->q, q); @@ -990,7 +1033,8 @@ void mpq_set_d(mpq_t x, double val) mpz_add(&x->q, &x->q, &x->q); mpq_canonicalize(x); } - if (s < 0) mpq_neg(x, x); + if (s < 0) + mpq_neg(x, x); done: return; } @@ -1040,7 +1084,7 @@ void mpq_div(mpq_t z, mpq_t x, mpq_t y) { /* set z to x / y */ mpz_t p, q; if (mpq_sgn(y) == 0) - xfault("mpq_div: zero divisor not allowed\n"); + xerror("mpq_div: zero divisor not allowed\n"); mpz_init(p); mpz_init(q); mpz_mul(p, &x->p, &y->q); @@ -1070,7 +1114,7 @@ void mpq_abs(mpq_t z, mpq_t x) int mpq_cmp(mpq_t x, mpq_t y) { /* compare x and y; return a positive value if x > y, zero if - x = y, or a nefative value if x < y */ + * x = y, or a negative value if x < y */ mpq_t temp; int s; mpq_init(temp); @@ -1090,16 +1134,17 @@ int mpq_sgn(mpq_t x) int mpq_out_str(void *_fp, int base, mpq_t x) { /* output x on stream fp, as a string in given base; the base - may vary from 2 to 36; output is in the form 'num/den' or if - the denominator is 1 then just 'num'; - if the parameter fp is a null pointer, stdout is assumed; - return the number of bytes written, or if an error occurred, - return 0 */ + * may vary from 2 to 36; output is in the form 'num/den' or if + * the denominator is 1 then just 'num'; + * if the parameter fp is a null pointer, stdout is assumed; + * return the number of bytes written, or if an error occurred, + * return 0 */ FILE *fp = _fp; int nwr; if (!(2 <= base && base <= 36)) - xfault("mpq_out_str: base = %d; invalid base\n", base); - if (fp == NULL) fp = stdout; + xerror("mpq_out_str: base = %d; invalid base\n", base); + if (fp == NULL) + fp = stdout; nwr = mpz_out_str(fp, base, &x->p); if (x->q.val == 1 && x->q.ptr == NULL) ; @@ -1107,7 +1152,8 @@ int mpq_out_str(void *_fp, int base, mpq_t x) { fputc('/', fp), nwr++; nwr += mpz_out_str(fp, base, &x->q); } - if (ferror(fp)) nwr = 0; + if (ferror(fp)) + nwr = 0; return nwr; } diff --git a/resources/3rdparty/glpk-4.65/src/misc/mygmp.h b/resources/3rdparty/glpk-4.65/src/misc/mygmp.h new file mode 100644 index 000000000..31d2024df --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/misc/mygmp.h @@ -0,0 +1,254 @@ +/* mygmp.h (integer and rational arithmetic) */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2008-2015 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#ifndef MYGMP_H +#define MYGMP_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef HAVE_GMP /* use GNU MP library */ + +#include + +#define gmp_pool_count() 0 + +#define gmp_free_mem() ((void)0) + +#else /* use GLPK MP module */ + +/*********************************************************************** +* INTEGER NUMBERS +* --------------- +* Depending on its magnitude an integer number of arbitrary precision +* is represented either in short format or in long format. +* +* Short format corresponds to the int type and allows representing +* integer numbers in the range [-(2^31-1), +(2^31-1)]. Note that for +* the most negative number of int type the short format is not used. +* +* In long format integer numbers are represented using the positional +* system with the base (radix) 2^16 = 65536: +* +* x = (-1)^s sum{j in 0..n-1} d[j] * 65536^j, +* +* where x is the integer to be represented, s is its sign (+1 or -1), +* d[j] are its digits (0 <= d[j] <= 65535). +* +* RATIONAL NUMBERS +* ---------------- +* A rational number is represented as an irreducible fraction: +* +* p / q, +* +* where p (numerator) and q (denominator) are integer numbers (q > 0) +* having no common divisors. */ + +struct mpz +{ /* integer number */ + int val; + /* if ptr is a null pointer, the number is in short format, and + val is its value; otherwise, the number is in long format, and + val is its sign (+1 or -1) */ + struct mpz_seg *ptr; + /* pointer to the linked list of the number segments ordered in + ascending of powers of the base */ +}; + +struct mpz_seg +{ /* integer number segment */ + unsigned short d[6]; + /* six digits of the number ordered in ascending of powers of the + base */ + struct mpz_seg *next; + /* pointer to the next number segment */ +}; + +struct mpq +{ /* rational number (p / q) */ + struct mpz p; + /* numerator */ + struct mpz q; + /* denominator */ +}; + +typedef struct mpz *mpz_t; +typedef struct mpq *mpq_t; + +#define gmp_get_atom _glp_gmp_get_atom +void *gmp_get_atom(int size); + +#define gmp_free_atom _glp_gmp_free_atom +void gmp_free_atom(void *ptr, int size); + +#define gmp_pool_count _glp_gmp_pool_count +int gmp_pool_count(void); + +#define gmp_get_work _glp_gmp_get_work +unsigned short *gmp_get_work(int size); + +#define gmp_free_mem _glp_gmp_free_mem +void gmp_free_mem(void); + +#define mpz_init(x) (void)((x) = _mpz_init()) + +#define _mpz_init _glp_mpz_init +mpz_t _mpz_init(void); +/* initialize x and set its value to 0 */ + +#define mpz_clear _glp_mpz_clear +void mpz_clear(mpz_t x); +/* free the space occupied by x */ + +#define mpz_set _glp_mpz_set +void mpz_set(mpz_t z, mpz_t x); +/* set the value of z from x */ + +#define mpz_set_si _glp_mpz_set_si +void mpz_set_si(mpz_t x, int val); +/* set the value of x to val */ + +#define mpz_get_d _glp_mpz_get_d +double mpz_get_d(mpz_t x); +/* convert x to a double, truncating if necessary */ + +#define mpz_get_d_2exp _glp_mpz_get_d_2exp +double mpz_get_d_2exp(int *exp, mpz_t x); +/* convert x to a double, returning the exponent separately */ + +#define mpz_swap _glp_mpz_swap +void mpz_swap(mpz_t x, mpz_t y); +/* swap the values x and y efficiently */ + +#define mpz_add _glp_mpz_add +void mpz_add(mpz_t, mpz_t, mpz_t); +/* set z to x + y */ + +#define mpz_sub _glp_mpz_sub +void mpz_sub(mpz_t, mpz_t, mpz_t); +/* set z to x - y */ + +#define mpz_mul _glp_mpz_mul +void mpz_mul(mpz_t, mpz_t, mpz_t); +/* set z to x * y */ + +#define mpz_neg _glp_mpz_neg +void mpz_neg(mpz_t z, mpz_t x); +/* set z to 0 - x */ + +#define mpz_abs _glp_mpz_abs +void mpz_abs(mpz_t z, mpz_t x); +/* set z to the absolute value of x */ + +#define mpz_div _glp_mpz_div +void mpz_div(mpz_t q, mpz_t r, mpz_t x, mpz_t y); +/* divide x by y, forming quotient q and/or remainder r */ + +#define mpz_gcd _glp_mpz_gcd +void mpz_gcd(mpz_t z, mpz_t x, mpz_t y); +/* set z to the greatest common divisor of x and y */ + +#define mpz_cmp _glp_mpz_cmp +int mpz_cmp(mpz_t x, mpz_t y); +/* compare x and y */ + +#define mpz_sgn _glp_mpz_sgn +int mpz_sgn(mpz_t x); +/* return +1 if x > 0, 0 if x = 0, and -1 if x < 0 */ + +#define mpz_out_str _glp_mpz_out_str +int mpz_out_str(void *fp, int base, mpz_t x); +/* output x on stream fp, as a string in given base */ + +#define mpq_init(x) (void)((x) = _mpq_init()) + +#define _mpq_init _glp_mpq_init +mpq_t _mpq_init(void); +/* initialize x, and set its value to 0/1 */ + +#define mpq_clear _glp_mpq_clear +void mpq_clear(mpq_t x); +/* free the space occupied by x */ + +#define mpq_canonicalize _glp_mpq_canonicalize +void mpq_canonicalize(mpq_t x); +/* canonicalize x */ + +#define mpq_set _glp_mpq_set +void mpq_set(mpq_t z, mpq_t x); +/* set the value of z from x */ + +#define mpq_set_si _glp_mpq_set_si +void mpq_set_si(mpq_t x, int p, unsigned int q); +/* set the value of x to p/q */ + +#define mpq_get_d _glp_mpq_get_d +double mpq_get_d(mpq_t x); +/* convert x to a double, truncating if necessary */ + +#define mpq_set_d _glp_mpq_set_d +void mpq_set_d(mpq_t x, double val); +/* set x to val; there is no rounding, the conversion is exact */ + +#define mpq_add _glp_mpq_add +void mpq_add(mpq_t z, mpq_t x, mpq_t y); +/* set z to x + y */ + +#define mpq_sub _glp_mpq_sub +void mpq_sub(mpq_t z, mpq_t x, mpq_t y); +/* set z to x - y */ + +#define mpq_mul _glp_mpq_mul +void mpq_mul(mpq_t z, mpq_t x, mpq_t y); +/* set z to x * y */ + +#define mpq_div _glp_mpq_div +void mpq_div(mpq_t z, mpq_t x, mpq_t y); +/* set z to x / y */ + +#define mpq_neg _glp_mpq_neg +void mpq_neg(mpq_t z, mpq_t x); +/* set z to 0 - x */ + +#define mpq_abs _glp_mpq_abs +void mpq_abs(mpq_t z, mpq_t x); +/* set z to the absolute value of x */ + +#define mpq_cmp _glp_mpq_cmp +int mpq_cmp(mpq_t x, mpq_t y); +/* compare x and y */ + +#define mpq_sgn _glp_mpq_sgn +int mpq_sgn(mpq_t x); +/* return +1 if x > 0, 0 if x = 0, and -1 if x < 0 */ + +#define mpq_out_str _glp_mpq_out_str +int mpq_out_str(void *fp, int base, mpq_t x); +/* output x on stream fp, as a string in given base */ + +#endif + +#endif + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/misc/okalg.c b/resources/3rdparty/glpk-4.65/src/misc/okalg.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/okalg.c rename to resources/3rdparty/glpk-4.65/src/misc/okalg.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/okalg.h b/resources/3rdparty/glpk-4.65/src/misc/okalg.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/okalg.h rename to resources/3rdparty/glpk-4.65/src/misc/okalg.h diff --git a/resources/3rdparty/glpk-4.57/src/misc/qmd.c b/resources/3rdparty/glpk-4.65/src/misc/qmd.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/qmd.c rename to resources/3rdparty/glpk-4.65/src/misc/qmd.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/qmd.h b/resources/3rdparty/glpk-4.65/src/misc/qmd.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/qmd.h rename to resources/3rdparty/glpk-4.65/src/misc/qmd.h diff --git a/resources/3rdparty/glpk-4.57/src/misc/relax4.c b/resources/3rdparty/glpk-4.65/src/misc/relax4.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/relax4.c rename to resources/3rdparty/glpk-4.65/src/misc/relax4.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/relax4.h b/resources/3rdparty/glpk-4.65/src/misc/relax4.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/relax4.h rename to resources/3rdparty/glpk-4.65/src/misc/relax4.h diff --git a/resources/3rdparty/glpk-4.57/src/misc/rng.c b/resources/3rdparty/glpk-4.65/src/misc/rng.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/rng.c rename to resources/3rdparty/glpk-4.65/src/misc/rng.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/rng.h b/resources/3rdparty/glpk-4.65/src/misc/rng.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/rng.h rename to resources/3rdparty/glpk-4.65/src/misc/rng.h diff --git a/resources/3rdparty/glpk-4.57/src/misc/rng1.c b/resources/3rdparty/glpk-4.65/src/misc/rng1.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/rng1.c rename to resources/3rdparty/glpk-4.65/src/misc/rng1.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/round2n.c b/resources/3rdparty/glpk-4.65/src/misc/round2n.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/round2n.c rename to resources/3rdparty/glpk-4.65/src/misc/round2n.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/str2int.c b/resources/3rdparty/glpk-4.65/src/misc/str2int.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/str2int.c rename to resources/3rdparty/glpk-4.65/src/misc/str2int.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/str2num.c b/resources/3rdparty/glpk-4.65/src/misc/str2num.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/str2num.c rename to resources/3rdparty/glpk-4.65/src/misc/str2num.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/strspx.c b/resources/3rdparty/glpk-4.65/src/misc/strspx.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/strspx.c rename to resources/3rdparty/glpk-4.65/src/misc/strspx.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/strtrim.c b/resources/3rdparty/glpk-4.65/src/misc/strtrim.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/strtrim.c rename to resources/3rdparty/glpk-4.65/src/misc/strtrim.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/triang.c b/resources/3rdparty/glpk-4.65/src/misc/triang.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/triang.c rename to resources/3rdparty/glpk-4.65/src/misc/triang.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/triang.h b/resources/3rdparty/glpk-4.65/src/misc/triang.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/triang.h rename to resources/3rdparty/glpk-4.65/src/misc/triang.h diff --git a/resources/3rdparty/glpk-4.57/src/misc/wclique.c b/resources/3rdparty/glpk-4.65/src/misc/wclique.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/wclique.c rename to resources/3rdparty/glpk-4.65/src/misc/wclique.c diff --git a/resources/3rdparty/glpk-4.57/src/misc/wclique.h b/resources/3rdparty/glpk-4.65/src/misc/wclique.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/wclique.h rename to resources/3rdparty/glpk-4.65/src/misc/wclique.h diff --git a/resources/3rdparty/glpk-4.57/src/misc/wclique1.c b/resources/3rdparty/glpk-4.65/src/misc/wclique1.c similarity index 98% rename from resources/3rdparty/glpk-4.57/src/misc/wclique1.c rename to resources/3rdparty/glpk-4.65/src/misc/wclique1.c index c263a5e5a..a3d895429 100644 --- a/resources/3rdparty/glpk-4.57/src/misc/wclique1.c +++ b/resources/3rdparty/glpk-4.65/src/misc/wclique1.c @@ -3,7 +3,7 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2012-2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2012-2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -64,7 +64,7 @@ struct vertex { int i; double cw; }; -static int fcmp(const void *xx, const void *yy) +static int CDECL fcmp(const void *xx, const void *yy) { const struct vertex *x = xx, *y = yy; if (x->cw > y->cw) return -1; if (x->cw < y->cw) return +1; diff --git a/resources/3rdparty/glpk-4.57/src/misc/wclique1.h b/resources/3rdparty/glpk-4.65/src/misc/wclique1.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/misc/wclique1.h rename to resources/3rdparty/glpk-4.65/src/misc/wclique1.h diff --git a/resources/3rdparty/glpk-4.57/src/glpmpl.h b/resources/3rdparty/glpk-4.65/src/mpl/mpl.h similarity index 96% rename from resources/3rdparty/glpk-4.57/src/glpmpl.h rename to resources/3rdparty/glpk-4.65/src/mpl/mpl.h index 34445d30a..ddd315438 100644 --- a/resources/3rdparty/glpk-4.57/src/glpmpl.h +++ b/resources/3rdparty/glpk-4.65/src/mpl/mpl.h @@ -1,10 +1,9 @@ -/* glpmpl.h (GNU MathProg translator) */ +/* mpl.h (GNU MathProg translator) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2003-2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -22,8 +21,8 @@ * along with GLPK. If not, see . ***********************************************************************/ -#ifndef GLPMPL_H -#define GLPMPL_H +#ifndef MPL_H +#define MPL_H #include "avl.h" #include "dmp.h" @@ -837,6 +836,10 @@ double fp_sin(MPL *mpl, double x); double fp_cos(MPL *mpl, double x); /* floating-point trigonometric cosine */ +#define fp_tan _glp_mpl_fp_tan +double fp_tan(MPL *mpl, double x); +/* floating-point trigonometric tangent */ + #define fp_atan _glp_mpl_fp_atan double fp_atan(MPL *mpl, double x); /* floating-point trigonometric arctangent */ @@ -2117,62 +2120,63 @@ struct CODE #define O_SQRT 330 /* square root */ #define O_SIN 331 /* trigonometric sine */ #define O_COS 332 /* trigonometric cosine */ -#define O_ATAN 333 /* trigonometric arctangent */ -#define O_ROUND 334 /* round to nearest integer */ -#define O_TRUNC 335 /* truncate to nearest integer */ -#define O_CARD 336 /* cardinality of set */ -#define O_LENGTH 337 /* length of symbolic value */ +#define O_TAN 333 /* trigonometric tangent */ +#define O_ATAN 334 /* trigonometric arctangent */ +#define O_ROUND 335 /* round to nearest integer */ +#define O_TRUNC 336 /* truncate to nearest integer */ +#define O_CARD 337 /* cardinality of set */ +#define O_LENGTH 338 /* length of symbolic value */ /* binary operations -------------------*/ -#define O_ADD 338 /* addition */ -#define O_SUB 339 /* subtraction */ -#define O_LESS 340 /* non-negative subtraction */ -#define O_MUL 341 /* multiplication */ -#define O_DIV 342 /* division */ -#define O_IDIV 343 /* quotient of exact division */ -#define O_MOD 344 /* remainder of exact division */ -#define O_POWER 345 /* exponentiation (raise to power) */ -#define O_ATAN2 346 /* trigonometric arctangent */ -#define O_ROUND2 347 /* round to n fractional digits */ -#define O_TRUNC2 348 /* truncate to n fractional digits */ -#define O_UNIFORM 349 /* pseudo-random in [a, b) */ -#define O_NORMAL 350 /* gaussian random, given mu and sigma */ -#define O_CONCAT 351 /* concatenation */ -#define O_LT 352 /* comparison on 'less than' */ -#define O_LE 353 /* comparison on 'not greater than' */ -#define O_EQ 354 /* comparison on 'equal to' */ -#define O_GE 355 /* comparison on 'not less than' */ -#define O_GT 356 /* comparison on 'greater than' */ -#define O_NE 357 /* comparison on 'not equal to' */ -#define O_AND 358 /* conjunction (logical "and") */ -#define O_OR 359 /* disjunction (logical "or") */ -#define O_UNION 360 /* union */ -#define O_DIFF 361 /* difference */ -#define O_SYMDIFF 362 /* symmetric difference */ -#define O_INTER 363 /* intersection */ -#define O_CROSS 364 /* cross (Cartesian) product */ -#define O_IN 365 /* test on 'x in Y' */ -#define O_NOTIN 366 /* test on 'x not in Y' */ -#define O_WITHIN 367 /* test on 'X within Y' */ -#define O_NOTWITHIN 368 /* test on 'X not within Y' */ -#define O_SUBSTR 369 /* substring */ -#define O_STR2TIME 370 /* convert string to time */ -#define O_TIME2STR 371 /* convert time to string */ +#define O_ADD 339 /* addition */ +#define O_SUB 340 /* subtraction */ +#define O_LESS 341 /* non-negative subtraction */ +#define O_MUL 342 /* multiplication */ +#define O_DIV 343 /* division */ +#define O_IDIV 344 /* quotient of exact division */ +#define O_MOD 345 /* remainder of exact division */ +#define O_POWER 346 /* exponentiation (raise to power) */ +#define O_ATAN2 347 /* trigonometric arctangent */ +#define O_ROUND2 348 /* round to n fractional digits */ +#define O_TRUNC2 349 /* truncate to n fractional digits */ +#define O_UNIFORM 350 /* pseudo-random in [a, b) */ +#define O_NORMAL 351 /* gaussian random, given mu and sigma */ +#define O_CONCAT 352 /* concatenation */ +#define O_LT 353 /* comparison on 'less than' */ +#define O_LE 354 /* comparison on 'not greater than' */ +#define O_EQ 355 /* comparison on 'equal to' */ +#define O_GE 356 /* comparison on 'not less than' */ +#define O_GT 357 /* comparison on 'greater than' */ +#define O_NE 358 /* comparison on 'not equal to' */ +#define O_AND 359 /* conjunction (logical "and") */ +#define O_OR 360 /* disjunction (logical "or") */ +#define O_UNION 361 /* union */ +#define O_DIFF 362 /* difference */ +#define O_SYMDIFF 363 /* symmetric difference */ +#define O_INTER 364 /* intersection */ +#define O_CROSS 365 /* cross (Cartesian) product */ +#define O_IN 366 /* test on 'x in Y' */ +#define O_NOTIN 367 /* test on 'x not in Y' */ +#define O_WITHIN 368 /* test on 'X within Y' */ +#define O_NOTWITHIN 369 /* test on 'X not within Y' */ +#define O_SUBSTR 370 /* substring */ +#define O_STR2TIME 371 /* convert string to time */ +#define O_TIME2STR 372 /* convert time to string */ /* ternary operations ------------------*/ -#define O_DOTS 372 /* build "arithmetic" set */ -#define O_FORK 373 /* if-then-else */ -#define O_SUBSTR3 374 /* substring */ +#define O_DOTS 373 /* build "arithmetic" set */ +#define O_FORK 374 /* if-then-else */ +#define O_SUBSTR3 375 /* substring */ /* n-ary operations --------------------*/ -#define O_MIN 375 /* minimal value (n-ary) */ -#define O_MAX 376 /* maximal value (n-ary) */ +#define O_MIN 376 /* minimal value (n-ary) */ +#define O_MAX 377 /* maximal value (n-ary) */ /* iterated operations -----------------*/ -#define O_SUM 377 /* summation */ -#define O_PROD 378 /* multiplication */ -#define O_MINIMUM 379 /* minimum */ -#define O_MAXIMUM 380 /* maximum */ -#define O_FORALL 381 /* conjunction (A-quantification) */ -#define O_EXISTS 382 /* disjunction (E-quantification) */ -#define O_SETOF 383 /* compute elemental set */ -#define O_BUILD 384 /* build elemental set */ +#define O_SUM 378 /* summation */ +#define O_PROD 379 /* multiplication */ +#define O_MINIMUM 380 /* minimum */ +#define O_MAXIMUM 381 /* maximum */ +#define O_FORALL 382 /* conjunction (A-quantification) */ +#define O_EXISTS 383 /* disjunction (E-quantification) */ +#define O_SETOF 384 /* compute elemental set */ +#define O_BUILD 385 /* build elemental set */ OPERANDS arg; /* operands that participate in the operation */ int type; diff --git a/resources/3rdparty/glpk-4.57/src/glpmpl01.c b/resources/3rdparty/glpk-4.65/src/mpl/mpl1.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpmpl01.c rename to resources/3rdparty/glpk-4.65/src/mpl/mpl1.c index db7af246b..7dc3cd796 100644 --- a/resources/3rdparty/glpk-4.57/src/glpmpl01.c +++ b/resources/3rdparty/glpk-4.65/src/mpl/mpl1.c @@ -1,10 +1,9 @@ -/* glpmpl01.c */ +/* mpl1.c */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2003-2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -22,7 +21,7 @@ * along with GLPK. If not, see . ***********************************************************************/ -#include "glpmpl.h" +#include "mpl.h" #define dmp_get_atomv dmp_get_atom @@ -602,6 +601,7 @@ CODE *make_code(MPL *mpl, int op, OPERANDS *arg, int type, int dim) case O_SQRT: case O_SIN: case O_COS: + case O_TAN: case O_ATAN: case O_ROUND: case O_TRUNC: @@ -1148,6 +1148,7 @@ CODE *elemset_argument(MPL *mpl, char *func) -- ::= sqrt ( ) -- ::= sin ( ) -- ::= cos ( ) +-- ::= tan ( ) -- ::= atan ( ) -- ::= atan2 ( , ) -- ::= round ( ) @@ -1194,6 +1195,8 @@ CODE *function_reference(MPL *mpl) op = O_SIN; else if (strcmp(mpl->image, "cos") == 0) op = O_COS; + else if (strcmp(mpl->image, "tan") == 0) + op = O_TAN; else if (strcmp(mpl->image, "atan") == 0) op = O_ATAN; else if (strcmp(mpl->image, "min") == 0) diff --git a/resources/3rdparty/glpk-4.57/src/glpmpl02.c b/resources/3rdparty/glpk-4.65/src/mpl/mpl2.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpmpl02.c rename to resources/3rdparty/glpk-4.65/src/mpl/mpl2.c index 277593981..0f99528b9 100644 --- a/resources/3rdparty/glpk-4.57/src/glpmpl02.c +++ b/resources/3rdparty/glpk-4.65/src/mpl/mpl2.c @@ -1,10 +1,9 @@ -/* glpmpl02.c */ +/* mpl2.c */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2003-2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -22,7 +21,7 @@ * along with GLPK. If not, see . ***********************************************************************/ -#include "glpmpl.h" +#include "mpl.h" /**********************************************************************/ /* * * PROCESSING DATA SECTION * * */ diff --git a/resources/3rdparty/glpk-4.57/src/glpmpl03.c b/resources/3rdparty/glpk-4.65/src/mpl/mpl3.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpmpl03.c rename to resources/3rdparty/glpk-4.65/src/mpl/mpl3.c index ddc3b583e..2489db27d 100644 --- a/resources/3rdparty/glpk-4.57/src/glpmpl03.c +++ b/resources/3rdparty/glpk-4.65/src/mpl/mpl3.c @@ -1,10 +1,9 @@ -/* glpmpl03.c */ +/* mpl3.c */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2003-2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -22,7 +21,7 @@ * along with GLPK. If not, see . ***********************************************************************/ -#include "glpmpl.h" +#include "mpl.h" /**********************************************************************/ /* * * FLOATING-POINT NUMBERS * * */ @@ -227,6 +226,17 @@ double fp_cos(MPL *mpl, double x) return cos(x); } +/*---------------------------------------------------------------------- +-- fp_tan - floating-point trigonometric tangent. +-- +-- This routine computes the trigonometric tangent tan(x). */ + +double fp_tan(MPL *mpl, double x) +{ if (!(-1e6 <= x && x <= +1e6)) + error(mpl, "tan(%.*g); argument too large", DBL_DIG, x); + return tan(x); +} + /*---------------------------------------------------------------------- -- fp_atan - floating-point trigonometric arctangent. -- @@ -3679,6 +3689,10 @@ double eval_numeric(MPL *mpl, CODE *code) /* trigonometric cosine */ value = fp_cos(mpl, eval_numeric(mpl, code->arg.arg.x)); break; + case O_TAN: + /* trigonometric tangent */ + value = fp_tan(mpl, eval_numeric(mpl, code->arg.arg.x)); + break; case O_ATAN: /* trigonometric arctangent (one argument) */ value = fp_atan(mpl, eval_numeric(mpl, code->arg.arg.x)); @@ -4874,6 +4888,7 @@ void clean_code(MPL *mpl, CODE *code) case O_SQRT: case O_SIN: case O_COS: + case O_TAN: case O_ATAN: case O_ROUND: case O_TRUNC: diff --git a/resources/3rdparty/glpk-4.57/src/glpmpl04.c b/resources/3rdparty/glpk-4.65/src/mpl/mpl4.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpmpl04.c rename to resources/3rdparty/glpk-4.65/src/mpl/mpl4.c index 4ec2c19c2..6e80499c9 100644 --- a/resources/3rdparty/glpk-4.57/src/glpmpl04.c +++ b/resources/3rdparty/glpk-4.65/src/mpl/mpl4.c @@ -1,10 +1,9 @@ -/* glpmpl04.c */ +/* mpl4.c */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2003-2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -22,7 +21,7 @@ * along with GLPK. If not, see . ***********************************************************************/ -#include "glpmpl.h" +#include "mpl.h" #define xfault xerror #define xfprintf glp_format diff --git a/resources/3rdparty/glpk-4.57/src/glpmpl05.c b/resources/3rdparty/glpk-4.65/src/mpl/mpl5.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpmpl05.c rename to resources/3rdparty/glpk-4.65/src/mpl/mpl5.c index 2207572a7..c5374c9c6 100644 --- a/resources/3rdparty/glpk-4.57/src/glpmpl05.c +++ b/resources/3rdparty/glpk-4.65/src/mpl/mpl5.c @@ -1,4 +1,4 @@ -/* glpmpl05.c */ +/* mpl5.c */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). @@ -6,8 +6,7 @@ * Authors: Andrew Makhorin * Heinrich Schuchardt * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2003-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -25,10 +24,10 @@ * along with GLPK. If not, see . ***********************************************************************/ -#include "glpmpl.h" #if 1 /* 11/VI-2013 */ #include "jd.h" #endif +#include "mpl.h" double fn_gmtime(MPL *mpl) { /* obtain the current calendar time (UTC) */ @@ -38,7 +37,11 @@ double fn_gmtime(MPL *mpl) time(&timer); if (timer == (time_t)(-1)) err: error(mpl, "gmtime(); unable to obtain current calendar time"); +#if 0 /* 29/I-2017 */ tm = gmtime(&timer); +#else + tm = xgmtime(&timer); +#endif if (tm == NULL) goto err; j = jday(tm->tm_mday, tm->tm_mon + 1, 1900 + tm->tm_year); if (j < 0) goto err; diff --git a/resources/3rdparty/glpk-4.57/src/glpmpl06.c b/resources/3rdparty/glpk-4.65/src/mpl/mpl6.c similarity index 97% rename from resources/3rdparty/glpk-4.57/src/glpmpl06.c rename to resources/3rdparty/glpk-4.65/src/mpl/mpl6.c index 67c5aa05e..ac2a03930 100644 --- a/resources/3rdparty/glpk-4.57/src/glpmpl06.c +++ b/resources/3rdparty/glpk-4.65/src/mpl/mpl6.c @@ -1,10 +1,9 @@ -/* glpmpl06.c */ +/* mpl6.c */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2003-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -22,8 +21,8 @@ * along with GLPK. If not, see . ***********************************************************************/ -#include "glpmpl.h" -#include "glpsql.h" +#include "mpl.h" +#include "mplsql.h" /**********************************************************************/ @@ -79,7 +78,11 @@ static void read_char(struct csv *csv) loop: c = fgetc(csv->fp); if (ferror(csv->fp)) { xprintf("%s:%d: read error - %s\n", csv->fname, csv->count, +#if 0 /* 29/I-2017 */ strerror(errno)); +#else + xstrerr(errno)); +#endif longjmp(csv->jump, 0); } if (feof(csv->fp)) @@ -238,7 +241,11 @@ static struct csv *csv_open_file(TABDCA *dca, int mode) csv->fp = fopen(csv->fname, "r"); if (csv->fp == NULL) { xprintf("csv_driver: unable to open %s - %s\n", +#if 0 /* 29/I-2017 */ csv->fname, strerror(errno)); +#else + csv->fname, xstrerr(errno)); +#endif longjmp(csv->jump, 0); } #if 1 /* 01/VI-2010 */ @@ -282,7 +289,11 @@ static struct csv *csv_open_file(TABDCA *dca, int mode) csv->fp = fopen(csv->fname, "w"); if (csv->fp == NULL) { xprintf("csv_driver: unable to create %s - %s\n", +#if 0 /* 29/I-2017 */ csv->fname, strerror(errno)); +#else + csv->fname, xstrerr(errno)); +#endif longjmp(csv->jump, 0); } /* write field names */ @@ -394,7 +405,11 @@ static int csv_write_record(TABDCA *dca, struct csv *csv) csv->count++; if (ferror(csv->fp)) { xprintf("%s:%d: write error - %s\n", csv->fname, csv->count, +#if 0 /* 29/I-2017 */ strerror(errno)); +#else + xstrerr(errno)); +#endif ret = 1; } return ret; @@ -408,7 +423,11 @@ static int csv_close_file(TABDCA *dca, struct csv *csv) { fflush(csv->fp); if (ferror(csv->fp)) { xprintf("%s:%d: write error - %s\n", csv->fname, +#if 0 /* 29/I-2017 */ csv->count, strerror(errno)); +#else + csv->count, xstrerr(errno)); +#endif ret = 1; } } @@ -460,7 +479,11 @@ static int read_byte(struct dbf *dbf) b = fgetc(dbf->fp); if (ferror(dbf->fp)) { xprintf("%s:0x%X: read error - %s\n", dbf->fname, +#if 0 /* 29/I-2017 */ dbf->offset, strerror(errno)); +#else + dbf->offset, xstrerr(errno)); +#endif longjmp(dbf->jump, 0); } if (feof(dbf->fp)) @@ -707,7 +730,11 @@ static struct dbf *dbf_open_file(TABDCA *dca, int mode) dbf->fp = fopen(dbf->fname, "rb"); if (dbf->fp == NULL) { xprintf("xBASE driver: unable to open %s - %s\n", +#if 0 /* 29/I-2017 */ dbf->fname, strerror(errno)); +#else + dbf->fname, xstrerr(errno)); +#endif longjmp(dbf->jump, 0); } read_header(dca, dbf); @@ -722,7 +749,11 @@ static struct dbf *dbf_open_file(TABDCA *dca, int mode) dbf->fp = fopen(dbf->fname, "wb"); if (dbf->fp == NULL) { xprintf("xBASE driver: unable to create %s - %s\n", +#if 0 /* 29/I-2017 */ dbf->fname, strerror(errno)); +#else + dbf->fname, xstrerr(errno)); +#endif longjmp(dbf->jump, 0); } write_header(dca, dbf); @@ -862,7 +893,11 @@ static int dbf_close_file(TABDCA *dca, struct dbf *dbf) dbf->offset = 4; if (fseek(dbf->fp, dbf->offset, SEEK_SET)) { xprintf("%s:0x%X: seek error - %s\n", dbf->fname, +#if 0 /* 29/I-2017 */ dbf->offset, strerror(errno)); +#else + dbf->offset, xstrerr(errno)); +#endif longjmp(dbf->jump, 0); } write_byte(dbf, dbf->count); @@ -872,7 +907,11 @@ static int dbf_close_file(TABDCA *dca, struct dbf *dbf) fflush(dbf->fp); if (ferror(dbf->fp)) { xprintf("%s:0x%X: write error - %s\n", dbf->fname, +#if 0 /* 29/I-2017 */ dbf->offset, strerror(errno)); +#else + dbf->offset, xstrerr(errno)); +#endif longjmp(dbf->jump, 0); } skip: ; diff --git a/resources/3rdparty/glpk-4.57/src/glpsql.c b/resources/3rdparty/glpk-4.65/src/mpl/mplsql.c similarity index 98% rename from resources/3rdparty/glpk-4.57/src/glpsql.c rename to resources/3rdparty/glpk-4.65/src/mpl/mplsql.c index 9c664dbc5..fcd2afa65 100644 --- a/resources/3rdparty/glpk-4.57/src/glpsql.c +++ b/resources/3rdparty/glpk-4.65/src/mpl/mplsql.c @@ -1,12 +1,11 @@ -/* glpsql.c */ +/* mplsql.c */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * * Author: Heinrich Schuchardt . * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2003-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -28,8 +27,8 @@ #include #endif -#include "glpmpl.h" -#include "glpsql.h" +#include "mpl.h" +#include "mplsql.h" #ifdef ODBC_DLNAME #define HAVE_ODBC @@ -654,7 +653,7 @@ static int is_numeric( * * SYNOPSIS * -* #include "glpsql.h" +* #include "mplsql.h" * void *db_iodbc_open(TABDCA *dca, int mode); * * DESCRIPTION @@ -964,8 +963,13 @@ int db_iodbc_write(TABDCA *dca, void *link) } query = xmalloc( (len + 1 ) * sizeof(char) ); query[0] = 0x00; +#if 0 /* 29/I-2017 */ for (k = 1, part = strtok (template, "?"); (part != NULL); part = strtok (NULL, "?"), k++) +#else + for (k = 1, part = xstrtok (template, "?"); (part != NULL); + part = xstrtok (NULL, "?"), k++) +#endif { if (k > nf) break; strcat( query, part ); @@ -1269,7 +1273,7 @@ MYSQL_RES * STDCALL dl_mysql_use_result(MYSQL *mysql) * * SYNOPSIS * -* #include "glpsql.h" +* #include "mplsql.h" * void *db_mysql_open(TABDCA *dca, int mode); * * DESCRIPTION @@ -1356,10 +1360,19 @@ static void *db_mysql_open_int(TABDCA *dca, int mode, const char arg = xmalloc(i * sizeof(char)); strcpy(arg, dsn); /*tokenize connection string*/ +#if 0 /* 29/I-2017 */ for (i = 1, keyword = strtok (arg, "="); (keyword != NULL); keyword = strtok (NULL, "="), i++) +#else + for (i = 1, keyword = xstrtok (arg, "="); (keyword != NULL); + keyword = xstrtok (NULL, "="), i++) +#endif { +#if 0 /* 29/I-2017 */ value = strtok (NULL, ";"); +#else + value = xstrtok (NULL, ";"); +#endif if (value==NULL) { xprintf("db_mysql_open: Missing value for keyword %s\n", @@ -1582,8 +1595,13 @@ int db_mysql_write(TABDCA *dca, void *link) } query = xmalloc( (len + 1 ) * sizeof(char) ); query[0] = 0x00; +#if 0 /* 29/I-2017 */ for (k = 1, part = strtok (template, "?"); (part != NULL); part = strtok (NULL, "?"), k++) +#else + for (k = 1, part = xstrtok (template, "?"); (part != NULL); + part = xstrtok (NULL, "?"), k++) +#endif { if (k > nf) break; strcat( query, part ); diff --git a/resources/3rdparty/glpk-4.57/src/glpsql.h b/resources/3rdparty/glpk-4.65/src/mpl/mplsql.h similarity index 91% rename from resources/3rdparty/glpk-4.57/src/glpsql.h rename to resources/3rdparty/glpk-4.65/src/mpl/mplsql.h index 2a1650561..11d438bbd 100644 --- a/resources/3rdparty/glpk-4.57/src/glpsql.h +++ b/resources/3rdparty/glpk-4.65/src/mpl/mplsql.h @@ -1,12 +1,11 @@ -/* glpsql.h */ +/* mplsql.h */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * * Author: Heinrich Schuchardt . * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2003-2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -24,8 +23,8 @@ * along with GLPK. If not, see . ***********************************************************************/ -#ifndef GLPSQL_H -#define GLPSQL_H +#ifndef MPLSQL_H +#define MPLSQL_H #define db_iodbc_open _glp_db_iodbc_open void *db_iodbc_open(TABDCA *dca, int mode); diff --git a/resources/3rdparty/glpk-4.57/src/glpnpp.h b/resources/3rdparty/glpk-4.65/src/npp/npp.h similarity index 98% rename from resources/3rdparty/glpk-4.57/src/glpnpp.h rename to resources/3rdparty/glpk-4.65/src/npp/npp.h index 6aaebe8d4..428cb23c6 100644 --- a/resources/3rdparty/glpk-4.57/src/glpnpp.h +++ b/resources/3rdparty/glpk-4.65/src/npp/npp.h @@ -1,10 +1,9 @@ -/* glpnpp.h (LP/MIP preprocessor) */ +/* npp.h (LP/MIP preprocessor) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2009-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -22,19 +21,27 @@ * along with GLPK. If not, see . ***********************************************************************/ -#ifndef GLPNPP_H -#define GLPNPP_H +#ifndef NPP_H +#define NPP_H #include "prob.h" +#if 0 /* 20/XI-2017 */ typedef struct NPP NPP; +#else +typedef struct glp_prep NPP; +#endif typedef struct NPPROW NPPROW; typedef struct NPPCOL NPPCOL; typedef struct NPPAIJ NPPAIJ; typedef struct NPPTSE NPPTSE; typedef struct NPPLFE NPPLFE; +#if 0 /* 20/XI-2017 */ struct NPP +#else +struct glp_prep +#endif { /* LP/MIP preprocessor workspace */ /*--------------------------------------------------------------*/ /* original problem segment */ diff --git a/resources/3rdparty/glpk-4.57/src/glpnpp01.c b/resources/3rdparty/glpk-4.65/src/npp/npp1.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpnpp01.c rename to resources/3rdparty/glpk-4.65/src/npp/npp1.c index 9eb59f28e..51758bad3 100644 --- a/resources/3rdparty/glpk-4.57/src/glpnpp01.c +++ b/resources/3rdparty/glpk-4.65/src/npp/npp1.c @@ -1,10 +1,9 @@ -/* glpnpp01.c */ +/* npp1.c */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2009-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +22,7 @@ ***********************************************************************/ #include "env.h" -#include "glpnpp.h" +#include "npp.h" NPP *npp_create_wksp(void) { /* create LP/MIP preprocessor workspace */ diff --git a/resources/3rdparty/glpk-4.57/src/glpnpp02.c b/resources/3rdparty/glpk-4.65/src/npp/npp2.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpnpp02.c rename to resources/3rdparty/glpk-4.65/src/npp/npp2.c index ec4a455b4..4efcf1d17 100644 --- a/resources/3rdparty/glpk-4.57/src/glpnpp02.c +++ b/resources/3rdparty/glpk-4.65/src/npp/npp2.c @@ -1,10 +1,9 @@ -/* glpnpp02.c */ +/* npp2.c */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2009-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +22,7 @@ ***********************************************************************/ #include "env.h" -#include "glpnpp.h" +#include "npp.h" /*********************************************************************** * NAME diff --git a/resources/3rdparty/glpk-4.57/src/glpnpp03.c b/resources/3rdparty/glpk-4.65/src/npp/npp3.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpnpp03.c rename to resources/3rdparty/glpk-4.65/src/npp/npp3.c index 0c869ee39..883af1277 100644 --- a/resources/3rdparty/glpk-4.57/src/glpnpp03.c +++ b/resources/3rdparty/glpk-4.65/src/npp/npp3.c @@ -1,10 +1,9 @@ -/* glpnpp03.c */ +/* npp3.c */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2009-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +22,7 @@ ***********************************************************************/ #include "env.h" -#include "glpnpp.h" +#include "npp.h" /*********************************************************************** * NAME diff --git a/resources/3rdparty/glpk-4.57/src/glpnpp04.c b/resources/3rdparty/glpk-4.65/src/npp/npp4.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpnpp04.c rename to resources/3rdparty/glpk-4.65/src/npp/npp4.c index 925b1ba0f..d7dd0e868 100644 --- a/resources/3rdparty/glpk-4.57/src/glpnpp04.c +++ b/resources/3rdparty/glpk-4.65/src/npp/npp4.c @@ -1,10 +1,9 @@ -/* glpnpp04.c */ +/* npp4.c */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2009-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +22,7 @@ ***********************************************************************/ #include "env.h" -#include "glpnpp.h" +#include "npp.h" /*********************************************************************** * NAME diff --git a/resources/3rdparty/glpk-4.57/src/glpnpp05.c b/resources/3rdparty/glpk-4.65/src/npp/npp5.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpnpp05.c rename to resources/3rdparty/glpk-4.65/src/npp/npp5.c index 8c8818508..2fad496de 100644 --- a/resources/3rdparty/glpk-4.57/src/glpnpp05.c +++ b/resources/3rdparty/glpk-4.65/src/npp/npp5.c @@ -1,10 +1,9 @@ -/* glpnpp05.c */ +/* npp5.c */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2009-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +22,7 @@ ***********************************************************************/ #include "env.h" -#include "glpnpp.h" +#include "npp.h" /*********************************************************************** * NAME diff --git a/resources/3rdparty/glpk-4.57/src/glpnpp06.c b/resources/3rdparty/glpk-4.65/src/npp/npp6.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/glpnpp06.c rename to resources/3rdparty/glpk-4.65/src/npp/npp6.c index 57d283ec9..b57f86154 100644 --- a/resources/3rdparty/glpk-4.57/src/glpnpp06.c +++ b/resources/3rdparty/glpk-4.65/src/npp/npp6.c @@ -1,10 +1,9 @@ -/* glpnpp06.c (translate feasibility problem to CNF-SAT) */ +/* npp6.c (translate feasibility problem to CNF-SAT) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2011-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -23,7 +22,7 @@ ***********************************************************************/ #include "env.h" -#include "glpnpp.h" +#include "npp.h" /*********************************************************************** * npp_sat_free_row - process free (unbounded) row diff --git a/resources/3rdparty/glpk-4.57/src/proxy/main.c b/resources/3rdparty/glpk-4.65/src/proxy/main.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/proxy/main.c rename to resources/3rdparty/glpk-4.65/src/proxy/main.c diff --git a/resources/3rdparty/glpk-4.57/src/proxy/proxy.c b/resources/3rdparty/glpk-4.65/src/proxy/proxy.c similarity index 99% rename from resources/3rdparty/glpk-4.57/src/proxy/proxy.c rename to resources/3rdparty/glpk-4.65/src/proxy/proxy.c index 31502a7f7..7d8900031 100644 --- a/resources/3rdparty/glpk-4.57/src/proxy/proxy.c +++ b/resources/3rdparty/glpk-4.65/src/proxy/proxy.c @@ -5,7 +5,7 @@ * * Author: Giorgio Sartor <0gioker0@gmail.com>. * -* Copyright (C) 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2013, 2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -1013,6 +1013,18 @@ static int do_refine(struct csa *csa, glp_prob *lp_ref, int ncols, else { status = glp_get_status(lp_ref); } + +#if 1 /* 29/II-2016 by mao as reported by Chris */ + switch (status) + { case GLP_OPT: + case GLP_FEAS: + break; + default: + status = GLP_UNDEF; + break; + } +#endif + #ifdef PROXY_DEBUG xprintf("STATUS REFINING = %d\n",status); #endif diff --git a/resources/3rdparty/glpk-4.57/src/proxy/proxy.h b/resources/3rdparty/glpk-4.65/src/proxy/proxy.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/proxy/proxy.h rename to resources/3rdparty/glpk-4.65/src/proxy/proxy.h diff --git a/resources/3rdparty/glpk-4.57/src/proxy/proxy1.c b/resources/3rdparty/glpk-4.65/src/proxy/proxy1.c similarity index 61% rename from resources/3rdparty/glpk-4.57/src/proxy/proxy1.c rename to resources/3rdparty/glpk-4.65/src/proxy/proxy1.c index b05fe8e4f..5f9850d42 100644 --- a/resources/3rdparty/glpk-4.57/src/proxy/proxy1.c +++ b/resources/3rdparty/glpk-4.65/src/proxy/proxy1.c @@ -3,7 +3,7 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2013 Andrew Makhorin, Department for Applied +* Copyright (C) 2013, 2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -22,7 +22,7 @@ ***********************************************************************/ #include "env.h" -#include "glpios.h" +#include "ios.h" #include "proxy.h" void ios_proxy_heur(glp_tree *T) @@ -49,7 +49,37 @@ void ios_proxy_heur(glp_tree *T) xfree(xinit); } if (status == 0) +#if 0 /* 17/III-2016 */ glp_ios_heur_sol(T, xstar); +#else + { /* sometimes the proxy heuristic reports a wrong solution, so + * make sure that the solution is really integer feasible */ + int i, feas1, feas2, ae_ind, re_ind; + double ae_max, re_max; + glp_copy_prob(prob, T->mip, 0); + for (j = 1; j <= prob->n; j++) + prob->col[j]->mipx = xstar[j]; + for (i = 1; i <= prob->m; i++) + { GLPROW *row; + GLPAIJ *aij; + row = prob->row[i]; + row->mipx = 0.0; + for (aij = row->ptr; aij != NULL; aij = aij->r_next) + row->mipx += aij->val * aij->col->mipx; + } + glp_check_kkt(prob, GLP_MIP, GLP_KKT_PE, &ae_max, &ae_ind, + &re_max, &re_ind); + feas1 = (re_max <= 1e-6); + glp_check_kkt(prob, GLP_MIP, GLP_KKT_PB, &ae_max, &ae_ind, + &re_max, &re_ind); + feas2 = (re_max <= 1e-6); + if (feas1 && feas2) + glp_ios_heur_sol(T, xstar); + else + xprintf("WARNING: PROXY HEURISTIC REPORTED WRONG SOLUTION; " + "SOLUTION REJECTED\n"); + } +#endif xfree(xstar); glp_delete_prob(prob); done: return; diff --git a/resources/3rdparty/glpk-4.57/src/simplex/simplex.h b/resources/3rdparty/glpk-4.65/src/simplex/simplex.h similarity index 93% rename from resources/3rdparty/glpk-4.57/src/simplex/simplex.h rename to resources/3rdparty/glpk-4.65/src/simplex/simplex.h index 48205881d..9a5acdb20 100644 --- a/resources/3rdparty/glpk-4.57/src/simplex/simplex.h +++ b/resources/3rdparty/glpk-4.65/src/simplex/simplex.h @@ -28,11 +28,11 @@ #define spx_primal _glp_spx_primal int spx_primal(glp_prob *P, const glp_smcp *parm); -/* driver to primal simplex method */ +/* driver to the primal simplex method */ #define spy_dual _glp_spy_dual int spy_dual(glp_prob *P, const glp_smcp *parm); -/* driver to dual simplex method */ +/* driver to the dual simplex method */ #endif diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spxat.c b/resources/3rdparty/glpk-4.65/src/simplex/spxat.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/simplex/spxat.c rename to resources/3rdparty/glpk-4.65/src/simplex/spxat.c diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spxat.h b/resources/3rdparty/glpk-4.65/src/simplex/spxat.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/simplex/spxat.h rename to resources/3rdparty/glpk-4.65/src/simplex/spxat.h diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spxchuzc.c b/resources/3rdparty/glpk-4.65/src/simplex/spxchuzc.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/simplex/spxchuzc.c rename to resources/3rdparty/glpk-4.65/src/simplex/spxchuzc.c diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spxchuzc.h b/resources/3rdparty/glpk-4.65/src/simplex/spxchuzc.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/simplex/spxchuzc.h rename to resources/3rdparty/glpk-4.65/src/simplex/spxchuzc.h diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spxchuzr.c b/resources/3rdparty/glpk-4.65/src/simplex/spxchuzr.c similarity index 64% rename from resources/3rdparty/glpk-4.57/src/simplex/spxchuzr.c rename to resources/3rdparty/glpk-4.65/src/simplex/spxchuzr.c index 49db8bd14..8bef77ba2 100644 --- a/resources/3rdparty/glpk-4.57/src/simplex/spxchuzr.c +++ b/resources/3rdparty/glpk-4.65/src/simplex/spxchuzr.c @@ -3,7 +3,7 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2015 Andrew Makhorin, Department for Applied +* Copyright (C) 2015-2018 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -385,4 +385,210 @@ int spx_chuzr_harris(SPXLP *lp, int phase, const double beta[/*1+m*/], done: return p; } +#if 1 /* 22/VI-2017 */ +/*********************************************************************** +* spx_ls_eval_bp - determine penalty function break points +* +* This routine determines break points of the penalty function (which +* is the sum of primal infeasibilities). +* +* The parameters lp, beta, q, dq, tcol, and tol_piv have the same +* meaning as for the routine spx_chuzr_std (see above). +* +* The routine stores the break-points determined to the array elements +* bp[1], ..., bp[nbp] in *arbitrary* order, where 0 <= nbp <= 2*m+1 is +* the number of break-points returned by the routine on exit. */ + +int spx_ls_eval_bp(SPXLP *lp, const double beta[/*1+m*/], + int q, double dq, const double tcol[/*1+m*/], double tol_piv, + SPXBP bp[/*1+2*m+1*/]) +{ int m = lp->m; + int n = lp->n; + double *c = lp->c; + double *l = lp->l; + double *u = lp->u; + int *head = lp->head; + int i, k, nbp; + double s, alfa; + xassert(1 <= q && q <= n-m); + xassert(dq != 0.0); + s = (dq < 0.0 ? +1.0 : -1.0); + nbp = 0; + /* if chosen non-basic variable xN[q] is double-bounded, include + * it in the list, because it can cross its opposite bound */ + k = head[m+q]; /* x[k] = xN[q] */ + if (l[k] != -DBL_MAX && u[k] != +DBL_MAX) + { nbp++; + bp[nbp].i = 0; + xassert(l[k] < u[k]); /* xN[q] cannot be fixed */ + bp[nbp].teta = u[k] - l[k]; + bp[nbp].dc = s; + } + /* build the list of all basic variables xB[i] that can cross + * their bound(s) for the ray parameter 0 <= teta < teta_max */ + for (i = 1; i <= m; i++) + { k = head[i]; /* x[k] = xB[i] */ + xassert(l[k] <= u[k]); + /* determine alfa such that (delta xB[i]) = alfa * teta */ + alfa = s * tcol[i]; + if (alfa >= +tol_piv) + { /* xB[i] increases on increasing teta */ + if (l[k] == u[k]) + { /* xB[i] is fixed at lB[i] = uB[i] */ + if (c[k] <= 0.0) + { /* increasing xB[i] can cross its fixed value lB[i], + * because currently xB[i] <= lB[i] */ + nbp++; + bp[nbp].i = +i; + bp[nbp].teta = (l[k] - beta[i]) / alfa; + /* if xB[i] > lB[i] then cB[i] = +1 */ + bp[nbp].dc = +1.0 - c[k]; + } + } + else + { if (l[k] != -DBL_MAX && c[k] < 0.0) + { /* increasing xB[i] can cross its lower bound lB[i], + * because currently xB[i] < lB[i] */ + nbp++; + bp[nbp].i = +i; + bp[nbp].teta = (l[k] - beta[i]) / alfa; + bp[nbp].dc = +1.0; + } + if (u[k] != +DBL_MAX && c[k] <= 0.0) + { /* increasing xB[i] can cross its upper bound uB[i], + * because currently xB[i] does not violate it */ + nbp++; + bp[nbp].i = -i; + bp[nbp].teta = (u[k] - beta[i]) / alfa; + bp[nbp].dc = +1.0; + } + } + } + else if (alfa <= -tol_piv) + { /* xB[i] decreases on increasing teta */ + if (l[k] == u[k]) + { /* xB[i] is fixed at lB[i] = uB[i] */ + if (c[k] >= 0.0) + { /* decreasing xB[i] can cross its fixed value lB[i], + * because currently xB[i] >= lB[i] */ + nbp++; + bp[nbp].i = +i; + bp[nbp].teta = (l[k] - beta[i]) / alfa; + /* if xB[i] < lB[i] then cB[i] = -1 */ + bp[nbp].dc = -1.0 - c[k]; + } + } + else + { if (l[k] != -DBL_MAX && c[k] >= 0.0) + { /* decreasing xB[i] can cross its lower bound lB[i], + * because currently xB[i] does not violate it */ + nbp++; + bp[nbp].i = +i; + bp[nbp].teta = (l[k] - beta[i]) / alfa; + bp[nbp].dc = -1.0; + } + if (u[k] != +DBL_MAX && c[k] > 0.0) + { /* decreasing xB[i] can cross its upper bound uB[i], + * because currently xB[i] > uB[i] */ + nbp++; + bp[nbp].i = -i; + bp[nbp].teta = (u[k] - beta[i]) / alfa; + bp[nbp].dc = -1.0; + } + } + } + else + { /* xB[i] does not depend on teta within a tolerance */ + continue; + } + /* teta < 0 may happen only due to round-off errors when the + * current value of xB[i] is *close* to its (lower or upper) + * bound; in this case we replace teta by exact zero */ + if (bp[nbp].teta < 0.0) + bp[nbp].teta = 0.0; + } + xassert(nbp <= 2*m+1); + return nbp; +} +#endif + +#if 1 /* 22/VI-2017 */ +/*********************************************************************** +* spx_ls_select_bp - select and process penalty function break points +* +* This routine selects a next portion of the penalty function break +* points and processes them. +* +* On entry to the routine it is assumed that break points bp[1], ..., +* bp[num] are already processed, and slope is the penalty function +* slope to the right of the last processed break point bp[num]. +* (Initially, when num = 0, slope should be specified as -fabs(d[q]), +* where d[q] is the reduced cost of chosen non-basic variable xN[q].) +* +* The routine selects break points among bp[num+1], ..., bp[nbp], for +* which teta <= teta_lim, and moves these break points to the array +* elements bp[num+1], ..., bp[num1], where num <= num1 <= 2*m+1 is the +* new number of processed break points returned by the routine on +* exit. Then the routine sorts the break points by ascending teta and +* computes the change of the penalty function relative to its value at +* teta = 0. +* +* On exit the routine also replaces the parameter slope with a new +* value that corresponds to the new last break-point bp[num1]. */ + +static int CDECL fcmp(const void *v1, const void *v2) +{ const SPXBP *p1 = v1, *p2 = v2; + if (p1->teta < p2->teta) + return -1; + else if (p1->teta > p2->teta) + return +1; + else + return 0; +} + +int spx_ls_select_bp(SPXLP *lp, const double tcol[/*1+m*/], + int nbp, SPXBP bp[/*1+m+m+1*/], int num, double *slope, double + teta_lim) +{ int m = lp->m; + int i, t, num1; + double teta, dz; + xassert(0 <= num && num <= nbp && nbp <= m+m+1); + /* select a new portion of break points */ + num1 = num; + for (t = num+1; t <= nbp; t++) + { if (bp[t].teta <= teta_lim) + { /* move break point to the beginning of the new portion */ + num1++; + i = bp[num1].i, teta = bp[num1].teta, dz = bp[num1].dc; + bp[num1].i = bp[t].i, bp[num1].teta = bp[t].teta, + bp[num1].dc = bp[t].dc; + bp[t].i = i, bp[t].teta = teta, bp[t].dc = dz; + } + } + /* sort new break points bp[num+1], ..., bp[num1] by ascending + * the ray parameter teta */ + if (num1 - num > 1) + qsort(&bp[num+1], num1 - num, sizeof(SPXBP), fcmp); + /* calculate the penalty function change at the new break points + * selected */ + for (t = num+1; t <= num1; t++) + { /* calculate the penalty function change relative to its value + * at break point bp[t-1] */ + dz = (*slope) * (bp[t].teta - (t == 1 ? 0.0 : bp[t-1].teta)); + /* calculate the penalty function change relative to its value + * at teta = 0 */ + bp[t].dz = (t == 1 ? 0.0 : bp[t-1].dz) + dz; + /* calculate a new slope of the penalty function to the right + * of the current break point bp[t] */ + i = (bp[t].i >= 0 ? bp[t].i : -bp[t].i); + xassert(0 <= i && i <= m); + if (i == 0) + *slope += fabs(1.0 * bp[t].dc); + else + *slope += fabs(tcol[i] * bp[t].dc); + } + return num1; +} +#endif + /* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spxchuzr.h b/resources/3rdparty/glpk-4.65/src/simplex/spxchuzr.h similarity index 55% rename from resources/3rdparty/glpk-4.57/src/simplex/spxchuzr.h rename to resources/3rdparty/glpk-4.65/src/simplex/spxchuzr.h index 74f6e444a..3ec900503 100644 --- a/resources/3rdparty/glpk-4.57/src/simplex/spxchuzr.h +++ b/resources/3rdparty/glpk-4.65/src/simplex/spxchuzr.h @@ -3,7 +3,7 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2015 Andrew Makhorin, Department for Applied +* Copyright (C) 2015-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -38,6 +38,40 @@ int spx_chuzr_harris(SPXLP *lp, int phase, const double beta[/*1+m*/], double tol_piv, double tol, double tol1); /* choose basic variable (Harris' ratio test) */ +#if 1 /* 22/VI-2017 */ +typedef struct SPXBP SPXBP; + +struct SPXBP +{ /* penalty function (sum of infeasibilities) break point */ + int i; + /* basic variable xB[i], 1 <= i <= m, that intersects its bound + * at this break point + * i > 0 if xB[i] intersects its lower bound (or fixed value) + * i < 0 if xB[i] intersects its upper bound + * i = 0 if xN[q] intersects its opposite bound */ + double teta; + /* ray parameter value, teta >= 0, at this break point */ + double dc; + /* increment of the penalty function coefficient cB[i] at this + * break point */ + double dz; + /* increment, z[t] - z[0], of the penalty function at this break + * point */ +}; + +#define spx_ls_eval_bp _glp_spx_ls_eval_bp +int spx_ls_eval_bp(SPXLP *lp, const double beta[/*1+m*/], + int q, double dq, const double tcol[/*1+m*/], double tol_piv, + SPXBP bp[/*1+2*m+1*/]); +/* determine penalty function break points */ + +#define spx_ls_select_bp _glp_spx_ls_select_bp +int spx_ls_select_bp(SPXLP *lp, const double tcol[/*1+m*/], + int nbp, SPXBP bp[/*1+m+m+1*/], int num, double *slope, double + teta_lim); +/* select and process penalty function break points */ +#endif + #endif /* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spxlp.c b/resources/3rdparty/glpk-4.65/src/simplex/spxlp.c similarity index 83% rename from resources/3rdparty/glpk-4.57/src/simplex/spxlp.c rename to resources/3rdparty/glpk-4.65/src/simplex/spxlp.c index fe788d84d..90ce26363 100644 --- a/resources/3rdparty/glpk-4.57/src/simplex/spxlp.c +++ b/resources/3rdparty/glpk-4.65/src/simplex/spxlp.c @@ -314,6 +314,22 @@ void spx_eval_rho(SPXLP *lp, int i, double rho[/*1+m*/]) return; } +#if 1 /* 31/III-2016 */ +void spx_eval_rho_s(SPXLP *lp, int i, FVS *rho) +{ /* sparse version of spx_eval_rho */ + int m = lp->m; + xassert(1 <= i && i <= m); + /* compute rho = inv(B') * e[i] */ + xassert(rho->n == m); + fvs_clear_vec(rho); + rho->nnz = 1; + rho->ind[1] = i; + rho->vec[i] = 1.0; + bfd_btran_s(lp->bfd, rho); + return; +} +#endif + /*********************************************************************** * spx_eval_tij - compute element T[i,j] of simplex table * @@ -514,6 +530,93 @@ void spx_update_beta(SPXLP *lp, double beta[/*1+m*/], int p, return; } +#if 1 /* 30/III-2016 */ +void spx_update_beta_s(SPXLP *lp, double beta[/*1+m*/], int p, + int p_flag, int q, const FVS *tcol) +{ /* sparse version of spx_update_beta */ + int m = lp->m; + int n = lp->n; + double *l = lp->l; + double *u = lp->u; + int *head = lp->head; + char *flag = lp->flag; + int nnz = tcol->nnz; + int *ind = tcol->ind; + double *vec = tcol->vec; + int i, k; + double delta_p, delta_q; + xassert(tcol->n == m); + if (p < 0) + { /* special case: xN[q] goes to its opposite bound */ +#if 0 /* 11/VI-2017 */ + /* FIXME: not tested yet */ + xassert(0); +#endif + xassert(1 <= q && q <= n-m); + /* xN[q] should be double-bounded variable */ + k = head[m+q]; /* x[k] = xN[q] */ + xassert(l[k] != -DBL_MAX && u[k] != +DBL_MAX && l[k] != u[k]); + /* determine delta xN[q] */ + if (flag[q]) + { /* xN[q] goes from its upper bound to its lower bound */ + delta_q = l[k] - u[k]; + } + else + { /* xN[q] goes from its lower bound to its upper bound */ + delta_q = u[k] - l[k]; + } + } + else + { /* xB[p] leaves the basis, xN[q] enters the basis */ + xassert(1 <= p && p <= m); + xassert(1 <= q && q <= n-m); + /* determine delta xB[p] */ + k = head[p]; /* x[k] = xB[p] */ + if (p_flag) + { /* xB[p] goes to its upper bound */ + xassert(l[k] != u[k] && u[k] != +DBL_MAX); + delta_p = u[k] - beta[p]; + } + else if (l[k] == -DBL_MAX) + { /* unbounded xB[p] becomes non-basic (unusual case) */ + xassert(u[k] == +DBL_MAX); + delta_p = 0.0 - beta[p]; + } + else + { /* xB[p] goes to its lower bound or becomes fixed */ + delta_p = l[k] - beta[p]; + } + /* determine delta xN[q] */ + delta_q = delta_p / vec[p]; + /* compute new beta[p], which is the value of xN[q] in the + * adjacent basis */ + k = head[m+q]; /* x[k] = xN[q] */ + if (flag[q]) + { /* xN[q] has its upper bound active */ + xassert(l[k] != u[k] && u[k] != +DBL_MAX); + beta[p] = u[k] + delta_q; + } + else if (l[k] == -DBL_MAX) + { /* xN[q] is non-basic unbounded variable */ + xassert(u[k] == +DBL_MAX); + beta[p] = 0.0 + delta_q; + } + else + { /* xN[q] has its lower bound active or is fixed (latter + * case is unusual) */ + beta[p] = l[k] + delta_q; + } + } + /* compute new beta[i] for all i != p */ + for (k = 1; k <= nnz; k++) + { i = ind[k]; + if (i != p) + beta[i] += vec[i] * delta_q; + } + return; +} +#endif + /*********************************************************************** * spx_update_d - update reduced costs of non-basic variables * @@ -594,6 +697,48 @@ double spx_update_d(SPXLP *lp, double d[/*1+n-m*/], int p, int q, return e; } +#if 1 /* 30/III-2016 */ +double spx_update_d_s(SPXLP *lp, double d[/*1+n-m*/], int p, int q, + const FVS *trow, const FVS *tcol) +{ /* sparse version of spx_update_d */ + int m = lp->m; + int n = lp->n; + double *c = lp->c; + int *head = lp->head; + int trow_nnz = trow->nnz; + int *trow_ind = trow->ind; + double *trow_vec = trow->vec; + int tcol_nnz = tcol->nnz; + int *tcol_ind = tcol->ind; + double *tcol_vec = tcol->vec; + int i, j, k; + double dq, e; + xassert(1 <= p && p <= m); + xassert(1 <= q && q <= n); + xassert(trow->n == n-m); + xassert(tcol->n == m); + /* compute d[q] in current basis more accurately */ + k = head[m+q]; /* x[k] = xN[q] */ + dq = c[k]; + for (k = 1; k <= tcol_nnz; k++) + { i = tcol_ind[k]; + dq += tcol_vec[i] * c[head[i]]; + } + /* compute relative error in d[q] */ + e = fabs(dq - d[q]) / (1.0 + fabs(dq)); + /* compute new d[q], which is the reduced cost of xB[p] in the + * adjacent basis */ + d[q] = (dq /= tcol_vec[p]); + /* compute new d[j] for all j != q */ + for (k = 1; k <= trow_nnz; k++) + { j = trow_ind[k]; + if (j != q) + d[j] -= trow_vec[j] * dq; + } + return e; +} +#endif + /*********************************************************************** * spx_change_basis - change current basis to adjacent one * diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spxlp.h b/resources/3rdparty/glpk-4.65/src/simplex/spxlp.h similarity index 93% rename from resources/3rdparty/glpk-4.57/src/simplex/spxlp.h rename to resources/3rdparty/glpk-4.65/src/simplex/spxlp.h index e13528c4c..29a135fec 100644 --- a/resources/3rdparty/glpk-4.57/src/simplex/spxlp.h +++ b/resources/3rdparty/glpk-4.65/src/simplex/spxlp.h @@ -182,6 +182,12 @@ void spx_eval_tcol(SPXLP *lp, int j, double tcol[/*1+m*/]); void spx_eval_rho(SPXLP *lp, int i, double rho[/*1+m*/]); /* compute i-th row of basis matrix inverse */ +#if 1 /* 31/III-2016 */ +#define spx_eval_rho_s _glp_spx_eval_rho_s +void spx_eval_rho_s(SPXLP *lp, int i, FVS *rho); +/* sparse version of spx_eval_rho */ +#endif + #define spx_eval_tij _glp_spx_eval_tij double spx_eval_tij(SPXLP *lp, const double rho[/*1+m*/], int j); /* compute element T[i,j] of simplex table */ @@ -196,11 +202,25 @@ void spx_update_beta(SPXLP *lp, double beta[/*1+m*/], int p, int p_flag, int q, const double tcol[/*1+m*/]); /* update values of basic variables */ +#if 1 /* 30/III-2016 */ +#define spx_update_beta_s _glp_spx_update_beta_s +void spx_update_beta_s(SPXLP *lp, double beta[/*1+m*/], int p, + int p_flag, int q, const FVS *tcol); +/* sparse version of spx_update_beta */ +#endif + #define spx_update_d _glp_spx_update_d double spx_update_d(SPXLP *lp, double d[/*1+n-m*/], int p, int q, const double trow[/*1+n-m*/], const double tcol[/*1+m*/]); /* update reduced costs of non-basic variables */ +#if 1 /* 30/III-2016 */ +#define spx_update_d_s _glp_spx_update_d_s +double spx_update_d_s(SPXLP *lp, double d[/*1+n-m*/], int p, int q, + const FVS *trow, const FVS *tcol); +/* sparse version of spx_update_d */ +#endif + #define spx_change_basis _glp_spx_change_basis void spx_change_basis(SPXLP *lp, int p, int p_flag, int q); /* change current basis to adjacent one */ diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spxnt.c b/resources/3rdparty/glpk-4.65/src/simplex/spxnt.c similarity index 87% rename from resources/3rdparty/glpk-4.57/src/simplex/spxnt.c rename to resources/3rdparty/glpk-4.65/src/simplex/spxnt.c index cf3e1f2be..7eaac8529 100644 --- a/resources/3rdparty/glpk-4.57/src/simplex/spxnt.c +++ b/resources/3rdparty/glpk-4.65/src/simplex/spxnt.c @@ -242,6 +242,49 @@ void spx_nt_prod(SPXLP *lp, SPXNT *nt, double y[/*1+n-m*/], int ign, return; } +#if 1 /* 31/III-2016 */ +void spx_nt_prod_s(SPXLP *lp, SPXNT *nt, FVS *y, int ign, double s, + const FVS *x, double eps) +{ /* sparse version of spx_nt_prod */ + int *NT_ptr = nt->ptr; + int *NT_len = nt->len; + int *NT_ind = nt->ind; + double *NT_val = nt->val; + int *x_ind = x->ind; + double *x_vec = x->vec; + int *y_ind = y->ind; + double *y_vec = y->vec; + int i, j, k, nnz, ptr, end; + double t; + xassert(x->n == lp->m); + xassert(y->n == lp->n-lp->m); + if (ign) + { /* y := 0 */ + fvs_clear_vec(y); + } + nnz = y->nnz; + for (k = x->nnz; k >= 1; k--) + { i = x_ind[k]; + /* y := y + s * (i-th row of N) * x[i] */ + t = s * x_vec[i]; + ptr = NT_ptr[i]; + end = ptr + NT_len[i]; + for (; ptr < end; ptr++) + { j = NT_ind[ptr]; + if (y_vec[j] == 0.0) + y_ind[++nnz] = j; + y_vec[j] += NT_val[ptr] * t; + /* don't forget about numeric cancellation */ + if (y_vec[j] == 0.0) + y_vec[j] = DBL_MIN; + } + } + y->nnz = nnz; + fvs_adjust_vec(y, eps); + return; +} +#endif + /*********************************************************************** * spx_free_nt - deallocate matrix N in sparse row-wise format * diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spxnt.h b/resources/3rdparty/glpk-4.65/src/simplex/spxnt.h similarity index 93% rename from resources/3rdparty/glpk-4.57/src/simplex/spxnt.h rename to resources/3rdparty/glpk-4.65/src/simplex/spxnt.h index d2622404c..857917b8d 100644 --- a/resources/3rdparty/glpk-4.57/src/simplex/spxnt.h +++ b/resources/3rdparty/glpk-4.65/src/simplex/spxnt.h @@ -80,6 +80,13 @@ void spx_nt_prod(SPXLP *lp, SPXNT *nt, double y[/*1+n-m*/], int ign, double s, const double x[/*1+m*/]); /* compute product y := y + s * N'* x */ +#if 1 /* 31/III-2016 */ +#define spx_nt_prod_s _glp_spx_nt_prod_s +void spx_nt_prod_s(SPXLP *lp, SPXNT *nt, FVS *y, int ign, double s, + const FVS *x, double eps); +/* sparse version of spx_nt_prod */ +#endif + #define spx_free_nt _glp_spx_free_nt void spx_free_nt(SPXLP *lp, SPXNT *nt); /* deallocate matrix N in sparse row-wise format */ diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spxprim.c b/resources/3rdparty/glpk-4.65/src/simplex/spxprim.c similarity index 59% rename from resources/3rdparty/glpk-4.57/src/simplex/spxprim.c rename to resources/3rdparty/glpk-4.65/src/simplex/spxprim.c index b22133ff0..e1cdfb5ab 100644 --- a/resources/3rdparty/glpk-4.57/src/simplex/spxprim.c +++ b/resources/3rdparty/glpk-4.65/src/simplex/spxprim.c @@ -3,7 +3,7 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2015 Andrew Makhorin, Department for Applied +* Copyright (C) 2015-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -21,6 +21,10 @@ * along with GLPK. If not, see . ***********************************************************************/ +#if 1 /* 18/VII-2017 */ +#define SCALE_Z 1 +#endif + #include "env.h" #include "simplex.h" #include "spxat.h" @@ -29,18 +33,6 @@ #include "spxchuzr.h" #include "spxprob.h" -#define USE_AT 0 -/* 1 - use A in row-wise format - * 0 - use N in row-wise format */ - -#define EXCL 1 -/* 1 - exclude fixed non-basic variables - * 0 - don't exclude variables */ - -#define SHIFT 1 -/* 1 - shift bounds of variables toward zero - * 0 - don't shift bounds of variables */ - #define CHECK_ACCURACY 0 /* (for debugging) */ @@ -53,8 +45,16 @@ struct csa /* original optimization direction: * +1 - minimization * -1 - maximization */ - double *c; /* double c[1+n]; */ +#if SCALE_Z + double fz; + /* factor used to scale original objective */ +#endif + double *orig_c; /* double orig_c[1+n]; */ /* copy of original objective coefficients */ + double *orig_l; /* double orig_l[1+n]; */ + /* copy of original lower bounds */ + double *orig_u; /* double orig_u[1+n]; */ + /* copy of original upper bounds */ SPXAT *at; /* mxn-matrix A of constraint coefficients, in sparse row-wise * format (NULL if not used) */ @@ -67,14 +67,14 @@ struct csa * 1 - searching for primal feasible solution * 2 - searching for optimal solution */ double *beta; /* double beta[1+m]; */ - /* beta[i] is primal value of basic variable xB[i] */ + /* beta[i] is a primal value of basic variable xB[i] */ int beta_st; /* status of the vector beta: * 0 - undefined * 1 - just computed * 2 - updated */ double *d; /* double d[1+n-m]; */ - /* d[j] is reduced cost of non-basic variable xN[j] */ + /* d[j] is a reduced cost of non-basic variable xN[j] */ int d_st; /* status of the vector d: * 0 - undefined @@ -90,8 +90,16 @@ struct csa * variables xN[j] */ int q; /* xN[q] is a non-basic variable chosen to enter the basis */ +#if 0 /* 11/VI-2017 */ double *tcol; /* double tcol[1+m]; */ +#else + FVS tcol; /* FVS tcol[1:m]; */ +#endif /* q-th (pivot) column of the simplex table */ +#if 1 /* 23/VI-2017 */ + SPXBP *bp; /* SPXBP bp[1+2*m+1]; */ + /* penalty function break points */ +#endif int p; /* xB[p] is a basic variable chosen to leave the basis; * p = 0 means that no basic variable reaches its bound; @@ -100,20 +108,37 @@ struct csa int p_flag; /* if this flag is set, the active bound of xB[p] in the adjacent * basis should be set to the upper bound */ +#if 0 /* 11/VI-2017 */ double *trow; /* double trow[1+n-m]; */ +#else + FVS trow; /* FVS trow[1:n-m]; */ +#endif /* p-th (pivot) row of the simplex table */ +#if 0 /* 09/VII-2017 */ double *work; /* double work[1+m]; */ /* working array */ +#else + FVS work; /* FVS work[1:m]; */ + /* working vector */ +#endif int p_stat, d_stat; /* primal and dual solution statuses */ /*--------------------------------------------------------------*/ /* control parameters (see struct glp_smcp) */ int msg_lev; /* message level */ +#if 0 /* 23/VI-2017 */ int harris; /* ratio test technique: * 0 - textbook ratio test * 1 - Harris' two pass ratio test */ +#else + int r_test; + /* ratio test technique: + * GLP_RT_STD - textbook ratio test + * GLP_RT_HAR - Harris' two pass ratio test + * GLP_RT_FLIP - long-step ratio test (only for phase I) */ +#endif double tol_bnd, tol_bnd1; /* primal feasibility tolerances */ double tol_dj, tol_dj1; @@ -125,7 +150,11 @@ struct csa int tm_lim; /* time limit, milliseconds */ int out_frq; +#if 0 /* 15/VII-2017 */ /* display output frequency, iterations */ +#else + /* display output frequency, milliseconds */ +#endif int out_dly; /* display output delay, milliseconds */ /*--------------------------------------------------------------*/ @@ -140,8 +169,21 @@ struct csa * jumps to its opposite bound) */ int it_dpy; /* simplex iteration count at most recent display output */ +#if 1 /* 15/VII-2017 */ + double tm_dpy; + /* time value at most recent display output */ +#endif int inv_cnt; /* basis factorization count since most recent display output */ +#if 1 /* 01/VII-2017 */ + int degen; + /* count of successive degenerate iterations; this count is used + * to detect stalling */ +#endif +#if 1 /* 23/VI-2017 */ + int ns_cnt, ls_cnt; + /* normal and long-step iteration counts */ +#endif }; /*********************************************************************** @@ -325,6 +367,7 @@ static int check_feas(struct csa *csa, int phase, double tol, double * The routine returns the number of objective coefficients which were * set to zero. */ +#if 0 static int adjust_penalty(struct csa *csa, double tol, double tol1) { SPXLP *lp = csa->lp; int m = lp->m; @@ -360,6 +403,48 @@ static int adjust_penalty(struct csa *csa, double tol, double tol1) } return count; } +#else +static int adjust_penalty(struct csa *csa, int num, const int + ind[/*1+num*/], double tol, double tol1) +{ SPXLP *lp = csa->lp; + int m = lp->m; + double *c = lp->c; + double *l = lp->l; + double *u = lp->u; + int *head = lp->head; + double *beta = csa->beta; + int i, k, t, cnt = 0; + double lk, uk, eps; + xassert(csa->phase == 1); + /* walk thru the specified list of basic variables */ + for (t = 1; t <= num; t++) + { i = ind[t]; + xassert(1 <= i && i <= m); + k = head[i]; /* x[k] = xB[i] */ + if (c[k] < 0.0) + { /* x[k] violates its original lower bound */ + lk = l[k]; + xassert(lk != -DBL_MAX); + eps = tol + tol1 * (lk >= 0.0 ? +lk : -lk); + if (beta[i] >= lk - eps) + { /* however, violation is close to zero */ + c[k] = 0.0, cnt++; + } + } + else if (c[k] > 0.0) + { /* x[k] violates its original upper bound */ + uk = u[k]; + xassert(uk != +DBL_MAX); + eps = tol + tol1 * (uk >= 0.0 ? +uk : -uk); + if (beta[i] <= uk + eps) + { /* however, violation is close to zero */ + c[k] = 0.0, cnt++; + } + } + } + return cnt; +} +#endif #if CHECK_ACCURACY /*********************************************************************** @@ -493,7 +578,10 @@ static void check_accuracy(struct csa *csa) * the routine attempts to choose another xN[q] and xB[p] in order to * avoid badly conditioned adjacent bases. */ -static void choose_pivot(struct csa *csa) +#if 1 /* 17/III-2016 */ +#define MIN_RATIO 0.0001 + +static int choose_pivot(struct csa *csa) { SPXLP *lp = csa->lp; int m = lp->m; int n = lp->n; @@ -501,13 +589,33 @@ static void choose_pivot(struct csa *csa) double *d = csa->d; SPXSE *se = csa->se; int *list = csa->list; - int nnn, try, q, t, p_flag, p; +#if 0 /* 09/VII-2017 */ double *tcol = csa->work; - /* initial number of eligible non-basic variables */ +#else + double *tcol = csa->work.vec; +#endif + double tol_piv = csa->tol_piv; + int try, nnn, /*i,*/ p, p_flag, q, t; + double big, /*temp,*/ best_ratio; +#if 1 /* 23/VI-2017 */ + double *c = lp->c; + int *head = lp->head; + SPXBP *bp = csa->bp; + int nbp, t_best, ret, k; + double dz_best; +#endif + xassert(csa->beta_st); + xassert(csa->d_st); +more: /* initial number of eligible non-basic variables */ nnn = csa->num; /* nothing has been chosen so far */ csa->q = 0; + best_ratio = 0.0; +#if 0 /* 23/VI-2017 */ try = 0; +#else + try = ret = 0; +#endif try: /* choose non-basic variable xN[q] */ xassert(nnn > 0); try++; @@ -522,34 +630,162 @@ try: /* choose non-basic variable xN[q] */ xassert(1 <= q && q <= n-m); /* compute q-th column of the simplex table */ spx_eval_tcol(lp, q, tcol); +#if 0 + /* big := max(1, |tcol[1]|, ..., |tcol[m]|) */ + big = 1.0; + for (i = 1; i <= m; i++) + { temp = tcol[i]; + if (temp < 0.0) + temp = - temp; + if (big < temp) + big = temp; + } +#else + /* this still puzzles me */ + big = 1.0; +#endif /* choose basic variable xB[p] */ +#if 1 /* 23/VI-2017 */ + if (csa->phase == 1 && csa->r_test == GLP_RT_FLIP && try <= 2) + { /* long-step ratio test */ + int t, num, num1; + double slope, teta_lim; + /* determine penalty function break points */ + nbp = spx_ls_eval_bp(lp, beta, q, d[q], tcol, tol_piv, bp); + if (nbp < 2) + goto skip; + /* set initial slope */ + slope = - fabs(d[q]); + /* estimate initial teta_lim */ + teta_lim = DBL_MAX; + for (t = 1; t <= nbp; t++) + { if (teta_lim > bp[t].teta) + teta_lim = bp[t].teta; + } + xassert(teta_lim >= 0.0); + if (teta_lim < 1e-3) + teta_lim = 1e-3; + /* nothing has been chosen so far */ + t_best = 0, dz_best = 0.0, num = 0; + /* choose appropriate break point */ + while (num < nbp) + { /* select and process a new portion of break points */ + num1 = spx_ls_select_bp(lp, tcol, nbp, bp, num, &slope, + teta_lim); + for (t = num+1; t <= num1; t++) + { int i = (bp[t].i >= 0 ? bp[t].i : -bp[t].i); + xassert(0 <= i && i <= m); + if (i == 0 || fabs(tcol[i]) / big >= MIN_RATIO) + { if (dz_best > bp[t].dz) + t_best = t, dz_best = bp[t].dz; + } +#if 0 + if (i == 0) + { /* do not consider further break points beyond this + * point, where xN[q] reaches its opposite bound; + * in principle (see spx_ls_eval_bp), this break + * point should be the last one, however, due to + * round-off errors there may be other break points + * with the same teta beyond this one */ + slope = +1.0; + } +#endif + } + if (slope > 0.0) + { /* penalty function starts increasing */ + break; + } + /* penalty function continues decreasing */ + num = num1; + teta_lim += teta_lim; + } + if (dz_best == 0.0) + goto skip; + /* the choice has been made */ + xassert(1 <= t_best && t_best <= num1); + if (t_best == 1) + { /* the very first break point was chosen; it is reasonable + * to use the short-step ratio test */ + goto skip; + } + csa->q = q; + memcpy(&csa->tcol.vec[1], &tcol[1], m * sizeof(double)); + fvs_gather_vec(&csa->tcol, DBL_EPSILON); + if (bp[t_best].i == 0) + { /* xN[q] goes to its opposite bound */ + csa->p = -1; + csa->p_flag = 0; + best_ratio = 1.0; + } + else if (bp[t_best].i > 0) + { /* xB[p] leaves the basis and goes to its lower bound */ + csa->p = + bp[t_best].i; + xassert(1 <= csa->p && csa->p <= m); + csa->p_flag = 0; + best_ratio = fabs(tcol[csa->p]) / big; + } + else + { /* xB[p] leaves the basis and goes to its upper bound */ + csa->p = - bp[t_best].i; + xassert(1 <= csa->p && csa->p <= m); + csa->p_flag = 1; + best_ratio = fabs(tcol[csa->p]) / big; + } +#if 0 + xprintf("num1 = %d; t_best = %d; dz = %g\n", num1, t_best, + bp[t_best].dz); +#endif + ret = 1; + goto done; +skip: ; + } +#endif +#if 0 /* 23/VI-2017 */ if (!csa->harris) +#else + if (csa->r_test == GLP_RT_STD) +#endif { /* textbook ratio test */ p = spx_chuzr_std(lp, csa->phase, beta, q, - d[q] < 0.0 ? +1. : -1., tcol, &p_flag, csa->tol_piv, + d[q] < 0.0 ? +1. : -1., tcol, &p_flag, tol_piv, .30 * csa->tol_bnd, .30 * csa->tol_bnd1); } else { /* Harris' two-pass ratio test */ p = spx_chuzr_harris(lp, csa->phase, beta, q, - d[q] < 0.0 ? +1. : -1., tcol, &p_flag , csa->tol_piv, + d[q] < 0.0 ? +1. : -1., tcol, &p_flag , tol_piv, .50 * csa->tol_bnd, .50 * csa->tol_bnd1); } + if (p <= 0) + { /* primal unboundedness or special case */ + csa->q = q; +#if 0 /* 11/VI-2017 */ + memcpy(&csa->tcol[1], &tcol[1], m * sizeof(double)); +#else + memcpy(&csa->tcol.vec[1], &tcol[1], m * sizeof(double)); + fvs_gather_vec(&csa->tcol, DBL_EPSILON); +#endif + csa->p = p; + csa->p_flag = p_flag; + best_ratio = 1.0; + goto done; + } /* either keep previous choice or accept new choice depending on * which one is better */ - if (csa->q == 0 || p <= 0 || - fabs(tcol[p]) > fabs(csa->tcol[csa->p])) + if (best_ratio < fabs(tcol[p]) / big) { csa->q = q; +#if 0 /* 11/VI-2017 */ memcpy(&csa->tcol[1], &tcol[1], m * sizeof(double)); +#else + memcpy(&csa->tcol.vec[1], &tcol[1], m * sizeof(double)); + fvs_gather_vec(&csa->tcol, DBL_EPSILON); +#endif csa->p = p; csa->p_flag = p_flag; + best_ratio = fabs(tcol[p]) / big; } - /* check if current choice is acceptable */ - if (csa->p <= 0 || fabs(csa->tcol[csa->p]) >= 0.001) - goto done; - if (nnn == 1) - goto done; - if (try == 5) + /* check if the current choice is acceptable */ + if (best_ratio >= MIN_RATIO || nnn == 1 || try == 5) goto done; /* try to choose other xN[q] and xB[p] */ /* find xN[q] in the list */ @@ -563,6 +799,182 @@ try: /* choose non-basic variable xN[q] */ /* repeat the choice */ goto try; done: /* the choice has been made */ +#if 1 /* FIXME: currently just to avoid badly conditioned basis */ + if (best_ratio < .001 * MIN_RATIO) + { /* looks like this helps */ + if (bfd_get_count(lp->bfd) > 0) + return -1; + /* didn't help; last chance to improve the choice */ + if (tol_piv == csa->tol_piv) + { tol_piv *= 1000.; + goto more; + } + } +#endif +#if 0 /* 23/VI-2017 */ + return 0; +#else /* FIXME */ + if (ret) + { /* invalidate dual basic solution components */ + csa->d_st = 0; + /* change penalty function coefficients at basic variables for + * all break points preceding the chosen one */ + for (t = 1; t < t_best; t++) + { int i = (bp[t].i >= 0 ? bp[t].i : -bp[t].i); + xassert(0 <= i && i <= m); + if (i == 0) + { /* xN[q] crosses its opposite bound */ + xassert(1 <= csa->q && csa->q <= n-m); + k = head[m+csa->q]; + } + else + { /* xB[i] crosses its (lower or upper) bound */ + k = head[i]; /* x[k] = xB[i] */ + } + c[k] += bp[t].dc; + xassert(c[k] == 0.0 || c[k] == +1.0 || c[k] == -1.0); + } + } + return ret; +#endif +} +#endif + +/*********************************************************************** +* play_bounds - play bounds of primal variables +* +* This routine is called after the primal values of basic variables +* beta[i] were updated and the basis was changed to the adjacent one. +* +* It is assumed that before updating all the primal values beta[i] +* were strongly feasible, so in the adjacent basis beta[i] remain +* feasible within a tolerance, i.e. if some beta[i] violates its lower +* or upper bound, the violation is insignificant. +* +* If some beta[i] violates its lower or upper bound, this routine +* changes (perturbs) the bound to remove such violation, i.e. to make +* all beta[i] strongly feasible. Otherwise, if beta[i] has a feasible +* value, this routine attempts to reduce (or remove) perturbation of +* corresponding lower/upper bound keeping strong feasibility. */ + +/* FIXME: what to do if l[k] = u[k]? */ + +/* FIXME: reduce/remove perturbation if x[k] becomes non-basic? */ + +static void play_bounds(struct csa *csa, int all) +{ SPXLP *lp = csa->lp; + int m = lp->m; + double *c = lp->c; + double *l = lp->l; + double *u = lp->u; + int *head = lp->head; + double *orig_l = csa->orig_l; + double *orig_u = csa->orig_u; + double *beta = csa->beta; +#if 0 /* 11/VI-2017 */ + const double *tcol = csa->tcol; /* was used to update beta */ +#else + const double *tcol = csa->tcol.vec; +#endif + int i, k; + xassert(csa->phase == 1 || csa->phase == 2); + /* primal values beta = (beta[i]) should be valid */ + xassert(csa->beta_st); + /* walk thru the list of basic variables xB = (xB[i]) */ + for (i = 1; i <= m; i++) + { if (all || tcol[i] != 0.0) + { /* beta[i] has changed in the adjacent basis */ + k = head[i]; /* x[k] = xB[i] */ + if (csa->phase == 1 && c[k] < 0.0) + { /* -inf < xB[i] <= lB[i] (artificial bounds) */ + if (beta[i] < l[k] - 1e-9) + continue; + /* restore actual bounds */ + c[k] = 0.0; + csa->d_st = 0; /* since c[k] = cB[i] has changed */ + } + if (csa->phase == 1 && c[k] > 0.0) + { /* uB[i] <= xB[i] < +inf (artificial bounds) */ + if (beta[i] > u[k] + 1e-9) + continue; + /* restore actual bounds */ + c[k] = 0.0; + csa->d_st = 0; /* since c[k] = cB[i] has changed */ + } + /* lB[i] <= xB[i] <= uB[i] */ + if (csa->phase == 1) + xassert(c[k] == 0.0); + if (l[k] != -DBL_MAX) + { /* xB[i] has lower bound */ + if (beta[i] < l[k]) + { /* strong feasibility means xB[i] >= lB[i] */ +#if 0 /* 11/VI-2017 */ + l[k] = beta[i]; +#else + l[k] = beta[i] - 1e-9; +#endif + } + else if (l[k] < orig_l[k]) + { /* remove/reduce perturbation of lB[i] */ + if (beta[i] >= orig_l[k]) + l[k] = orig_l[k]; + else + l[k] = beta[i]; + } + } + if (u[k] != +DBL_MAX) + { /* xB[i] has upper bound */ + if (beta[i] > u[k]) + { /* strong feasibility means xB[i] <= uB[i] */ +#if 0 /* 11/VI-2017 */ + u[k] = beta[i]; +#else + u[k] = beta[i] + 1e-9; +#endif + } + else if (u[k] > orig_u[k]) + { /* remove/reduce perturbation of uB[i] */ + if (beta[i] <= orig_u[k]) + u[k] = orig_u[k]; + else + u[k] = beta[i]; + } + } + } + } + return; +} + +static void remove_perturb(struct csa *csa) +{ /* remove perturbation */ + SPXLP *lp = csa->lp; + int m = lp->m; + int n = lp->n; + double *l = lp->l; + double *u = lp->u; + int *head = lp->head; + char *flag = lp->flag; + double *orig_l = csa->orig_l; + double *orig_u = csa->orig_u; + int j, k; + /* restore original bounds of variables */ + memcpy(l, orig_l, (1+n) * sizeof(double)); + memcpy(u, orig_u, (1+n) * sizeof(double)); + /* adjust flags of fixed non-basic variables, because in the + * perturbed problem such variables might be changed to double- + * bounded type */ + for (j = 1; j <= n-m; j++) + { k = head[m+j]; /* x[k] = xN[j] */ + if (l[k] == u[k]) + flag[j] = 0; + } + /* removing perturbation changes primal solution components */ + csa->phase = csa->beta_st = 0; +#if 1 + if (csa->msg_lev >= GLP_MSG_ALL) + xprintf("Removing LP perturbation [%d]...\n", + csa->it_cnt); +#endif return; } @@ -609,21 +1021,50 @@ static double sum_infeas(SPXLP *lp, const double beta[/*1+m*/]) static void display(struct csa *csa, int spec) { int nnn, k; - double obj, sum, *save; + double obj, sum, *save, *save1; +#if 1 /* 15/VII-2017 */ + double tm_cur; +#endif /* check if the display output should be skipped */ if (csa->msg_lev < GLP_MSG_ON) goto skip; +#if 1 /* 15/VII-2017 */ + tm_cur = xtime(); +#endif if (csa->out_dly > 0 && +#if 0 /* 15/VII-2017 */ 1000.0 * xdifftime(xtime(), csa->tm_beg) < csa->out_dly) +#else + 1000.0 * xdifftime(tm_cur, csa->tm_beg) < csa->out_dly) +#endif goto skip; if (csa->it_cnt == csa->it_dpy) goto skip; +#if 0 /* 15/VII-2017 */ if (!spec && csa->it_cnt % csa->out_frq != 0) goto skip; +#else + if (!spec && + 1000.0 * xdifftime(tm_cur, csa->tm_dpy) < csa->out_frq) + goto skip; +#endif /* compute original objective value */ save = csa->lp->c; - csa->lp->c = csa->c; + csa->lp->c = csa->orig_c; obj = csa->dir * spx_eval_obj(csa->lp, csa->beta); csa->lp->c = save; +#if SCALE_Z + obj *= csa->fz; +#endif /* compute sum of (scaled) primal infeasibilities */ +#if 1 /* 01/VII-2017 */ + save = csa->lp->l; + save1 = csa->lp->u; + csa->lp->l = csa->orig_l; + csa->lp->u = csa->orig_u; +#endif sum = sum_infeas(csa->lp, csa->beta); +#if 1 /* 01/VII-2017 */ + csa->lp->l = save; + csa->lp->u = save1; +#endif /* compute number of infeasibilities/non-optimalities */ switch (csa->phase) { case 1: @@ -647,13 +1088,25 @@ static void display(struct csa *csa, int spec) xprintf(" %d", csa->inv_cnt); csa->inv_cnt = 0; } +#if 1 /* 23/VI-2017 */ + if (csa->phase == 1 && csa->r_test == GLP_RT_FLIP) + { /*xprintf(" %d,%d", csa->ns_cnt, csa->ls_cnt);*/ + if (csa->ns_cnt + csa->ls_cnt) + xprintf(" %d%%", + (100 * csa->ls_cnt) / (csa->ns_cnt + csa->ls_cnt)); + csa->ns_cnt = csa->ls_cnt = 0; + } +#endif xprintf("\n"); csa->it_dpy = csa->it_cnt; +#if 1 /* 15/VII-2017 */ + csa->tm_dpy = tm_cur; +#endif skip: return; } /*********************************************************************** -* spx_primal - driver to primal simplex method +* spx_primal - driver to the primal simplex method * * This routine is a driver to the two-phase primal simplex method. * @@ -683,15 +1136,26 @@ static int primal_simplex(struct csa *csa) double *d = csa->d; SPXSE *se = csa->se; int *list = csa->list; +#if 0 /* 11/VI-2017 */ double *tcol = csa->tcol; double *trow = csa->trow; +#endif +#if 0 /* 09/VII-2017 */ double *pi = csa->work; double *rho = csa->work; +#else + double *pi = csa->work.vec; + double *rho = csa->work.vec; +#endif int msg_lev = csa->msg_lev; double tol_bnd = csa->tol_bnd; double tol_bnd1 = csa->tol_bnd1; double tol_dj = csa->tol_dj; double tol_dj1 = csa->tol_dj1; + int perturb = -1; + /* -1 = perturbation is not used, but enabled + * 0 = perturbation is not used and disabled + * +1 = perturbation is being used */ int j, refct, ret; loop: /* main loop starts here */ /* compute factorization of the basis matrix */ @@ -740,7 +1204,7 @@ loop: /* main loop starts here */ { /* current basic solution is primal feasible */ /* start to minimize the original objective function */ csa->phase = 2; - memcpy(c, csa->c, (1+n) * sizeof(double)); + memcpy(c, csa->orig_c, (1+n) * sizeof(double)); } /* working objective coefficients have been changed, so * invalidate reduced costs */ @@ -748,27 +1212,45 @@ loop: /* main loop starts here */ } /* make sure that the current basic solution remains primal * feasible (or pseudo-feasible on phase I) */ - if (check_feas(csa, csa->phase, tol_bnd, tol_bnd1)) - { /* excessive bound violations due to round-off errors */ - if (msg_lev >= GLP_MSG_ERR) - xprintf("Warning: numerical instability (primal simplex," - " phase %s)\n", csa->phase == 1 ? "I" : "II"); - /* restart the search */ - lp->valid = 0; - csa->phase = 0; - goto loop; + if (perturb <= 0) + { if (check_feas(csa, csa->phase, tol_bnd, tol_bnd1)) + { /* excessive bound violations due to round-off errors */ +#if 1 /* 01/VII-2017 */ + if (perturb < 0) + { if (msg_lev >= GLP_MSG_ALL) + xprintf("Perturbing LP to avoid instability [%d].." + ".\n", csa->it_cnt); + perturb = 1; + goto loop; + } +#endif + if (msg_lev >= GLP_MSG_ERR) + xprintf("Warning: numerical instability (primal simpl" + "ex, phase %s)\n", csa->phase == 1 ? "I" : "II"); + /* restart the search */ + lp->valid = 0; + csa->phase = 0; + goto loop; + } + if (csa->phase == 1) + { int i, cnt; + for (i = 1; i <= m; i++) + csa->tcol.ind[i] = i; + cnt = adjust_penalty(csa, m, csa->tcol.ind, + 0.99 * tol_bnd, 0.99 * tol_bnd1); + if (cnt) + { /*xprintf("*** cnt = %d\n", cnt);*/ + csa->d_st = 0; + } + } + } + else + { /* FIXME */ + play_bounds(csa, 1); } } /* at this point the search phase is determined */ xassert(csa->phase == 1 || csa->phase == 2); - if (csa->phase == 1) - { /* adjust penalty function coefficients */ - if (adjust_penalty(csa, tol_bnd, tol_bnd1)) - { /* some coefficients were changed, so invalidate reduced - * costs of non-basic variables */ - csa->d_st = 0; - } - } /* compute reduced costs of non-basic variables d = (d[j]) */ if (!csa->d_st) { spx_eval_pi(lp, pi); @@ -789,7 +1271,12 @@ loop: /* main loop starts here */ #endif /* check if the iteration limit has been exhausted */ if (csa->it_cnt - csa->it_beg >= csa->it_lim) - { if (csa->beta_st != 1) + { if (perturb > 0) + { /* remove perturbation */ + remove_perturb(csa); + perturb = 0; + } + if (csa->beta_st != 1) csa->beta_st = 0; if (csa->d_st != 1) csa->d_st = 0; @@ -805,7 +1292,12 @@ loop: /* main loop starts here */ } /* check if the time limit has been exhausted */ if (1000.0 * xdifftime(xtime(), csa->tm_beg) >= csa->tm_lim) - { if (csa->beta_st != 1) + { if (perturb > 0) + { /* remove perturbation */ + remove_perturb(csa); + perturb = 0; + } + if (csa->beta_st != 1) csa->beta_st = 0; if (csa->d_st != 1) csa->d_st = 0; @@ -834,7 +1326,12 @@ loop: /* main loop starts here */ } /* check for optimality */ if (csa->num == 0) - { if (csa->beta_st != 1) + { if (perturb > 0 && csa->phase == 2) + { /* remove perturbation */ + remove_perturb(csa); + perturb = 0; + } + if (csa->beta_st != 1) csa->beta_st = 0; if (csa->d_st != 1) csa->d_st = 0; @@ -847,12 +1344,15 @@ loop: /* main loop starts here */ /* check for primal feasibility */ if (!check_feas(csa, 2, tol_bnd, tol_bnd1)) { /* feasible solution found; switch to phase II */ - memcpy(c, csa->c, (1+n) * sizeof(double)); + memcpy(c, csa->orig_c, (1+n) * sizeof(double)); csa->phase = 2; csa->d_st = 0; goto loop; } /* no feasible solution exists */ +#if 1 /* 09/VII-2017 */ + /* FIXME: remove perturbation */ +#endif if (msg_lev >= GLP_MSG_ALL) xprintf("LP HAS NO PRIMAL FEASIBLE SOLUTION\n"); csa->p_stat = GLP_NOFEAS; @@ -871,10 +1371,34 @@ loop: /* main loop starts here */ } } /* choose xN[q] and xB[p] */ +#if 0 /* 23/VI-2017 */ +#if 0 /* 17/III-2016 */ choose_pivot(csa); +#else + if (choose_pivot(csa) < 0) + { lp->valid = 0; + goto loop; + } +#endif +#else + ret = choose_pivot(csa); + if (ret < 0) + { lp->valid = 0; + goto loop; + } + if (ret == 0) + csa->ns_cnt++; + else + csa->ls_cnt++; +#endif /* check for unboundedness */ if (csa->p == 0) - { if (csa->beta_st != 1) + { if (perturb > 0) + { /* remove perturbation */ + remove_perturb(csa); + perturb = 0; + } + if (csa->beta_st != 1) csa->beta_st = 0; if (csa->d_st != 1) csa->d_st = 0; @@ -901,8 +1425,52 @@ loop: /* main loop starts here */ xassert(csa != csa); } } +#if 1 /* 01/VII-2017 */ + /* check for stalling */ + if (csa->p > 0) + { int k; + xassert(1 <= csa->p && csa->p <= m); + k = head[csa->p]; /* x[k] = xB[p] */ + if (lp->l[k] != lp->u[k]) + { if (csa->p_flag) + { /* xB[p] goes to its upper bound */ + xassert(lp->u[k] != +DBL_MAX); + if (fabs(beta[csa->p] - lp->u[k]) >= 1e-6) + { csa->degen = 0; + goto skip1; + } + } + else if (lp->l[k] == -DBL_MAX) + { /* unusual case */ + goto skip1; + } + else + { /* xB[p] goes to its lower bound */ + xassert(lp->l[k] != -DBL_MAX); + if (fabs(beta[csa->p] - lp->l[k]) >= 1e-6) + { csa->degen = 0; + goto skip1; + } + } + /* degenerate iteration has been detected */ + csa->degen++; + if (perturb < 0 && csa->degen >= 200) + { if (msg_lev >= GLP_MSG_ALL) + xprintf("Perturbing LP to avoid stalling [%d]...\n", + csa->it_cnt); + perturb = 1; + } +skip1: ; + } + } +#endif /* update values of basic variables for adjacent basis */ +#if 0 /* 11/VI-2017 */ spx_update_beta(lp, beta, csa->p, csa->p_flag, csa->q, tcol); +#else + spx_update_beta_s(lp, beta, csa->p, csa->p_flag, csa->q, + &csa->tcol); +#endif csa->beta_st = 2; /* p < 0 means that xN[q] jumps to its opposite bound */ if (csa->p < 0) @@ -911,15 +1479,42 @@ loop: /* main loop starts here */ /* compute p-th row of inv(B) */ spx_eval_rho(lp, csa->p, rho); /* compute p-th (pivot) row of the simplex table */ +#if 0 /* 11/VI-2017 */ if (at != NULL) spx_eval_trow1(lp, at, rho, trow); else spx_nt_prod(lp, nt, trow, 1, -1.0, rho); +#else + if (at != NULL) + spx_eval_trow1(lp, at, rho, csa->trow.vec); + else + spx_nt_prod(lp, nt, csa->trow.vec, 1, -1.0, rho); + fvs_gather_vec(&csa->trow, DBL_EPSILON); +#endif /* FIXME: tcol[p] and trow[q] should be close to each other */ +#if 0 /* 26/V-2017 by cmatraki */ xassert(trow[csa->q] != 0.0); +#else + if (csa->trow.vec[csa->q] == 0.0) + { if (msg_lev >= GLP_MSG_ERR) + xprintf("Error: trow[q] = 0.0\n"); + csa->p_stat = csa->d_stat = GLP_UNDEF; + ret = GLP_EFAIL; + goto fini; + } +#endif /* update reduced costs of non-basic variables for adjacent * basis */ +#if 1 /* 23/VI-2017 */ + /* dual solution may be invalidated due to long step */ + if (csa->d_st) +#endif +#if 0 /* 11/VI-2017 */ if (spx_update_d(lp, d, csa->p, csa->q, trow, tcol) <= 1e-9) +#else + if (spx_update_d_s(lp, d, csa->p, csa->q, &csa->trow, &csa->tcol) + <= 1e-9) +#endif { /* successful updating */ csa->d_st = 2; if (csa->phase == 1) @@ -940,8 +1535,13 @@ loop: /* main loop starts here */ /* update steepest edge weights for adjacent basis, if used */ if (se != NULL) { if (refct > 0) +#if 0 /* 11/VI-2017 */ { if (spx_update_gamma(lp, se, csa->p, csa->q, trow, tcol) <= 1e-3) +#else /* FIXME: spx_update_gamma_s */ + { if (spx_update_gamma(lp, se, csa->p, csa->q, csa->trow.vec, + csa->tcol.vec) <= 1e-3) +#endif { /* successful updating */ refct--; } @@ -963,11 +1563,31 @@ skip: /* change current basis header to adjacent one */ /* and update factorization of the basis matrix */ if (csa->p > 0) spx_update_invb(lp, csa->p, head[csa->p]); +#if 1 + if (perturb <= 0) + { if (csa->phase == 1) + { int cnt; + /* adjust penalty function coefficients */ + cnt = adjust_penalty(csa, csa->tcol.nnz, csa->tcol.ind, + 0.99 * tol_bnd, 0.99 * tol_bnd1); + if (cnt) + { /* some coefficients were changed, so invalidate reduced + * costs of non-basic variables */ + /*xprintf("... cnt = %d\n", cnt);*/ + csa->d_st = 0; + } + } + } + else + { /* FIXME */ + play_bounds(csa, 0); + } +#endif /* simplex iteration complete */ csa->it_cnt++; goto loop; fini: /* restore original objective function */ - memcpy(c, csa->c, (1+n) * sizeof(double)); + memcpy(c, csa->orig_c, (1+n) * sizeof(double)); /* compute reduced costs of non-basic variables and determine * solution dual status, if necessary */ if (csa->p_stat != GLP_UNDEF && csa->d_stat == GLP_UNDEF) @@ -982,23 +1602,23 @@ fini: /* restore original objective function */ } int spx_primal(glp_prob *P, const glp_smcp *parm) -{ /* driver to primal simplex method */ +{ /* driver to the primal simplex method */ struct csa csa_, *csa = &csa_; SPXLP lp; -#if USE_AT SPXAT at; -#else SPXNT nt; -#endif SPXSE se; int ret, *map, *daeh; +#if SCALE_Z + int i, j, k; +#endif /* build working LP and its initial basis */ memset(csa, 0, sizeof(struct csa)); csa->lp = &lp; - spx_init_lp(csa->lp, P, EXCL); + spx_init_lp(csa->lp, P, parm->excl); spx_alloc_lp(csa->lp); map = talloc(1+P->m+P->n, int); - spx_build_lp(csa->lp, P, EXCL, SHIFT, map); + spx_build_lp(csa->lp, P, parm->excl, parm->shift, map); spx_build_basis(csa->lp, P, map); switch (P->dir) { case GLP_MIN: @@ -1010,22 +1630,50 @@ int spx_primal(glp_prob *P, const glp_smcp *parm) default: xassert(P != P); } - csa->c = talloc(1+csa->lp->n, double); - memcpy(csa->c, csa->lp->c, (1+csa->lp->n) * sizeof(double)); -#if USE_AT - /* build matrix A in row-wise format */ - csa->at = &at; - csa->nt = NULL; - spx_alloc_at(csa->lp, csa->at); - spx_build_at(csa->lp, csa->at); +#if SCALE_Z + csa->fz = 0.0; + for (k = 1; k <= csa->lp->n; k++) + { double t = fabs(csa->lp->c[k]); + if (csa->fz < t) + csa->fz = t; + } + if (csa->fz <= 1000.0) + csa->fz = 1.0; + else + csa->fz /= 1000.0; + /*xprintf("csa->fz = %g\n", csa->fz);*/ + for (k = 0; k <= csa->lp->n; k++) + csa->lp->c[k] /= csa->fz; +#endif + csa->orig_c = talloc(1+csa->lp->n, double); + memcpy(csa->orig_c, csa->lp->c, (1+csa->lp->n) * sizeof(double)); +#if 1 /*PERTURB*/ + csa->orig_l = talloc(1+csa->lp->n, double); + memcpy(csa->orig_l, csa->lp->l, (1+csa->lp->n) * sizeof(double)); + csa->orig_u = talloc(1+csa->lp->n, double); + memcpy(csa->orig_u, csa->lp->u, (1+csa->lp->n) * sizeof(double)); #else - /* build matrix N in row-wise format for initial basis */ - csa->at = NULL; - csa->nt = &nt; - spx_alloc_nt(csa->lp, csa->nt); - spx_init_nt(csa->lp, csa->nt); - spx_build_nt(csa->lp, csa->nt); + csa->orig_l = csa->orig_u = NULL; #endif + switch (parm->aorn) + { case GLP_USE_AT: + /* build matrix A in row-wise format */ + csa->at = &at; + csa->nt = NULL; + spx_alloc_at(csa->lp, csa->at); + spx_build_at(csa->lp, csa->at); + break; + case GLP_USE_NT: + /* build matrix N in row-wise format for initial basis */ + csa->at = NULL; + csa->nt = &nt; + spx_alloc_nt(csa->lp, csa->nt); + spx_init_nt(csa->lp, csa->nt); + spx_build_nt(csa->lp, csa->nt); + break; + default: + xassert(parm != parm); + } /* allocate and initialize working components */ csa->phase = 0; csa->beta = talloc(1+csa->lp->m, double); @@ -1044,21 +1692,53 @@ int spx_primal(glp_prob *P, const glp_smcp *parm) xassert(parm != parm); } csa->list = talloc(1+csa->lp->n-csa->lp->m, int); +#if 0 /* 11/VI-2017 */ csa->tcol = talloc(1+csa->lp->m, double); csa->trow = talloc(1+csa->lp->n-csa->lp->m, double); +#else + fvs_alloc_vec(&csa->tcol, csa->lp->m); + fvs_alloc_vec(&csa->trow, csa->lp->n-csa->lp->m); +#endif +#if 1 /* 23/VI-2017 */ + csa->bp = NULL; +#endif +#if 0 /* 09/VII-2017 */ csa->work = talloc(1+csa->lp->m, double); +#else + fvs_alloc_vec(&csa->work, csa->lp->m); +#endif /* initialize control parameters */ csa->msg_lev = parm->msg_lev; +#if 0 /* 23/VI-2017 */ switch (parm->r_test) { case GLP_RT_STD: csa->harris = 0; break; case GLP_RT_HAR: +#if 1 /* 16/III-2016 */ + case GLP_RT_FLIP: + /* FIXME */ + /* currently for primal simplex GLP_RT_FLIP is equivalent + * to GLP_RT_HAR */ +#endif csa->harris = 1; break; default: xassert(parm != parm); } +#else + switch (parm->r_test) + { case GLP_RT_STD: + case GLP_RT_HAR: + break; + case GLP_RT_FLIP: + csa->bp = talloc(1+2*csa->lp->m+1, SPXBP); + break; + default: + xassert(parm != parm); + } + csa->r_test = parm->r_test; +#endif csa->tol_bnd = parm->tol_bnd; csa->tol_bnd1 = .001 * parm->tol_bnd; csa->tol_dj = parm->tol_dj; @@ -1072,7 +1752,16 @@ int spx_primal(glp_prob *P, const glp_smcp *parm) csa->tm_beg = xtime(); csa->it_beg = csa->it_cnt = P->it_cnt; csa->it_dpy = -1; +#if 1 /* 15/VII-2017 */ + csa->tm_dpy = 0.0; +#endif csa->inv_cnt = 0; +#if 1 /* 01/VII-2017 */ + csa->degen = 0; +#endif +#if 1 /* 23/VI-2017 */ + csa->ns_cnt = csa->ls_cnt = 0; +#endif /* try to solve working LP */ ret = primal_simplex(csa); /* return basis factorization back to problem object */ @@ -1091,11 +1780,26 @@ int spx_primal(glp_prob *P, const glp_smcp *parm) spx_store_basis(csa->lp, P, map, daeh); /* compute simplex multipliers for final basic solution found by * the solver */ +#if 0 /* 09/VII-2017 */ spx_eval_pi(csa->lp, csa->work); +#else + spx_eval_pi(csa->lp, csa->work.vec); +#endif /* convert working LP solution to original LP solution and store - * it to problem object */ + * it into the problem object */ +#if SCALE_Z + for (i = 1; i <= csa->lp->m; i++) + csa->work.vec[i] *= csa->fz; + for (j = 1; j <= csa->lp->n-csa->lp->m; j++) + csa->d[j] *= csa->fz; +#endif +#if 0 /* 09/VII-2017 */ spx_store_sol(csa->lp, P, SHIFT, map, daeh, csa->beta, csa->work, csa->d); +#else + spx_store_sol(csa->lp, P, parm->shift, map, daeh, csa->beta, + csa->work.vec, csa->d); +#endif tfree(daeh); /* save simplex iteration count */ P->it_cnt = csa->it_cnt; @@ -1119,7 +1823,11 @@ int spx_primal(glp_prob *P, const glp_smcp *parm) skip: /* deallocate working objects and arrays */ spx_free_lp(csa->lp); tfree(map); - tfree(csa->c); + tfree(csa->orig_c); +#if 1 /*PERTURB*/ + tfree(csa->orig_l); + tfree(csa->orig_u); +#endif if (csa->at != NULL) spx_free_at(csa->lp, csa->at); if (csa->nt != NULL) @@ -1129,9 +1837,22 @@ skip: /* deallocate working objects and arrays */ if (csa->se != NULL) spx_free_se(csa->lp, csa->se); tfree(csa->list); +#if 0 /* 11/VI-2017 */ tfree(csa->tcol); tfree(csa->trow); +#else + fvs_free_vec(&csa->tcol); + fvs_free_vec(&csa->trow); +#endif +#if 1 /* 23/VI-2017 */ + if (csa->bp != NULL) + tfree(csa->bp); +#endif +#if 0 /* 09/VII-2017 */ tfree(csa->work); +#else + fvs_free_vec(&csa->work); +#endif /* return to calling program */ return ret; } diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spxprob.c b/resources/3rdparty/glpk-4.65/src/simplex/spxprob.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/simplex/spxprob.c rename to resources/3rdparty/glpk-4.65/src/simplex/spxprob.c diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spxprob.h b/resources/3rdparty/glpk-4.65/src/simplex/spxprob.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/simplex/spxprob.h rename to resources/3rdparty/glpk-4.65/src/simplex/spxprob.h diff --git a/resources/3rdparty/glpk-4.65/src/simplex/spychuzc.c b/resources/3rdparty/glpk-4.65/src/simplex/spychuzc.c new file mode 100644 index 000000000..b92212988 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/src/simplex/spychuzc.c @@ -0,0 +1,567 @@ +/* spychuzc.c */ + +/*********************************************************************** +* This code is part of GLPK (GNU Linear Programming Kit). +* +* Copyright (C) 2015-2018 Andrew Makhorin, Department for Applied +* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights +* reserved. E-mail: . +* +* GLPK is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GLPK is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +* License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GLPK. If not, see . +***********************************************************************/ + +#include "env.h" +#include "spychuzc.h" + +/*********************************************************************** +* spy_chuzc_std - choose non-basic variable (dual textbook ratio test) +* +* This routine implements an improved dual textbook ratio test to +* choose non-basic variable xN[q]. +* +* Current reduced costs of non-basic variables should be placed in the +* array locations d[1], ..., d[n-m]. Note that d[j] is a value of dual +* basic variable lambdaN[j] in the current basis. +* +#if 0 (* 14/III-2016 *) +* The parameter s specifies the sign of bound violation for basic +* variable xB[p] chosen: s = +1.0 means that xB[p] violates its lower +* bound, so dual non-basic variable lambdaB[p] = lambda^+B[p] +* increases, and s = -1.0 means that xB[p] violates its upper bound, +* so dual non-basic variable lambdaB[p] = lambda^-B[p] decreases. +* (Thus, the dual ray parameter theta = s * lambdaB[p] >= 0.) +#else +* The parameter r specifies the bound violation for basic variable +* xB[p] chosen: +* +* r = lB[p] - beta[p] > 0 means that xB[p] violates its lower bound, +* so dual non-basic variable lambdaB[p] = lambda^+B[p] increases; and +* +* r = uB[p] - beta[p] < 0 means that xB[p] violates its upper bound, +* so dual non-basic variable lambdaB[p] = lambda^-B[p] decreases. +* +* (Note that r is the dual reduced cost of lambdaB[p].) +#endif +* +* Elements of p-th simplex table row t[p] = (t[p,j]) corresponding +* to basic variable xB[p] should be placed in the array locations +* trow[1], ..., trow[n-m]. +* +* The parameter tol_piv specifies a tolerance for elements of the +* simplex table row t[p]. If |t[p,j]| < tol_piv, dual basic variable +* lambdaN[j] is skipped, i.e. it is assumed that it does not depend on +* the dual ray parameter theta. +* +* The parameters tol and tol1 specify tolerances used to increase the +* choice freedom by simulating an artificial degeneracy as follows. +* If lambdaN[j] = lambda^+N[j] >= 0 and d[j] <= +delta[j], or if +* lambdaN[j] = lambda^-N[j] <= 0 and d[j] >= -delta[j], where +* delta[j] = tol + tol1 * |cN[j]|, cN[j] is objective coefficient at +* xN[j], then it is assumed that reduced cost d[j] is equal to zero. +* +* The routine determines the index 1 <= q <= n-m of non-basic variable +* xN[q], for which corresponding dual basic variable lambda^+N[j] or +* lambda^-N[j] reaches its zero bound first on increasing the dual ray +* parameter theta, and returns p on exit. And if theta may increase +* unlimitedly, the routine returns zero. */ + +int spy_chuzc_std(SPXLP *lp, const double d[/*1+n-m*/], +#if 0 /* 14/III-2016 */ + double s, const double trow[/*1+n-m*/], double tol_piv, +#else + double r, const double trow[/*1+n-m*/], double tol_piv, +#endif + double tol, double tol1) +{ int m = lp->m; + int n = lp->n; + double *c = lp->c; + double *l = lp->l; + double *u = lp->u; + int *head = lp->head; + char *flag = lp->flag; + int j, k, q; + double alfa, biga, delta, teta, teta_min; +#if 0 /* 14/III-2016 */ + xassert(s == +1.0 || s == -1.0); +#else + double s; + xassert(r != 0.0); + s = (r > 0.0 ? +1.0 : -1.0); +#endif + /* nothing is chosen so far */ + q = 0, teta_min = DBL_MAX, biga = 0.0; + /* walk thru the list of non-basic variables */ + for (j = 1; j <= n-m; j++) + { k = head[m+j]; /* x[k] = xN[j] */ + /* if xN[j] is fixed variable, skip it */ + if (l[k] == u[k]) + continue; + alfa = s * trow[j]; + if (alfa >= +tol_piv && !flag[j]) + { /* xN[j] is either free or has its lower bound active, so + * lambdaN[j] = d[j] >= 0 decreases down to zero */ + delta = tol + tol1 * (c[k] >= 0.0 ? +c[k] : -c[k]); + /* determine theta on which lambdaN[j] reaches zero */ + teta = (d[j] < +delta ? 0.0 : d[j] / alfa); + } + else if (alfa <= -tol_piv && (l[k] == -DBL_MAX || flag[j])) + { /* xN[j] is either free or has its upper bound active, so + * lambdaN[j] = d[j] <= 0 increases up to zero */ + delta = tol + tol1 * (c[k] >= 0.0 ? +c[k] : -c[k]); + /* determine theta on which lambdaN[j] reaches zero */ + teta = (d[j] > -delta ? 0.0 : d[j] / alfa); + } + else + { /* lambdaN[j] cannot reach zero on increasing theta */ + continue; + } + /* choose non-basic variable xN[q] by corresponding dual basic + * variable lambdaN[q] for which theta is minimal */ + xassert(teta >= 0.0); + alfa = (alfa >= 0.0 ? +alfa : -alfa); + if (teta_min > teta || (teta_min == teta && biga < alfa)) + q = j, teta_min = teta, biga = alfa; + } + return q; +} + +/*********************************************************************** +* spy_chuzc_harris - choose non-basic var. (dual Harris' ratio test) +* +* This routine implements dual Harris' ratio test to choose non-basic +* variable xN[q]. +* +* All the parameters, except tol and tol1, as well as the returned +* value have the same meaning as for the routine spx_chuzr_std (see +* above). +* +* The parameters tol and tol1 specify tolerances on zero bound +* violations for reduced costs of non-basic variables. For reduced +* cost d[j] the tolerance is delta[j] = tol + tol1 |cN[j]|, where +* cN[j] is objective coefficient at non-basic variable xN[j]. */ + +int spy_chuzc_harris(SPXLP *lp, const double d[/*1+n-m*/], +#if 0 /* 14/III-2016 */ + double s, const double trow[/*1+n-m*/], double tol_piv, +#else + double r, const double trow[/*1+n-m*/], double tol_piv, +#endif + double tol, double tol1) +{ int m = lp->m; + int n = lp->n; + double *c = lp->c; + double *l = lp->l; + double *u = lp->u; + int *head = lp->head; + char *flag = lp->flag; + int j, k, q; + double alfa, biga, delta, teta, teta_min; +#if 0 /* 14/III-2016 */ + xassert(s == +1.0 || s == -1.0); +#else + double s; + xassert(r != 0.0); + s = (r > 0.0 ? +1.0 : -1.0); +#endif + /*--------------------------------------------------------------*/ + /* first pass: determine teta_min for relaxed bounds */ + /*--------------------------------------------------------------*/ + teta_min = DBL_MAX; + /* walk thru the list of non-basic variables */ + for (j = 1; j <= n-m; j++) + { k = head[m+j]; /* x[k] = xN[j] */ + /* if xN[j] is fixed variable, skip it */ + if (l[k] == u[k]) + continue; + alfa = s * trow[j]; + if (alfa >= +tol_piv && !flag[j]) + { /* xN[j] is either free or has its lower bound active, so + * lambdaN[j] = d[j] >= 0 decreases down to zero */ + delta = tol + tol1 * (c[k] >= 0.0 ? +c[k] : -c[k]); + /* determine theta on which lambdaN[j] reaches -delta */ + teta = ((d[j] < 0.0 ? 0.0 : d[j]) + delta) / alfa; + } + else if (alfa <= -tol_piv && (l[k] == -DBL_MAX || flag[j])) + { /* xN[j] is either free or has its upper bound active, so + * lambdaN[j] = d[j] <= 0 increases up to zero */ + delta = tol + tol1 * (c[k] >= 0.0 ? +c[k] : -c[k]); + /* determine theta on which lambdaN[j] reaches +delta */ + teta = ((d[j] > 0.0 ? 0.0 : d[j]) - delta) / alfa; + } + else + { /* lambdaN[j] cannot reach zero on increasing theta */ + continue; + } + xassert(teta >= 0.0); + if (teta_min > teta) + teta_min = teta; + } + /*--------------------------------------------------------------*/ + /* second pass: choose non-basic variable xN[q] */ + /*--------------------------------------------------------------*/ + if (teta_min == DBL_MAX) + { /* theta may increase unlimitedly */ + q = 0; + goto done; + } + /* nothing is chosen so far */ + q = 0, biga = 0.0; + /* walk thru the list of non-basic variables */ + for (j = 1; j <= n-m; j++) + { k = head[m+j]; /* x[k] = xN[j] */ + /* if xN[j] is fixed variable, skip it */ + if (l[k] == u[k]) + continue; + alfa = s * trow[j]; + if (alfa >= +tol_piv && !flag[j]) + { /* xN[j] is either free or has its lower bound active, so + * lambdaN[j] = d[j] >= 0 decreases down to zero */ + /* determine theta on which lambdaN[j] reaches zero */ + teta = d[j] / alfa; + } + else if (alfa <= -tol_piv && (l[k] == -DBL_MAX || flag[j])) + { /* xN[j] is either free or has its upper bound active, so + * lambdaN[j] = d[j] <= 0 increases up to zero */ + /* determine theta on which lambdaN[j] reaches zero */ + teta = d[j] / alfa; + } + else + { /* lambdaN[j] cannot reach zero on increasing theta */ + continue; + } + /* choose non-basic variable for which theta is not greater + * than theta_min determined for relaxed bounds and which has + * best (largest in magnitude) pivot */ + alfa = (alfa >= 0.0 ? +alfa : -alfa); + if (teta <= teta_min && biga < alfa) + q = j, biga = alfa; + } + /* something must be chosen */ + xassert(1 <= q && q <= n-m); +done: return q; +} + +#if 0 /* 23/III-2016 */ +/*********************************************************************** +* spy_eval_bp - determine dual objective function break-points +* +* This routine determines the dual objective function break-points. +* +* The parameters lp, d, r, trow, and tol_piv have the same meaning as +* for the routine spx_chuzc_std (see above). +* +* On exit the routine stores the break-points determined to the array +* elements bp[1], ..., bp[num], where 0 <= num <= n-m is the number of +* break-points returned by the routine. +* +* The break-points stored in the array bp are ordered by ascending +* the ray parameter teta >= 0. The break-points numbered 1, ..., num-1 +* always correspond to non-basic non-fixed variables xN[j] of primal +* LP having both lower and upper bounds while the last break-point +* numbered num may correspond to a non-basic variable having only one +* lower or upper bound, if such variable prevents further increasing +* of the ray parameter teta. Besides, the routine includes in the +* array bp only the break-points that correspond to positive increment +* of the dual objective. */ + +static int CDECL fcmp(const void *v1, const void *v2) +{ const SPYBP *p1 = v1, *p2 = v2; + if (p1->teta < p2->teta) + return -1; + else if (p1->teta > p2->teta) + return +1; + else + return 0; +} + +int spy_eval_bp(SPXLP *lp, const double d[/*1+n-m*/], + double r, const double trow[/*1+n-m*/], double tol_piv, + SPYBP bp[/*1+n-m*/]) +{ int m = lp->m; + int n = lp->n; + double *l = lp->l; + double *u = lp->u; + int *head = lp->head; + char *flag = lp->flag; + int j, j_max, k, t, nnn, num; + double s, alfa, teta, teta_max, dz, v; + xassert(r != 0.0); + s = (r > 0.0 ? +1.0 : -1.0); + /* build the list of all dual basic variables lambdaN[j] that + * can reach zero on increasing the ray parameter teta >= 0 */ + num = 0; + /* walk thru the list of non-basic variables */ + for (j = 1; j <= n-m; j++) + { k = head[m+j]; /* x[k] = xN[j] */ + /* if xN[j] is fixed variable, skip it */ + if (l[k] == u[k]) + continue; + alfa = s * trow[j]; + if (alfa >= +tol_piv && !flag[j]) + { /* xN[j] is either free or has its lower bound active, so + * lambdaN[j] = d[j] >= 0 decreases down to zero */ + /* determine teta[j] on which lambdaN[j] reaches zero */ + teta = (d[j] < 0.0 ? 0.0 : d[j] / alfa); + } + else if (alfa <= -tol_piv && (l[k] == -DBL_MAX || flag[j])) + { /* xN[j] is either free or has its upper bound active, so + * lambdaN[j] = d[j] <= 0 increases up to zero */ + /* determine teta[j] on which lambdaN[j] reaches zero */ + teta = (d[j] > 0.0 ? 0.0 : d[j] / alfa); + } + else + { /* lambdaN[j] cannot reach zero on increasing teta */ + continue; + } + /* add lambdaN[j] to the list */ + num++; + bp[num].j = j; + bp[num].teta = teta; + } + if (num == 0) + { /* dual unboundedness */ + goto done; + } + /* determine "blocking" dual basic variable lambdaN[j_max] that + * prevents increasing teta more than teta_max */ + j_max = 0, teta_max = DBL_MAX; + for (t = 1; t <= num; t++) + { j = bp[t].j; + k = head[m+j]; /* x[k] = xN[j] */ + if (l[k] == -DBL_MAX || u[k] == +DBL_MAX) + { /* lambdaN[j] cannot intersect zero */ + if (j_max == 0 + || teta_max > bp[t].teta + || (teta_max == bp[t].teta + && fabs(trow[j_max]) < fabs(trow[j]))) + j_max = j, teta_max = bp[t].teta; + } + } + /* keep in the list only dual basic variables lambdaN[j] that + * correspond to primal double-bounded variables xN[j] and whose + * teta[j] is not greater than teta_max */ + nnn = 0; + for (t = 1; t <= num; t++) + { j = bp[t].j; + k = head[m+j]; /* x[k] = xN[j] */ + if (l[k] != -DBL_MAX && u[k] != +DBL_MAX + && bp[t].teta <= teta_max) + { nnn++; + bp[nnn].j = j; + bp[nnn].teta = bp[t].teta; + } + } + num = nnn; + /* sort break-points by ascending teta[j] */ + qsort(&bp[1], num, sizeof(SPYBP), fcmp); + /* add lambdaN[j_max] to the end of the list */ + if (j_max != 0) + { xassert(num < n-m); + num++; + bp[num].j = j_max; + bp[num].teta = teta_max; + } + /* compute increments of the dual objective at all break-points + * (relative to its value at teta = 0) */ + dz = 0.0; /* dual objective increment */ + v = fabs(r); /* dual objective slope d zeta / d teta */ + for (t = 1; t <= num; t++) + { /* compute increment at current break-point */ + dz += v * (bp[t].teta - (t == 1 ? 0.0 : bp[t-1].teta)); + if (dz < 0.001) + { /* break-point with non-positive increment reached */ + num = t - 1; + break; + } + bp[t].dz = dz; + /* compute next slope on the right to current break-point */ + if (t < num) + { j = bp[t].j; + k = head[m+j]; /* x[k] = xN[j] */ + xassert(-DBL_MAX < l[k] && l[k] < u[k] && u[k] < +DBL_MAX); + v -= fabs(trow[j]) * (u[k] - l[k]); + } + } +done: return num; +} +#endif + +/*********************************************************************** +* spy_ls_eval_bp - determine dual objective function break-points +* +* This routine determines the dual objective function break-points. +* +* The parameters lp, d, r, trow, and tol_piv have the same meaning as +* for the routine spx_chuzc_std (see above). +* +* The routine stores the break-points determined to the array elements +* bp[1], ..., bp[nbp] in *arbitrary* order, where 0 <= nbp <= n-m is +* the number of break-points returned by the routine on exit. */ + +int spy_ls_eval_bp(SPXLP *lp, const double d[/*1+n-m*/], + double r, const double trow[/*1+n-m*/], double tol_piv, + SPYBP bp[/*1+n-m*/]) +{ int m = lp->m; + int n = lp->n; + double *l = lp->l; + double *u = lp->u; + int *head = lp->head; + char *flag = lp->flag; + int j, k, t, nnn, nbp; + double s, alfa, teta, teta_max; + xassert(r != 0.0); + s = (r > 0.0 ? +1.0 : -1.0); + /* build the list of all dual basic variables lambdaN[j] that + * can reach zero on increasing the ray parameter teta >= 0 */ + nnn = 0, teta_max = DBL_MAX; + /* walk thru the list of non-basic variables */ + for (j = 1; j <= n-m; j++) + { k = head[m+j]; /* x[k] = xN[j] */ + /* if xN[j] is fixed variable, skip it */ + if (l[k] == u[k]) + continue; + alfa = s * trow[j]; + if (alfa >= +tol_piv && !flag[j]) + { /* xN[j] is either free or has its lower bound active, so + * lambdaN[j] = d[j] >= 0 decreases down to zero */ + /* determine teta[j] on which lambdaN[j] reaches zero */ + teta = (d[j] < 0.0 ? 0.0 : d[j] / alfa); + /* if xN[j] has no upper bound, lambdaN[j] cannot become + * negative and thereby blocks further increasing teta */ + if (u[k] == +DBL_MAX && teta_max > teta) + teta_max = teta; + } + else if (alfa <= -tol_piv && (l[k] == -DBL_MAX || flag[j])) + { /* xN[j] is either free or has its upper bound active, so + * lambdaN[j] = d[j] <= 0 increases up to zero */ + /* determine teta[j] on which lambdaN[j] reaches zero */ + teta = (d[j] > 0.0 ? 0.0 : d[j] / alfa); + /* if xN[j] has no lower bound, lambdaN[j] cannot become + * positive and thereby blocks further increasing teta */ + if (l[k] == -DBL_MAX && teta_max > teta) + teta_max = teta; + } + else + { /* lambdaN[j] cannot reach zero on increasing teta */ + continue; + } + /* add lambdaN[j] to the list */ + nnn++; + bp[nnn].j = j; + bp[nnn].teta = teta; + } + /* remove from the list all dual basic variables lambdaN[j], for + * which teta[j] > teta_max */ + nbp = 0; + for (t = 1; t <= nnn; t++) + { if (bp[t].teta <= teta_max + 1e-6) + { nbp++; + bp[nbp].j = bp[t].j; + bp[nbp].teta = bp[t].teta; + } + } + return nbp; +} + +/*********************************************************************** +* spy_ls_select_bp - select and process dual objective break-points +* +* This routine selects a next portion of the dual objective function +* break-points and processes them. +* +* On entry to the routine it is assumed that break-points bp[1], ..., +* bp[num] are already processed, and slope is the dual objective slope +* to the right of the last processed break-point bp[num]. (Initially, +* when num = 0, slope should be specified as fabs(r), where r has the +* same meaning as above.) +* +* The routine selects break-points among bp[num+1], ..., bp[nbp], for +* which teta <= teta_lim, and moves these break-points to the array +* elements bp[num+1], ..., bp[num1], where num <= num1 <= n-m is the +* new number of processed break-points returned by the routine on +* exit. Then the routine sorts these break-points by ascending teta +* and computes the change of the dual objective function relative to +* its value at teta = 0. +* +* On exit the routine also replaces the parameter slope with a new +* value that corresponds to the new last break-point bp[num1]. */ + +static int CDECL fcmp(const void *v1, const void *v2) +{ const SPYBP *p1 = v1, *p2 = v2; + if (p1->teta < p2->teta) + return -1; + else if (p1->teta > p2->teta) + return +1; + else + return 0; +} + +int spy_ls_select_bp(SPXLP *lp, const double trow[/*1+n-m*/], + int nbp, SPYBP bp[/*1+n-m*/], int num, double *slope, double + teta_lim) +{ int m = lp->m; + int n = lp->n; + double *l = lp->l; + double *u = lp->u; + int *head = lp->head; + int j, k, t, num1; + double teta, dz; + xassert(0 <= num && num <= nbp && nbp <= n-m); + /* select a new portion of break-points */ + num1 = num; + for (t = num+1; t <= nbp; t++) + { if (bp[t].teta <= teta_lim) + { /* move break-point to the beginning of the new portion */ + num1++; + j = bp[num1].j, teta = bp[num1].teta; + bp[num1].j = bp[t].j, bp[num1].teta = bp[t].teta; + bp[t].j = j, bp[t].teta = teta; + } + } + /* sort new break-points bp[num+1], ..., bp[num1] by ascending + * the ray parameter teta */ + if (num1 - num > 1) + qsort(&bp[num+1], num1 - num, sizeof(SPYBP), fcmp); + /* calculate the dual objective change at the new break-points */ + for (t = num+1; t <= num1; t++) + { /* calculate the dual objective change relative to its value + * at break-point bp[t-1] */ + if (*slope == -DBL_MAX) + dz = -DBL_MAX; + else + dz = (*slope) * + (bp[t].teta - (t == 1 ? 0.0 : bp[t-1].teta)); + /* calculate the dual objective change relative to its value + * at teta = 0 */ + if (dz == -DBL_MAX) + bp[t].dz = -DBL_MAX; + else + bp[t].dz = (t == 1 ? 0.0 : bp[t-1].dz) + dz; + /* calculate a new slope of the dual objective to the right of + * the current break-point bp[t] */ + if (*slope != -DBL_MAX) + { j = bp[t].j; + k = head[m+j]; /* x[k] = xN[j] */ + if (l[k] == -DBL_MAX || u[k] == +DBL_MAX) + *slope = -DBL_MAX; /* blocking break-point reached */ + else + { xassert(l[k] < u[k]); + *slope -= fabs(trow[j]) * (u[k] - l[k]); + } + } + } + return num1; +} + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spychuzc.h b/resources/3rdparty/glpk-4.65/src/simplex/spychuzc.h similarity index 51% rename from resources/3rdparty/glpk-4.57/src/simplex/spychuzc.h rename to resources/3rdparty/glpk-4.65/src/simplex/spychuzc.h index 751e64dda..8aa45a072 100644 --- a/resources/3rdparty/glpk-4.57/src/simplex/spychuzc.h +++ b/resources/3rdparty/glpk-4.65/src/simplex/spychuzc.h @@ -3,7 +3,7 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2015 Andrew Makhorin, Department for Applied +* Copyright (C) 2015-2016 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -28,16 +28,58 @@ #define spy_chuzc_std _glp_spy_chuzc_std int spy_chuzc_std(SPXLP *lp, const double d[/*1+n-m*/], +#if 0 /* 14/III-2016 */ double s, const double trow[/*1+n-m*/], double tol_piv, +#else + double r, const double trow[/*1+n-m*/], double tol_piv, +#endif double tol, double tol1); /* choose non-basic variable (dual textbook ratio test) */ #define spy_chuzc_harris _glp_spy_chuzc_harris int spy_chuzc_harris(SPXLP *lp, const double d[/*1+n-m*/], +#if 0 /* 14/III-2016 */ double s, const double trow[/*1+n-m*/], double tol_piv, +#else + double r, const double trow[/*1+n-m*/], double tol_piv, +#endif double tol, double tol1); /* choose non-basic variable (dual Harris' ratio test) */ +typedef struct SPYBP SPYBP; + +struct SPYBP +{ /* dual objective function break point */ + int j; + /* dual basic variable lambdaN[j], 1 <= j <= n-m, that intersects + * zero at this break point */ + double teta; + /* ray parameter value, teta[j] >= 0, at this break point */ + double dz; + /* increment, zeta[j] - zeta[0], of the dual objective function + * at this break point */ +}; + +#if 0 /* 23/III-2016 */ +#define spy_eval_bp _glp_spy_eval_bp +int spy_eval_bp(SPXLP *lp, const double d[/*1+n-m*/], + double r, const double trow[/*1+n-m*/], double tol_piv, + SPYBP bp[/*1+n-m*/]); +/* determine dual objective function break-points */ +#endif + +#define spy_ls_eval_bp _glp_spy_ls_eval_bp +int spy_ls_eval_bp(SPXLP *lp, const double d[/*1+n-m*/], + double r, const double trow[/*1+n-m*/], double tol_piv, + SPYBP bp[/*1+n-m*/]); +/* determine dual objective function break-points */ + +#define spy_ls_select_bp _glp_spy_ls_select_bp +int spy_ls_select_bp(SPXLP *lp, const double trow[/*1+n-m*/], + int nbp, SPYBP bp[/*1+n-m*/], int num, double *slope, double + teta_lim); +/* select and process dual objective break-points */ + #endif /* eof */ diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spychuzr.c b/resources/3rdparty/glpk-4.65/src/simplex/spychuzr.c similarity index 84% rename from resources/3rdparty/glpk-4.57/src/simplex/spychuzr.c rename to resources/3rdparty/glpk-4.65/src/simplex/spychuzr.c index 756ce3e6a..63079c178 100644 --- a/resources/3rdparty/glpk-4.57/src/simplex/spychuzr.c +++ b/resources/3rdparty/glpk-4.65/src/simplex/spychuzr.c @@ -161,10 +161,21 @@ int spy_chuzr_std(SPXLP *lp, const double beta[/*1+m*/], int num, void spy_alloc_se(SPXLP *lp, SPYSE *se) { int m = lp->m; int n = lp->n; +#if 1 /* 30/III-2016 */ + int i; +#endif se->valid = 0; se->refsp = talloc(1+n, char); se->gamma = talloc(1+m, double); se->work = talloc(1+m, double); +#if 1 /* 30/III-2016 */ + se->u.n = m; + se->u.nnz = 0; + se->u.ind = talloc(1+m, int); + se->u.vec = talloc(1+m, double); + for (i = 1; i <= m; i++) + se->u.vec[i] = 0.0; +#endif return; } @@ -389,6 +400,68 @@ double spy_update_gamma(SPXLP *lp, SPYSE *se, int p, int q, return e; } +#if 1 /* 30/III-2016 */ +double spy_update_gamma_s(SPXLP *lp, SPYSE *se, int p, int q, + const FVS *trow, const FVS *tcol) +{ /* sparse version of spy_update_gamma */ + int m = lp->m; + int n = lp->n; + int *head = lp->head; + char *refsp = se->refsp; + double *gamma = se->gamma; + double *u = se->work; + int trow_nnz = trow->nnz; + int *trow_ind = trow->ind; + double *trow_vec = trow->vec; + int tcol_nnz = tcol->nnz; + int *tcol_ind = tcol->ind; + double *tcol_vec = tcol->vec; + int i, j, k, t, ptr, end; + double gamma_p, delta_p, e, r, t1, t2; + xassert(se->valid); + xassert(1 <= p && p <= m); + xassert(1 <= q && q <= n-m); + /* compute gamma[p] in current basis more accurately; also + * compute auxiliary vector u */ + k = head[p]; /* x[k] = xB[p] */ + gamma_p = delta_p = (refsp[k] ? 1.0 : 0.0); + for (i = 1; i <= m; i++) + u[i] = 0.0; + for (t = 1; t <= trow_nnz; t++) + { j = trow_ind[t]; + k = head[m+j]; /* x[k] = xN[j] */ + if (refsp[k]) + { gamma_p += trow_vec[j] * trow_vec[j]; + /* u := u + T[p,j] * N[j], where N[j] = A[k] is constraint + * matrix column corresponding to xN[j] */ + ptr = lp->A_ptr[k]; + end = lp->A_ptr[k+1]; + for (; ptr < end; ptr++) + u[lp->A_ind[ptr]] += trow_vec[j] * lp->A_val[ptr]; + } + } + bfd_ftran(lp->bfd, u); + /* compute relative error in gamma[p] */ + e = fabs(gamma_p - gamma[p]) / (1.0 + gamma_p); + /* compute new gamma[p] */ + gamma[p] = gamma_p / (tcol_vec[p] * tcol_vec[p]); + /* compute new gamma[i] for all i != p */ + for (t = 1; t <= tcol_nnz; t++) + { i = tcol_ind[t]; + if (i == p) + continue; + /* compute r[i] = T[i,q] / T[p,q] */ + r = tcol_vec[i] / tcol_vec[p]; + /* compute new gamma[i] */ + t1 = gamma[i] + r * (r * gamma_p + u[i] + u[i]); + k = head[i]; /* x[k] = xB[i] */ + t2 = (refsp[k] ? 1.0 : 0.0) + delta_p * r * r; + gamma[i] = (t1 >= t2 ? t1 : t2); + } + return e; +} +#endif + /*********************************************************************** * spy_free_se - deallocate dual pricing data block * @@ -400,6 +473,10 @@ void spy_free_se(SPXLP *lp, SPYSE *se) tfree(se->refsp); tfree(se->gamma); tfree(se->work); +#if 1 /* 30/III-2016 */ + tfree(se->u.ind); + tfree(se->u.vec); +#endif return; } diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spychuzr.h b/resources/3rdparty/glpk-4.65/src/simplex/spychuzr.h similarity index 90% rename from resources/3rdparty/glpk-4.57/src/simplex/spychuzr.h rename to resources/3rdparty/glpk-4.65/src/simplex/spychuzr.h index 5be8192ef..31f01b78a 100644 --- a/resources/3rdparty/glpk-4.57/src/simplex/spychuzr.h +++ b/resources/3rdparty/glpk-4.65/src/simplex/spychuzr.h @@ -53,6 +53,10 @@ struct SPYSE * (r[i] is bound violation for basic variable xB[i]) */ double *work; /* double work[1+m]; */ /* working array */ +#if 1 /* 30/III-2016 */ + FVS u; /* FVS u[1:m]; */ + /* working vector */ +#endif }; #define spy_alloc_se _glp_spy_alloc_se @@ -77,6 +81,13 @@ double spy_update_gamma(SPXLP *lp, SPYSE *se, int p, int q, const double trow[/*1+n-m*/], const double tcol[/*1+m*/]); /* update dual projected steepest edge weights exactly */ +#if 1 /* 30/III-2016 */ +#define spy_update_gamma_s _glp_spy_update_gamma_s +double spy_update_gamma_s(SPXLP *lp, SPYSE *se, int p, int q, + const FVS *trow, const FVS *tcol); +/* sparse version of spy_update_gamma */ +#endif + #define spy_free_se _glp_spy_free_se void spy_free_se(SPXLP *lp, SPYSE *se); /* deallocate dual pricing data block */ diff --git a/resources/3rdparty/glpk-4.57/src/simplex/spydual.c b/resources/3rdparty/glpk-4.65/src/simplex/spydual.c similarity index 54% rename from resources/3rdparty/glpk-4.57/src/simplex/spydual.c rename to resources/3rdparty/glpk-4.65/src/simplex/spydual.c index 9d08fbdc9..89d98db9b 100644 --- a/resources/3rdparty/glpk-4.57/src/simplex/spydual.c +++ b/resources/3rdparty/glpk-4.65/src/simplex/spydual.c @@ -3,7 +3,7 @@ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * -* Copyright (C) 2015 Andrew Makhorin, Department for Applied +* Copyright (C) 2015-2017 Andrew Makhorin, Department for Applied * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights * reserved. E-mail: . * @@ -21,6 +21,10 @@ * along with GLPK. If not, see . ***********************************************************************/ +#if 1 /* 18/VII-2017 */ +#define SCALE_Z 1 +#endif + #include "env.h" #include "simplex.h" #include "spxat.h" @@ -28,19 +32,11 @@ #include "spxprob.h" #include "spychuzc.h" #include "spychuzr.h" - -#define USE_AT 1 -/* 1 - use A in row-wise format - * 0 - use N in row-wise format */ -/* (Looks like using A' provide more accuracy for dual simplex.) */ - -#define EXCL 1 -/* 1 - exclude fixed non-basic variables - * 0 - don't exclude variables */ - -#define SHIFT 1 -/* 1 - shift bounds of variables toward zero - * 0 - don't shift bounds of variables */ +#if 0 /* 11/VI-2017 */ +#if 1 /* 29/III-2016 */ +#include "fvs.h" +#endif +#endif #define CHECK_ACCURACY 0 /* (for debugging) */ @@ -54,11 +50,17 @@ struct csa /* original optimization direction: * +1 - minimization * -1 - maximization */ - double *b; /* double b[1+m]; */ +#if SCALE_Z + double fz; + /* factor used to scale original objective */ +#endif + double *orig_b; /* double orig_b[1+m]; */ /* copy of original right-hand sides */ - double *l; /* double l[1+n]; */ + double *orig_c; /* double orig_c[1+n]; */ + /* copy of original objective coefficients */ + double *orig_l; /* double orig_l[1+n]; */ /* copy of original lower bounds */ - double *u; /* double u[1+n]; */ + double *orig_u; /* double orig_u[1+n]; */ /* copy of original upper bounds */ SPXAT *at; /* mxn-matrix A of constraint coefficients, in sparse row-wise @@ -88,23 +90,49 @@ struct csa SPYSE *se; /* dual projected steepest edge and Devex pricing data block * (NULL if not used) */ +#if 0 /* 30/III-2016 */ int num; /* number of eligible basic variables */ int *list; /* int list[1+m]; */ /* list[1], ..., list[num] are indices i of eligible basic * variables xB[i] */ +#else + FVS r; /* FVS r[1:m]; */ + /* vector of primal infeasibilities */ + /* r->nnz = num; r->ind = list */ + /* vector r has the same status as vector beta (see above) */ +#endif int p; /* xB[p] is a basic variable chosen to leave the basis */ +#if 0 /* 29/III-2016 */ double *trow; /* double trow[1+n-m]; */ +#else + FVS trow; /* FVS trow[1:n-m]; */ +#endif /* p-th (pivot) row of the simplex table */ +#if 1 /* 16/III-2016 */ + SPYBP *bp; /* SPYBP bp[1+n-m]; */ + /* dual objective break-points */ +#endif int q; /* xN[q] is a non-basic variable chosen to enter the basis */ +#if 0 /* 29/III-2016 */ double *tcol; /* double tcol[1+m]; */ +#else + FVS tcol; /* FVS tcol[1:m]; */ +#endif /* q-th (pivot) column of the simplex table */ double *work; /* double work[1+m]; */ /* working array */ double *work1; /* double work1[1+n-m]; */ /* another working array */ +#if 0 /* 11/VI-2017 */ +#if 1 /* 31/III-2016 */ + FVS wrow; /* FVS wrow[1:n-m]; */ + FVS wcol; /* FVS wcol[1:m]; */ + /* working sparse vectors */ +#endif +#endif int p_stat, d_stat; /* primal and dual solution statuses */ /*--------------------------------------------------------------*/ @@ -113,10 +141,18 @@ struct csa /* message level */ int dualp; /* if this flag is set, report failure in case of instability */ +#if 0 /* 16/III-2016 */ int harris; /* dual ratio test technique: * 0 - textbook ratio test * 1 - Harris' two pass ratio test */ +#else + int r_test; + /* dual ratio test technique: + * GLP_RT_STD - textbook ratio test + * GLP_RT_HAR - Harris' two pass ratio test + * GLP_RT_FLIP - long-step (flip-flop) ratio test */ +#endif double tol_bnd, tol_bnd1; /* primal feasibility tolerances */ double tol_dj, tol_dj1; @@ -130,7 +166,11 @@ struct csa int tm_lim; /* time limit, milliseconds */ int out_frq; +#if 0 /* 15/VII-2017 */ /* display output frequency, iterations */ +#else + /* display output frequency, milliseconds */ +#endif int out_dly; /* display output delay, milliseconds */ /*--------------------------------------------------------------*/ @@ -144,8 +184,21 @@ struct csa * basis changes */ int it_dpy; /* simplex iteration count at most recent display output */ +#if 1 /* 15/VII-2017 */ + double tm_dpy; + /* time value at most recent display output */ +#endif int inv_cnt; /* basis factorization count since most recent display output */ +#if 1 /* 11/VII-2017 */ + int degen; + /* count of successive degenerate iterations; this count is used + * to detect stalling */ +#endif +#if 1 /* 23/III-2016 */ + int ns_cnt, ls_cnt; + /* normal and long-step iteration count */ +#endif }; /*********************************************************************** @@ -201,22 +254,24 @@ static void set_art_bounds(struct csa *csa) char *flag = lp->flag; double *d = csa->d; int i, j, k; +#if 1 /* 31/III-2016: FIXME */ /* set artificial right-hand sides */ for (i = 1; i <= m; i++) b[i] = 0.0; /* set artificial bounds depending on types of variables */ for (k = 1; k <= n; k++) - { if (csa->l[k] == -DBL_MAX && csa->u[k] == +DBL_MAX) + { if (csa->orig_l[k] == -DBL_MAX && csa->orig_u[k] == +DBL_MAX) { /* force free variables to enter the basis */ l[k] = -1e3, u[k] = +1e3; } - else if (csa->l[k] != -DBL_MAX && csa->u[k] == +DBL_MAX) + else if (csa->orig_l[k] != -DBL_MAX && csa->orig_u[k] == +DBL_MAX) l[k] = 0.0, u[k] = +1.0; - else if (csa->l[k] == -DBL_MAX && csa->u[k] != +DBL_MAX) + else if (csa->orig_l[k] == -DBL_MAX && csa->orig_u[k] != +DBL_MAX) l[k] = -1.0, u[k] = 0.0; else l[k] = u[k] = 0.0; } +#endif /* set active artificial bounds for non-basic variables */ xassert(csa->d_st == 1); for (j = 1; j <= n-m; j++) @@ -238,7 +293,7 @@ static void set_art_bounds(struct csa *csa) * reduced costs d = (d[j]) are used to decide which bound (lower or * upper) should be made active. */ -void set_orig_bounds(struct csa *csa) +static void set_orig_bounds(struct csa *csa) { SPXLP *lp = csa->lp; int m = lp->m; int n = lp->n; @@ -250,10 +305,10 @@ void set_orig_bounds(struct csa *csa) double *d = csa->d; int j, k; /* restore original right-hand sides */ - memcpy(b, csa->b, (1+m) * sizeof(double)); + memcpy(b, csa->orig_b, (1+m) * sizeof(double)); /* restore original bounds of all variables */ - memcpy(l, csa->l, (1+n) * sizeof(double)); - memcpy(u, csa->u, (1+n) * sizeof(double)); + memcpy(l, csa->orig_l, (1+n) * sizeof(double)); + memcpy(u, csa->orig_u, (1+n) * sizeof(double)); /* set active original bounds for non-basic variables */ xassert(csa->d_st == 1); for (j = 1; j <= n-m; j++) @@ -383,7 +438,7 @@ static int check_feas(struct csa *csa, double tol, double tol1, * * err_max = max |x[i] - y[i]| / (1 + |x[i]|). * -* NOTE: This routine is intended only for debugginig purposes. */ +* NOTE: This routine is intended only for debugging purposes. */ static double err_in_vec(int n, const double x[], const double y[]) { int i; @@ -405,7 +460,7 @@ static double err_in_vec(int n, const double x[], const double y[]) * This routine computes and returns maximal relative error in vector * of values of basic variables beta = (beta[i]). * -* NOTE: This routine is intended only for debugginig purposes. */ +* NOTE: This routine is intended only for debugging purposes. */ static double err_in_beta(struct csa *csa) { SPXLP *lp = csa->lp; @@ -419,6 +474,33 @@ static double err_in_beta(struct csa *csa) } #endif +#if CHECK_ACCURACY +static double err_in_r(struct csa *csa) +{ SPXLP *lp = csa->lp; + int m = lp->m; + int i, k; + double err, *r; + r = talloc(1+m, double); + for (i = 1; i <= m; i++) + { k = lp->head[i]; + if (csa->beta[i] < lp->l[k]) + r[i] = lp->l[k] - csa->beta[i]; + else if (csa->beta[i] > lp->u[k]) + r[i] = lp->u[k] - csa->beta[i]; + else + r[i] = 0.0; + +if (fabs(r[i] - csa->r.vec[i]) > 1e-6) +printf("i = %d; r = %g; csa->r = %g\n", i, r[i], csa->r.vec[i]); + + + } + err = err_in_vec(m, r, csa->r.vec); + tfree(r); + return err; +} +#endif + #if CHECK_ACCURACY /*********************************************************************** * err_in_d - compute maximal relative error in vector d @@ -426,7 +508,7 @@ static double err_in_beta(struct csa *csa) * This routine computes and returns maximal relative error in vector * of reduced costs of non-basic variables d = (d[j]). * -* NOTE: This routine is intended only for debugginig purposes. */ +* NOTE: This routine is intended only for debugging purposes. */ static double err_in_d(struct csa *csa) { SPXLP *lp = csa->lp; @@ -453,7 +535,7 @@ static double err_in_d(struct csa *csa) * This routine computes and returns maximal relative error in vector * of projected steepest edge weights gamma = (gamma[j]). * -* NOTE: This routine is intended only for debugginig purposes. */ +* NOTE: This routine is intended only for debugging purposes. */ static double err_in_gamma(struct csa *csa) { SPXLP *lp = csa->lp; @@ -478,23 +560,74 @@ gamma = talloc(1+m, double); * * This routine checks accuracy of current basic solution components. * -* NOTE: This routine is intended only for debugginig purposes. */ +* NOTE: This routine is intended only for debugging purposes. */ static void check_accuracy(struct csa *csa) -{ double e_beta, e_d, e_gamma; +{ double e_beta, e_r, e_d, e_gamma; e_beta = err_in_beta(csa); + e_r = err_in_r(csa); e_d = err_in_d(csa); if (csa->se == NULL) e_gamma = 0.; else e_gamma = err_in_gamma(csa); - xprintf("e_beta = %10.3e; e_d = %10.3e; e_gamma = %10.3e\n", - e_beta, e_d, e_gamma); + xprintf("e_beta = %10.3e; e_r = %10.3e; e_d = %10.3e; e_gamma = %" + "10.3e\n", e_beta, e_r, e_d, e_gamma); xassert(e_beta <= 1e-5 && e_d <= 1e-5 && e_gamma <= 1e-3); return; } #endif +#if 1 /* 30/III-2016 */ +static +void spy_eval_r(SPXLP *lp, const double beta[/*1+m*/], double tol, + double tol1, FVS *r) +{ /* this routine computes the vector of primal infeasibilities: + * + * ( lB[i] - beta[i] > 0, if beta[i] < lb[i] + * r[i] = { 0, if lb[i] <= beta[i] <= ub[i] + * ( ub[i] - beta[i] < 0, if beta[i] > ub[i] + * + * (this routine replaces spy_chuzr_sel) */ + int m = lp->m; + double *l = lp->l; + double *u = lp->u; + int *head = lp->head; + int *ind = r->ind; + double *vec = r->vec; + int i, k, nnz = 0; + double lk, uk, eps; + xassert(r->n == m); + /* walk thru the list of basic variables */ + for (i = 1; i <= m; i++) + { vec[i] = 0.0; + k = head[i]; /* x[k] = xB[i] */ + lk = l[k], uk = u[k]; + /* check primal feasibility */ + if (beta[i] < lk) + { /* determine absolute tolerance eps1[i] */ + eps = tol + tol1 * (lk >= 0.0 ? +lk : -lk); + if (beta[i] < lk - eps) + { /* lower bound is violated */ + ind[++nnz] = i; + vec[i] = lk - beta[i]; + } + } + else if (beta[i] > uk) + { /* determine absolute tolerance eps2[i] */ + eps = tol + tol1 * (uk >= 0.0 ? +uk : -uk); + if (beta[i] > uk + eps) + { /* upper bound is violated */ + ind[++nnz] = i; + vec[i] = uk - beta[i]; + } + } + } + r->nnz = nnz; + return; +} +#endif + /*********************************************************************** * choose_pivot - choose xB[p] and xN[q] * @@ -504,30 +637,54 @@ static void check_accuracy(struct csa *csa) * computes p-th row T[p,*] of the simplex table T[i,j] and chooses * non-basic variable xN[q]. If the pivot T[p,q] is small in magnitude, * the routine attempts to choose another xB[p] and xN[q] in order to -* avoid badly conditioned adjacent bases. */ +* avoid badly conditioned adjacent bases. +* +* If the normal choice was made, the routine returns zero. Otherwise, +* if the long-step choice was made, the routine returns non-zero. */ + +#ifdef TIMING /* 31/III-2016 */ + +#include "choose_pivot.c" + +#else + +#define MIN_RATIO 0.0001 -static void choose_pivot(struct csa *csa) +static int choose_pivot(struct csa *csa) { SPXLP *lp = csa->lp; int m = lp->m; int n = lp->n; double *l = lp->l; + double *u = lp->u; int *head = lp->head; SPXAT *at = csa->at; SPXNT *nt = csa->nt; double *beta = csa->beta; double *d = csa->d; SPYSE *se = csa->se; +#if 0 /* 30/III-2016 */ int *list = csa->list; +#else + int *list = csa->r.ind; +#endif double *rho = csa->work; double *trow = csa->work1; - int nnn, try, k, p, q, t; + SPYBP *bp = csa->bp; + double tol_piv = csa->tol_piv; + int try, nnn, j, k, p, q, t, t_best, nbp, ret; + double big, temp, r, best_ratio, dz_best; xassert(csa->beta_st); xassert(csa->d_st); - /* initial number of eligible basic variables */ +more: /* initial number of eligible basic variables */ +#if 0 /* 30/III-2016 */ nnn = csa->num; +#else + nnn = csa->r.nnz; +#endif /* nothing has been chosen so far */ csa->p = 0; - try = 0; + best_ratio = 0.0; + try = ret = 0; try: /* choose basic variable xB[p] */ xassert(nnn > 0); try++; @@ -547,28 +704,140 @@ try: /* choose basic variable xB[p] */ spx_eval_trow1(lp, at, rho, trow); else spx_nt_prod(lp, nt, trow, 1, -1.0, rho); +#if 1 /* 23/III-2016 */ + /* big := max(1, |trow[1]|, ..., |trow[n-m]|) */ + big = 1.0; + for (j = 1; j <= n-m; j++) + { temp = trow[j]; + if (temp < 0.0) + temp = - temp; + if (big < temp) + big = temp; + } +#else + /* this still puzzles me */ + big = 1.0; +#endif /* choose non-basic variable xN[q] */ k = head[p]; /* x[k] = xB[p] */ - if (!csa->harris) - q = spy_chuzc_std(lp, d, beta[p] < l[k] ? +1. : -1., trow, - csa->tol_piv, .30 * csa->tol_dj, .30 * csa->tol_dj1); + xassert(beta[p] < l[k] || beta[p] > u[k]); + r = beta[p] < l[k] ? l[k] - beta[p] : u[k] - beta[p]; + if (csa->r_test == GLP_RT_FLIP && try <= 2) + { /* long-step ratio test */ +#if 0 /* 23/III-2016 */ + /* determine dual objective break-points */ + nbp = spy_eval_bp(lp, d, r, trow, tol_piv, bp); + if (nbp <= 1) + goto skip; + /* choose appropriate break-point */ + t_best = 0, dz_best = -DBL_MAX; + for (t = 1; t <= nbp; t++) + { if (fabs(trow[bp[t].j]) / big >= MIN_RATIO) + { if (dz_best < bp[t].dz) + t_best = t, dz_best = bp[t].dz; + } + } + if (t_best == 0) + goto skip; +#else + int t, num, num1; + double slope, teta_lim; + /* determine dual objective break-points */ + nbp = spy_ls_eval_bp(lp, d, r, trow, tol_piv, bp); + if (nbp < 2) + goto skip; + /* set initial slope */ + slope = fabs(r); + /* estimate initial teta_lim */ + teta_lim = DBL_MAX; + for (t = 1; t <= nbp; t++) + { if (teta_lim > bp[t].teta) + teta_lim = bp[t].teta; + } + xassert(teta_lim >= 0.0); + if (teta_lim < 1e-6) + teta_lim = 1e-6; + /* nothing has been chosen so far */ + t_best = 0, dz_best = 0.0, num = 0; + /* choose appropriate break-point */ + while (num < nbp) + { /* select and process a new portion of break-points */ + num1 = spy_ls_select_bp(lp, trow, nbp, bp, num, &slope, + teta_lim); + for (t = num+1; t <= num1; t++) + { if (fabs(trow[bp[t].j]) / big >= MIN_RATIO) + { if (dz_best < bp[t].dz) + t_best = t, dz_best = bp[t].dz; + } + } + if (slope < 0.0) + { /* the dual objective starts decreasing */ + break; + } + /* the dual objective continues increasing */ + num = num1; + teta_lim += teta_lim; + } + if (dz_best == 0.0) + goto skip; + xassert(1 <= t_best && t_best <= num1); +#endif + /* the choice has been made */ + csa->p = p; +#if 0 /* 29/III-2016 */ + memcpy(&csa->trow[1], &trow[1], (n-m) * sizeof(double)); +#else + memcpy(&csa->trow.vec[1], &trow[1], (n-m) * sizeof(double)); + fvs_gather_vec(&csa->trow, DBL_EPSILON); +#endif + csa->q = bp[t_best].j; + best_ratio = fabs(trow[bp[t_best].j]) / big; +#if 0 + xprintf("num = %d; t_best = %d; dz = %g\n", num, t_best, + bp[t_best].dz); +#endif + ret = 1; + goto done; +skip: ; + } + if (csa->r_test == GLP_RT_STD) + { /* textbook dual ratio test */ + q = spy_chuzc_std(lp, d, r, trow, tol_piv, + .30 * csa->tol_dj, .30 * csa->tol_dj1); + } else - q = spy_chuzc_harris(lp, d, beta[p] < l[k] ? +1. : -1., trow, - csa->tol_piv, .35 * csa->tol_dj, .35 * csa->tol_dj1); + { /* Harris' two-pass dual ratio test */ + q = spy_chuzc_harris(lp, d, r, trow, tol_piv, + .35 * csa->tol_dj, .35 * csa->tol_dj1); + } + if (q == 0) + { /* dual unboundedness */ + csa->p = p; +#if 0 /* 29/III-2016 */ + memcpy(&csa->trow[1], &trow[1], (n-m) * sizeof(double)); +#else + memcpy(&csa->trow.vec[1], &trow[1], (n-m) * sizeof(double)); + fvs_gather_vec(&csa->trow, DBL_EPSILON); +#endif + csa->q = q; + best_ratio = 1.0; + goto done; + } /* either keep previous choice or accept new choice depending on * which one is better */ - if (csa->p == 0 || q == 0 || - fabs(trow[q]) > fabs(csa->trow[csa->q])) + if (best_ratio < fabs(trow[q]) / big) { csa->p = p; +#if 0 /* 29/III-2016 */ memcpy(&csa->trow[1], &trow[1], (n-m) * sizeof(double)); +#else + memcpy(&csa->trow.vec[1], &trow[1], (n-m) * sizeof(double)); + fvs_gather_vec(&csa->trow, DBL_EPSILON); +#endif csa->q = q; + best_ratio = fabs(trow[q]) / big; } - /* check if current choice is acceptable */ - if (csa->q == 0 || fabs(csa->trow[csa->q]) >= 0.001) - goto done; - if (nnn == 1) - goto done; - if (try == 5) + /* check if the current choice is acceptable */ + if (best_ratio >= MIN_RATIO || nnn == 1 || try == 5) goto done; /* try to choose other xB[p] and xN[q] */ /* find xB[p] in the list */ @@ -582,8 +851,136 @@ try: /* choose basic variable xB[p] */ /* repeat the choice */ goto try; done: /* the choice has been made */ +#if 1 /* FIXME: currently just to avoid badly conditioned basis */ + if (best_ratio < .001 * MIN_RATIO) + { /* looks like this helps */ + if (bfd_get_count(lp->bfd) > 0) + return -1; + /* didn't help; last chance to improve the choice */ + if (tol_piv == csa->tol_piv) + { tol_piv *= 1000.; + goto more; + } + } +#endif +#if 1 /* FIXME */ + if (ret) + { /* invalidate basic solution components */ +#if 0 /* 28/III-2016 */ + csa->beta_st = csa->d_st = 0; +#else + /* dual solution remains valid */ + csa->beta_st = 0; +#endif + /* set double-bounded non-basic variables to opposite bounds + * for all break-points preceding the chosen one */ + for (t = 1; t < t_best; t++) + { k = head[m + bp[t].j]; + xassert(-DBL_MAX < l[k] && l[k] < u[k] && u[k] < +DBL_MAX); + lp->flag[bp[t].j] = !(lp->flag[bp[t].j]); + } + } +#endif + return ret; +} + +#endif + +/*********************************************************************** +* play_coef - play objective coefficients +* +* This routine is called after the reduced costs d[j] was updated and +* the basis was changed to the adjacent one. +* +* It is assumed that before updating all the reduced costs d[j] were +* strongly feasible, so in the adjacent basis d[j] remain feasible +* within a tolerance, i.e. if some d[j] violates its zero bound, the +* violation is insignificant. +* +* If some d[j] violates its zero bound, the routine changes (perturbs) +* objective coefficient cN[j] to provide d[j] = 0, i.e. to make all +* d[j] strongly feasible. Otherwise, if d[j] has a feasible value, the +* routine attempts to reduce (or remove) perturbation in cN[j] by +* shifting d[j] to its zero bound keeping strong feasibility. */ + +static void play_coef(struct csa *csa, int all) +{ SPXLP *lp = csa->lp; + int m = lp->m; + int n = lp->n; + double *c = lp->c; + double *l = lp->l; + double *u = lp->u; + int *head = lp->head; + char *flag = lp->flag; + double *orig_c = csa->orig_c; + double *d = csa->d; + const double *trow = csa->trow.vec; + /* this vector was used to update d = (d[j]) */ + int j, k; + static const double eps = 1e-9; + /* reduced costs d = (d[j]) should be valid */ + xassert(csa->d_st); + /* walk thru the list of non-basic variables xN = (xN[j]) */ + for (j = 1; j <= n-m; j++) + { if (all || trow[j] != 0.0) + { /* d[j] has changed in the adjacent basis */ + k = head[m+j]; /* x[k] = xN[j] */ + if (l[k] == u[k]) + { /* xN[j] is fixed variable */ + /* d[j] may have any sign */ + } + else if (l[k] == -DBL_MAX && u[k] == +DBL_MAX) + { /* xN[j] is free (unbounded) variable */ + /* strong feasibility means d[j] = 0 */ + c[k] -= d[j], d[j] = 0.0; + /* in this case dual degeneracy is not critical, since + * if xN[j] enters the basis, it never leaves it */ + } + else if (!flag[j]) + { /* xN[j] has its lower bound active */ + xassert(l[k] != -DBL_MAX); + /* first, we remove current perturbation to provide + * c[k] = orig_c[k] */ + d[j] -= c[k] - orig_c[k], c[k] = orig_c[k]; + /* strong feasibility means d[j] >= 0, but we provide + * d[j] >= +eps to prevent dual degeneracy */ + if (d[j] < +eps) + c[k] -= d[j] - eps, d[j] = +eps; + } + else + { /* xN[j] has its upper bound active */ + xassert(u[k] != +DBL_MAX); + /* similarly, we remove current perturbation to provide + * c[k] = orig_c[k] */ + d[j] -= c[k] - orig_c[k], c[k] = orig_c[k]; + /* strong feasibility means d[j] <= 0, but we provide + * d[j] <= -eps to prevent dual degeneracy */ + if (d[j] > -eps) + c[k] -= d[j] + eps, d[j] = -eps; + } + } + } + return; +} + +#if 1 /* 11/VII-2017 */ +static void remove_perturb(struct csa *csa) +{ /* remove perturbation */ + SPXLP *lp = csa->lp; + int n = lp->n; + double *c = lp->c; + double *orig_c = csa->orig_c; + memcpy(c, orig_c, (1+n) * sizeof(double)); + /* removing perturbation changes dual solution components */ + csa->phase = csa->d_st = 0; +#if 1 + if (csa->msg_lev >= GLP_MSG_ALL) + xprintf("Removing LP perturbation [%d]...\n", + csa->it_cnt); +#endif return; } +#endif /*********************************************************************** * display - display search progress @@ -610,19 +1007,35 @@ static void display(struct csa *csa, int spec) int n = lp->n; int *head = lp->head; char *flag = lp->flag; - double *l = csa->l; /* original lower bounds */ - double *u = csa->u; /* original upper bounds */ + double *l = csa->orig_l; /* original lower bounds */ + double *u = csa->orig_u; /* original upper bounds */ double *beta = csa->beta; double *d = csa->d; int j, k, nnn; double sum; +#if 1 /* 15/VII-2017 */ + double tm_cur; +#endif /* check if the display output should be skipped */ if (csa->msg_lev < GLP_MSG_ON) goto skip; +#if 1 /* 15/VII-2017 */ + tm_cur = xtime(); +#endif if (csa->out_dly > 0 && +#if 0 /* 15/VII-2017 */ 1000.0 * xdifftime(xtime(), csa->tm_beg) < csa->out_dly) +#else + 1000.0 * xdifftime(tm_cur, csa->tm_beg) < csa->out_dly) +#endif goto skip; if (csa->it_cnt == csa->it_dpy) goto skip; +#if 0 /* 15/VII-2017 */ if (!spec && csa->it_cnt % csa->out_frq != 0) goto skip; +#else + if (!spec && + 1000.0 * xdifftime(tm_cur, csa->tm_dpy) < csa->out_frq) + goto skip; +#endif /* display search progress depending on search phase */ switch (csa->phase) { case 1: @@ -651,8 +1064,14 @@ static void display(struct csa *csa, int spec) /* on phase I variables have artificial bounds which are * meaningless for original LP, so corresponding objective * function value is also meaningless */ +#if 0 /* 27/III-2016 */ xprintf(" %6d: %23s inf = %11.3e (%d)", csa->it_cnt, "", sum, nnn); +#else + xprintf(" %6d: sum = %17.9e inf = %11.3e (%d)", + csa->it_cnt, lp->c[0] - spx_eval_obj(lp, beta), + sum, nnn); +#endif break; case 2: /* compute sum of (scaled) dual infeasibilities */ @@ -674,7 +1093,12 @@ static void display(struct csa *csa, int spec) nnn = spy_chuzr_sel(lp, beta, csa->tol_bnd, csa->tol_bnd1, NULL); xprintf("#%6d: obj = %17.9e inf = %11.3e (%d)", +#if SCALE_Z + csa->it_cnt, + (double)csa->dir * csa->fz * spx_eval_obj(lp, beta), +#else csa->it_cnt, (double)csa->dir * spx_eval_obj(lp, beta), +#endif sum, nnn); break; default: @@ -685,13 +1109,91 @@ static void display(struct csa *csa, int spec) xprintf(" %d", csa->inv_cnt); csa->inv_cnt = 0; } +#if 1 /* 23/III-2016 */ + if (csa->r_test == GLP_RT_FLIP) + { /*xprintf(" %d,%d", csa->ns_cnt, csa->ls_cnt);*/ + if (csa->ns_cnt + csa->ls_cnt) + xprintf(" %d%%", + (100 * csa->ls_cnt) / (csa->ns_cnt + csa->ls_cnt)); + csa->ns_cnt = csa->ls_cnt = 0; + } +#endif xprintf("\n"); csa->it_dpy = csa->it_cnt; +#if 1 /* 15/VII-2017 */ + csa->tm_dpy = tm_cur; +#endif skip: return; } +#if 1 /* 31/III-2016 */ +static +void spy_update_r(SPXLP *lp, int p, int q, const double beta[/*1+m*/], + const FVS *tcol, double tol, double tol1, FVS *r) +{ /* update vector r of primal infeasibilities */ + /* it is assumed that xB[p] leaves the basis, xN[q] enters the + * basis, and beta corresponds to the adjacent basis (i.e. this + * routine should be called after spx_update_beta) */ + int m = lp->m; + int n = lp->n; + double *l = lp->l; + double *u = lp->u; + int *head = lp->head; + int *tcol_ind = tcol->ind; + int *ind = r->ind; + double *vec = r->vec; + int i, k, t, nnz; + double lk, uk, ri, eps; + xassert(1 <= p && p <= m); + xassert(1 <= q && q <= n-m); + nnz = r->nnz; + for (t = tcol->nnz; t >= 1; t--) + { i = tcol_ind[t]; + /* xB[i] changes in the adjacent basis to beta[i], so only + * r[i] should be updated */ + if (i == p) + k = head[m+q]; /* x[k] = new xB[p] = old xN[q] */ + else + k = head[i]; /* x[k] = new xB[i] = old xB[i] */ + lk = l[k], uk = u[k]; + /* determine new value of r[i]; see spy_eval_r */ + ri = 0.0; + if (beta[i] < lk) + { /* determine absolute tolerance eps1[i] */ + eps = tol + tol1 * (lk >= 0.0 ? +lk : -lk); + if (beta[i] < lk - eps) + { /* lower bound is violated */ + ri = lk - beta[i]; + } + } + else if (beta[i] > uk) + { /* determine absolute tolerance eps2[i] */ + eps = tol + tol1 * (uk >= 0.0 ? +uk : -uk); + if (beta[i] > uk + eps) + { /* upper bound is violated */ + ri = uk - beta[i]; + } + } + if (ri == 0.0) + { if (vec[i] != 0.0) + vec[i] = DBL_MIN; /* will be removed */ + } + else + { if (vec[i] == 0.0) + ind[++nnz] = i; + vec[i] = ri; + } + + } + r->nnz = nnz; + /* remove zero elements */ + fvs_adjust_vec(r, DBL_MIN + DBL_MIN); + return; +} +#endif + /*********************************************************************** -* spy_dual - driver to dual simplex method +* spy_dual - driver to the dual simplex method * * This routine is a driver to the two-phase dual simplex method. * @@ -726,9 +1228,13 @@ static int dual_simplex(struct csa *csa) double *beta = csa->beta; double *d = csa->d; SPYSE *se = csa->se; +#if 0 /* 30/III-2016 */ int *list = csa->list; +#endif +#if 0 /* 31/III-2016 */ double *trow = csa->trow; double *tcol = csa->tcol; +#endif double *pi = csa->work; int msg_lev = csa->msg_lev; double tol_bnd = csa->tol_bnd; @@ -736,12 +1242,37 @@ static int dual_simplex(struct csa *csa) double tol_dj = csa->tol_dj; double tol_dj1 = csa->tol_dj1; int j, k, p_flag, refct, ret; + int perturb = -1; + /* -1 = perturbation is not used, but enabled + * 0 = perturbation is not used and disabled + * +1 = perturbation is being used */ +#if 1 /* 27/III-2016 */ + int instab = 0; /* instability count */ +#endif +#ifdef TIMING + double t_total = timer(); /* total time */ + double t_fact = 0.0; /* computing factorization */ + double t_rtest = 0.0; /* performing ratio test */ + double t_pivcol = 0.0; /* computing pivot column */ + double t_upd1 = 0.0; /* updating primal values */ + double t_upd2 = 0.0; /* updating dual values */ + double t_upd3 = 0.0; /* updating se weights */ + double t_upd4 = 0.0; /* updating matrix N */ + double t_upd5 = 0.0; /* updating factorization */ + double t_start; +#endif check_flags(csa); loop: /* main loop starts here */ /* compute factorization of the basis matrix */ if (!lp->valid) { double cond; +#ifdef TIMING + t_start = timer(); +#endif ret = spx_factorize(lp); +#ifdef TIMING + t_fact += timer() - t_start; +#endif csa->inv_cnt++; if (ret != 0) { if (msg_lev >= GLP_MSG_ERR) @@ -795,41 +1326,67 @@ loop: /* main loop starts here */ } } /* make sure that current basic solution is dual feasible */ - j = check_feas(csa, tol_dj, tol_dj1, 0); - if (j) - { /* dual feasibility is broken due to excessive round-off - * errors */ - if (bfd_get_count(lp->bfd)) - { /* try to provide more accuracy */ - lp->valid = 0; - goto loop; - } - if (msg_lev >= GLP_MSG_ERR) - xprintf("Warning: numerical instability (dual simplex, p" - "hase %s)\n", csa->phase == 1 ? "I" : "II"); - if (csa->dualp) - { /* do not continue the search; report failure */ - csa->p_stat = csa->d_stat = GLP_UNDEF; - ret = -1; /* special case of GLP_EFAIL */ - goto fini; - } - /* try to recover dual feasibility */ - j = check_feas(csa, 0.97 * tol_dj, 0.97 * tol_dj1, 1); - if (j > 0) - { /* dual feasibility cannot be recovered (this may happen - * only on phase II) */ - xassert(csa->phase == 2); - /* restart to search for dual feasible solution */ - set_art_bounds(csa); - csa->phase = 1; +#if 1 /* 11/VII-2017 */ + if (perturb <= 0) + { if (check_feas(csa, tol_dj, tol_dj1, 0)) + { /* dual feasibility is broken due to excessive round-off + * errors */ + if (perturb < 0) + { if (msg_lev >= GLP_MSG_ALL) + xprintf("Perturbing LP to avoid instability [%d].." + ".\n", csa->it_cnt); + perturb = 1; + goto loop; + } + if (msg_lev >= GLP_MSG_ERR) + xprintf("Warning: numerical instability (dual simplex" + ", phase %s)\n", csa->phase == 1 ? "I" : "II"); + instab++; + if (csa->dualp && instab >= 10) + { /* do not continue the search; report failure */ + if (msg_lev >= GLP_MSG_ERR) + xprintf("Warning: dual simplex failed due to exces" + "sive numerical instability\n"); + csa->p_stat = csa->d_stat = GLP_UNDEF; + ret = -1; /* special case of GLP_EFAIL */ + goto fini; + } + /* try to recover dual feasibility */ + j = check_feas(csa, 0.97 * tol_dj, 0.97 * tol_dj1, 1); + if (j > 0) + { /* dual feasibility cannot be recovered (this may + * happen only on phase II) */ + xassert(csa->phase == 2); + /* restart to search for dual feasible solution */ + set_art_bounds(csa); + csa->phase = 1; + } } } + else + { /* FIXME */ + play_coef(csa, 1); + } } +#endif /* at this point the search phase is determined */ xassert(csa->phase == 1 || csa->phase == 2); /* compute values of basic variables beta = (beta[i]) */ if (!csa->beta_st) { spx_eval_beta(lp, beta); +#if 1 /* 31/III-2016 */ + /* also compute vector r of primal infeasibilities */ + switch (csa->phase) + { case 1: + spy_eval_r(lp, beta, 1e-8, 0.0, &csa->r); + break; + case 2: + spy_eval_r(lp, beta, tol_bnd, tol_bnd1, &csa->r); + break; + default: + xassert(csa != csa); + } +#endif csa->beta_st = 1; /* just computed */ } /* reset the dual reference space, if necessary */ @@ -838,7 +1395,9 @@ loop: /* main loop starts here */ /* at this point the basis factorization and all basic solution * components are valid */ xassert(lp->valid && csa->beta_st && csa->d_st); +#ifdef GLP_DEBUG check_flags(csa); +#endif #if CHECK_ACCURACY /* check accuracy of current basic solution components (only for * debugging) */ @@ -847,7 +1406,20 @@ loop: /* main loop starts here */ /* check if the objective limit has been reached */ if (csa->phase == 2 && csa->obj_lim != DBL_MAX && spx_eval_obj(lp, beta) >= csa->obj_lim) - { if (csa->beta_st != 1) + { +#if 1 /* 26/V-2017 by mao */ + if (perturb > 0) + { /* remove perturbation */ + /* [Should note that perturbing of objective coefficients + * implemented in play_coef is equivalent to *relaxing* of + * (zero) bounds of dual variables, so the perturbed + * objective is always better (*greater*) that the original + * one at the same basic point.] */ + remove_perturb(csa); + perturb = 0; + } +#endif + if (csa->beta_st != 1) csa->beta_st = 0; if (csa->d_st != 1) csa->d_st = 0; @@ -857,15 +1429,25 @@ loop: /* main loop starts here */ if (msg_lev >= GLP_MSG_ALL) xprintf("OBJECTIVE %s LIMIT REACHED; SEARCH TERMINATED\n", csa->dir > 0 ? "UPPER" : "LOWER"); +#if 0 /* 30/III-2016 */ csa->num = spy_chuzr_sel(lp, beta, tol_bnd, tol_bnd1, list); csa->p_stat = (csa->num == 0 ? GLP_FEAS : GLP_INFEAS); +#else + spy_eval_r(lp, beta, tol_bnd, tol_bnd1, &csa->r); + csa->p_stat = (csa->r.nnz == 0 ? GLP_FEAS : GLP_INFEAS); +#endif csa->d_stat = GLP_FEAS; ret = (csa->dir > 0 ? GLP_EOBJUL : GLP_EOBJLL); goto fini; } /* check if the iteration limit has been exhausted */ if (csa->it_cnt - csa->it_beg >= csa->it_lim) - { if (csa->beta_st != 1) + { if (perturb > 0) + { /* remove perturbation */ + remove_perturb(csa); + perturb = 0; + } + if (csa->beta_st != 1) csa->beta_st = 0; if (csa->d_st != 1) csa->d_st = 0; @@ -879,15 +1461,25 @@ loop: /* main loop starts here */ check_flags(csa); spx_eval_beta(lp, beta); } +#if 0 /* 30/III-2016 */ csa->num = spy_chuzr_sel(lp, beta, tol_bnd, tol_bnd1, list); csa->p_stat = (csa->num == 0 ? GLP_FEAS : GLP_INFEAS); +#else + spy_eval_r(lp, beta, tol_bnd, tol_bnd1, &csa->r); + csa->p_stat = (csa->r.nnz == 0 ? GLP_FEAS : GLP_INFEAS); +#endif csa->d_stat = (csa->phase == 1 ? GLP_INFEAS : GLP_FEAS); ret = GLP_EITLIM; goto fini; } /* check if the time limit has been exhausted */ if (1000.0 * xdifftime(xtime(), csa->tm_beg) >= csa->tm_lim) - { if (csa->beta_st != 1) + { if (perturb > 0) + { /* remove perturbation */ + remove_perturb(csa); + perturb = 0; + } + if (csa->beta_st != 1) csa->beta_st = 0; if (csa->d_st != 1) csa->d_st = 0; @@ -901,28 +1493,52 @@ loop: /* main loop starts here */ check_flags(csa); spx_eval_beta(lp, beta); } +#if 0 /* 30/III-2016 */ csa->num = spy_chuzr_sel(lp, beta, tol_bnd, tol_bnd1, list); csa->p_stat = (csa->num == 0 ? GLP_FEAS : GLP_INFEAS); +#else + spy_eval_r(lp, beta, tol_bnd, tol_bnd1, &csa->r); + csa->p_stat = (csa->r.nnz == 0 ? GLP_FEAS : GLP_INFEAS); +#endif csa->d_stat = (csa->phase == 1 ? GLP_INFEAS : GLP_FEAS); - ret = GLP_EITLIM; + ret = GLP_ETMLIM; goto fini; } /* display the search progress */ display(csa, 0); /* select eligible basic variables */ +#if 0 /* 31/III-2016; not needed because r is valid */ switch (csa->phase) { case 1: +#if 0 /* 30/III-2016 */ csa->num = spy_chuzr_sel(lp, beta, 1e-8, 0.0, list); +#else + spy_eval_r(lp, beta, 1e-8, 0.0, &csa->r); +#endif break; case 2: +#if 0 /* 30/III-2016 */ csa->num = spy_chuzr_sel(lp, beta, tol_bnd, tol_bnd1, list); +#else + spy_eval_r(lp, beta, tol_bnd, tol_bnd1, &csa->r); +#endif break; default: xassert(csa != csa); } +#endif /* check for optimality */ +#if 0 /* 30/III-2016 */ if (csa->num == 0) - { if (csa->beta_st != 1) +#else + if (csa->r.nnz == 0) +#endif + { if (perturb > 0 && csa->phase == 2) + { /* remove perturbation */ + remove_perturb(csa); + perturb = 0; + } + if (csa->beta_st != 1) csa->beta_st = 0; if (csa->d_st != 1) csa->d_st = 0; @@ -941,13 +1557,26 @@ loop: /* main loop starts here */ xassert(!csa->beta_st); goto loop; } +#if 1 /* 26/V-2017 by cmatraki */ + if (perturb > 0) + { /* remove perturbation */ + remove_perturb(csa); + perturb = 0; + goto loop; + } +#endif /* no dual feasible solution exists */ if (msg_lev >= GLP_MSG_ALL) xprintf("LP HAS NO DUAL FEASIBLE SOLUTION\n"); spx_eval_beta(lp, beta); +#if 0 /* 30/III-2016 */ csa->num = spy_chuzr_sel(lp, beta, tol_bnd, tol_bnd1, list); csa->p_stat = (csa->num == 0 ? GLP_FEAS : GLP_INFEAS); +#else + spy_eval_r(lp, beta, tol_bnd, tol_bnd1, &csa->r); + csa->p_stat = (csa->r.nnz == 0 ? GLP_FEAS : GLP_INFEAS); +#endif csa->d_stat = GLP_NOFEAS; ret = 0; goto fini; @@ -963,10 +1592,35 @@ loop: /* main loop starts here */ } } /* choose xB[p] and xN[q] */ +#if 0 /* 23/III-2016 */ choose_pivot(csa); +#else +#ifdef TIMING + t_start = timer(); +#endif +#if 1 /* 31/III-2016 */ + ret = choose_pivot(csa); +#endif +#ifdef TIMING + t_rtest += timer() - t_start; +#endif + if (ret < 0) + { lp->valid = 0; + goto loop; + } + if (ret == 0) + csa->ns_cnt++; + else + csa->ls_cnt++; +#endif /* check for dual unboundedness */ if (csa->q == 0) - { if (csa->beta_st != 1) + { if (perturb > 0) + { /* remove perturbation */ + remove_perturb(csa); + perturb = 0; + } + if (csa->beta_st != 1) csa->beta_st = 0; if (csa->d_st != 1) csa->d_st = 0; @@ -994,17 +1648,107 @@ loop: /* main loop starts here */ } } /* compute q-th column of the simplex table */ +#ifdef TIMING + t_start = timer(); +#endif +#if 0 /* 31/III-2016 */ spx_eval_tcol(lp, csa->q, tcol); +#else + spx_eval_tcol(lp, csa->q, csa->tcol.vec); + fvs_gather_vec(&csa->tcol, DBL_EPSILON); +#endif +#ifdef TIMING + t_pivcol += timer() - t_start; +#endif /* FIXME: tcol[p] and trow[q] should be close to each other */ - xassert(tcol[csa->p] != 0.0); +#if 0 /* 26/V-2017 by cmatraki */ + xassert(csa->tcol.vec[csa->p] != 0.0); +#else + if (csa->tcol.vec[csa->p] == 0.0) + { if (msg_lev >= GLP_MSG_ERR) + xprintf("Error: tcol[p] = 0.0\n"); + csa->p_stat = csa->d_stat = GLP_UNDEF; + ret = GLP_EFAIL; + goto fini; + } +#endif /* update values of basic variables for adjacent basis */ k = head[csa->p]; /* x[k] = xB[p] */ p_flag = (l[k] != u[k] && beta[csa->p] > u[k]); +#if 0 /* 16/III-2016 */ spx_update_beta(lp, beta, csa->p, p_flag, csa->q, tcol); csa->beta_st = 2; +#else + /* primal solution may be invalidated due to long step */ +#ifdef TIMING + t_start = timer(); +#endif + if (csa->beta_st) +#if 0 /* 30/III-2016 */ + { spx_update_beta(lp, beta, csa->p, p_flag, csa->q, tcol); +#else + { spx_update_beta_s(lp, beta, csa->p, p_flag, csa->q, + &csa->tcol); + /* also update vector r of primal infeasibilities */ + /*fvs_check_vec(&csa->r);*/ + switch (csa->phase) + { case 1: + spy_update_r(lp, csa->p, csa->q, beta, &csa->tcol, + 1e-8, 0.0, &csa->r); + break; + case 2: + spy_update_r(lp, csa->p, csa->q, beta, &csa->tcol, + tol_bnd, tol_bnd1, &csa->r); + break; + default: + xassert(csa != csa); + } + /*fvs_check_vec(&csa->r);*/ +#endif + csa->beta_st = 2; + } +#ifdef TIMING + t_upd1 += timer() - t_start; +#endif +#endif +#if 1 /* 11/VII-2017 */ + /* check for stalling */ + { int k; + xassert(1 <= csa->p && csa->p <= m); + xassert(1 <= csa->q && csa->q <= n-m); + /* FIXME: recompute d[q]; see spx_update_d */ + k = head[m+csa->q]; /* x[k] = xN[q] */ + if (!(lp->l[k] == -DBL_MAX && lp->u[k] == +DBL_MAX)) + { if (fabs(d[csa->q]) >= 1e-6) + { csa->degen = 0; + goto skip1; + } + /* degenerate iteration has been detected */ + csa->degen++; + if (perturb < 0 && csa->degen >= 200) + { if (msg_lev >= GLP_MSG_ALL) + xprintf("Perturbing LP to avoid stalling [%d]...\n", + csa->it_cnt); + perturb = 1; + } +skip1: ; + } + } +#endif /* update reduced costs of non-basic variables for adjacent * basis */ +#if 1 /* 28/III-2016 */ + xassert(csa->d_st); +#endif +#ifdef TIMING + t_start = timer(); +#endif +#if 0 /* 30/III-2016 */ if (spx_update_d(lp, d, csa->p, csa->q, trow, tcol) <= 1e-9) +#else + if (spx_update_d_s(lp, d, csa->p, csa->q, &csa->trow, &csa->tcol) + <= 1e-9) +#endif { /* successful updating */ csa->d_st = 2; } @@ -1012,11 +1756,22 @@ loop: /* main loop starts here */ { /* new reduced costs are inaccurate */ csa->d_st = 0; } +#ifdef TIMING + t_upd2 += timer() - t_start; +#endif /* update steepest edge weights for adjacent basis, if used */ +#ifdef TIMING + t_start = timer(); +#endif if (se != NULL) { if (refct > 0) +#if 0 /* 30/III-2016 */ { if (spy_update_gamma(lp, se, csa->p, csa->q, trow, tcol) <= 1e-3) +#else + { if (spy_update_gamma_s(lp, se, csa->p, csa->q, &csa->trow, + &csa->tcol) <= 1e-3) +#endif { /* successful updating */ refct--; } @@ -1030,38 +1785,70 @@ loop: /* main loop starts here */ se->valid = 0; } } +#ifdef TIMING + t_upd3 += timer() - t_start; +#endif +#ifdef TIMING + t_start = timer(); +#endif /* update matrix N for adjacent basis, if used */ if (nt != NULL) spx_update_nt(lp, nt, csa->p, csa->q); +#ifdef TIMING + t_upd4 += timer() - t_start; +#endif /* change current basis header to adjacent one */ spx_change_basis(lp, csa->p, p_flag, csa->q); /* and update factorization of the basis matrix */ +#ifdef TIMING + t_start = timer(); +#endif +#if 0 /* 16/III-2016 */ if (csa->p > 0) +#endif spx_update_invb(lp, csa->p, head[csa->p]); +#ifdef TIMING + t_upd5 += timer() - t_start; +#endif + if (perturb > 0 && csa->d_st) + play_coef(csa, 0); /* dual simplex iteration complete */ csa->it_cnt++; goto loop; -fini: return ret; +fini: +#ifdef TIMING + t_total = timer() - t_total; + xprintf("Total time = %10.3f\n", t_total); + xprintf("Factorization = %10.3f\n", t_fact); + xprintf("Ratio test = %10.3f\n", t_rtest); + xprintf("Pivot column = %10.3f\n", t_pivcol); + xprintf("Updating beta = %10.3f\n", t_upd1); + xprintf("Updating d = %10.3f\n", t_upd2); + xprintf("Updating gamma = %10.3f\n", t_upd3); + xprintf("Updating N = %10.3f\n", t_upd4); + xprintf("Updating inv(B) = %10.3f\n", t_upd5); +#endif + return ret; } int spy_dual(glp_prob *P, const glp_smcp *parm) -{ /* driver to dual simplex method */ +{ /* driver to the dual simplex method */ struct csa csa_, *csa = &csa_; SPXLP lp; -#if USE_AT SPXAT at; -#else SPXNT nt; -#endif SPYSE se; int ret, *map, *daeh; +#if SCALE_Z + int i, j, k; +#endif /* build working LP and its initial basis */ memset(csa, 0, sizeof(struct csa)); csa->lp = &lp; - spx_init_lp(csa->lp, P, EXCL); + spx_init_lp(csa->lp, P, parm->excl); spx_alloc_lp(csa->lp); map = talloc(1+P->m+P->n, int); - spx_build_lp(csa->lp, P, EXCL, SHIFT, map); + spx_build_lp(csa->lp, P, parm->excl, parm->shift, map); spx_build_basis(csa->lp, P, map); switch (P->dir) { case GLP_MIN: @@ -1073,26 +1860,48 @@ int spy_dual(glp_prob *P, const glp_smcp *parm) default: xassert(P != P); } - csa->b = talloc(1+csa->lp->m, double); - memcpy(csa->b, csa->lp->b, (1+csa->lp->m) * sizeof(double)); - csa->l = talloc(1+csa->lp->n, double); - memcpy(csa->l, csa->lp->l, (1+csa->lp->n) * sizeof(double)); - csa->u = talloc(1+csa->lp->n, double); - memcpy(csa->u, csa->lp->u, (1+csa->lp->n) * sizeof(double)); -#if USE_AT - /* build matrix A in row-wise format */ - csa->at = &at; - csa->nt = NULL; - spx_alloc_at(csa->lp, csa->at); - spx_build_at(csa->lp, csa->at); -#else - /* build matrix N in row-wise format for initial basis */ - csa->at = NULL; - csa->nt = &nt; - spx_alloc_nt(csa->lp, csa->nt); - spx_init_nt(csa->lp, csa->nt); - spx_build_nt(csa->lp, csa->nt); +#if SCALE_Z + csa->fz = 0.0; + for (k = 1; k <= csa->lp->n; k++) + { double t = fabs(csa->lp->c[k]); + if (csa->fz < t) + csa->fz = t; + } + if (csa->fz <= 1000.0) + csa->fz = 1.0; + else + csa->fz /= 1000.0; + /*xprintf("csa->fz = %g\n", csa->fz);*/ + for (k = 0; k <= csa->lp->n; k++) + csa->lp->c[k] /= csa->fz; #endif + csa->orig_b = talloc(1+csa->lp->m, double); + memcpy(csa->orig_b, csa->lp->b, (1+csa->lp->m) * sizeof(double)); + csa->orig_c = talloc(1+csa->lp->n, double); + memcpy(csa->orig_c, csa->lp->c, (1+csa->lp->n) * sizeof(double)); + csa->orig_l = talloc(1+csa->lp->n, double); + memcpy(csa->orig_l, csa->lp->l, (1+csa->lp->n) * sizeof(double)); + csa->orig_u = talloc(1+csa->lp->n, double); + memcpy(csa->orig_u, csa->lp->u, (1+csa->lp->n) * sizeof(double)); + switch (parm->aorn) + { case GLP_USE_AT: + /* build matrix A in row-wise format */ + csa->at = &at; + csa->nt = NULL; + spx_alloc_at(csa->lp, csa->at); + spx_build_at(csa->lp, csa->at); + break; + case GLP_USE_NT: + /* build matrix N in row-wise format for initial basis */ + csa->at = NULL; + csa->nt = &nt; + spx_alloc_nt(csa->lp, csa->nt); + spx_init_nt(csa->lp, csa->nt); + spx_build_nt(csa->lp, csa->nt); + break; + default: + xassert(parm != parm); + } /* allocate and initialize working components */ csa->phase = 0; csa->beta = talloc(1+csa->lp->m, double); @@ -1110,14 +1919,30 @@ int spy_dual(glp_prob *P, const glp_smcp *parm) default: xassert(parm != parm); } +#if 0 /* 30/III-2016 */ csa->list = talloc(1+csa->lp->m, int); csa->trow = talloc(1+csa->lp->n-csa->lp->m, double); csa->tcol = talloc(1+csa->lp->m, double); +#else + fvs_alloc_vec(&csa->r, csa->lp->m); + fvs_alloc_vec(&csa->trow, csa->lp->n-csa->lp->m); + fvs_alloc_vec(&csa->tcol, csa->lp->m); +#endif +#if 1 /* 16/III-2016 */ + csa->bp = NULL; +#endif csa->work = talloc(1+csa->lp->m, double); csa->work1 = talloc(1+csa->lp->n-csa->lp->m, double); +#if 0 /* 11/VI-2017 */ +#if 1 /* 31/III-2016 */ + fvs_alloc_vec(&csa->wrow, csa->lp->n-csa->lp->m); + fvs_alloc_vec(&csa->wcol, csa->lp->m); +#endif +#endif /* initialize control parameters */ csa->msg_lev = parm->msg_lev; csa->dualp = (parm->meth == GLP_DUALP); +#if 0 /* 16/III-2016 */ switch (parm->r_test) { case GLP_RT_STD: csa->harris = 0; @@ -1128,10 +1953,26 @@ int spy_dual(glp_prob *P, const glp_smcp *parm) default: xassert(parm != parm); } +#else + switch (parm->r_test) + { case GLP_RT_STD: + case GLP_RT_HAR: + break; + case GLP_RT_FLIP: + csa->bp = talloc(1+csa->lp->n-csa->lp->m, SPYBP); + break; + default: + xassert(parm != parm); + } + csa->r_test = parm->r_test; +#endif csa->tol_bnd = parm->tol_bnd; csa->tol_bnd1 = .001 * parm->tol_bnd; csa->tol_dj = parm->tol_dj; csa->tol_dj1 = .001 * parm->tol_dj; +#if 0 + csa->tol_dj1 = 1e-9 * parm->tol_dj; +#endif csa->tol_piv = parm->tol_piv; switch (P->dir) { case GLP_MIN: @@ -1143,6 +1984,10 @@ int spy_dual(glp_prob *P, const glp_smcp *parm) default: xassert(parm != parm); } +#if SCALE_Z + if (csa->obj_lim != DBL_MAX) + csa->obj_lim /= csa->fz; +#endif csa->it_lim = parm->it_lim; csa->tm_lim = parm->tm_lim; csa->out_frq = parm->out_frq; @@ -1151,7 +1996,16 @@ int spy_dual(glp_prob *P, const glp_smcp *parm) csa->tm_beg = xtime(); csa->it_beg = csa->it_cnt = P->it_cnt; csa->it_dpy = -1; +#if 1 /* 15/VII-2017 */ + csa->tm_dpy = 0.0; +#endif csa->inv_cnt = 0; +#if 1 /* 11/VII-2017 */ + csa->degen = 0; +#endif +#if 1 /* 23/III-2016 */ + csa->ns_cnt = csa->ls_cnt = 0; +#endif /* try to solve working LP */ ret = dual_simplex(csa); /* return basis factorization back to problem object */ @@ -1173,8 +2027,14 @@ int spy_dual(glp_prob *P, const glp_smcp *parm) spx_eval_pi(csa->lp, csa->work); /* convert working LP solution to original LP solution and store * it to problem object */ - spx_store_sol(csa->lp, P, SHIFT, map, daeh, csa->beta, csa->work, - csa->d); +#if SCALE_Z + for (i = 1; i <= csa->lp->m; i++) + csa->work[i] *= csa->fz; + for (j = 1; j <= csa->lp->n-csa->lp->m; j++) + csa->d[j] *= csa->fz; +#endif + spx_store_sol(csa->lp, P, parm->shift, map, daeh, csa->beta, + csa->work, csa->d); tfree(daeh); /* save simplex iteration count */ P->it_cnt = csa->it_cnt; @@ -1198,9 +2058,10 @@ int spy_dual(glp_prob *P, const glp_smcp *parm) skip: /* deallocate working objects and arrays */ spx_free_lp(csa->lp); tfree(map); - tfree(csa->b); - tfree(csa->l); - tfree(csa->u); + tfree(csa->orig_b); + tfree(csa->orig_c); + tfree(csa->orig_l); + tfree(csa->orig_u); if (csa->at != NULL) spx_free_at(csa->lp, csa->at); if (csa->nt != NULL) @@ -1209,11 +2070,30 @@ skip: /* deallocate working objects and arrays */ tfree(csa->d); if (csa->se != NULL) spy_free_se(csa->lp, csa->se); +#if 0 /* 30/III-2016 */ tfree(csa->list); tfree(csa->trow); +#else + fvs_free_vec(&csa->r); + fvs_free_vec(&csa->trow); +#endif +#if 1 /* 16/III-2016 */ + if (csa->bp != NULL) + tfree(csa->bp); +#endif +#if 0 /* 29/III-2016 */ tfree(csa->tcol); +#else + fvs_free_vec(&csa->tcol); +#endif tfree(csa->work); tfree(csa->work1); +#if 0 /* 11/VI-2017 */ +#if 1 /* 31/III-2016 */ + fvs_free_vec(&csa->wrow); + fvs_free_vec(&csa->wcol); +#endif +#endif /* return to calling program */ return ret >= 0 ? ret : GLP_EFAIL; } diff --git a/resources/3rdparty/glpk-4.57/src/zlib/README b/resources/3rdparty/glpk-4.65/src/zlib/README similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/README rename to resources/3rdparty/glpk-4.65/src/zlib/README diff --git a/resources/3rdparty/glpk-4.57/src/zlib/adler32.c b/resources/3rdparty/glpk-4.65/src/zlib/adler32.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/adler32.c rename to resources/3rdparty/glpk-4.65/src/zlib/adler32.c diff --git a/resources/3rdparty/glpk-4.57/src/zlib/compress.c b/resources/3rdparty/glpk-4.65/src/zlib/compress.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/compress.c rename to resources/3rdparty/glpk-4.65/src/zlib/compress.c diff --git a/resources/3rdparty/glpk-4.57/src/zlib/crc32.c b/resources/3rdparty/glpk-4.65/src/zlib/crc32.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/crc32.c rename to resources/3rdparty/glpk-4.65/src/zlib/crc32.c diff --git a/resources/3rdparty/glpk-4.57/src/zlib/crc32.h b/resources/3rdparty/glpk-4.65/src/zlib/crc32.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/crc32.h rename to resources/3rdparty/glpk-4.65/src/zlib/crc32.h diff --git a/resources/3rdparty/glpk-4.57/src/zlib/deflate.c b/resources/3rdparty/glpk-4.65/src/zlib/deflate.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/deflate.c rename to resources/3rdparty/glpk-4.65/src/zlib/deflate.c diff --git a/resources/3rdparty/glpk-4.57/src/zlib/deflate.h b/resources/3rdparty/glpk-4.65/src/zlib/deflate.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/deflate.h rename to resources/3rdparty/glpk-4.65/src/zlib/deflate.h diff --git a/resources/3rdparty/glpk-4.57/src/zlib/gzclose.c b/resources/3rdparty/glpk-4.65/src/zlib/gzclose.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/gzclose.c rename to resources/3rdparty/glpk-4.65/src/zlib/gzclose.c diff --git a/resources/3rdparty/glpk-4.57/src/zlib/gzguts.h b/resources/3rdparty/glpk-4.65/src/zlib/gzguts.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/gzguts.h rename to resources/3rdparty/glpk-4.65/src/zlib/gzguts.h diff --git a/resources/3rdparty/glpk-4.57/src/zlib/gzlib.c b/resources/3rdparty/glpk-4.65/src/zlib/gzlib.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/gzlib.c rename to resources/3rdparty/glpk-4.65/src/zlib/gzlib.c diff --git a/resources/3rdparty/glpk-4.57/src/zlib/gzread.c b/resources/3rdparty/glpk-4.65/src/zlib/gzread.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/gzread.c rename to resources/3rdparty/glpk-4.65/src/zlib/gzread.c diff --git a/resources/3rdparty/glpk-4.57/src/zlib/gzwrite.c b/resources/3rdparty/glpk-4.65/src/zlib/gzwrite.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/gzwrite.c rename to resources/3rdparty/glpk-4.65/src/zlib/gzwrite.c diff --git a/resources/3rdparty/glpk-4.57/src/zlib/inffast.c b/resources/3rdparty/glpk-4.65/src/zlib/inffast.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/inffast.c rename to resources/3rdparty/glpk-4.65/src/zlib/inffast.c diff --git a/resources/3rdparty/glpk-4.57/src/zlib/inffast.h b/resources/3rdparty/glpk-4.65/src/zlib/inffast.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/inffast.h rename to resources/3rdparty/glpk-4.65/src/zlib/inffast.h diff --git a/resources/3rdparty/glpk-4.57/src/zlib/inffixed.h b/resources/3rdparty/glpk-4.65/src/zlib/inffixed.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/inffixed.h rename to resources/3rdparty/glpk-4.65/src/zlib/inffixed.h diff --git a/resources/3rdparty/glpk-4.57/src/zlib/inflate.c b/resources/3rdparty/glpk-4.65/src/zlib/inflate.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/inflate.c rename to resources/3rdparty/glpk-4.65/src/zlib/inflate.c diff --git a/resources/3rdparty/glpk-4.57/src/zlib/inflate.h b/resources/3rdparty/glpk-4.65/src/zlib/inflate.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/inflate.h rename to resources/3rdparty/glpk-4.65/src/zlib/inflate.h diff --git a/resources/3rdparty/glpk-4.57/src/zlib/inftrees.c b/resources/3rdparty/glpk-4.65/src/zlib/inftrees.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/inftrees.c rename to resources/3rdparty/glpk-4.65/src/zlib/inftrees.c diff --git a/resources/3rdparty/glpk-4.57/src/zlib/inftrees.h b/resources/3rdparty/glpk-4.65/src/zlib/inftrees.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/inftrees.h rename to resources/3rdparty/glpk-4.65/src/zlib/inftrees.h diff --git a/resources/3rdparty/glpk-4.57/src/zlib/trees.c b/resources/3rdparty/glpk-4.65/src/zlib/trees.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/trees.c rename to resources/3rdparty/glpk-4.65/src/zlib/trees.c diff --git a/resources/3rdparty/glpk-4.57/src/zlib/trees.h b/resources/3rdparty/glpk-4.65/src/zlib/trees.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/trees.h rename to resources/3rdparty/glpk-4.65/src/zlib/trees.h diff --git a/resources/3rdparty/glpk-4.57/src/zlib/uncompr.c b/resources/3rdparty/glpk-4.65/src/zlib/uncompr.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/uncompr.c rename to resources/3rdparty/glpk-4.65/src/zlib/uncompr.c diff --git a/resources/3rdparty/glpk-4.57/src/zlib/zconf.h b/resources/3rdparty/glpk-4.65/src/zlib/zconf.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/zconf.h rename to resources/3rdparty/glpk-4.65/src/zlib/zconf.h diff --git a/resources/3rdparty/glpk-4.57/src/zlib/zio.c b/resources/3rdparty/glpk-4.65/src/zlib/zio.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/zio.c rename to resources/3rdparty/glpk-4.65/src/zlib/zio.c diff --git a/resources/3rdparty/glpk-4.57/src/zlib/zio.h b/resources/3rdparty/glpk-4.65/src/zlib/zio.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/zio.h rename to resources/3rdparty/glpk-4.65/src/zlib/zio.h diff --git a/resources/3rdparty/glpk-4.57/src/zlib/zlib.h b/resources/3rdparty/glpk-4.65/src/zlib/zlib.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/zlib.h rename to resources/3rdparty/glpk-4.65/src/zlib/zlib.h diff --git a/resources/3rdparty/glpk-4.57/src/zlib/zutil.c b/resources/3rdparty/glpk-4.65/src/zlib/zutil.c similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/zutil.c rename to resources/3rdparty/glpk-4.65/src/zlib/zutil.c diff --git a/resources/3rdparty/glpk-4.57/src/zlib/zutil.h b/resources/3rdparty/glpk-4.65/src/zlib/zutil.h similarity index 100% rename from resources/3rdparty/glpk-4.57/src/zlib/zutil.h rename to resources/3rdparty/glpk-4.65/src/zlib/zutil.h diff --git a/resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC10.bat b/resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC10.bat similarity index 96% rename from resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC10.bat rename to resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC10.bat index b0f693446..d175ab840 100755 --- a/resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC10.bat +++ b/resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC10.bat @@ -1,11 +1,11 @@ -rem Build GLPK with Microsoft Visual Studio Express 2010 - -rem NOTE: Make sure that HOME variable specifies correct path -set HOME="C:\Program Files\Microsoft Visual Studio 10.0\VC" - -call %HOME%\vcvarsall.bat x86 -copy config_VC config.h -%HOME%\bin\nmake.exe /f Makefile_VC -%HOME%\bin\nmake.exe /f Makefile_VC check - -pause +rem Build GLPK with Microsoft Visual Studio Express 2010 + +rem NOTE: Make sure that HOME variable specifies correct path +set HOME="C:\Program Files\Microsoft Visual Studio 10.0\VC" + +call %HOME%\vcvarsall.bat x86 +copy config_VC config.h +%HOME%\bin\nmake.exe /f Makefile_VC +%HOME%\bin\nmake.exe /f Makefile_VC check + +pause diff --git a/resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC10_DLL.bat b/resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC10_DLL.bat similarity index 96% rename from resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC10_DLL.bat rename to resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC10_DLL.bat index e66f5cb39..a2876ee65 100755 --- a/resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC10_DLL.bat +++ b/resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC10_DLL.bat @@ -1,11 +1,11 @@ -rem Build GLPK DLL with Microsoft Visual Studio Express 2010 - -rem NOTE: Make sure that HOME variable specifies correct path -set HOME="C:\Program Files\Microsoft Visual Studio 10.0\VC" - -call %HOME%\vcvarsall.bat x86 -copy config_VC config.h -%HOME%\bin\nmake.exe /f Makefile_VC_DLL -%HOME%\bin\nmake.exe /f Makefile_VC_DLL check - -pause +rem Build GLPK DLL with Microsoft Visual Studio Express 2010 + +rem NOTE: Make sure that HOME variable specifies correct path +set HOME="C:\Program Files\Microsoft Visual Studio 10.0\VC" + +call %HOME%\vcvarsall.bat x86 +copy config_VC config.h +%HOME%\bin\nmake.exe /f Makefile_VC_DLL +%HOME%\bin\nmake.exe /f Makefile_VC_DLL check + +pause diff --git a/resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC10_stdcall_DLL.bat b/resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC10_stdcall_DLL.bat new file mode 100755 index 000000000..95de3aa15 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC10_stdcall_DLL.bat @@ -0,0 +1,11 @@ +rem Build GLPK DLL with Microsoft Visual Studio Express 2010 + +rem NOTE: Make sure that HOME variable specifies correct path +set HOME="C:\Program Files\Microsoft Visual Studio 10.0\VC" + +call %HOME%\vcvarsall.bat x86 +copy config_VC config.h +%HOME%\bin\nmake.exe /f Makefile_VC_stdcall_DLL +%HOME%\bin\nmake.exe /f Makefile_VC_stdcall_DLL check + +pause diff --git a/resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC14.bat b/resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC14.bat similarity index 96% rename from resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC14.bat rename to resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC14.bat index 02bb9add3..aa4532f91 100755 --- a/resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC14.bat +++ b/resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC14.bat @@ -1,11 +1,11 @@ -rem Build GLPK with Microsoft Visual Studio Community 2015 - -rem NOTE: Make sure that HOME variable specifies correct path -set HOME="C:\Program Files\Microsoft Visual Studio 14.0\VC" - -call %HOME%\vcvarsall.bat x86 -copy config_VC config.h -%HOME%\bin\nmake.exe /f Makefile_VC -%HOME%\bin\nmake.exe /f Makefile_VC check - -pause +rem Build GLPK with Microsoft Visual Studio Community 2015 + +rem NOTE: Make sure that HOME variable specifies correct path +set HOME="C:\Program Files\Microsoft Visual Studio 14.0\VC" + +call %HOME%\vcvarsall.bat x86 +copy config_VC config.h +%HOME%\bin\nmake.exe /f Makefile_VC +%HOME%\bin\nmake.exe /f Makefile_VC check + +pause diff --git a/resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC14_DLL.bat b/resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC14_DLL.bat similarity index 96% rename from resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC14_DLL.bat rename to resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC14_DLL.bat index baf4b112b..28174657d 100755 --- a/resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC14_DLL.bat +++ b/resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC14_DLL.bat @@ -1,11 +1,11 @@ -rem Build GLPK DLL with Microsoft Visual Studio Community 2015 - -rem NOTE: Make sure that HOME variable specifies correct path -set HOME="C:\Program Files\Microsoft Visual Studio 14.0\VC" - -call %HOME%\vcvarsall.bat x86 -copy config_VC config.h -%HOME%\bin\nmake.exe /f Makefile_VC_DLL -%HOME%\bin\nmake.exe /f Makefile_VC_DLL check - -pause +rem Build GLPK DLL with Microsoft Visual Studio Community 2015 + +rem NOTE: Make sure that HOME variable specifies correct path +set HOME="C:\Program Files\Microsoft Visual Studio 14.0\VC" + +call %HOME%\vcvarsall.bat x86 +copy config_VC config.h +%HOME%\bin\nmake.exe /f Makefile_VC_DLL +%HOME%\bin\nmake.exe /f Makefile_VC_DLL check + +pause diff --git a/resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC9.bat b/resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC9.bat similarity index 96% rename from resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC9.bat rename to resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC9.bat index 9c5e8f83d..1298a7c8b 100755 --- a/resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC9.bat +++ b/resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC9.bat @@ -1,11 +1,11 @@ -rem Build GLPK with Microsoft Visual Studio Express 2008 - -rem NOTE: Make sure that HOME variable specifies correct path -set HOME="C:\Program Files\Microsoft Visual Studio 9.0\VC" - -call %HOME%\bin\vcvars32.bat -copy config_VC config.h -%HOME%\bin\nmake.exe /f Makefile_VC -%HOME%\bin\nmake.exe /f Makefile_VC check - -pause +rem Build GLPK with Microsoft Visual Studio Express 2008 + +rem NOTE: Make sure that HOME variable specifies correct path +set HOME="C:\Program Files\Microsoft Visual Studio 9.0\VC" + +call %HOME%\bin\vcvars32.bat +copy config_VC config.h +%HOME%\bin\nmake.exe /f Makefile_VC +%HOME%\bin\nmake.exe /f Makefile_VC check + +pause diff --git a/resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC9_DLL.bat b/resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC9_DLL.bat similarity index 96% rename from resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC9_DLL.bat rename to resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC9_DLL.bat index f334c04af..c054308fc 100755 --- a/resources/3rdparty/glpk-4.57/w32/Build_GLPK_with_VC9_DLL.bat +++ b/resources/3rdparty/glpk-4.65/w32/Build_GLPK_with_VC9_DLL.bat @@ -1,11 +1,11 @@ -rem Build GLPK DLL with Microsoft Visual Studio Express 2008 - -rem NOTE: Make sure that HOME variable specifies correct path -set HOME="C:\Program Files\Microsoft Visual Studio 9.0\VC" - -call %HOME%\bin\vcvars32.bat -copy config_VC config.h -%HOME%\bin\nmake.exe /f Makefile_VC_DLL -%HOME%\bin\nmake.exe /f Makefile_VC_DLL check - -pause +rem Build GLPK DLL with Microsoft Visual Studio Express 2008 + +rem NOTE: Make sure that HOME variable specifies correct path +set HOME="C:\Program Files\Microsoft Visual Studio 9.0\VC" + +call %HOME%\bin\vcvars32.bat +copy config_VC config.h +%HOME%\bin\nmake.exe /f Makefile_VC_DLL +%HOME%\bin\nmake.exe /f Makefile_VC_DLL check + +pause diff --git a/resources/3rdparty/glpk-4.65/w32/Makefile_VC b/resources/3rdparty/glpk-4.65/w32/Makefile_VC new file mode 100644 index 000000000..207338243 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/w32/Makefile_VC @@ -0,0 +1,251 @@ +## Build GLPK with Microsoft Visual Studio Express ## + +CFLAGS = \ +/I. \ +/I..\src \ +/I..\src\amd \ +/I..\src\api \ +/I..\src\bflib \ +/I..\src\colamd \ +/I..\src\draft \ +/I..\src\env \ +/I..\src\intopt \ +/I..\src\minisat \ +/I..\src\misc \ +/I..\src\mpl \ +/I..\src\npp \ +/I..\src\proxy \ +/I..\src\simplex \ +/I..\src\zlib \ +/DHAVE_CONFIG_H=1 \ +/D_CRT_SECURE_NO_WARNINGS=1 \ +/nologo \ +/W3 \ +/O2 \ +/Zi + +OBJSET = \ +..\src\amd\amd_1.obj \ +..\src\amd\amd_2.obj \ +..\src\amd\amd_aat.obj \ +..\src\amd\amd_control.obj \ +..\src\amd\amd_defaults.obj \ +..\src\amd\amd_dump.obj \ +..\src\amd\amd_info.obj \ +..\src\amd\amd_order.obj \ +..\src\amd\amd_post_tree.obj \ +..\src\amd\amd_postorder.obj \ +..\src\amd\amd_preprocess.obj \ +..\src\amd\amd_valid.obj \ +..\src\api\advbas.obj \ +..\src\api\asnhall.obj \ +..\src\api\asnlp.obj \ +..\src\api\asnokalg.obj \ +..\src\api\ckasn.obj \ +..\src\api\ckcnf.obj \ +..\src\api\cplex.obj \ +..\src\api\cpp.obj \ +..\src\api\cpxbas.obj \ +..\src\api\graph.obj \ +..\src\api\gridgen.obj \ +..\src\api\intfeas1.obj \ +..\src\api\maxffalg.obj \ +..\src\api\maxflp.obj \ +..\src\api\mcflp.obj \ +..\src\api\mcfokalg.obj \ +..\src\api\mcfrelax.obj \ +..\src\api\minisat1.obj \ +..\src\api\mpl.obj \ +..\src\api\mps.obj \ +..\src\api\netgen.obj \ +..\src\api\npp.obj \ +..\src\api\pript.obj \ +..\src\api\prmip.obj \ +..\src\api\prob1.obj \ +..\src\api\prob2.obj \ +..\src\api\prob3.obj \ +..\src\api\prob4.obj \ +..\src\api\prob5.obj \ +..\src\api\prrngs.obj \ +..\src\api\prsol.obj \ +..\src\api\rdasn.obj \ +..\src\api\rdcc.obj \ +..\src\api\rdcnf.obj \ +..\src\api\rdipt.obj \ +..\src\api\rdmaxf.obj \ +..\src\api\rdmcf.obj \ +..\src\api\rdmip.obj \ +..\src\api\rdprob.obj \ +..\src\api\rdsol.obj \ +..\src\api\rmfgen.obj \ +..\src\api\strong.obj \ +..\src\api\topsort.obj \ +..\src\api\weak.obj \ +..\src\api\wcliqex.obj \ +..\src\api\wrasn.obj \ +..\src\api\wrcc.obj \ +..\src\api\wrcnf.obj \ +..\src\api\wript.obj \ +..\src\api\wrmaxf.obj \ +..\src\api\wrmcf.obj \ +..\src\api\wrmip.obj \ +..\src\api\wrprob.obj \ +..\src\api\wrsol.obj \ +..\src\bflib\btf.obj \ +..\src\bflib\btfint.obj \ +..\src\bflib\fhv.obj \ +..\src\bflib\fhvint.obj \ +..\src\bflib\ifu.obj \ +..\src\bflib\luf.obj \ +..\src\bflib\lufint.obj \ +..\src\bflib\scf.obj \ +..\src\bflib\scfint.obj \ +..\src\bflib\sgf.obj \ +..\src\bflib\sva.obj \ +..\src\colamd\colamd.obj \ +..\src\draft\bfd.obj \ +..\src\draft\bfx.obj \ +..\src\draft\glpapi06.obj \ +..\src\draft\glpapi07.obj \ +..\src\draft\glpapi08.obj \ +..\src\draft\glpapi09.obj \ +..\src\draft\glpapi10.obj \ +..\src\draft\glpapi12.obj \ +..\src\draft\glpapi13.obj \ +..\src\draft\glphbm.obj \ +..\src\draft\glpios01.obj \ +..\src\draft\glpios02.obj \ +..\src\draft\glpios03.obj \ +..\src\draft\glpios07.obj \ +..\src\draft\glpios09.obj \ +..\src\draft\glpios11.obj \ +..\src\draft\glpios12.obj \ +..\src\draft\glpipm.obj \ +..\src\draft\glpmat.obj \ +..\src\draft\glprgr.obj \ +..\src\draft\glpscl.obj \ +..\src\draft\glpspm.obj \ +..\src\draft\glpssx01.obj \ +..\src\draft\glpssx02.obj \ +..\src\draft\lux.obj \ +..\src\env\alloc.obj \ +..\src\env\dlsup.obj \ +..\src\env\env.obj \ +..\src\env\error.obj \ +..\src\env\stdc.obj \ +..\src\env\stdout.obj \ +..\src\env\stream.obj \ +..\src\env\time.obj \ +..\src\env\tls.obj \ +..\src\intopt\cfg.obj \ +..\src\intopt\cfg1.obj \ +..\src\intopt\cfg2.obj \ +..\src\intopt\clqcut.obj \ +..\src\intopt\covgen.obj \ +..\src\intopt\fpump.obj \ +..\src\intopt\gmicut.obj \ +..\src\intopt\gmigen.obj \ +..\src\intopt\mirgen.obj \ +..\src\intopt\spv.obj \ +..\src\minisat\minisat.obj \ +..\src\misc\avl.obj \ +..\src\misc\bignum.obj \ +..\src\misc\dimacs.obj \ +..\src\misc\dmp.obj \ +..\src\misc\ffalg.obj \ +..\src\misc\fp2rat.obj \ +..\src\misc\fvs.obj \ +..\src\misc\gcd.obj \ +..\src\misc\jd.obj \ +..\src\misc\keller.obj \ +..\src\misc\ks.obj \ +..\src\misc\mc13d.obj \ +..\src\misc\mc21a.obj \ +..\src\misc\mt1.obj \ +..\src\misc\mygmp.obj \ +..\src\misc\okalg.obj \ +..\src\misc\qmd.obj \ +..\src\misc\relax4.obj \ +..\src\misc\rng.obj \ +..\src\misc\rng1.obj \ +..\src\misc\round2n.obj \ +..\src\misc\str2int.obj \ +..\src\misc\str2num.obj \ +..\src\misc\strspx.obj \ +..\src\misc\strtrim.obj \ +..\src\misc\triang.obj \ +..\src\misc\wclique.obj \ +..\src\misc\wclique1.obj \ +..\src\mpl\mpl1.obj \ +..\src\mpl\mpl2.obj \ +..\src\mpl\mpl3.obj \ +..\src\mpl\mpl4.obj \ +..\src\mpl\mpl5.obj \ +..\src\mpl\mpl6.obj \ +..\src\mpl\mplsql.obj \ +..\src\npp\npp1.obj \ +..\src\npp\npp2.obj \ +..\src\npp\npp3.obj \ +..\src\npp\npp4.obj \ +..\src\npp\npp5.obj \ +..\src\npp\npp6.obj \ +..\src\proxy\proxy.obj \ +..\src\proxy\proxy1.obj \ +..\src\simplex\spxat.obj \ +..\src\simplex\spxchuzc.obj \ +..\src\simplex\spxchuzr.obj \ +..\src\simplex\spxlp.obj \ +..\src\simplex\spxnt.obj \ +..\src\simplex\spxprim.obj \ +..\src\simplex\spxprob.obj \ +..\src\simplex\spychuzc.obj \ +..\src\simplex\spychuzr.obj \ +..\src\simplex\spydual.obj \ +..\src\zlib\adler32.obj \ +..\src\zlib\compress.obj \ +..\src\zlib\crc32.obj \ +..\src\zlib\deflate.obj \ +..\src\zlib\gzclose.obj \ +..\src\zlib\gzlib.obj \ +..\src\zlib\gzread.obj \ +..\src\zlib\gzwrite.obj \ +..\src\zlib\inffast.obj \ +..\src\zlib\inflate.obj \ +..\src\zlib\inftrees.obj \ +..\src\zlib\trees.obj \ +..\src\zlib\uncompr.obj \ +..\src\zlib\zio.obj \ +..\src\zlib\zutil.obj + +.c.obj: + cl.exe $(CFLAGS) /Fo$*.obj /c $*.c + +all: glpk.lib glpsol.exe + +glpk.lib: $(OBJSET) + lib.exe /out:glpk.lib \ + ..\src\*.obj \ + ..\src\amd\*.obj \ + ..\src\api\*.obj \ + ..\src\bflib\*.obj \ + ..\src\colamd\*.obj \ + ..\src\draft\*.obj \ + ..\src\env\*.obj \ + ..\src\intopt\*.obj \ + ..\src\minisat\*.obj \ + ..\src\misc\*.obj \ + ..\src\mpl\*.obj \ + ..\src\npp\*.obj \ + ..\src\proxy\*.obj \ + ..\src\simplex\*.obj \ + ..\src\zlib\*.obj + +glpsol.exe: ..\examples\glpsol.obj glpk.lib + cl.exe $(CFLAGS) /Feglpsol.exe \ + ..\examples\glpsol.obj glpk.lib + +check: glpsol.exe + .\glpsol.exe --version + .\glpsol.exe --mps ..\examples\murtagh.mps --max + +## eof ## diff --git a/resources/3rdparty/glpk-4.65/w32/Makefile_VC_DLL b/resources/3rdparty/glpk-4.65/w32/Makefile_VC_DLL new file mode 100644 index 000000000..5ca94d36c --- /dev/null +++ b/resources/3rdparty/glpk-4.65/w32/Makefile_VC_DLL @@ -0,0 +1,252 @@ +## Build GLPK DLL with Microsoft Visual Studio Express ## + +CFLAGS = \ +/I. \ +/I..\src \ +/I..\src\amd \ +/I..\src\api \ +/I..\src\bflib \ +/I..\src\colamd \ +/I..\src\draft \ +/I..\src\env \ +/I..\src\intopt \ +/I..\src\minisat \ +/I..\src\misc \ +/I..\src\mpl \ +/I..\src\npp \ +/I..\src\proxy \ +/I..\src\simplex \ +/I..\src\zlib \ +/DHAVE_CONFIG_H=1 \ +/D_CRT_SECURE_NO_WARNINGS=1 \ +/nologo \ +/W3 \ +/O2 \ +/Zi + +OBJSET = \ +..\src\amd\amd_1.obj \ +..\src\amd\amd_2.obj \ +..\src\amd\amd_aat.obj \ +..\src\amd\amd_control.obj \ +..\src\amd\amd_defaults.obj \ +..\src\amd\amd_dump.obj \ +..\src\amd\amd_info.obj \ +..\src\amd\amd_order.obj \ +..\src\amd\amd_post_tree.obj \ +..\src\amd\amd_postorder.obj \ +..\src\amd\amd_preprocess.obj \ +..\src\amd\amd_valid.obj \ +..\src\api\advbas.obj \ +..\src\api\asnhall.obj \ +..\src\api\asnlp.obj \ +..\src\api\asnokalg.obj \ +..\src\api\ckasn.obj \ +..\src\api\ckcnf.obj \ +..\src\api\cplex.obj \ +..\src\api\cpp.obj \ +..\src\api\cpxbas.obj \ +..\src\api\graph.obj \ +..\src\api\gridgen.obj \ +..\src\api\intfeas1.obj \ +..\src\api\maxffalg.obj \ +..\src\api\maxflp.obj \ +..\src\api\mcflp.obj \ +..\src\api\mcfokalg.obj \ +..\src\api\mcfrelax.obj \ +..\src\api\minisat1.obj \ +..\src\api\mpl.obj \ +..\src\api\mps.obj \ +..\src\api\netgen.obj \ +..\src\api\npp.obj \ +..\src\api\pript.obj \ +..\src\api\prmip.obj \ +..\src\api\prob1.obj \ +..\src\api\prob2.obj \ +..\src\api\prob3.obj \ +..\src\api\prob4.obj \ +..\src\api\prob5.obj \ +..\src\api\prrngs.obj \ +..\src\api\prsol.obj \ +..\src\api\rdasn.obj \ +..\src\api\rdcc.obj \ +..\src\api\rdcnf.obj \ +..\src\api\rdipt.obj \ +..\src\api\rdmaxf.obj \ +..\src\api\rdmcf.obj \ +..\src\api\rdmip.obj \ +..\src\api\rdprob.obj \ +..\src\api\rdsol.obj \ +..\src\api\rmfgen.obj \ +..\src\api\strong.obj \ +..\src\api\topsort.obj \ +..\src\api\weak.obj \ +..\src\api\wcliqex.obj \ +..\src\api\wrasn.obj \ +..\src\api\wrcc.obj \ +..\src\api\wrcnf.obj \ +..\src\api\wript.obj \ +..\src\api\wrmaxf.obj \ +..\src\api\wrmcf.obj \ +..\src\api\wrmip.obj \ +..\src\api\wrprob.obj \ +..\src\api\wrsol.obj \ +..\src\bflib\btf.obj \ +..\src\bflib\btfint.obj \ +..\src\bflib\fhv.obj \ +..\src\bflib\fhvint.obj \ +..\src\bflib\ifu.obj \ +..\src\bflib\luf.obj \ +..\src\bflib\lufint.obj \ +..\src\bflib\scf.obj \ +..\src\bflib\scfint.obj \ +..\src\bflib\sgf.obj \ +..\src\bflib\sva.obj \ +..\src\colamd\colamd.obj \ +..\src\draft\bfd.obj \ +..\src\draft\bfx.obj \ +..\src\draft\glpapi06.obj \ +..\src\draft\glpapi07.obj \ +..\src\draft\glpapi08.obj \ +..\src\draft\glpapi09.obj \ +..\src\draft\glpapi10.obj \ +..\src\draft\glpapi12.obj \ +..\src\draft\glpapi13.obj \ +..\src\draft\glphbm.obj \ +..\src\draft\glpios01.obj \ +..\src\draft\glpios02.obj \ +..\src\draft\glpios03.obj \ +..\src\draft\glpios07.obj \ +..\src\draft\glpios09.obj \ +..\src\draft\glpios11.obj \ +..\src\draft\glpios12.obj \ +..\src\draft\glpipm.obj \ +..\src\draft\glpmat.obj \ +..\src\draft\glprgr.obj \ +..\src\draft\glpscl.obj \ +..\src\draft\glpspm.obj \ +..\src\draft\glpssx01.obj \ +..\src\draft\glpssx02.obj \ +..\src\draft\lux.obj \ +..\src\env\alloc.obj \ +..\src\env\dlsup.obj \ +..\src\env\env.obj \ +..\src\env\error.obj \ +..\src\env\stdc.obj \ +..\src\env\stdout.obj \ +..\src\env\stream.obj \ +..\src\env\time.obj \ +..\src\env\tls.obj \ +..\src\intopt\cfg.obj \ +..\src\intopt\cfg1.obj \ +..\src\intopt\cfg2.obj \ +..\src\intopt\clqcut.obj \ +..\src\intopt\covgen.obj \ +..\src\intopt\fpump.obj \ +..\src\intopt\gmicut.obj \ +..\src\intopt\gmigen.obj \ +..\src\intopt\mirgen.obj \ +..\src\intopt\spv.obj \ +..\src\minisat\minisat.obj \ +..\src\misc\avl.obj \ +..\src\misc\bignum.obj \ +..\src\misc\dimacs.obj \ +..\src\misc\dmp.obj \ +..\src\misc\ffalg.obj \ +..\src\misc\fp2rat.obj \ +..\src\misc\fvs.obj \ +..\src\misc\gcd.obj \ +..\src\misc\jd.obj \ +..\src\misc\keller.obj \ +..\src\misc\ks.obj \ +..\src\misc\mc13d.obj \ +..\src\misc\mc21a.obj \ +..\src\misc\mt1.obj \ +..\src\misc\mygmp.obj \ +..\src\misc\okalg.obj \ +..\src\misc\qmd.obj \ +..\src\misc\relax4.obj \ +..\src\misc\rng.obj \ +..\src\misc\rng1.obj \ +..\src\misc\round2n.obj \ +..\src\misc\str2int.obj \ +..\src\misc\str2num.obj \ +..\src\misc\strspx.obj \ +..\src\misc\strtrim.obj \ +..\src\misc\triang.obj \ +..\src\misc\wclique.obj \ +..\src\misc\wclique1.obj \ +..\src\mpl\mpl1.obj \ +..\src\mpl\mpl2.obj \ +..\src\mpl\mpl3.obj \ +..\src\mpl\mpl4.obj \ +..\src\mpl\mpl5.obj \ +..\src\mpl\mpl6.obj \ +..\src\mpl\mplsql.obj \ +..\src\npp\npp1.obj \ +..\src\npp\npp2.obj \ +..\src\npp\npp3.obj \ +..\src\npp\npp4.obj \ +..\src\npp\npp5.obj \ +..\src\npp\npp6.obj \ +..\src\proxy\proxy.obj \ +..\src\proxy\proxy1.obj \ +..\src\simplex\spxat.obj \ +..\src\simplex\spxchuzc.obj \ +..\src\simplex\spxchuzr.obj \ +..\src\simplex\spxlp.obj \ +..\src\simplex\spxnt.obj \ +..\src\simplex\spxprim.obj \ +..\src\simplex\spxprob.obj \ +..\src\simplex\spychuzc.obj \ +..\src\simplex\spychuzr.obj \ +..\src\simplex\spydual.obj \ +..\src\zlib\adler32.obj \ +..\src\zlib\compress.obj \ +..\src\zlib\crc32.obj \ +..\src\zlib\deflate.obj \ +..\src\zlib\gzclose.obj \ +..\src\zlib\gzlib.obj \ +..\src\zlib\gzread.obj \ +..\src\zlib\gzwrite.obj \ +..\src\zlib\inffast.obj \ +..\src\zlib\inflate.obj \ +..\src\zlib\inftrees.obj \ +..\src\zlib\trees.obj \ +..\src\zlib\uncompr.obj \ +..\src\zlib\zio.obj \ +..\src\zlib\zutil.obj + +.c.obj: + cl.exe $(CFLAGS) /Fo$*.obj /c $*.c + +all: glpk_4_65.dll glpsol.exe + +glpk_4_65.dll: $(OBJSET) + cl.exe $(CFLAGS) /LD /Feglpk_4_65.dll \ + ..\src\*.obj \ + ..\src\amd\*.obj \ + ..\src\api\*.obj \ + ..\src\bflib\*.obj \ + ..\src\colamd\*.obj \ + ..\src\draft\*.obj \ + ..\src\env\*.obj \ + ..\src\intopt\*.obj \ + ..\src\minisat\*.obj \ + ..\src\misc\*.obj \ + ..\src\mpl\*.obj \ + ..\src\npp\*.obj \ + ..\src\proxy\*.obj \ + ..\src\simplex\*.obj \ + ..\src\zlib\*.obj \ + glpk_4_65.def + +glpsol.exe: ..\examples\glpsol.obj glpk_4_65.dll + cl.exe $(CFLAGS) /Feglpsol.exe \ + ..\examples\glpsol.obj glpk_4_65.lib + +check: glpsol.exe + .\glpsol.exe --version + .\glpsol.exe --mps ..\examples\murtagh.mps --max + +## eof ## diff --git a/resources/3rdparty/glpk-4.65/w32/Makefile_VC_stdcall_DLL b/resources/3rdparty/glpk-4.65/w32/Makefile_VC_stdcall_DLL new file mode 100644 index 000000000..8875f803b --- /dev/null +++ b/resources/3rdparty/glpk-4.65/w32/Makefile_VC_stdcall_DLL @@ -0,0 +1,253 @@ +## Build GLPK DLL with Microsoft Visual Studio Express ## + +CFLAGS = \ +/I. \ +/I..\src \ +/I..\src\amd \ +/I..\src\api \ +/I..\src\bflib \ +/I..\src\colamd \ +/I..\src\draft \ +/I..\src\env \ +/I..\src\intopt \ +/I..\src\minisat \ +/I..\src\misc \ +/I..\src\mpl \ +/I..\src\npp \ +/I..\src\proxy \ +/I..\src\simplex \ +/I..\src\zlib \ +/DHAVE_CONFIG_H=1 \ +/D_CRT_SECURE_NO_WARNINGS=1 \ +/nologo \ +/W3 \ +/O2 \ +/Zi \ +/Gz + +OBJSET = \ +..\src\amd\amd_1.obj \ +..\src\amd\amd_2.obj \ +..\src\amd\amd_aat.obj \ +..\src\amd\amd_control.obj \ +..\src\amd\amd_defaults.obj \ +..\src\amd\amd_dump.obj \ +..\src\amd\amd_info.obj \ +..\src\amd\amd_order.obj \ +..\src\amd\amd_post_tree.obj \ +..\src\amd\amd_postorder.obj \ +..\src\amd\amd_preprocess.obj \ +..\src\amd\amd_valid.obj \ +..\src\api\advbas.obj \ +..\src\api\asnhall.obj \ +..\src\api\asnlp.obj \ +..\src\api\asnokalg.obj \ +..\src\api\ckasn.obj \ +..\src\api\ckcnf.obj \ +..\src\api\cplex.obj \ +..\src\api\cpp.obj \ +..\src\api\cpxbas.obj \ +..\src\api\graph.obj \ +..\src\api\gridgen.obj \ +..\src\api\intfeas1.obj \ +..\src\api\maxffalg.obj \ +..\src\api\maxflp.obj \ +..\src\api\mcflp.obj \ +..\src\api\mcfokalg.obj \ +..\src\api\mcfrelax.obj \ +..\src\api\minisat1.obj \ +..\src\api\mpl.obj \ +..\src\api\mps.obj \ +..\src\api\netgen.obj \ +..\src\api\npp.obj \ +..\src\api\pript.obj \ +..\src\api\prmip.obj \ +..\src\api\prob1.obj \ +..\src\api\prob2.obj \ +..\src\api\prob3.obj \ +..\src\api\prob4.obj \ +..\src\api\prob5.obj \ +..\src\api\prrngs.obj \ +..\src\api\prsol.obj \ +..\src\api\rdasn.obj \ +..\src\api\rdcc.obj \ +..\src\api\rdcnf.obj \ +..\src\api\rdipt.obj \ +..\src\api\rdmaxf.obj \ +..\src\api\rdmcf.obj \ +..\src\api\rdmip.obj \ +..\src\api\rdprob.obj \ +..\src\api\rdsol.obj \ +..\src\api\rmfgen.obj \ +..\src\api\strong.obj \ +..\src\api\topsort.obj \ +..\src\api\weak.obj \ +..\src\api\wcliqex.obj \ +..\src\api\wrasn.obj \ +..\src\api\wrcc.obj \ +..\src\api\wrcnf.obj \ +..\src\api\wript.obj \ +..\src\api\wrmaxf.obj \ +..\src\api\wrmcf.obj \ +..\src\api\wrmip.obj \ +..\src\api\wrprob.obj \ +..\src\api\wrsol.obj \ +..\src\bflib\btf.obj \ +..\src\bflib\btfint.obj \ +..\src\bflib\fhv.obj \ +..\src\bflib\fhvint.obj \ +..\src\bflib\ifu.obj \ +..\src\bflib\luf.obj \ +..\src\bflib\lufint.obj \ +..\src\bflib\scf.obj \ +..\src\bflib\scfint.obj \ +..\src\bflib\sgf.obj \ +..\src\bflib\sva.obj \ +..\src\colamd\colamd.obj \ +..\src\draft\bfd.obj \ +..\src\draft\bfx.obj \ +..\src\draft\glpapi06.obj \ +..\src\draft\glpapi07.obj \ +..\src\draft\glpapi08.obj \ +..\src\draft\glpapi09.obj \ +..\src\draft\glpapi10.obj \ +..\src\draft\glpapi12.obj \ +..\src\draft\glpapi13.obj \ +..\src\draft\glphbm.obj \ +..\src\draft\glpios01.obj \ +..\src\draft\glpios02.obj \ +..\src\draft\glpios03.obj \ +..\src\draft\glpios07.obj \ +..\src\draft\glpios09.obj \ +..\src\draft\glpios11.obj \ +..\src\draft\glpios12.obj \ +..\src\draft\glpipm.obj \ +..\src\draft\glpmat.obj \ +..\src\draft\glprgr.obj \ +..\src\draft\glpscl.obj \ +..\src\draft\glpspm.obj \ +..\src\draft\glpssx01.obj \ +..\src\draft\glpssx02.obj \ +..\src\draft\lux.obj \ +..\src\env\alloc.obj \ +..\src\env\dlsup.obj \ +..\src\env\env.obj \ +..\src\env\error.obj \ +..\src\env\stdc.obj \ +..\src\env\stdout.obj \ +..\src\env\stream.obj \ +..\src\env\time.obj \ +..\src\env\tls.obj \ +..\src\intopt\cfg.obj \ +..\src\intopt\cfg1.obj \ +..\src\intopt\cfg2.obj \ +..\src\intopt\clqcut.obj \ +..\src\intopt\covgen.obj \ +..\src\intopt\fpump.obj \ +..\src\intopt\gmicut.obj \ +..\src\intopt\gmigen.obj \ +..\src\intopt\mirgen.obj \ +..\src\intopt\spv.obj \ +..\src\minisat\minisat.obj \ +..\src\misc\avl.obj \ +..\src\misc\bignum.obj \ +..\src\misc\dimacs.obj \ +..\src\misc\dmp.obj \ +..\src\misc\ffalg.obj \ +..\src\misc\fp2rat.obj \ +..\src\misc\fvs.obj \ +..\src\misc\gcd.obj \ +..\src\misc\jd.obj \ +..\src\misc\keller.obj \ +..\src\misc\ks.obj \ +..\src\misc\mc13d.obj \ +..\src\misc\mc21a.obj \ +..\src\misc\mt1.obj \ +..\src\misc\mygmp.obj \ +..\src\misc\okalg.obj \ +..\src\misc\qmd.obj \ +..\src\misc\relax4.obj \ +..\src\misc\rng.obj \ +..\src\misc\rng1.obj \ +..\src\misc\round2n.obj \ +..\src\misc\str2int.obj \ +..\src\misc\str2num.obj \ +..\src\misc\strspx.obj \ +..\src\misc\strtrim.obj \ +..\src\misc\triang.obj \ +..\src\misc\wclique.obj \ +..\src\misc\wclique1.obj \ +..\src\mpl\mpl1.obj \ +..\src\mpl\mpl2.obj \ +..\src\mpl\mpl3.obj \ +..\src\mpl\mpl4.obj \ +..\src\mpl\mpl5.obj \ +..\src\mpl\mpl6.obj \ +..\src\mpl\mplsql.obj \ +..\src\npp\npp1.obj \ +..\src\npp\npp2.obj \ +..\src\npp\npp3.obj \ +..\src\npp\npp4.obj \ +..\src\npp\npp5.obj \ +..\src\npp\npp6.obj \ +..\src\proxy\proxy.obj \ +..\src\proxy\proxy1.obj \ +..\src\simplex\spxat.obj \ +..\src\simplex\spxchuzc.obj \ +..\src\simplex\spxchuzr.obj \ +..\src\simplex\spxlp.obj \ +..\src\simplex\spxnt.obj \ +..\src\simplex\spxprim.obj \ +..\src\simplex\spxprob.obj \ +..\src\simplex\spychuzc.obj \ +..\src\simplex\spychuzr.obj \ +..\src\simplex\spydual.obj \ +..\src\zlib\adler32.obj \ +..\src\zlib\compress.obj \ +..\src\zlib\crc32.obj \ +..\src\zlib\deflate.obj \ +..\src\zlib\gzclose.obj \ +..\src\zlib\gzlib.obj \ +..\src\zlib\gzread.obj \ +..\src\zlib\gzwrite.obj \ +..\src\zlib\inffast.obj \ +..\src\zlib\inflate.obj \ +..\src\zlib\inftrees.obj \ +..\src\zlib\trees.obj \ +..\src\zlib\uncompr.obj \ +..\src\zlib\zio.obj \ +..\src\zlib\zutil.obj + +.c.obj: + cl.exe $(CFLAGS) /Fo$*.obj /c $*.c + +all: glpk_4_65_stdcall.dll glpsol.exe + +glpk_4_65_stdcall.dll: $(OBJSET) + cl.exe $(CFLAGS) /LD /Feglpk_4_65_stdcall.dll \ + ..\src\*.obj \ + ..\src\amd\*.obj \ + ..\src\api\*.obj \ + ..\src\bflib\*.obj \ + ..\src\colamd\*.obj \ + ..\src\draft\*.obj \ + ..\src\env\*.obj \ + ..\src\intopt\*.obj \ + ..\src\minisat\*.obj \ + ..\src\misc\*.obj \ + ..\src\mpl\*.obj \ + ..\src\npp\*.obj \ + ..\src\proxy\*.obj \ + ..\src\simplex\*.obj \ + ..\src\zlib\*.obj \ + glpk_4_65_stdcall.def + +glpsol.exe: ..\examples\glpsol.obj glpk_4_65_stdcall.dll + cl.exe $(CFLAGS) /Feglpsol.exe \ + ..\examples\glpsol.obj glpk_4_65_stdcall.lib + +check: glpsol.exe + .\glpsol.exe --version + .\glpsol.exe --mps ..\examples\murtagh.mps --max + +## eof ## diff --git a/resources/3rdparty/glpk-4.57/w64/config_VC b/resources/3rdparty/glpk-4.65/w32/config_VC similarity index 73% rename from resources/3rdparty/glpk-4.57/w64/config_VC rename to resources/3rdparty/glpk-4.65/w32/config_VC index 581ab6e6e..c8986d34f 100644 --- a/resources/3rdparty/glpk-4.57/w64/config_VC +++ b/resources/3rdparty/glpk-4.65/w32/config_VC @@ -1,13 +1,16 @@ -/* GLPK configuration file (Microsoft Visual Studio Express) */ - -#define __WOE__ 1 - -#define ODBC_DLNAME "odbc32.dll" -/* ODBC shared library name if this feature is enabled */ - -#if 0 -#define MYSQL_DLNAME "libmysql.dll" -/* MySQL shared library name if this feature is enabled */ -#endif - -/* eof */ +/* GLPK configuration file (Microsoft Visual Studio Express) */ + +#define __WOE__ 1 + +#define TLS __declspec(thread) +/* thread local storage-class specifier for reentrancy */ + +#define ODBC_DLNAME "odbc32.dll" +/* ODBC shared library name if this feature is enabled */ + +#if 0 +#define MYSQL_DLNAME "libmysql.dll" +/* MySQL shared library name if this feature is enabled */ +#endif + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/w64/glpk_4_57.def b/resources/3rdparty/glpk-4.65/w32/glpk_4_65.def similarity index 88% rename from resources/3rdparty/glpk-4.57/w64/glpk_4_57.def rename to resources/3rdparty/glpk-4.65/w32/glpk_4_65.def index 61076961c..45fecb189 100644 --- a/resources/3rdparty/glpk-4.57/w64/glpk_4_57.def +++ b/resources/3rdparty/glpk-4.65/w32/glpk_4_65.def @@ -1,223 +1,234 @@ -LIBRARY glpk_4_57 -VERSION 4.57 -DESCRIPTION "GNU Linear Programming Kit" -EXPORTS -glp_create_prob -glp_set_prob_name -glp_set_obj_name -glp_set_obj_dir -glp_add_rows -glp_add_cols -glp_set_row_name -glp_set_col_name -glp_set_row_bnds -glp_set_col_bnds -glp_set_obj_coef -glp_set_mat_row -glp_set_mat_col -glp_load_matrix -glp_check_dup -glp_sort_matrix -glp_del_rows -glp_del_cols -glp_copy_prob -glp_erase_prob -glp_delete_prob -glp_get_prob_name -glp_get_obj_name -glp_get_obj_dir -glp_get_num_rows -glp_get_num_cols -glp_get_row_name -glp_get_col_name -glp_get_row_type -glp_get_row_lb -glp_get_row_ub -glp_get_col_type -glp_get_col_lb -glp_get_col_ub -glp_get_obj_coef -glp_get_num_nz -glp_get_mat_row -glp_get_mat_col -glp_create_index -glp_find_row -glp_find_col -glp_delete_index -glp_set_rii -glp_set_sjj -glp_get_rii -glp_get_sjj -glp_scale_prob -glp_unscale_prob -glp_set_row_stat -glp_set_col_stat -glp_std_basis -glp_adv_basis -glp_cpx_basis -glp_simplex -glp_exact -glp_init_smcp -glp_get_status -glp_get_prim_stat -glp_get_dual_stat -glp_get_obj_val -glp_get_row_stat -glp_get_row_prim -glp_get_row_dual -glp_get_col_stat -glp_get_col_prim -glp_get_col_dual -glp_get_unbnd_ray -glp_get_it_cnt -glp_set_it_cnt -glp_interior -glp_init_iptcp -glp_ipt_status -glp_ipt_obj_val -glp_ipt_row_prim -glp_ipt_row_dual -glp_ipt_col_prim -glp_ipt_col_dual -glp_set_col_kind -glp_get_col_kind -glp_get_num_int -glp_get_num_bin -glp_intopt -glp_init_iocp -glp_mip_status -glp_mip_obj_val -glp_mip_row_val -glp_mip_col_val -glp_check_kkt -glp_print_sol -glp_read_sol -glp_write_sol -glp_print_ranges -glp_print_ipt -glp_read_ipt -glp_write_ipt -glp_print_mip -glp_read_mip -glp_write_mip -glp_bf_exists -glp_factorize -glp_bf_updated -glp_get_bfcp -glp_set_bfcp -glp_get_bhead -glp_get_row_bind -glp_get_col_bind -glp_ftran -glp_btran -glp_warm_up -glp_eval_tab_row -glp_eval_tab_col -glp_transform_row -glp_transform_col -glp_prim_rtest -glp_dual_rtest -glp_analyze_bound -glp_analyze_coef -glp_ios_reason -glp_ios_get_prob -glp_ios_tree_size -glp_ios_curr_node -glp_ios_next_node -glp_ios_prev_node -glp_ios_up_node -glp_ios_node_level -glp_ios_node_bound -glp_ios_best_node -glp_ios_mip_gap -glp_ios_node_data -glp_ios_row_attr -glp_ios_pool_size -glp_ios_add_row -glp_ios_del_row -glp_ios_clear_pool -glp_ios_can_branch -glp_ios_branch_upon -glp_ios_select_node -glp_ios_heur_sol -glp_ios_terminate -glp_init_mpscp -glp_read_mps -glp_write_mps -glp_init_cpxcp -glp_read_lp -glp_write_lp -glp_read_prob -glp_write_prob -glp_mpl_alloc_wksp -glp_mpl_read_model -glp_mpl_read_data -glp_mpl_generate -glp_mpl_build_prob -glp_mpl_postsolve -glp_mpl_free_wksp -glp_main -glp_read_cnfsat -glp_check_cnfsat -glp_write_cnfsat -glp_minisat1 -glp_intfeas1 -glp_init_env -glp_version -glp_free_env -glp_puts -glp_printf -glp_vprintf -glp_term_out -glp_term_hook -glp_open_tee -glp_close_tee -glp_error_ -glp_assert_ -glp_error_hook -glp_alloc -glp_realloc -glp_free -glp_mem_limit -glp_mem_usage -glp_create_graph -glp_set_graph_name -glp_add_vertices -glp_set_vertex_name -glp_add_arc -glp_del_vertices -glp_del_arc -glp_erase_graph -glp_delete_graph -glp_create_v_index -glp_find_vertex -glp_delete_v_index -glp_read_graph -glp_write_graph -glp_mincost_lp -glp_mincost_okalg -glp_mincost_relax4 -glp_maxflow_lp -glp_maxflow_ffalg -glp_check_asnprob -glp_asnprob_lp -glp_asnprob_okalg -glp_asnprob_hall -glp_cpp -glp_read_mincost -glp_write_mincost -glp_read_maxflow -glp_write_maxflow -glp_read_asnprob -glp_write_asnprob -glp_read_ccdata -glp_write_ccdata -glp_netgen -glp_netgen_prob -glp_gridgen -glp_rmfgen -glp_weak_comp -glp_strong_comp -glp_top_sort -glp_wclique_exact -;; end of file ;; +LIBRARY glpk_4_65 +VERSION 4.65 +DESCRIPTION "GNU Linear Programming Kit" +EXPORTS +glp_create_prob +glp_set_prob_name +glp_set_obj_name +glp_set_obj_dir +glp_add_rows +glp_add_cols +glp_set_row_name +glp_set_col_name +glp_set_row_bnds +glp_set_col_bnds +glp_set_obj_coef +glp_set_mat_row +glp_set_mat_col +glp_load_matrix +glp_check_dup +glp_sort_matrix +glp_del_rows +glp_del_cols +glp_copy_prob +glp_erase_prob +glp_delete_prob +glp_get_prob_name +glp_get_obj_name +glp_get_obj_dir +glp_get_num_rows +glp_get_num_cols +glp_get_row_name +glp_get_col_name +glp_get_row_type +glp_get_row_lb +glp_get_row_ub +glp_get_col_type +glp_get_col_lb +glp_get_col_ub +glp_get_obj_coef +glp_get_num_nz +glp_get_mat_row +glp_get_mat_col +glp_create_index +glp_find_row +glp_find_col +glp_delete_index +glp_set_rii +glp_set_sjj +glp_get_rii +glp_get_sjj +glp_scale_prob +glp_unscale_prob +glp_set_row_stat +glp_set_col_stat +glp_std_basis +glp_adv_basis +glp_cpx_basis +glp_simplex +glp_exact +glp_init_smcp +glp_get_status +glp_get_prim_stat +glp_get_dual_stat +glp_get_obj_val +glp_get_row_stat +glp_get_row_prim +glp_get_row_dual +glp_get_col_stat +glp_get_col_prim +glp_get_col_dual +glp_get_unbnd_ray +glp_get_it_cnt +glp_set_it_cnt +glp_interior +glp_init_iptcp +glp_ipt_status +glp_ipt_obj_val +glp_ipt_row_prim +glp_ipt_row_dual +glp_ipt_col_prim +glp_ipt_col_dual +glp_set_col_kind +glp_get_col_kind +glp_get_num_int +glp_get_num_bin +glp_intopt +glp_init_iocp +glp_mip_status +glp_mip_obj_val +glp_mip_row_val +glp_mip_col_val +glp_check_kkt +glp_print_sol +glp_read_sol +glp_write_sol +glp_print_ranges +glp_print_ipt +glp_read_ipt +glp_write_ipt +glp_print_mip +glp_read_mip +glp_write_mip +glp_bf_exists +glp_factorize +glp_bf_updated +glp_get_bfcp +glp_set_bfcp +glp_get_bhead +glp_get_row_bind +glp_get_col_bind +glp_ftran +glp_btran +glp_warm_up +glp_eval_tab_row +glp_eval_tab_col +glp_transform_row +glp_transform_col +glp_prim_rtest +glp_dual_rtest +glp_analyze_bound +glp_analyze_coef +glp_npp_alloc_wksp +glp_npp_load_prob +glp_npp_preprocess1 +glp_npp_build_prob +glp_npp_postprocess +glp_npp_obtain_sol +glp_npp_free_wksp +glp_ios_reason +glp_ios_get_prob +glp_ios_tree_size +glp_ios_curr_node +glp_ios_next_node +glp_ios_prev_node +glp_ios_up_node +glp_ios_node_level +glp_ios_node_bound +glp_ios_best_node +glp_ios_mip_gap +glp_ios_node_data +glp_ios_row_attr +glp_ios_pool_size +glp_ios_add_row +glp_ios_del_row +glp_ios_clear_pool +glp_ios_can_branch +glp_ios_branch_upon +glp_ios_select_node +glp_ios_heur_sol +glp_ios_terminate +glp_init_mpscp +glp_read_mps +glp_write_mps +glp_init_cpxcp +glp_read_lp +glp_write_lp +glp_read_prob +glp_write_prob +glp_mpl_alloc_wksp +glp_mpl_init_rand +glp_mpl_read_model +glp_mpl_read_data +glp_mpl_generate +glp_mpl_build_prob +glp_mpl_postsolve +glp_mpl_free_wksp +glp_read_cnfsat +glp_check_cnfsat +glp_write_cnfsat +glp_minisat1 +glp_intfeas1 +glp_init_env +glp_version +glp_config +glp_free_env +glp_puts +glp_printf +glp_vprintf +glp_term_out +glp_term_hook +glp_open_tee +glp_close_tee +glp_error_ +glp_at_error +glp_assert_ +glp_error_hook +glp_alloc +glp_realloc +glp_free +glp_mem_limit +glp_mem_usage +glp_time +glp_difftime +glp_create_graph +glp_set_graph_name +glp_add_vertices +glp_set_vertex_name +glp_add_arc +glp_del_vertices +glp_del_arc +glp_erase_graph +glp_delete_graph +glp_create_v_index +glp_find_vertex +glp_delete_v_index +glp_read_graph +glp_write_graph +glp_mincost_lp +glp_mincost_okalg +glp_mincost_relax4 +glp_maxflow_lp +glp_maxflow_ffalg +glp_check_asnprob +glp_asnprob_lp +glp_asnprob_okalg +glp_asnprob_hall +glp_cpp +glp_read_mincost +glp_write_mincost +glp_read_maxflow +glp_write_maxflow +glp_read_asnprob +glp_write_asnprob +glp_read_ccdata +glp_write_ccdata +glp_netgen +glp_netgen_prob +glp_gridgen +glp_rmfgen +glp_weak_comp +glp_strong_comp +glp_top_sort +glp_wclique_exact +;; end of file ;; diff --git a/resources/3rdparty/glpk-4.65/w32/glpk_4_65_stdcall.def b/resources/3rdparty/glpk-4.65/w32/glpk_4_65_stdcall.def new file mode 100644 index 000000000..8f4ab5907 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/w32/glpk_4_65_stdcall.def @@ -0,0 +1,234 @@ +LIBRARY glpk_4_65_stdcall +VERSION 4.65 +DESCRIPTION "GNU Linear Programming Kit" +EXPORTS +glp_create_prob +glp_set_prob_name +glp_set_obj_name +glp_set_obj_dir +glp_add_rows +glp_add_cols +glp_set_row_name +glp_set_col_name +glp_set_row_bnds +glp_set_col_bnds +glp_set_obj_coef +glp_set_mat_row +glp_set_mat_col +glp_load_matrix +glp_check_dup +glp_sort_matrix +glp_del_rows +glp_del_cols +glp_copy_prob +glp_erase_prob +glp_delete_prob +glp_get_prob_name +glp_get_obj_name +glp_get_obj_dir +glp_get_num_rows +glp_get_num_cols +glp_get_row_name +glp_get_col_name +glp_get_row_type +glp_get_row_lb +glp_get_row_ub +glp_get_col_type +glp_get_col_lb +glp_get_col_ub +glp_get_obj_coef +glp_get_num_nz +glp_get_mat_row +glp_get_mat_col +glp_create_index +glp_find_row +glp_find_col +glp_delete_index +glp_set_rii +glp_set_sjj +glp_get_rii +glp_get_sjj +glp_scale_prob +glp_unscale_prob +glp_set_row_stat +glp_set_col_stat +glp_std_basis +glp_adv_basis +glp_cpx_basis +glp_simplex +glp_exact +glp_init_smcp +glp_get_status +glp_get_prim_stat +glp_get_dual_stat +glp_get_obj_val +glp_get_row_stat +glp_get_row_prim +glp_get_row_dual +glp_get_col_stat +glp_get_col_prim +glp_get_col_dual +glp_get_unbnd_ray +glp_get_it_cnt +glp_set_it_cnt +glp_interior +glp_init_iptcp +glp_ipt_status +glp_ipt_obj_val +glp_ipt_row_prim +glp_ipt_row_dual +glp_ipt_col_prim +glp_ipt_col_dual +glp_set_col_kind +glp_get_col_kind +glp_get_num_int +glp_get_num_bin +glp_intopt +glp_init_iocp +glp_mip_status +glp_mip_obj_val +glp_mip_row_val +glp_mip_col_val +glp_check_kkt +glp_print_sol +glp_read_sol +glp_write_sol +glp_print_ranges +glp_print_ipt +glp_read_ipt +glp_write_ipt +glp_print_mip +glp_read_mip +glp_write_mip +glp_bf_exists +glp_factorize +glp_bf_updated +glp_get_bfcp +glp_set_bfcp +glp_get_bhead +glp_get_row_bind +glp_get_col_bind +glp_ftran +glp_btran +glp_warm_up +glp_eval_tab_row +glp_eval_tab_col +glp_transform_row +glp_transform_col +glp_prim_rtest +glp_dual_rtest +glp_analyze_bound +glp_analyze_coef +glp_npp_alloc_wksp +glp_npp_load_prob +glp_npp_preprocess1 +glp_npp_build_prob +glp_npp_postprocess +glp_npp_obtain_sol +glp_npp_free_wksp +glp_ios_reason +glp_ios_get_prob +glp_ios_tree_size +glp_ios_curr_node +glp_ios_next_node +glp_ios_prev_node +glp_ios_up_node +glp_ios_node_level +glp_ios_node_bound +glp_ios_best_node +glp_ios_mip_gap +glp_ios_node_data +glp_ios_row_attr +glp_ios_pool_size +glp_ios_add_row +glp_ios_del_row +glp_ios_clear_pool +glp_ios_can_branch +glp_ios_branch_upon +glp_ios_select_node +glp_ios_heur_sol +glp_ios_terminate +glp_init_mpscp +glp_read_mps +glp_write_mps +glp_init_cpxcp +glp_read_lp +glp_write_lp +glp_read_prob +glp_write_prob +glp_mpl_alloc_wksp +glp_mpl_init_rand +glp_mpl_read_model +glp_mpl_read_data +glp_mpl_generate +glp_mpl_build_prob +glp_mpl_postsolve +glp_mpl_free_wksp +glp_read_cnfsat +glp_check_cnfsat +glp_write_cnfsat +glp_minisat1 +glp_intfeas1 +glp_init_env +glp_version +glp_config +glp_free_env +glp_puts +glp_printf +glp_vprintf +glp_term_out +glp_term_hook +glp_open_tee +glp_close_tee +glp_error_ +glp_at_error +glp_assert_ +glp_error_hook +glp_alloc +glp_realloc +glp_free +glp_mem_limit +glp_mem_usage +glp_time +glp_difftime +glp_create_graph +glp_set_graph_name +glp_add_vertices +glp_set_vertex_name +glp_add_arc +glp_del_vertices +glp_del_arc +glp_erase_graph +glp_delete_graph +glp_create_v_index +glp_find_vertex +glp_delete_v_index +glp_read_graph +glp_write_graph +glp_mincost_lp +glp_mincost_okalg +glp_mincost_relax4 +glp_maxflow_lp +glp_maxflow_ffalg +glp_check_asnprob +glp_asnprob_lp +glp_asnprob_okalg +glp_asnprob_hall +glp_cpp +glp_read_mincost +glp_write_mincost +glp_read_maxflow +glp_write_maxflow +glp_read_asnprob +glp_write_asnprob +glp_read_ccdata +glp_write_ccdata +glp_netgen +glp_netgen_prob +glp_gridgen +glp_rmfgen +glp_weak_comp +glp_strong_comp +glp_top_sort +glp_wclique_exact +;; end of file ;; diff --git a/resources/3rdparty/glpk-4.57/w32/readme.txt b/resources/3rdparty/glpk-4.65/w32/readme.txt similarity index 97% rename from resources/3rdparty/glpk-4.57/w32/readme.txt rename to resources/3rdparty/glpk-4.65/w32/readme.txt index 10daeda4b..e563fb4f1 100644 --- a/resources/3rdparty/glpk-4.57/w32/readme.txt +++ b/resources/3rdparty/glpk-4.65/w32/readme.txt @@ -1,24 +1,24 @@ -This directory contains batch files and other stuff which you can use -to build GLPK for 32-bit Windows with the native C/C++ compilers. - -Before running the batch file do the following: - -1. Make sure that you have installed the compiler you are going to use - to build GLPK. - -2. Look into corresponding batch file (just right-click it and choose - 'Edit' in the popup menu; DO NOT choose 'Open'). Make sure that HOME - variable specifies correct path to the compiler directory; if not, - make necessary changes. - -To run the batch file just double-click it and wait a bit while the -Make utility does its job. The message 'OPTIMAL SOLUTION FOUND' in the -MS-DOS window means that all is OK. If you do not see it, something is -wrong. - -Once GLPK has been successfully built, there must appear two files in -this directory: - -glpk.lib, which is the GLPK object library, and - -glpsol.exe, which is the stand-alone GLPK LP/MIP solver. +This directory contains batch files and other stuff which you can use +to build GLPK for 32-bit Windows with the native C/C++ compilers. + +Before running the batch file do the following: + +1. Make sure that you have installed the compiler you are going to use + to build GLPK. + +2. Look into corresponding batch file (just right-click it and choose + 'Edit' in the popup menu; DO NOT choose 'Open'). Make sure that HOME + variable specifies correct path to the compiler directory; if not, + make necessary changes. + +To run the batch file just double-click it and wait a bit while the +Make utility does its job. The message 'OPTIMAL SOLUTION FOUND' in the +MS-DOS window means that all is OK. If you do not see it, something is +wrong. + +Once GLPK has been successfully built, there must appear two files in +this directory: + +glpk.lib, which is the GLPK object library, and + +glpsol.exe, which is the stand-alone GLPK LP/MIP solver. diff --git a/resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC10.bat b/resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC10.bat similarity index 96% rename from resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC10.bat rename to resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC10.bat index 8e8a3e1e7..350704ac6 100755 --- a/resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC10.bat +++ b/resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC10.bat @@ -1,11 +1,11 @@ -rem Build GLPK with Microsoft Visual Studio Express 2010 - -rem NOTE: Make sure that HOME variable specifies correct path -set HOME="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC" - -call %HOME%\vcvarsall.bat x64 -copy config_VC config.h -%HOME%\bin\nmake.exe /f Makefile_VC -%HOME%\bin\nmake.exe /f Makefile_VC check - -pause +rem Build GLPK with Microsoft Visual Studio Express 2010 + +rem NOTE: Make sure that HOME variable specifies correct path +set HOME="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC" + +call %HOME%\vcvarsall.bat x64 +copy config_VC config.h +%HOME%\bin\nmake.exe /f Makefile_VC +%HOME%\bin\nmake.exe /f Makefile_VC check + +pause diff --git a/resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC10_DLL.bat b/resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC10_DLL.bat similarity index 96% rename from resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC10_DLL.bat rename to resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC10_DLL.bat index 0bbe697b3..5ba14dcc1 100755 --- a/resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC10_DLL.bat +++ b/resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC10_DLL.bat @@ -1,11 +1,11 @@ -rem Build GLPK DLL with Microsoft Visual Studio Express 2010 - -rem NOTE: Make sure that HOME variable specifies correct path -set HOME="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC" - -call %HOME%\vcvarsall.bat x64 -copy config_VC config.h -%HOME%\bin\nmake.exe /f Makefile_VC_DLL -%HOME%\bin\nmake.exe /f Makefile_VC_DLL check - -pause +rem Build GLPK DLL with Microsoft Visual Studio Express 2010 + +rem NOTE: Make sure that HOME variable specifies correct path +set HOME="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC" + +call %HOME%\vcvarsall.bat x64 +copy config_VC config.h +%HOME%\bin\nmake.exe /f Makefile_VC_DLL +%HOME%\bin\nmake.exe /f Makefile_VC_DLL check + +pause diff --git a/resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC14.bat b/resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC14.bat similarity index 96% rename from resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC14.bat rename to resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC14.bat index 33bdaeaa2..864b0a8c1 100755 --- a/resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC14.bat +++ b/resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC14.bat @@ -1,11 +1,11 @@ -rem Build GLPK with Microsoft Visual Studio Community 2015 - -rem NOTE: Make sure that HOME variable specifies correct path -set HOME="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC" - -call %HOME%\vcvarsall.bat x64 -copy config_VC config.h -%HOME%\bin\nmake.exe /f Makefile_VC -%HOME%\bin\nmake.exe /f Makefile_VC check - -pause +rem Build GLPK with Microsoft Visual Studio Community 2015 + +rem NOTE: Make sure that HOME variable specifies correct path +set HOME="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC" + +call %HOME%\vcvarsall.bat x64 +copy config_VC config.h +%HOME%\bin\nmake.exe /f Makefile_VC +%HOME%\bin\nmake.exe /f Makefile_VC check + +pause diff --git a/resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC14_DLL.bat b/resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC14_DLL.bat similarity index 96% rename from resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC14_DLL.bat rename to resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC14_DLL.bat index 25a6a87d8..2f5430971 100755 --- a/resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC14_DLL.bat +++ b/resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC14_DLL.bat @@ -1,11 +1,11 @@ -rem Build GLPK DLL with Microsoft Visual Studio Community 2015 - -rem NOTE: Make sure that HOME variable specifies correct path -set HOME="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC" - -call %HOME%\vcvarsall.bat x64 -copy config_VC config.h -%HOME%\bin\nmake.exe /f Makefile_VC_DLL -%HOME%\bin\nmake.exe /f Makefile_VC_DLL check - -pause +rem Build GLPK DLL with Microsoft Visual Studio Community 2015 + +rem NOTE: Make sure that HOME variable specifies correct path +set HOME="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC" + +call %HOME%\vcvarsall.bat x64 +copy config_VC config.h +%HOME%\bin\nmake.exe /f Makefile_VC_DLL +%HOME%\bin\nmake.exe /f Makefile_VC_DLL check + +pause diff --git a/resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC9.bat b/resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC9.bat similarity index 96% rename from resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC9.bat rename to resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC9.bat index 9a32ef850..432c4c1be 100755 --- a/resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC9.bat +++ b/resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC9.bat @@ -1,11 +1,11 @@ -rem Build GLPK with Microsoft Visual Studio Express 2008 - -rem NOTE: Make sure that HOME variable specifies correct path -set HOME="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC" - -call %HOME%\bin\vcvars64.bat -copy config_VC config.h -%HOME%\bin\nmake.exe /f Makefile_VC -%HOME%\bin\nmake.exe /f Makefile_VC check - -pause +rem Build GLPK with Microsoft Visual Studio Express 2008 + +rem NOTE: Make sure that HOME variable specifies correct path +set HOME="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC" + +call %HOME%\bin\vcvars64.bat +copy config_VC config.h +%HOME%\bin\nmake.exe /f Makefile_VC +%HOME%\bin\nmake.exe /f Makefile_VC check + +pause diff --git a/resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC9_DLL.bat b/resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC9_DLL.bat similarity index 96% rename from resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC9_DLL.bat rename to resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC9_DLL.bat index 4d7c19719..2cff0932f 100755 --- a/resources/3rdparty/glpk-4.57/w64/Build_GLPK_with_VC9_DLL.bat +++ b/resources/3rdparty/glpk-4.65/w64/Build_GLPK_with_VC9_DLL.bat @@ -1,11 +1,11 @@ -rem Build GLPK DLL with Microsoft Visual Studio Express 2008 - -rem NOTE: Make sure that HOME variable specifies correct path -set HOME="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC" - -call %HOME%\bin\vcvars64.bat -copy config_VC config.h -%HOME%\bin\nmake.exe /f Makefile_VC_DLL -%HOME%\bin\nmake.exe /f Makefile_VC_DLL check - -pause +rem Build GLPK DLL with Microsoft Visual Studio Express 2008 + +rem NOTE: Make sure that HOME variable specifies correct path +set HOME="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC" + +call %HOME%\bin\vcvars64.bat +copy config_VC config.h +%HOME%\bin\nmake.exe /f Makefile_VC_DLL +%HOME%\bin\nmake.exe /f Makefile_VC_DLL check + +pause diff --git a/resources/3rdparty/glpk-4.57/w32/config_VC b/resources/3rdparty/glpk-4.65/w64/config_VC similarity index 73% rename from resources/3rdparty/glpk-4.57/w32/config_VC rename to resources/3rdparty/glpk-4.65/w64/config_VC index 581ab6e6e..c8986d34f 100644 --- a/resources/3rdparty/glpk-4.57/w32/config_VC +++ b/resources/3rdparty/glpk-4.65/w64/config_VC @@ -1,13 +1,16 @@ -/* GLPK configuration file (Microsoft Visual Studio Express) */ - -#define __WOE__ 1 - -#define ODBC_DLNAME "odbc32.dll" -/* ODBC shared library name if this feature is enabled */ - -#if 0 -#define MYSQL_DLNAME "libmysql.dll" -/* MySQL shared library name if this feature is enabled */ -#endif - -/* eof */ +/* GLPK configuration file (Microsoft Visual Studio Express) */ + +#define __WOE__ 1 + +#define TLS __declspec(thread) +/* thread local storage-class specifier for reentrancy */ + +#define ODBC_DLNAME "odbc32.dll" +/* ODBC shared library name if this feature is enabled */ + +#if 0 +#define MYSQL_DLNAME "libmysql.dll" +/* MySQL shared library name if this feature is enabled */ +#endif + +/* eof */ diff --git a/resources/3rdparty/glpk-4.57/w32/glpk_4_57.def b/resources/3rdparty/glpk-4.65/w64/glpk_4_65.def similarity index 88% rename from resources/3rdparty/glpk-4.57/w32/glpk_4_57.def rename to resources/3rdparty/glpk-4.65/w64/glpk_4_65.def index 61076961c..45fecb189 100644 --- a/resources/3rdparty/glpk-4.57/w32/glpk_4_57.def +++ b/resources/3rdparty/glpk-4.65/w64/glpk_4_65.def @@ -1,223 +1,234 @@ -LIBRARY glpk_4_57 -VERSION 4.57 -DESCRIPTION "GNU Linear Programming Kit" -EXPORTS -glp_create_prob -glp_set_prob_name -glp_set_obj_name -glp_set_obj_dir -glp_add_rows -glp_add_cols -glp_set_row_name -glp_set_col_name -glp_set_row_bnds -glp_set_col_bnds -glp_set_obj_coef -glp_set_mat_row -glp_set_mat_col -glp_load_matrix -glp_check_dup -glp_sort_matrix -glp_del_rows -glp_del_cols -glp_copy_prob -glp_erase_prob -glp_delete_prob -glp_get_prob_name -glp_get_obj_name -glp_get_obj_dir -glp_get_num_rows -glp_get_num_cols -glp_get_row_name -glp_get_col_name -glp_get_row_type -glp_get_row_lb -glp_get_row_ub -glp_get_col_type -glp_get_col_lb -glp_get_col_ub -glp_get_obj_coef -glp_get_num_nz -glp_get_mat_row -glp_get_mat_col -glp_create_index -glp_find_row -glp_find_col -glp_delete_index -glp_set_rii -glp_set_sjj -glp_get_rii -glp_get_sjj -glp_scale_prob -glp_unscale_prob -glp_set_row_stat -glp_set_col_stat -glp_std_basis -glp_adv_basis -glp_cpx_basis -glp_simplex -glp_exact -glp_init_smcp -glp_get_status -glp_get_prim_stat -glp_get_dual_stat -glp_get_obj_val -glp_get_row_stat -glp_get_row_prim -glp_get_row_dual -glp_get_col_stat -glp_get_col_prim -glp_get_col_dual -glp_get_unbnd_ray -glp_get_it_cnt -glp_set_it_cnt -glp_interior -glp_init_iptcp -glp_ipt_status -glp_ipt_obj_val -glp_ipt_row_prim -glp_ipt_row_dual -glp_ipt_col_prim -glp_ipt_col_dual -glp_set_col_kind -glp_get_col_kind -glp_get_num_int -glp_get_num_bin -glp_intopt -glp_init_iocp -glp_mip_status -glp_mip_obj_val -glp_mip_row_val -glp_mip_col_val -glp_check_kkt -glp_print_sol -glp_read_sol -glp_write_sol -glp_print_ranges -glp_print_ipt -glp_read_ipt -glp_write_ipt -glp_print_mip -glp_read_mip -glp_write_mip -glp_bf_exists -glp_factorize -glp_bf_updated -glp_get_bfcp -glp_set_bfcp -glp_get_bhead -glp_get_row_bind -glp_get_col_bind -glp_ftran -glp_btran -glp_warm_up -glp_eval_tab_row -glp_eval_tab_col -glp_transform_row -glp_transform_col -glp_prim_rtest -glp_dual_rtest -glp_analyze_bound -glp_analyze_coef -glp_ios_reason -glp_ios_get_prob -glp_ios_tree_size -glp_ios_curr_node -glp_ios_next_node -glp_ios_prev_node -glp_ios_up_node -glp_ios_node_level -glp_ios_node_bound -glp_ios_best_node -glp_ios_mip_gap -glp_ios_node_data -glp_ios_row_attr -glp_ios_pool_size -glp_ios_add_row -glp_ios_del_row -glp_ios_clear_pool -glp_ios_can_branch -glp_ios_branch_upon -glp_ios_select_node -glp_ios_heur_sol -glp_ios_terminate -glp_init_mpscp -glp_read_mps -glp_write_mps -glp_init_cpxcp -glp_read_lp -glp_write_lp -glp_read_prob -glp_write_prob -glp_mpl_alloc_wksp -glp_mpl_read_model -glp_mpl_read_data -glp_mpl_generate -glp_mpl_build_prob -glp_mpl_postsolve -glp_mpl_free_wksp -glp_main -glp_read_cnfsat -glp_check_cnfsat -glp_write_cnfsat -glp_minisat1 -glp_intfeas1 -glp_init_env -glp_version -glp_free_env -glp_puts -glp_printf -glp_vprintf -glp_term_out -glp_term_hook -glp_open_tee -glp_close_tee -glp_error_ -glp_assert_ -glp_error_hook -glp_alloc -glp_realloc -glp_free -glp_mem_limit -glp_mem_usage -glp_create_graph -glp_set_graph_name -glp_add_vertices -glp_set_vertex_name -glp_add_arc -glp_del_vertices -glp_del_arc -glp_erase_graph -glp_delete_graph -glp_create_v_index -glp_find_vertex -glp_delete_v_index -glp_read_graph -glp_write_graph -glp_mincost_lp -glp_mincost_okalg -glp_mincost_relax4 -glp_maxflow_lp -glp_maxflow_ffalg -glp_check_asnprob -glp_asnprob_lp -glp_asnprob_okalg -glp_asnprob_hall -glp_cpp -glp_read_mincost -glp_write_mincost -glp_read_maxflow -glp_write_maxflow -glp_read_asnprob -glp_write_asnprob -glp_read_ccdata -glp_write_ccdata -glp_netgen -glp_netgen_prob -glp_gridgen -glp_rmfgen -glp_weak_comp -glp_strong_comp -glp_top_sort -glp_wclique_exact -;; end of file ;; +LIBRARY glpk_4_65 +VERSION 4.65 +DESCRIPTION "GNU Linear Programming Kit" +EXPORTS +glp_create_prob +glp_set_prob_name +glp_set_obj_name +glp_set_obj_dir +glp_add_rows +glp_add_cols +glp_set_row_name +glp_set_col_name +glp_set_row_bnds +glp_set_col_bnds +glp_set_obj_coef +glp_set_mat_row +glp_set_mat_col +glp_load_matrix +glp_check_dup +glp_sort_matrix +glp_del_rows +glp_del_cols +glp_copy_prob +glp_erase_prob +glp_delete_prob +glp_get_prob_name +glp_get_obj_name +glp_get_obj_dir +glp_get_num_rows +glp_get_num_cols +glp_get_row_name +glp_get_col_name +glp_get_row_type +glp_get_row_lb +glp_get_row_ub +glp_get_col_type +glp_get_col_lb +glp_get_col_ub +glp_get_obj_coef +glp_get_num_nz +glp_get_mat_row +glp_get_mat_col +glp_create_index +glp_find_row +glp_find_col +glp_delete_index +glp_set_rii +glp_set_sjj +glp_get_rii +glp_get_sjj +glp_scale_prob +glp_unscale_prob +glp_set_row_stat +glp_set_col_stat +glp_std_basis +glp_adv_basis +glp_cpx_basis +glp_simplex +glp_exact +glp_init_smcp +glp_get_status +glp_get_prim_stat +glp_get_dual_stat +glp_get_obj_val +glp_get_row_stat +glp_get_row_prim +glp_get_row_dual +glp_get_col_stat +glp_get_col_prim +glp_get_col_dual +glp_get_unbnd_ray +glp_get_it_cnt +glp_set_it_cnt +glp_interior +glp_init_iptcp +glp_ipt_status +glp_ipt_obj_val +glp_ipt_row_prim +glp_ipt_row_dual +glp_ipt_col_prim +glp_ipt_col_dual +glp_set_col_kind +glp_get_col_kind +glp_get_num_int +glp_get_num_bin +glp_intopt +glp_init_iocp +glp_mip_status +glp_mip_obj_val +glp_mip_row_val +glp_mip_col_val +glp_check_kkt +glp_print_sol +glp_read_sol +glp_write_sol +glp_print_ranges +glp_print_ipt +glp_read_ipt +glp_write_ipt +glp_print_mip +glp_read_mip +glp_write_mip +glp_bf_exists +glp_factorize +glp_bf_updated +glp_get_bfcp +glp_set_bfcp +glp_get_bhead +glp_get_row_bind +glp_get_col_bind +glp_ftran +glp_btran +glp_warm_up +glp_eval_tab_row +glp_eval_tab_col +glp_transform_row +glp_transform_col +glp_prim_rtest +glp_dual_rtest +glp_analyze_bound +glp_analyze_coef +glp_npp_alloc_wksp +glp_npp_load_prob +glp_npp_preprocess1 +glp_npp_build_prob +glp_npp_postprocess +glp_npp_obtain_sol +glp_npp_free_wksp +glp_ios_reason +glp_ios_get_prob +glp_ios_tree_size +glp_ios_curr_node +glp_ios_next_node +glp_ios_prev_node +glp_ios_up_node +glp_ios_node_level +glp_ios_node_bound +glp_ios_best_node +glp_ios_mip_gap +glp_ios_node_data +glp_ios_row_attr +glp_ios_pool_size +glp_ios_add_row +glp_ios_del_row +glp_ios_clear_pool +glp_ios_can_branch +glp_ios_branch_upon +glp_ios_select_node +glp_ios_heur_sol +glp_ios_terminate +glp_init_mpscp +glp_read_mps +glp_write_mps +glp_init_cpxcp +glp_read_lp +glp_write_lp +glp_read_prob +glp_write_prob +glp_mpl_alloc_wksp +glp_mpl_init_rand +glp_mpl_read_model +glp_mpl_read_data +glp_mpl_generate +glp_mpl_build_prob +glp_mpl_postsolve +glp_mpl_free_wksp +glp_read_cnfsat +glp_check_cnfsat +glp_write_cnfsat +glp_minisat1 +glp_intfeas1 +glp_init_env +glp_version +glp_config +glp_free_env +glp_puts +glp_printf +glp_vprintf +glp_term_out +glp_term_hook +glp_open_tee +glp_close_tee +glp_error_ +glp_at_error +glp_assert_ +glp_error_hook +glp_alloc +glp_realloc +glp_free +glp_mem_limit +glp_mem_usage +glp_time +glp_difftime +glp_create_graph +glp_set_graph_name +glp_add_vertices +glp_set_vertex_name +glp_add_arc +glp_del_vertices +glp_del_arc +glp_erase_graph +glp_delete_graph +glp_create_v_index +glp_find_vertex +glp_delete_v_index +glp_read_graph +glp_write_graph +glp_mincost_lp +glp_mincost_okalg +glp_mincost_relax4 +glp_maxflow_lp +glp_maxflow_ffalg +glp_check_asnprob +glp_asnprob_lp +glp_asnprob_okalg +glp_asnprob_hall +glp_cpp +glp_read_mincost +glp_write_mincost +glp_read_maxflow +glp_write_maxflow +glp_read_asnprob +glp_write_asnprob +glp_read_ccdata +glp_write_ccdata +glp_netgen +glp_netgen_prob +glp_gridgen +glp_rmfgen +glp_weak_comp +glp_strong_comp +glp_top_sort +glp_wclique_exact +;; end of file ;; diff --git a/resources/3rdparty/glpk-4.65/w64/makefile_VC b/resources/3rdparty/glpk-4.65/w64/makefile_VC new file mode 100644 index 000000000..207338243 --- /dev/null +++ b/resources/3rdparty/glpk-4.65/w64/makefile_VC @@ -0,0 +1,251 @@ +## Build GLPK with Microsoft Visual Studio Express ## + +CFLAGS = \ +/I. \ +/I..\src \ +/I..\src\amd \ +/I..\src\api \ +/I..\src\bflib \ +/I..\src\colamd \ +/I..\src\draft \ +/I..\src\env \ +/I..\src\intopt \ +/I..\src\minisat \ +/I..\src\misc \ +/I..\src\mpl \ +/I..\src\npp \ +/I..\src\proxy \ +/I..\src\simplex \ +/I..\src\zlib \ +/DHAVE_CONFIG_H=1 \ +/D_CRT_SECURE_NO_WARNINGS=1 \ +/nologo \ +/W3 \ +/O2 \ +/Zi + +OBJSET = \ +..\src\amd\amd_1.obj \ +..\src\amd\amd_2.obj \ +..\src\amd\amd_aat.obj \ +..\src\amd\amd_control.obj \ +..\src\amd\amd_defaults.obj \ +..\src\amd\amd_dump.obj \ +..\src\amd\amd_info.obj \ +..\src\amd\amd_order.obj \ +..\src\amd\amd_post_tree.obj \ +..\src\amd\amd_postorder.obj \ +..\src\amd\amd_preprocess.obj \ +..\src\amd\amd_valid.obj \ +..\src\api\advbas.obj \ +..\src\api\asnhall.obj \ +..\src\api\asnlp.obj \ +..\src\api\asnokalg.obj \ +..\src\api\ckasn.obj \ +..\src\api\ckcnf.obj \ +..\src\api\cplex.obj \ +..\src\api\cpp.obj \ +..\src\api\cpxbas.obj \ +..\src\api\graph.obj \ +..\src\api\gridgen.obj \ +..\src\api\intfeas1.obj \ +..\src\api\maxffalg.obj \ +..\src\api\maxflp.obj \ +..\src\api\mcflp.obj \ +..\src\api\mcfokalg.obj \ +..\src\api\mcfrelax.obj \ +..\src\api\minisat1.obj \ +..\src\api\mpl.obj \ +..\src\api\mps.obj \ +..\src\api\netgen.obj \ +..\src\api\npp.obj \ +..\src\api\pript.obj \ +..\src\api\prmip.obj \ +..\src\api\prob1.obj \ +..\src\api\prob2.obj \ +..\src\api\prob3.obj \ +..\src\api\prob4.obj \ +..\src\api\prob5.obj \ +..\src\api\prrngs.obj \ +..\src\api\prsol.obj \ +..\src\api\rdasn.obj \ +..\src\api\rdcc.obj \ +..\src\api\rdcnf.obj \ +..\src\api\rdipt.obj \ +..\src\api\rdmaxf.obj \ +..\src\api\rdmcf.obj \ +..\src\api\rdmip.obj \ +..\src\api\rdprob.obj \ +..\src\api\rdsol.obj \ +..\src\api\rmfgen.obj \ +..\src\api\strong.obj \ +..\src\api\topsort.obj \ +..\src\api\weak.obj \ +..\src\api\wcliqex.obj \ +..\src\api\wrasn.obj \ +..\src\api\wrcc.obj \ +..\src\api\wrcnf.obj \ +..\src\api\wript.obj \ +..\src\api\wrmaxf.obj \ +..\src\api\wrmcf.obj \ +..\src\api\wrmip.obj \ +..\src\api\wrprob.obj \ +..\src\api\wrsol.obj \ +..\src\bflib\btf.obj \ +..\src\bflib\btfint.obj \ +..\src\bflib\fhv.obj \ +..\src\bflib\fhvint.obj \ +..\src\bflib\ifu.obj \ +..\src\bflib\luf.obj \ +..\src\bflib\lufint.obj \ +..\src\bflib\scf.obj \ +..\src\bflib\scfint.obj \ +..\src\bflib\sgf.obj \ +..\src\bflib\sva.obj \ +..\src\colamd\colamd.obj \ +..\src\draft\bfd.obj \ +..\src\draft\bfx.obj \ +..\src\draft\glpapi06.obj \ +..\src\draft\glpapi07.obj \ +..\src\draft\glpapi08.obj \ +..\src\draft\glpapi09.obj \ +..\src\draft\glpapi10.obj \ +..\src\draft\glpapi12.obj \ +..\src\draft\glpapi13.obj \ +..\src\draft\glphbm.obj \ +..\src\draft\glpios01.obj \ +..\src\draft\glpios02.obj \ +..\src\draft\glpios03.obj \ +..\src\draft\glpios07.obj \ +..\src\draft\glpios09.obj \ +..\src\draft\glpios11.obj \ +..\src\draft\glpios12.obj \ +..\src\draft\glpipm.obj \ +..\src\draft\glpmat.obj \ +..\src\draft\glprgr.obj \ +..\src\draft\glpscl.obj \ +..\src\draft\glpspm.obj \ +..\src\draft\glpssx01.obj \ +..\src\draft\glpssx02.obj \ +..\src\draft\lux.obj \ +..\src\env\alloc.obj \ +..\src\env\dlsup.obj \ +..\src\env\env.obj \ +..\src\env\error.obj \ +..\src\env\stdc.obj \ +..\src\env\stdout.obj \ +..\src\env\stream.obj \ +..\src\env\time.obj \ +..\src\env\tls.obj \ +..\src\intopt\cfg.obj \ +..\src\intopt\cfg1.obj \ +..\src\intopt\cfg2.obj \ +..\src\intopt\clqcut.obj \ +..\src\intopt\covgen.obj \ +..\src\intopt\fpump.obj \ +..\src\intopt\gmicut.obj \ +..\src\intopt\gmigen.obj \ +..\src\intopt\mirgen.obj \ +..\src\intopt\spv.obj \ +..\src\minisat\minisat.obj \ +..\src\misc\avl.obj \ +..\src\misc\bignum.obj \ +..\src\misc\dimacs.obj \ +..\src\misc\dmp.obj \ +..\src\misc\ffalg.obj \ +..\src\misc\fp2rat.obj \ +..\src\misc\fvs.obj \ +..\src\misc\gcd.obj \ +..\src\misc\jd.obj \ +..\src\misc\keller.obj \ +..\src\misc\ks.obj \ +..\src\misc\mc13d.obj \ +..\src\misc\mc21a.obj \ +..\src\misc\mt1.obj \ +..\src\misc\mygmp.obj \ +..\src\misc\okalg.obj \ +..\src\misc\qmd.obj \ +..\src\misc\relax4.obj \ +..\src\misc\rng.obj \ +..\src\misc\rng1.obj \ +..\src\misc\round2n.obj \ +..\src\misc\str2int.obj \ +..\src\misc\str2num.obj \ +..\src\misc\strspx.obj \ +..\src\misc\strtrim.obj \ +..\src\misc\triang.obj \ +..\src\misc\wclique.obj \ +..\src\misc\wclique1.obj \ +..\src\mpl\mpl1.obj \ +..\src\mpl\mpl2.obj \ +..\src\mpl\mpl3.obj \ +..\src\mpl\mpl4.obj \ +..\src\mpl\mpl5.obj \ +..\src\mpl\mpl6.obj \ +..\src\mpl\mplsql.obj \ +..\src\npp\npp1.obj \ +..\src\npp\npp2.obj \ +..\src\npp\npp3.obj \ +..\src\npp\npp4.obj \ +..\src\npp\npp5.obj \ +..\src\npp\npp6.obj \ +..\src\proxy\proxy.obj \ +..\src\proxy\proxy1.obj \ +..\src\simplex\spxat.obj \ +..\src\simplex\spxchuzc.obj \ +..\src\simplex\spxchuzr.obj \ +..\src\simplex\spxlp.obj \ +..\src\simplex\spxnt.obj \ +..\src\simplex\spxprim.obj \ +..\src\simplex\spxprob.obj \ +..\src\simplex\spychuzc.obj \ +..\src\simplex\spychuzr.obj \ +..\src\simplex\spydual.obj \ +..\src\zlib\adler32.obj \ +..\src\zlib\compress.obj \ +..\src\zlib\crc32.obj \ +..\src\zlib\deflate.obj \ +..\src\zlib\gzclose.obj \ +..\src\zlib\gzlib.obj \ +..\src\zlib\gzread.obj \ +..\src\zlib\gzwrite.obj \ +..\src\zlib\inffast.obj \ +..\src\zlib\inflate.obj \ +..\src\zlib\inftrees.obj \ +..\src\zlib\trees.obj \ +..\src\zlib\uncompr.obj \ +..\src\zlib\zio.obj \ +..\src\zlib\zutil.obj + +.c.obj: + cl.exe $(CFLAGS) /Fo$*.obj /c $*.c + +all: glpk.lib glpsol.exe + +glpk.lib: $(OBJSET) + lib.exe /out:glpk.lib \ + ..\src\*.obj \ + ..\src\amd\*.obj \ + ..\src\api\*.obj \ + ..\src\bflib\*.obj \ + ..\src\colamd\*.obj \ + ..\src\draft\*.obj \ + ..\src\env\*.obj \ + ..\src\intopt\*.obj \ + ..\src\minisat\*.obj \ + ..\src\misc\*.obj \ + ..\src\mpl\*.obj \ + ..\src\npp\*.obj \ + ..\src\proxy\*.obj \ + ..\src\simplex\*.obj \ + ..\src\zlib\*.obj + +glpsol.exe: ..\examples\glpsol.obj glpk.lib + cl.exe $(CFLAGS) /Feglpsol.exe \ + ..\examples\glpsol.obj glpk.lib + +check: glpsol.exe + .\glpsol.exe --version + .\glpsol.exe --mps ..\examples\murtagh.mps --max + +## eof ## diff --git a/resources/3rdparty/glpk-4.65/w64/makefile_VC_DLL b/resources/3rdparty/glpk-4.65/w64/makefile_VC_DLL new file mode 100644 index 000000000..5ca94d36c --- /dev/null +++ b/resources/3rdparty/glpk-4.65/w64/makefile_VC_DLL @@ -0,0 +1,252 @@ +## Build GLPK DLL with Microsoft Visual Studio Express ## + +CFLAGS = \ +/I. \ +/I..\src \ +/I..\src\amd \ +/I..\src\api \ +/I..\src\bflib \ +/I..\src\colamd \ +/I..\src\draft \ +/I..\src\env \ +/I..\src\intopt \ +/I..\src\minisat \ +/I..\src\misc \ +/I..\src\mpl \ +/I..\src\npp \ +/I..\src\proxy \ +/I..\src\simplex \ +/I..\src\zlib \ +/DHAVE_CONFIG_H=1 \ +/D_CRT_SECURE_NO_WARNINGS=1 \ +/nologo \ +/W3 \ +/O2 \ +/Zi + +OBJSET = \ +..\src\amd\amd_1.obj \ +..\src\amd\amd_2.obj \ +..\src\amd\amd_aat.obj \ +..\src\amd\amd_control.obj \ +..\src\amd\amd_defaults.obj \ +..\src\amd\amd_dump.obj \ +..\src\amd\amd_info.obj \ +..\src\amd\amd_order.obj \ +..\src\amd\amd_post_tree.obj \ +..\src\amd\amd_postorder.obj \ +..\src\amd\amd_preprocess.obj \ +..\src\amd\amd_valid.obj \ +..\src\api\advbas.obj \ +..\src\api\asnhall.obj \ +..\src\api\asnlp.obj \ +..\src\api\asnokalg.obj \ +..\src\api\ckasn.obj \ +..\src\api\ckcnf.obj \ +..\src\api\cplex.obj \ +..\src\api\cpp.obj \ +..\src\api\cpxbas.obj \ +..\src\api\graph.obj \ +..\src\api\gridgen.obj \ +..\src\api\intfeas1.obj \ +..\src\api\maxffalg.obj \ +..\src\api\maxflp.obj \ +..\src\api\mcflp.obj \ +..\src\api\mcfokalg.obj \ +..\src\api\mcfrelax.obj \ +..\src\api\minisat1.obj \ +..\src\api\mpl.obj \ +..\src\api\mps.obj \ +..\src\api\netgen.obj \ +..\src\api\npp.obj \ +..\src\api\pript.obj \ +..\src\api\prmip.obj \ +..\src\api\prob1.obj \ +..\src\api\prob2.obj \ +..\src\api\prob3.obj \ +..\src\api\prob4.obj \ +..\src\api\prob5.obj \ +..\src\api\prrngs.obj \ +..\src\api\prsol.obj \ +..\src\api\rdasn.obj \ +..\src\api\rdcc.obj \ +..\src\api\rdcnf.obj \ +..\src\api\rdipt.obj \ +..\src\api\rdmaxf.obj \ +..\src\api\rdmcf.obj \ +..\src\api\rdmip.obj \ +..\src\api\rdprob.obj \ +..\src\api\rdsol.obj \ +..\src\api\rmfgen.obj \ +..\src\api\strong.obj \ +..\src\api\topsort.obj \ +..\src\api\weak.obj \ +..\src\api\wcliqex.obj \ +..\src\api\wrasn.obj \ +..\src\api\wrcc.obj \ +..\src\api\wrcnf.obj \ +..\src\api\wript.obj \ +..\src\api\wrmaxf.obj \ +..\src\api\wrmcf.obj \ +..\src\api\wrmip.obj \ +..\src\api\wrprob.obj \ +..\src\api\wrsol.obj \ +..\src\bflib\btf.obj \ +..\src\bflib\btfint.obj \ +..\src\bflib\fhv.obj \ +..\src\bflib\fhvint.obj \ +..\src\bflib\ifu.obj \ +..\src\bflib\luf.obj \ +..\src\bflib\lufint.obj \ +..\src\bflib\scf.obj \ +..\src\bflib\scfint.obj \ +..\src\bflib\sgf.obj \ +..\src\bflib\sva.obj \ +..\src\colamd\colamd.obj \ +..\src\draft\bfd.obj \ +..\src\draft\bfx.obj \ +..\src\draft\glpapi06.obj \ +..\src\draft\glpapi07.obj \ +..\src\draft\glpapi08.obj \ +..\src\draft\glpapi09.obj \ +..\src\draft\glpapi10.obj \ +..\src\draft\glpapi12.obj \ +..\src\draft\glpapi13.obj \ +..\src\draft\glphbm.obj \ +..\src\draft\glpios01.obj \ +..\src\draft\glpios02.obj \ +..\src\draft\glpios03.obj \ +..\src\draft\glpios07.obj \ +..\src\draft\glpios09.obj \ +..\src\draft\glpios11.obj \ +..\src\draft\glpios12.obj \ +..\src\draft\glpipm.obj \ +..\src\draft\glpmat.obj \ +..\src\draft\glprgr.obj \ +..\src\draft\glpscl.obj \ +..\src\draft\glpspm.obj \ +..\src\draft\glpssx01.obj \ +..\src\draft\glpssx02.obj \ +..\src\draft\lux.obj \ +..\src\env\alloc.obj \ +..\src\env\dlsup.obj \ +..\src\env\env.obj \ +..\src\env\error.obj \ +..\src\env\stdc.obj \ +..\src\env\stdout.obj \ +..\src\env\stream.obj \ +..\src\env\time.obj \ +..\src\env\tls.obj \ +..\src\intopt\cfg.obj \ +..\src\intopt\cfg1.obj \ +..\src\intopt\cfg2.obj \ +..\src\intopt\clqcut.obj \ +..\src\intopt\covgen.obj \ +..\src\intopt\fpump.obj \ +..\src\intopt\gmicut.obj \ +..\src\intopt\gmigen.obj \ +..\src\intopt\mirgen.obj \ +..\src\intopt\spv.obj \ +..\src\minisat\minisat.obj \ +..\src\misc\avl.obj \ +..\src\misc\bignum.obj \ +..\src\misc\dimacs.obj \ +..\src\misc\dmp.obj \ +..\src\misc\ffalg.obj \ +..\src\misc\fp2rat.obj \ +..\src\misc\fvs.obj \ +..\src\misc\gcd.obj \ +..\src\misc\jd.obj \ +..\src\misc\keller.obj \ +..\src\misc\ks.obj \ +..\src\misc\mc13d.obj \ +..\src\misc\mc21a.obj \ +..\src\misc\mt1.obj \ +..\src\misc\mygmp.obj \ +..\src\misc\okalg.obj \ +..\src\misc\qmd.obj \ +..\src\misc\relax4.obj \ +..\src\misc\rng.obj \ +..\src\misc\rng1.obj \ +..\src\misc\round2n.obj \ +..\src\misc\str2int.obj \ +..\src\misc\str2num.obj \ +..\src\misc\strspx.obj \ +..\src\misc\strtrim.obj \ +..\src\misc\triang.obj \ +..\src\misc\wclique.obj \ +..\src\misc\wclique1.obj \ +..\src\mpl\mpl1.obj \ +..\src\mpl\mpl2.obj \ +..\src\mpl\mpl3.obj \ +..\src\mpl\mpl4.obj \ +..\src\mpl\mpl5.obj \ +..\src\mpl\mpl6.obj \ +..\src\mpl\mplsql.obj \ +..\src\npp\npp1.obj \ +..\src\npp\npp2.obj \ +..\src\npp\npp3.obj \ +..\src\npp\npp4.obj \ +..\src\npp\npp5.obj \ +..\src\npp\npp6.obj \ +..\src\proxy\proxy.obj \ +..\src\proxy\proxy1.obj \ +..\src\simplex\spxat.obj \ +..\src\simplex\spxchuzc.obj \ +..\src\simplex\spxchuzr.obj \ +..\src\simplex\spxlp.obj \ +..\src\simplex\spxnt.obj \ +..\src\simplex\spxprim.obj \ +..\src\simplex\spxprob.obj \ +..\src\simplex\spychuzc.obj \ +..\src\simplex\spychuzr.obj \ +..\src\simplex\spydual.obj \ +..\src\zlib\adler32.obj \ +..\src\zlib\compress.obj \ +..\src\zlib\crc32.obj \ +..\src\zlib\deflate.obj \ +..\src\zlib\gzclose.obj \ +..\src\zlib\gzlib.obj \ +..\src\zlib\gzread.obj \ +..\src\zlib\gzwrite.obj \ +..\src\zlib\inffast.obj \ +..\src\zlib\inflate.obj \ +..\src\zlib\inftrees.obj \ +..\src\zlib\trees.obj \ +..\src\zlib\uncompr.obj \ +..\src\zlib\zio.obj \ +..\src\zlib\zutil.obj + +.c.obj: + cl.exe $(CFLAGS) /Fo$*.obj /c $*.c + +all: glpk_4_65.dll glpsol.exe + +glpk_4_65.dll: $(OBJSET) + cl.exe $(CFLAGS) /LD /Feglpk_4_65.dll \ + ..\src\*.obj \ + ..\src\amd\*.obj \ + ..\src\api\*.obj \ + ..\src\bflib\*.obj \ + ..\src\colamd\*.obj \ + ..\src\draft\*.obj \ + ..\src\env\*.obj \ + ..\src\intopt\*.obj \ + ..\src\minisat\*.obj \ + ..\src\misc\*.obj \ + ..\src\mpl\*.obj \ + ..\src\npp\*.obj \ + ..\src\proxy\*.obj \ + ..\src\simplex\*.obj \ + ..\src\zlib\*.obj \ + glpk_4_65.def + +glpsol.exe: ..\examples\glpsol.obj glpk_4_65.dll + cl.exe $(CFLAGS) /Feglpsol.exe \ + ..\examples\glpsol.obj glpk_4_65.lib + +check: glpsol.exe + .\glpsol.exe --version + .\glpsol.exe --mps ..\examples\murtagh.mps --max + +## eof ## diff --git a/resources/3rdparty/glpk-4.57/w64/readme.txt b/resources/3rdparty/glpk-4.65/w64/readme.txt similarity index 97% rename from resources/3rdparty/glpk-4.57/w64/readme.txt rename to resources/3rdparty/glpk-4.65/w64/readme.txt index d5742d964..0e0df14d2 100644 --- a/resources/3rdparty/glpk-4.57/w64/readme.txt +++ b/resources/3rdparty/glpk-4.65/w64/readme.txt @@ -1,24 +1,24 @@ -This directory contains batch files and other stuff which you can use -to build GLPK for 64-bit Windows with the native C/C++ compilers. - -Before running the batch file do the following: - -1. Make sure that you have installed the compiler you are going to use - to build GLPK. - -2. Look into corresponding batch file (just right-click it and choose - 'Edit' in the popup menu; DO NOT choose 'Open'). Make sure that HOME - variable specifies correct path to the compiler directory; if not, - make necessary changes. - -To run the batch file just double-click it and wait a bit while the -Make utility does its job. The message 'OPTIMAL SOLUTION FOUND' in the -MS-DOS window means that all is OK. If you do not see it, something is -wrong. - -Once GLPK has been successfully built, there must appear two files in -this directory: - -glpk.lib, which is the GLPK object library, and - -glpsol.exe, which is the stand-alone GLPK LP/MIP solver. +This directory contains batch files and other stuff which you can use +to build GLPK for 64-bit Windows with the native C/C++ compilers. + +Before running the batch file do the following: + +1. Make sure that you have installed the compiler you are going to use + to build GLPK. + +2. Look into corresponding batch file (just right-click it and choose + 'Edit' in the popup menu; DO NOT choose 'Open'). Make sure that HOME + variable specifies correct path to the compiler directory; if not, + make necessary changes. + +To run the batch file just double-click it and wait a bit while the +Make utility does its job. The message 'OPTIMAL SOLUTION FOUND' in the +MS-DOS window means that all is OK. If you do not see it, something is +wrong. + +Once GLPK has been successfully built, there must appear two files in +this directory: + +glpk.lib, which is the GLPK object library, and + +glpsol.exe, which is the stand-alone GLPK LP/MIP solver.