[Top][All Lists]

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

[Help-glpk] formulation of a problem

From: Nico Moser
Subject: [Help-glpk] formulation of a problem
Date: Thu, 22 Jun 2006 13:33:11 +0200


I'm in trouble with set in a problem in the glpk datastructure and I can't find answers to my questions (perhaps I looked at the wrong places).
The two main problems:
1. How can I set a variable to the right hand side?
If I have a constraint like this: x1+x2 <= y1 I can't set:

lpx_set_row_name(lp, 3, "constraint");
lpx_set_row_bnds(lp, 3, LPX_UP, 0, y1);

2. How can I set 'holes' in the matrix (if a variable is not needed in one constraint)?

For instance:
x1+x2 = 3
x1 <= 1

then I would think the array assignments looks like that:

ia[1] = 1, ja[1] = 1, ar[1] = 1.0;
ia[2] = 1, ja[2] = 2, ar[2] = 1.0;
ia[3] = 2, ja[3] = 1, ar[3] = 1.0;
ia[4] = 2, ja[4] = 2, ar[4] = 0; // <- it doesn't work

(a similar problem: if I don't need a basic variable in the minimize or maximize funktion, can I set the the coefficient to zero? like: lpx_set_obj_coef(lp,1,0.0); )

Thanks a lot,

reply via email to

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