help-glpk
[Top][All Lists]

## RE: [Help-glpk] formulation of a problem

 From: Gottfried Lindner Subject: RE: [Help-glpk] formulation of a problem Date: Thu, 22 Jun 2006 14:27:17 +0200

```
See below

Gottfried Lindner

Besuchen Sie unsere Seite:
http://www.informatikfuchs.de/Software/GLPK/LiMath_Optimierung.htm

-----Original Message-----
Nico Moser
Sent: Donnerstag, 22. Juni 2006 13:33
Subject: [Help-glpk] formulation of a problem

Hi,

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

-> Yes, if y1 is a constant in your model and a variable in the program
containing this constant value.

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, ja = 1, ar = 1.0;
ia = 1, ja = 2, ar = 1.0;
ia = 2, ja = 1, ar = 1.0;
ia = 2, ja = 2, ar = 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);  )

-> Only coefficients with value <> 0 may be explicitly assigned. The
others are assigned to 0 implicitly (sparse matrix storage).

Thanks a lot,
Nico

_______________________________________________
Help-glpk mailing list