[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] ILP problem , unexpected solution
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] ILP problem , unexpected solution |
Date: |
Tue, 29 Dec 2009 22:47:50 +0300 |
> Sorry for the botchup. I did some code juggling and posted incorrect
> code. I have posted the modified code at the end. I have upgraded to
> glpk 4.41. I actually want x1, x2 ,x3 ,x4 to take only binary values 0
> and 1. I have used glp_set_col_kind function to set the column kind to
> GLP_IV
> my foobar.lp(glp_write_lp function #39;s output) is as follows
> I get x1 , x2, x3 and x4 all zero #39;s
> I think The right solution is x1 can #39;t be one and one of other
> 3 variables should be 1. I don #39;t know if i am doing something
> silly.
> Is it okay to have x1, x2 , x3, x4 to be int type? Are there any
> special type that i should use.
To solve mip you need to call glp_integer following a call to
glp_simplex. Besides, to obtain mip solution components you need to
use glp_get_mip_col rather than glp_get_col_prim. For more details
please consult the glpk reference manual (section "Mixed integer
programming routines") included in the distribution.