Fixed several bugs
[libfirm] / ir / be / becopyilp2.c
1 /**
2  * Author:      Daniel Grund
3  * Date:                28.02.2006
4  * Copyright:   (c) Universitaet Karlsruhe
5  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
6  *
7  * ILP formalization using G=(V, E, Q):
8  *  - 1 class of variables: equal color vars
9  *  - Path constraints
10  *  - Clique path constraints
11  *
12  *
13  *      \min \sum_{ (i,j) \in Q }  w_ij y_ij
14  *
15  *              y_ij                            =  1                    (i,j) \in E
16  *
17  *              \sum_c y_nc                     =  |C| - 1              n \in N, c \in C
18  *
19  *              y_nc                            =  1                    n \in N, c \not\in C(n)
20  *
21  *              \sum_{e \in p} y_e      >= 1                    p \in P         path constraints
22  *
23  *              \sum_{e \in cp} y_e     >= |cp| - 1             cp \in CP       clique-path constraints
24  *
25  *              y_ij \in N,   w_ij \in R^+
26  */
27
28 #include "becopyilp_t.h"
29
30 #define DEBUG_LVL 1
31
32 typedef struct _my_env_t {
33         int foo;
34 } my_env_t;
35
36
37 static void ilp2_build(ilp_env_t *ienv) {
38         ienv->lp = new_lpp(ienv->co->name, lpp_minimize);
39
40 }
41
42 static void ilp2_apply(ilp_env_t *ienv) {
43
44 }
45
46 int co_solve_ilp2(copy_opt_t *co, double time_limit) {
47         lpp_sol_state_t sol_state;
48         ilp_env_t *ienv;
49         my_env_t my;
50         firm_dbg_module_t *dbg = firm_dbg_register("ir.be.coilp2");
51
52         firm_dbg_set_mask(dbg, DEBUG_LVL);
53
54         // my.bla = TODO
55
56         ienv = new_ilp_env(co, dbg, ilp2_build, ilp2_apply, &my);
57
58         sol_state = ilp_go(ienv, time_limit);
59
60         free_ilp_env(ienv);
61
62         return sol_state == lpp_optimal;
63 }