help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] [Fwd: How to access variables by names]


From: Michael Hennebry
Subject: Re: [Help-glpk] [Fwd: How to access variables by names]
Date: Thu, 16 Jun 2011 11:08:25 -0500 (CDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

On Thu, 16 Jun 2011, Andrew Makhorin wrote:

-------- Forwarded Message --------
From: Lounes BENTAHA <address@hidden>
To: address@hidden
Subject: Help
Date: Thu, 16 Jun 2011 11:36:20 +0200

I'm user of GLPK as a C library, i find it more handy, practical and

What i can't or i don't know how doing it is the felloing:


I know the names of my variables and i want accessing them (their
values) directly in my C program like this (for example):


a = glp_get_col_prim_value(x_v[1,3]) where x_v[1,3] is my variable and i
wish affecting its value to a.

As should be obvious, the above syntax won't work.
[1, 3] is the same as [3].
Define a macro.
Something like
#define var_x_v(hi, lo)  (var_x_v00 + (lo) + (hi)*x_v0_size)
x_v0_size is the number of elements in x_v_[0, *].
It should be part of the problem definiton.
I'm assuming that x_v is a rectangular array.
var_x_v00 in the index number of x_v[0, 0] whether or not it exists.
You should be able to discover it while generating the matrix.

--
Michael   address@hidden
"Pessimist: The glass is half empty.
Optimist:   The glass is half full.
Engineer:   The glass is twice as big as it needs to be."



reply via email to

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