[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-glpk] Re: hi, x1=x2 constraint
From: |
Andrew Makhorin |
Subject: |
[Help-glpk] Re: hi, x1=x2 constraint |
Date: |
Thu, 15 Jan 2004 00:16:22 +0300 |
>I tried the suggestion but it still gives me 0 for Xa.
>It is suppose to be 100.
>Here is the full problem and code, I don't know what
>I'm doing wrong.
>
>Problem:
>Z=1Xa + 3Xb
>Xa=Xb
>Xb=100
>
>Code:
>Initialization code
>
>lpx_add_rows(lp, 2);
>Lpx_set_row_name(lp, 1, p);
>lpx_set_row_bnds(lp, 1, LPX_FX, 0.0, 0.0);
>lpx_set_row_name(lp, 2, q);
>lpx_set_row_bnds(lp, 2, LPX_UP, 0.0, 100.0);
>
>lpx_add_cols(lp, 2);
>lpx_set_cols_name(lp, 1, a);
>lpx_set_cols_bnds(lp, 1, LPX_LO, 0.0, 0.0);
>lpx_set_cols_name(lp, 2, b);
>lpx_set_cols_bnds(lp, 2, LPX_LO, 0.0, 0.0);
>
>rn[1]=1; cn[1]=1; a[1]=1.0;
>rn[2]=1; cn[2]=2; a[2]=-1.0;
>rn[3]=2; cn[3]=2; a[3]=1.0;
>lpx_load_mat3(lp, 3, rn, cn, a);
>
>the rest is the code for lp solver function, integer
>function, extraction of results, deletion of problem.
You forgot to specify the objective function.