diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-03-03 08:17:40 +0100 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-03-03 08:17:40 +0100 |
commit | 1ab7b51c30e1b10ac45b0bd64cefdc01da0f7f68 (patch) | |
tree | 210ffc156c83f04fb0c61a40b4f9037d7ba8a7e1 /test/monniaux/glpk-4.65/src/proxy/main.c.disabled | |
parent | 222c9047d61961db9c6b19fed5ca49829223fd33 (diff) | |
parent | 12be46d59a2483a10d77fa8ee67f7e0ca1bd702f (diff) | |
download | compcert-kvx-1ab7b51c30e1b10ac45b0bd64cefdc01da0f7f68.tar.gz compcert-kvx-1ab7b51c30e1b10ac45b0bd64cefdc01da0f7f68.zip |
Merge branch 'mppa-cse2' of gricad-gitlab.univ-grenoble-alpes.fr:sixcy/CompCert into mppa-work
Diffstat (limited to 'test/monniaux/glpk-4.65/src/proxy/main.c.disabled')
-rw-r--r-- | test/monniaux/glpk-4.65/src/proxy/main.c.disabled | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/test/monniaux/glpk-4.65/src/proxy/main.c.disabled b/test/monniaux/glpk-4.65/src/proxy/main.c.disabled new file mode 100644 index 00000000..a7d1e2b8 --- /dev/null +++ b/test/monniaux/glpk-4.65/src/proxy/main.c.disabled @@ -0,0 +1,87 @@ +/* Last update: 08-May-2013 */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "glpk.h" +#include "proxy.h" + +/**********************************************************************/ +int main(int argc, char **argv) +/**********************************************************************/ +{ + glp_prob *lp; + int ncols, status; + double *initsol, zstar, *xstar; + + /* check arguments */ + if ( (argc == 1) || (argc > 3) ) { + printf("ERROR: Usage: ts <instance> <(possibly) xml initsols>\n" + ); + exit(1); + } + + /* creating the problem */ + lp = glp_create_prob(); + glp_set_prob_name(lp, "Proxy"); + + /* reading the problem */ + glp_term_out(GLP_OFF); +#if 0 /* by mao */ + status = glp_read_lp(lp, NULL, argv[1]); +#else + status = glp_read_mps(lp, GLP_MPS_FILE, NULL, argv[1]); +#endif + glp_term_out(GLP_ON); + if ( status ) { + printf("Problem %s does not exist!!!, status %d\n", + argv[1], status); + exit(1); + } + + ncols = glp_get_num_cols(lp); + + initsol = (double *) calloc(ncols+1, sizeof(double)); + + if (argc == 3) { + FILE *fp=fopen(argv[2],"r"); + char tmp[256]={0x0}; + int counter = 1; + while(fp!=NULL && fgets(tmp, sizeof(tmp),fp)!=NULL) + { + char *valini = strstr(tmp, "value"); + if (valini!=NULL){ + int num; + double dnum; + valini +=7; + sscanf(valini, "%d%*s",&num); + dnum = (double)num; + initsol[counter] = dnum; + counter++; + } + } + fclose(fp); + } + + xstar = (double *) calloc(ncols+1, sizeof(double)); + + if (argc == 3) { + status = proxy(lp, &zstar, xstar, initsol, 0.0, 0, 1); + } + else { + status = proxy(lp, &zstar, xstar, NULL, 0.0, 0, 1); + } + + printf("Status = %d; ZSTAR = %f\n",status,zstar); + /* + int i; + for (i=1; i< ncols+1; i++) { + printf("XSTAR[%d] = %f\n",i, xstar[i]); + } + */ + + glp_delete_prob(lp); + + return 0; +} |