help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Re: hi, x1=x2 constraint


From: Michael Hennebry
Subject: Re: [Help-glpk] Re: hi, x1=x2 constraint
Date: Wed, 14 Jan 2004 16:03:11 -0600 (CST)

On Thu, 15 Jan 2004, Andrew Makhorin wrote:

> >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);

According to the problem, both rows should be LPX_FX.

> >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.

Isn't a zero objective function legal?

-- 
Mike   address@hidden
"History is written by the winners."  --  the losers





reply via email to

[Prev in Thread] Current Thread [Next in Thread]