Re: [Help-glpk] Constraints Problem

2008-12-03 Thread Ali Baharev
> lpx_load_matrix(lp,1,ia,ja,ar);

You did not load all the matrix, only one non-zero element but you
have 4 of them. Try:

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

It seems to me you are using an old version of GLPK, try to update to
a more recent one.

Good luck,

Ali


___
Help-glpk mailing list
Help-glpk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-glpk


[Help-glpk] Constraints Problem

2008-12-03 Thread Simone Atzeni
Hi,I have a problem with GLPK.

I had written a program like this:




lpx_set_prob_name(lp,"SAPP");

lpx_set_obj_dir(lp,LPX_MIN);




lpx_add_rows(lp,1);

lpx_add_cols(lp,4);






lpx_set_col_kind(lp,1,LPX_IV);

lpx_set_col_name(lp,1,"V1");

lpx_set_col_bnds(lp,1,LPX_DB,0.0,1.0);




lpx_set_col_kind(lp,2,LPX_IV);

lpx_set_col_name(lp,2,"V2");

lpx_set_col_bnds(lp,2,LPX_DB,0.0,1.0);




lpx_set_col_kind(lp,3,LPX_IV);

lpx_set_col_name(lp,3,"V3");

lpx_set_col_bnds(lp,3,LPX_DB,0.0,1.0);




lpx_set_col_kind(lp,4,LPX_IV);

lpx_set_col_name(lp,4,"V4");

lpx_set_col_bnds(lp,4,LPX_DB,0.0,1.0);












lpx_set_row_name(lp,1,"VERTEXFLOW");

lpx_set_row_bnds(lp,1,LPX_FX,0.0,0.0);




ia[1] = 1, ja[1] = 1, ar[1] = 1.0;

ia[2] = 1, ja[2] = 2, ar[2] = 1.0;

ia[3] = 1, ja[3] = 3, ar[3] = -1.0;

ia[4] = 1, ja[4] = 4, ar[4] = -1.0;




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






Then I get the command:




...




lpx_print_prob(lp,"vincoli.txt");




...




The result is:




...




Row 1: VERTEXFLOW = 0

1 V1


1 V2





...






but there are not V3 and V4.




What is the problem??




The program that I show in this mail is only an example, but the real program 
is very big. It has about 1500 variables and 300 constraints, so I have the 
same problem about several constraints.




Can you help me?

Sorry for my bad english :-D

Thanks.




Simone Atzeni
















Hi,I have a problem with GLPK.I had written a program like this:lpx_set_prob_name(lp,"SAPP");lpx_set_obj_dir(lp,LPX_MIN);lpx_add_rows(lp,1);lpx_add_cols(lp,4);lpx_set_col_kind(lp,1,LPX_IV);lpx_set_col_name(lp,1,"V1");lpx_set_col_bnds(lp,1,LPX_DB,0.0,1.0);lpx_set_col_kind(lp,2,LPX_IV);lpx_set_col_name(lp,2,"V2");lpx_set_col_bnds(lp,2,LPX_DB,0.0,1.0);lpx_set_col_kind(lp,3,LPX_IV);lpx_set_col_name(lp,3,"V3");lpx_set_col_bnds(lp,3,LPX_DB,0.0,1.0);lpx_set_col_kind(lp,4,LPX_IV);lpx_set_col_name(lp,4,"V4");lpx_set_col_bnds(lp,4,LPX_DB,0.0,1.0);lpx_set_row_name(lp,1,"VERTEXFLOW");lpx_set_row_bnds(lp,1,LPX_FX,0.0,0.0);ia[1] = 1, ja[1] = 1, ar[1] = 1.0;ia[2] = 1, ja[2] = 2, ar[2] = 1.0;ia[3] = 1, ja[3] = 3, ar[3] = -1.0;ia[4] = 1, ja[4] = 4, ar[4] = -1.0;lpx_load_matrix(lp,1,ia,ja,ar);Then I get the command:...lpx_print_prob(lp,"vincoli.txt");...The result is:...Row 1: VERTEXFLOW = 0			1 V1			1 V2...but there are not V3 and V4.What is the problem??The program that I show in this mail is only an example, but the real program is very big. It has about 1500 variables and 300 constraints, so I have the same problem about several constraints.Can you help me?Sorry for my bad english :-DThanks.Simone Atzeni
___
Help-glpk mailing list
Help-glpk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-glpk