[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-glpk] Strange Error with if/then/else
From: |
Jonathan Klein |
Subject: |
[Help-glpk] Strange Error with if/then/else |
Date: |
Sat, 05 Apr 2008 13:36:10 +0000 |
User-agent: |
Thunderbird 2.0.0.12 (Windows/20080213) |
Hi,
i havbe a very simple Problem like this:
set PEOPLE;
var x{i in PEOPLE} binary;
maximize Anzahl : sum{i in PEOPLE} (if x[i]==1 then 1 else 0);
data;
set LEUTE:=Hans Joachen Peter Klaus;
end;
And i get the Error: operator preceding == has invalid type
I know, that this problem doesn't make sense, but i have i somewhat more
complex problem in wich i get the same error:
# Berufsinformationstag
set STUDENT;#i
set CHOICE;#j
set COURSE;#k
set GROUP;#l
param Student_Choice {i in STUDENT, j in CHOICE} symbolic in COURSE;#
Welcher Schüler welche Wünsche hat
#param Course_Minimum {k in COURSE};#Wie viele Schüler eine
Veranstaltung minimal braucht
#param Course_Maximum {k in COURSE};#Wie viele Schüler eine
Veranstaltung haben darf
param Satisfaction {j in CHOICE};#für jeden wunsch die Menge, wie
glücklich er ist
var TimeTable{k in COURSE, l in GROUP}, binary;
var StudentDistribution {i in STUDENT, k in COURSE, l in GROUP} binary ;
# wenn sich der schüler die aktuelle veranstaltung wünscht und in der
veranstaltung in dieser gruppe ist
maximize z: sum{i in STUDENT, l in GROUP, k in COURSE, j in CHOICE}
(if 1==StudentDistribution[i,k,l]
and k==Student_Choice[i, j]
then Satisfaction[k] else 0);
So i have Students that are in different Courses, in 1 Course per Group.
They coose 6 Courses and will be in 4 (1 in each group). If they are in
a grout that the have choosen, they are happy.
So i have to check for every Choice of every Student in every Course in
every Group if the student is in this course in this group and if he had
choosen it. If so, he gets as much happiness as his choice had importance.
At the end i need to know form every Student in which courses he ist an
which courses in which group have to take place, so i have choosen the
binary variables.
I dont konw why the types should not match, because StudentDistribution
ist binary, so i can only be 0 or 1 an Student_Choice has to be a COURSE.
I studiet the language reference manual for a long time and looked at
many examples with if/then/else but i still have no idea what i'm doing
wrong.
PS: I use C++ for 5 years now, but im relativly new to GNU MathProg :(
I would be very gald for every help.
Jonathan
- [Help-glpk] Strange Error with if/then/else,
Jonathan Klein <=