help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] help! how tow set constraint coeffients to zero?


From: Olivier Liess
Subject: Re: [Help-glpk] help! how tow set constraint coeffients to zero?
Date: Mon, 10 Dec 2007 09:11:00 +0100
User-agent: IceDove 1.5.0.14pre (X11/20071018)

Hi,

As the refman says, you don't have to put the zero coefficients (see
http://permalink.gmane.org/gmane.comp.gnu.glpk/849 ). So you should do
something like this:

lpx_load_matrix(lp,ne,ia,ja,ar);

with:

ne=4;              //(number of non-zero elements)
ia[5]={0,1,1,2,2}; //(row indexes)
ja[5]={0,2,3,1,2}; //(column indexes)
ar[5]={0,1,1,1,1}; //(coefficients)


Note that strict inequalities (a > b) are not especially "wanted" in 
optimization problems.

Olivier.


CiHang Jin a écrit :
> Hi all,
>
> I am using GLPK to solve a LP problem, such as:
>
> max            Z = x1 + x2 + x3
> subject to:    1 >      x2 + x3
>                2 > x1 + x2
>
> In the first row, the coefficient of x1 is zero and in the 2nd line the
> coefficient of x3 is zero. I trid to set the constaint matrix by
> lpx_load_matrix(),but got an error "lpx_load_matrix: ar[1] = 0; zero element 
> not
> allowed".
>
> How could I formulate this problem?
>
> BR!
>
> cihang
>
>
>
>
> _______________________________________________
> Help-glpk mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-glpk
>   


-- 
------------------------------------------------
Olivier Liess
------------------------------------------------
Ingénieur de Recherche
------------------------------------------------
Laboratoire de Mathématiques Appliquées du Havre
UFR Sciences et Techniques
8, rue Philippe Lebon BP540
Université du Havre
------------------------------------------------
address@hidden
------------------------------------------------





reply via email to

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