-/**
- * Invoke an external solver
- */
-static void pi_solve_ilp(problem_instance_t *pi) {
- FILE *out, *pwfile;
- char passwd[128];
-
- DBG((dbg, LEVEL_1, "Solving with CPLEX@RZ...\n"));
- /* write command file for CPLEX */
- out = ffopen(pi->co->name, "cmd", "wt");
- fprintf(out, "set logfile %s.sol\n", pi->co->name);
-#ifdef DUMP_Q2ILP
- fprintf(out, "read %s.q2ilp mps\n", pi->co->name);
-#endif
-#ifdef DUMP_DILP
- fprintf(out, "read %s.dilp mps\n", pi->co->name);
-#endif
- fprintf(out, "read %s.mst\n", pi->co->name);
- fprintf(out, "set mip strategy mipstart 1\n");
- //fprintf(out, "set mip emphasis 3\n");
- fprintf(out, "optimize\n");
- fprintf(out, "display solution variables 1-%d\n", pi->x_dim);
- fprintf(out, "quit\n");
- fclose(out);
-
- /* write expect-file for copying problem to RZ */
- pwfile = fopen(SSH_PASSWD_FILE, "rt");
- fgets(passwd, sizeof(passwd), pwfile);
- fclose(pwfile);
-
- out = ffopen(EXPECT_FILENAME, "exp", "wt");
- fprintf(out, "#! /usr/bin/expect\n");
- fprintf(out, "spawn scp %s.dilp %s.q2ilp %s.mst %s.cmd %s:\n", pi->co->name, pi->co->name, pi->co->name, pi->co->name, SSH_USER_HOST); /* copy problem files */
- fprintf(out, "expect \"word:\"\nsend \"%s\\n\"\ninteract\n", passwd);
-
- fprintf(out, "spawn ssh %s \"./cplex90 < %s.cmd\"\n", SSH_USER_HOST, pi->co->name); /* solve */
- fprintf(out, "expect \"word:\"\nsend \"%s\\n\"\ninteract\n", passwd);
-
- fprintf(out, "spawn scp %s:%s.sol .\n", SSH_USER_HOST, pi->co->name); /*copy back solution */
- fprintf(out, "expect \"word:\"\nsend \"%s\\n\"\ninteract\n", passwd);
-
- fprintf(out, "spawn ssh %s ./dell\n", SSH_USER_HOST); /* clean files on server */
- fprintf(out, "expect \"word:\"\nsend \"%s\\n\"\ninteract\n", passwd);
-
- fclose(out);
-
- /* call the expect script */
- chmod(EXPECT_FILENAME ".exp", 0700);
- system(EXPECT_FILENAME ".exp");
-}
-
-static void pi_set_simplicials(problem_instance_t *pi) {
- simpl_t *simpl, *tmp;
- bitset_t *used_cols = bitset_alloca(arch_register_class_n_regs(pi->co->cls));
-
- /* color the simplicial nodes in right order */
- list_for_each_entry_safe(simpl_t, simpl, tmp, &pi->simplicials, chain) {
- int free_col;
- ir_node *other_irn, *irn;
- if_node_t *other, *ifn;
-
- /* get free color by inspecting all neighbors */
- ifn = simpl->ifn;
- irn = get_irn_for_graph_nr(pi->co->irg, ifn->nnr);
- bitset_clear_all(used_cols);
- foreach_neighb(ifn, other) {
- other_irn = get_irn_for_graph_nr(pi->co->irg, other->nnr);
- if (!is_removed(other_irn)) /* only inspect nodes which are in graph right now */
- bitset_set(used_cols, get_irn_col(pi->co, other_irn));
- }
-
- /* now all bits not set are possible colors */
- free_col = bitset_next_clear(used_cols, 0);
- assert(free_col != -1 && "No free color found. This can not be.");
- set_irn_col(pi->co, irn, free_col);
- pset_remove_ptr(pi->removed, irn); /* irn is back in graph again */
- free(simpl);
- }