help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] [Fwd: Unconstrained variables]


From: Andrew Makhorin
Subject: [Help-glpk] [Fwd: Unconstrained variables]
Date: Mon, 15 Jul 2013 09:43:23 +0400

-------- Forwarded Message --------
From: Bruce MacDonald <address@hidden>
To: address@hidden
Subject: Unconstrained variables
Date: Mon, 15 Jul 2013 14:19:58 +1000

Hi,

I am experimenting with GLPK (using GLPK Sharp) and have a problem with
the variables.

The problem I am trying to solve is this:

Maximise 10x1 + 6x2 + 4x3

S.T.             x1 +   x2 +  x3 <= 100

               10x1 + 4x2 + 5x3 <= 600

                2x1 +  2x2 + 6x3 <= 300


I can solve this fine if I have non-negativity constraints on the
variables:
Problem Status: Optimal
Objective value: 733.333333333333
Primal basis: 33.3333333333333 66.6666666666667 0

For my next step I want to make the variables unconstrained, so that the
problem becomes unbounded. I would have expected that the below code
would do it.

for (int i = 0; i < cols; i++) {
                glpkProblem.SetObjCoef(i + 1, ObjectiveCoefficients[i]);
                glpkProblem.SetColBounds(i + 1, GetBoundsType(">"),
double.NegativeInfinity, 0);
            }


It does indeed appear to work:
Problem Status: Unbounded
Objective value:
Primal basis:

So now, if I try to constrain x3 >= -5 as a constraint row rather than a
ColBound, i.e. adding one more constraint row to the above formulation:
0x1 + 0x2 + x3 >= -5, I get the following


Problem Status: Unbounded
Objective value:
Primal basis:


That is, it appears to be ignoring my 4th constraint. Just to prove
this, if I make the ColBound LB=-10 and make my 4th constraint >= 5 I
get the following
Problem Status: Optimal
Objective value: 720
Primal basis: 32.5 62.5 5


So, obviously I need to have some sort of LB on each column variable.
What value should I use if I want it to be unbounded?


Thanks for your help.

Bruce.






reply via email to

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