TA GUEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEUUUUUUULE
This commit is contained in:
parent
3f980f1d09
commit
9cb04f58bd
25
src/master.c
25
src/master.c
@ -50,6 +50,9 @@ int perfect_rolls() {
|
||||
int nb_coeffs = 4;
|
||||
double y1, y2, y3, y4;
|
||||
int a[4] = {0};
|
||||
glp_smcp params = {0};
|
||||
glp_init_smcp(¶ms);
|
||||
params.msg_lev = GLP_MSG_OFF;
|
||||
while (1) {
|
||||
/* printf("nb_coeffs=%d\n", nb_coeffs); */
|
||||
/* for (int i = 0; i < nb_coeffs + 4; i++) { */
|
||||
@ -61,19 +64,21 @@ int perfect_rolls() {
|
||||
printf("col_num=%d\n", col_num);
|
||||
|
||||
/* solve problem */
|
||||
glp_prob *tmp_prob = glp_create_prob();
|
||||
glp_copy_prob(tmp_prob, lp, GLP_ON);
|
||||
glp_simplex(tmp_prob, NULL);
|
||||
y1 = glp_get_row_dual(tmp_prob, 1);
|
||||
y2 = glp_get_row_dual(tmp_prob, 2);
|
||||
y3 = glp_get_row_dual(tmp_prob, 3);
|
||||
y4 = glp_get_row_dual(tmp_prob, 4);
|
||||
glp_simplex(lp, ¶ms);
|
||||
y1 = glp_get_row_dual(lp, 1);
|
||||
y2 = glp_get_row_dual(lp, 2);
|
||||
y3 = glp_get_row_dual(lp, 3);
|
||||
y4 = glp_get_row_dual(lp, 4);
|
||||
|
||||
column_generator(y1, y2, y3, y4, a, num_col_sp);
|
||||
if (a[0] > 1) {
|
||||
/* for (int i = 1; i <= 4; i++) { */
|
||||
/* printf("a[%d]=%d\n", i, a[i]); */
|
||||
/* } */
|
||||
fputs("Après résolution du sous-problème, on ajoute : ", stdout);
|
||||
int i = 1;
|
||||
for (i = 1; i < 4; i++) {
|
||||
printf("%d, ", a[i]);
|
||||
}
|
||||
printf("%d\n", a[i]);
|
||||
|
||||
add_column(lp, 1.0);
|
||||
for (int i = 1; i < 5; i++) {
|
||||
/* a[col_num, i] = a[i] */
|
||||
|
11
src/sub.c
11
src/sub.c
@ -45,8 +45,15 @@ void column_generator(int y1, int y2, int y3, int y4, int a[static 4], int num_c
|
||||
glp_load_matrix(sous_prob, 4, ia, ja, ar);
|
||||
|
||||
/* solve problem */
|
||||
glp_simplex(sous_prob, NULL);
|
||||
glp_intopt(sous_prob, NULL);
|
||||
glp_smcp params = {0};
|
||||
glp_init_smcp(¶ms);
|
||||
params.msg_lev = GLP_MSG_OFF;
|
||||
glp_iocp iocp = {0};
|
||||
glp_init_iocp(&iocp);
|
||||
iocp.msg_lev = GLP_MSG_OFF;
|
||||
|
||||
glp_simplex(sous_prob, ¶ms);
|
||||
glp_intopt(sous_prob, &iocp);
|
||||
|
||||
a[0] = glp_get_obj_val(sous_prob);
|
||||
a[1] = glp_mip_col_val(sous_prob, 1);
|
||||
|
Reference in New Issue
Block a user