int main (int argc, char **argv) { IloEnv env; try { IloModel model(env, "example"); IloNumVarArray var(env); IloRangeArray rng(env); populatebycolumn (model, var, rng); IloCplex cplex(model); IloCplex::BasisStatusArray cstat(env), rstat(env); cstat.add(IloCplex::AtUpper); cstat.add(IloCplex::Basic); cstat.add(IloCplex::Basic); rstat.add(IloCplex::AtLower); rstat.add(IloCplex::AtLower); cplex.setBasisStatuses(cstat, var, rstat, rng); cplex.solve(); cplex.out() << "Solution status = " << cplex.getStatus() << endl; cplex.out() << "Solution value = " << cplex.getObjValue() << endl; cplex.out() << "Iteration count = " << cplex.getNiterations() << endl; IloNumArray vals(env); cplex.getValues(vals, var); env.out() << "Values = " << vals << endl; cplex.getSlacks(vals, rng); env.out() << "Slacks = " << vals << endl; cplex.getDuals(vals, rng); env.out() << "Duals = " << vals << endl; cplex.getReducedCosts(vals, var); env.out() << "Reduced Costs = " << vals << endl; cplex.exportModel("lpex6.lp"); } catch (IloException& e) { cerr << "Concert exception caught: " << e << endl; } catch (...) { cerr << "Unknown exception caught" << endl; } env.end(); return 0; } // END main
APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, apr_int32_t wanted, apr_pool_t *pool) { struct stat info; int srv; NXPathCtx_t pathCtx = 0; getcwdpath(NULL, &pathCtx, CTX_ACTUAL_CWD); #ifdef APR_HAS_PSA srv = getstat(pathCtx, (char*)fname, &info, ST_STAT_BITS|ST_NAME_BIT); #else srv = cstat(pathCtx, (char*)fname, &info, ST_STAT_BITS|ST_NAME_BIT, pool); #endif errno = srv; if (srv == 0) { finfo->pool = pool; finfo->fname = fname; fill_out_finfo(finfo, &info, wanted); if (wanted & APR_FINFO_LINK) wanted &= ~APR_FINFO_LINK; if (wanted & APR_FINFO_NAME) { finfo->name = apr_pstrdup(pool, info.st_name); finfo->valid |= APR_FINFO_NAME; } return (wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS; } else { #if !defined(ENOENT) || !defined(ENOTDIR) #error ENOENT || ENOTDIR not defined; please see the #error comments at this line in the source for a workaround. /* * If ENOENT || ENOTDIR is not defined in one of the your OS's * include files, APR cannot report a good reason why the stat() * of the file failed; there are cases where it can fail even though * the file exists. This opens holes in Apache, for example, because * it becomes possible for someone to get a directory listing of a * directory even though there is an index (eg. index.html) file in * it. If you do not have a problem with this, delete the above * #error lines and start the compile again. If you need to do this, * please submit a bug report to http://www.apache.org/bug_report.html * letting us know that you needed to do this. Please be sure to * include the operating system you are using. */ /* WARNING: All errors will be handled as not found */ #if !defined(ENOENT) return APR_ENOENT; #else /* WARNING: All errors but not found will be handled as not directory */ if (errno != ENOENT) return APR_ENOENT; else return errno; #endif #else /* All was defined well, report the usual: */ return errno; #endif } }
/* carries out a clustering using the k-medoid approach. */ void cl_pam(int *nn, int *p, int *kk, double *x, double *dys, int *jdyss, /* jdyss = 0 : compute distances from x * = 1 : distances provided in x */ double *valmd, int *jtmd, int *ndyst, int *nsend, int/*logical*/ *nrepr, int *nelem, double *radus, double *damer, double *avsyl, double *separ, double *ttsyl, double *obj, int *med, int *ncluv, double *clusinf, double *sylinf, int *nisol, int* pamonce) { int clusinf_dim1 = *kk; /* Local variables */ Rboolean all_stats = (obj[0] == 0.),/* if false, only return 'ncluv[]' */ med_given = (med[0] != 0),/* if true, med[] contain initial medoids */ do_swap = (nisol[0] != 0); int k, i, nhalf, jhalt, trace_lev = (int) obj[1]; double s; /* Function Body */ nhalf = *nn * (*nn - 1) / 2 + 1; /* nhalf := #{distances}+1 = length(dys) */ if (*jdyss != 1) { jhalt = 0; if(trace_lev) Rprintf("C pam(): computing %d dissimilarities: ", nhalf); F77_CALL(dysta)(nn, p, x, dys, ndyst, jtmd, valmd, &jhalt); if(trace_lev) Rprintf("[Ok]\n"); if (jhalt != 0) { *jdyss = -1; return; } } /* s := max( dys[.] ), the largest distance */ for (i = 1, s = 0.; i < nhalf; ++i) /* dys[0] == 0. not used here */ if (s < dys[i]) s = dys[i]; /* FIXME: work with med[] = (i_1, i_2, ..., i_k) * ----- instead nrepr[] = (b_1, ... b_n) b_i in {0,1} */ for (i = 0; i < *nn; ++i) nrepr[i] = 0; if(med_given) { /* if true, med[] contain initial medoids */ /* for the moment, translate these to nrepr[] 0/1 : * not assuming that the med[] indices are sorted */ for (k = 0; k < *kk; k++) nrepr[med[k] - 1] = 1; } /* Build + Swap [but no build if(med_given); swap only if(do_swap) : */ bswap(*kk, *nn, nrepr, med_given, do_swap, trace_lev, radus, damer, avsyl, dys, s, obj, pamonce); if(trace_lev) Rprintf("end{bswap()}, "); /* Compute Clustering & STATs if(all_stats): */ cstat(kk, nn, nsend, nrepr, all_stats, radus, damer, avsyl, separ, &s, dys, ncluv, nelem, med, nisol); if(trace_lev) Rprintf("end{cstat()}\n"); if(all_stats) { for (k = 0; k < *kk; ++k) { clusinf[k]= (double) nrepr[k]; clusinf[k + clusinf_dim1] = radus[k]; clusinf[k + (clusinf_dim1 << 1)] = avsyl [k]; clusinf[k + clusinf_dim1 * 3] = damer[k]; clusinf[k + (clusinf_dim1 << 2)] = separ[k]; } if (1 < *kk && *kk < *nn) { /* Compute Silhouette info : */ dark(*kk, *nn, ncluv, nsend, nelem, nrepr, radus, damer, avsyl, ttsyl, dys, &s, sylinf); } } } /* pam */
/* Retourne la valeur 1 si une touche du clavier a ete enfonce, 0 sinon */ int TestClavier() { return cstat(fenetreCourante); }