[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-glpk] RE: Help-glpk Digest, Vol 22, Issue 13
From: |
Rich Wu |
Subject: |
[Help-glpk] RE: Help-glpk Digest, Vol 22, Issue 13 |
Date: |
Tue, 21 Sep 2004 10:36:32 +0800 |
Thanks for the answer, I'm aware now that the
abs(CountryColor[ct1]-CountryColor[ct2])>=1 is a non-linear constraint. My
goal is to limit the color for adjacent countries to be different,
CountryColor[ct1]<>CountryColor[ct2], as GLPK solver doesn't allow strict
inequality, then how should I revise the code to accomplish the goal?
Thanks a lot for the help.
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
address@hidden
Sent: Tuesday, September 21, 2004 12:00 AM
To: address@hidden
Subject: Help-glpk Digest, Vol 22, Issue 13
Send Help-glpk mailing list submissions to
address@hidden
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.gnu.org/mailman/listinfo/help-glpk
or, via email, send a message with subject or body 'help' to
address@hidden
You can reach the person managing the list at
address@hidden
When replying, please edit your Subject line so it is more specific than
"Re: Contents of Help-glpk digest..."
Today's Topics:
1. RE: Help-glpk Digest, Vol 22, Issue 12 (Q Wu)
2. Re: RE: Help-glpk Digest, Vol 22, Issue 12 (Michael Hennebry)
----------------------------------------------------------------------
Message: 1
Date: Mon, 20 Sep 2004 20:50:02 +0800
From: "Q Wu" <address@hidden>
Subject: [Help-glpk] RE: Help-glpk Digest, Vol 22, Issue 12
To: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; format=flowed
Hi all,
I'm new to learn GLPK to solve LP problem, I have a simple model for Map
Coloring problem as below, but when I tried to solve it, I got the following
parse error at line 12#: argument for abs has invalid type. I'm very
confused with this error.
And, I'm also wondering why strict inequality is not allowed in the model.
Can anyone give some explanation? Thanks for any input in advance.
Rich Wu
#----Start------
set Country 'Country List';
param Adjacent 'Adjacent Maps' {Country, Country} logical; var ColorAmount,
integer, >= 1; var CountryColor{Country} integer >=1; #Objective minimize
ObjColorAmount: ColorAmount; #Subject to #Constraints FirstCountryLim 'First
Country Color Limit':
CountryColor['c1'] = 1;
AdjacentLim 'Adjacent Limit' {ct1 in Country, ct2 in Country:ct1<>ct2 &&
Adjacent[ct1,ct2]=1}:
abs(CountryColor[ct1]-(CountryColor[ct2]))>=1;
CountryNumber 'Country Number Limit' {c in Country}:
CountryColor[c]<=ColorAmount;
display CountryColor;
#data
data;
set Country:=c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16,c17,c18;
param Adjacent default 0 (tr) :
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 :=
c1 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0
c2 1 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0
c3 0 1 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 1
c4 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0
c5 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1
c6 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0
c7 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0
c8 1 1 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0
c9 0 1 1 0 0 0 0 1 0 1 1 0 0 0 0 0 0 1
c10 0 0 0 0 0 0 0 0 1 0 1 1 0 0 1 0 0 0
c11 0 0 0 0 0 0 1 1 1 1 0 1 0 1 0 0 0 0
c12 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1 0 0 0
c13 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0
c14 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0
c15 0 0 0 0 1 1 0 0 1 1 0 1 1 0 0 1 1 0
c16 0 0 0 0 1 1 0 0 0 0 0 0 1 0 1 0 1 0
c17 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0
c18 0 0 1 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 ; end;
#----end-----
_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus
------------------------------
Message: 2
Date: Mon, 20 Sep 2004 09:20:42 -0500 (CDT)
From: Michael Hennebry <address@hidden>
Subject: Re: [Help-glpk] RE: Help-glpk Digest, Vol 22, Issue 12
To: Q Wu <address@hidden>
Cc: address@hidden
Message-ID: <address@hidden>
Content-Type: TEXT/PLAIN; charset=US-ASCII
On Mon, 20 Sep 2004, Q Wu wrote:
> I'm new to learn GLPK to solve LP problem, I have a simple model for Map
> Coloring problem as below, but when I tried to solve it, I got the
following
> parse error at line 12#: argument for abs has invalid type. I'm very
> confused with this error.
The phrasing is a bit confusing.
The distinction is not between integer and real,
It's between constant and not constant.
abs(linear non-constant function) >= 1 is a nonlinear constraint.
> And, I'm also wondering why strict inequality is not allowed in the model.
> Can anyone give some explanation? Thanks for any input in advance.
Open sets lead to optimization problems with no optimum solution.
--
Mike address@hidden
"Nothing says it like words if you know how to use them."
-- the Professional Organization of English Majors
------------------------------
_______________________________________________
Help-glpk mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-glpk
End of Help-glpk Digest, Vol 22, Issue 13
*****************************************
- [Help-glpk] RE: Help-glpk Digest, Vol 22, Issue 13,
Rich Wu <=