Extended perm insertion by setting the colors of the outs.
[libfirm] / ir / be / lpp_local.c
index fd96a1a..362be3e 100644 (file)
@@ -21,8 +21,8 @@
 #include "sp_matrix.h"
 #include "ilcplex/cplex.h"
 
-#define LOGFILE stdout
-
+#undef LOGFILE //stdout
+#define TIME_LIMIT 5*60 /* in sec. 0 for none */
 
 static char cpx_cst_encoding[4] = {'?', 'E', 'L', 'G'};
 static char cpx_var_encoding[4] = {'?', '?', 'C', 'B'};
@@ -54,8 +54,10 @@ static cpx_t *new_cpx(lpp_t *lpp) {
        chk_cpx_err(cpx);
        CPXchgobjsen(cpx->env, cpx->prob, (lpp->opt_type == minimize)?1:-1);
        chk_cpx_err(cpx);
+#ifdef LOGFILE
        if (CPXsetlogfile(cpx->env, LOGFILE))
                assert(0 && "Could not set logfile");
+#endif
        return cpx;
 }
 
@@ -147,6 +149,8 @@ static void cpx_solve(cpx_t *cpx) {
        CPXsetintparam(cpx->env, CPX_PARAM_MIPSTART, CPX_ON);
        CPXsetintparam(cpx->env, CPX_PARAM_MIPEMPHASIS, CPX_MIPEMPHASIS_BESTBOUND);
        CPXsetintparam(cpx->env, CPX_PARAM_VARSEL, CPX_VARSEL_STRONG);
+       if (TIME_LIMIT)
+               CPXsetdblparam(cpx->env, CPX_PARAM_TILIM, TIME_LIMIT);
 
        /* solve */
        gettimeofday(&tvb, NULL);
@@ -172,7 +176,7 @@ static void cpx_solve(cpx_t *cpx) {
                case CPX_STAT_OPTIMAL:          lpp->sol_state = optimal; break;
                default:                                        lpp->sol_state = unknown;
        }
-       assert(lpp->sol_state == optimal);
+       assert(lpp->sol_state == optimal || lpp->sol_state == feasible);
 
        /* get variable solution values */
        values = alloca(numcols * sizeof(*values));