[Top][All Lists]

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

Re: [Help-glpk] Variables with different cardinalities

From: Brady Hunsaker
Subject: Re: [Help-glpk] Variables with different cardinalities
Date: Tue, 18 Jan 2005 00:16:32 -0500
User-agent: Mozilla Thunderbird 0.9 (X11/20041124)

address@hidden wrote:
Hello all,

First of all let me say that GLPK is a great project!
I really appreciate all the excellent work.

I think I understand how to set up a problem in
which all the variables have the same cardinality
(by this I mean the same number of possible values).

I want to set up a problem in which the variables
can have different cardinalities. I've tried various
things but I haven't found anything that glpsol is
happy with. Maybe someone can point me to a simple

I guess this is a really simple problem but I've
read the MathProg manual and searched the mailing
list archive without success.

Thanks in advance for your help!
Robert Dodier

It sounds like you must be using a MIP, since variables have a finite number of possible values. All you need to do is declare a variable to be integer and give appropriate lower and upper bounds. This will limit the values it can take. It is perfectly fine to have variables with different bounds.

I think something like the following would work, thought I didn't test it myself:
var One >=0, <= 3, integer;
var Two >=0, <= 2, integer;

The way that you asked the question makes me wonder if what you have is more of a constraint program, however. If so, you may want to consider other solution methods, such as constraint programming.


reply via email to

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