help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] RE: Help-glpk Digest, Vol 22, Issue 12


From: Q Wu
Subject: [Help-glpk] RE: Help-glpk Digest, Vol 22, Issue 12
Date: Mon, 20 Sep 2004 20:50:02 +0800

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





reply via email to

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