[Top][All Lists]

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

Re: [Help-glpk] Compare two matrices

From: address@hidden
Subject: Re: [Help-glpk] Compare two matrices
Date: Tue, 7 Aug 2007 06:34:00 -0400

Thanks a lot for your answer.

I am trying to implement your information, however there is one small other
problem. In the data section, how should I write down the values for the
A[a,b,c] matrix?

For two dimensional, I always use:

param A : a1 a2 :=
       b1 1 1
       b2 1 1;

However, for three indices, this doesn't work.

I hope that you can help me out.


Original Message:
From: Andrew Makhorin address@hidden
Date: Tue, 7 Aug 2007 06:58:58 +0400
To: address@hidden, address@hidden
Subject: Re: [Help-glpk] Compare two matrices

> I have the following problem: I have a parameter A with (3 indices)
> and a decision variable X also with 3 indices (same matrix form).
> The idea is as follows: Parameter A is the old matrix, X is the new
> matrix. Now I need to be sure that at most 10 changes are made. So I
> would like to have at most 10 different X[a,b,c] to A[a,b,c] for all
> a,b,c.

> Now I was used to programs that could work with absolute values
> (SUM[a,b,c]: abs(A[a,b,c]-X[a,b,c]) <= 10), however GLPK is not able
> to work with absolute values of decision variables.

> Does anyone have an idea how to solve this?

> I tried introducing a Dummy: D[a,b,c] = 1 for A[a,b,c]<=X[a,b,c], 0
> else but that didn't work out....

Big M formulation:

"if z1 then x <= a - eps else x <= +M" can be modeled as

   x <= (a - eps) * z1 + M * (1 - z1)

"if z2 then x >= a + eps else x >= -M" can be modeled as

   x >= (a + eps) * z2 - M * (1 - z2)

"if z then x <= a - eps or x >= a + eps else a - eps < x < a + eps"
is equivalent to "z = z1 or z2" and can be modeled as

   0 <= 2 * z - z1 - z2 <= 1

where z1, z2, z are binary variables.

-------------------------------------------------------------------- - Microsoft® Exchange solutions from a leading provider -

reply via email to

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