help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] 2D Matrix, One value per column constraint


From: phalkone
Subject: [Help-glpk] 2D Matrix, One value per column constraint
Date: Thu, 21 Feb 2008 11:36:31 +0300

I have a var w[i,j] which is a matrix with i rows and j column representing
the values I'm looking for. I have been able to model most of my constraints
linearly, but I'm stuck at one of the constraints. The constraint is that
there can only be one value per column and the rest of the values have to be
zero. I'm not sure how I can model this linearly.
I tried introducing a second var x[i,j] which would be a binary value
indicating if the value w[i,j] was zero or another value and then putting
constraints on the x[i,j] values. I tried this in two ways:

1. Making the x[i,j] dependent on the w[i,j] values like so:
s.t. set_x1{i in I, j in J}: if(w[i,j] > 0) then x[i,j] = 1;
This is an invalid statement.

2. By making the product of the w[i,j] and x[i,j] values like so:
x[i,j]*w[i,j]
Then the idea was to let glpk choose both variables and put a constraint on
x[i,j] that only one x[i,j] can be 1 per column. Even if there were more
w[i,j] values (other then zero) in each column then these would be
eliminated by a preceding zero. This however is not a linear constraint as
I'm making the product of two variables.

I'm a newbie to linear programming and I'm really hoping someone can help me
with this problem. I really hope I can model this in a linear way and avoid
using heuristics.

Thank you very much,

phalkone
-- 
View this message in context: 
http://www.nabble.com/2D-Matrix%2C-One-value-per-column-constraint-tp15606177p15606177.html
Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.








reply via email to

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