ich wollte mich nicht nur mti dem Programmieren auf Papier begnügen und hatte mal versucht das Programm der Folien 63 und 64 in die aktuelle OPL Syntax zu übersetzen die auch unter dem aktuellen "IBM Ilog CPLEX Optimization Studio" läuft.
Dabei bin ich auf die folgende Syntax gekommen:
Code: Alles auswählen
using CP;
int+ number_of_lectures= ...;
int+ number_of_halls= ...;
int+ number_of_slots= ...;
range lectures = 1..number_of_lectures;
range halls = 1..number_of_halls;
range slots = 1..number_of_slots;
int number_of_seats [halls]= ...;
int number_of_students [lectures]= ...;
// range boolean = 0..1;
boolean in_conflict[lectures][lectures]= ...;
var halls hall [lectures];
var slots slot [lectures];
subject to{
forall (i in lectures, j in lectures)
i!= j=> hall[i] != hall[j] || slot[i] != slot[j];
forall ( i in lectures, j in lectures)
in_conflict[i,j] => slot[i] != slot[j];
forall (i in lectures)
number_of_students[i] <= number_of_seats[hall[i]];
};
Code: Alles auswählen
number_of_lectures= 4;
number_of_halls= 6;
number_of_slots= 8;
in_conflict= [[0, 0, 0, 0]
[0, 0, 0, 0]
[0, 0, 0, 0]
[0, 0, 0, 0]
];
Ich bekomme bei der Definition von "var" jeweils das gleiche Problem angezeigt --> "syntax error unexpected (identifier), expecting ';'
Ist jemand damit weiter gekommen und hat ein lauffähiges Programm als Beispiel?