Originally posted by: giannil
Hello,
We are trying to make an optimal schedule and therefore we have a model that first make couples of artist that should play together.
We can make couples of 2, 3, etc. artist, that isn't the problem.
After this we have a model that uses this solution to make the schedule. In the last model we try to make an optimal sequence of the couples of artist.
There we found a problem. The model works fine for couples of 2 and gives us an optimal solution. But when we have couples of 3 it won't give any values.
In particular, this code works when aantalPodia is 2. When it is 3 or more it doesn't work.
Is there anything wrong with are code?
This is our code :
int AantalFG = ...;
int AantalPodia = ...;
int AantalTijdsblokken = ...;
int AantalArtiesten = AantalPodia*AantalTijdsblokken;
int X[0 .. AantalArtiesten-1][0 .. AantalArtiesten-1] = ...; //in vorige stap is bepaald welke optredens samenvallen
int Voorkeuren [0 .. AantalFG-1][0 .. AantalArtiesten-1] = ...;
//Conflicten is een matrix waarin op plaats ij het aantal festivalgangers staan die zowel optreden i als optreden j willen bijwonen
int Conflicten[a in 0 .. AantalArtiesten-1][b in 0 .. AantalArtiesten-1]= sum(c in 0 .. AantalFG-1) Voorkeuren[c][a]*Voorkeuren[c][b];
//Decision Variables
//Oijk = 1, als optreden i plaatsvind op podium j tijdens tijdslot k
dvar int O[0 .. AantalArtiesten-1][0 .. AantalPodia-1][0 .. AantalTijdsblokken-1] in 0 .. 1;
//Zij = 1, als optreden j volgt op i op een verschillend podium
dvar int Z[0 .. AantalArtiesten-1][0 .. AantalArtiesten-1] in 0 .. 1;
//Objective Function
minimize sum(i,j in 0 .. AantalArtiesten-1)Conflicten[i][j]*Z[i][j];
//Constraints
subject to{
//Uniciteit
//Elke artiest moet 1 podium en 1 tijdsblok toegewezen krijgen
forall( i in 0 .. AantalArtiesten-1)
sum(j in 0 .. AantalPodia-1, k in 0 .. AantalTijdsblokken-1)O[i][j][k] == 1;
//Er mag maar 1 artiest per podium en per tijdsblok zijn
forall( j in 0 .. AantalPodia-1, k in 0 .. AantalTijdsblokken-1)
sum( i in 0 .. AantalArtiesten-1) O[i][j][k] == 1;
//__________________________________________________________________
//De optredens waarvan bepaald is dat zei in het vorige deel samenvallen, moeten ook effectief in hetzelfde tijdslot vallen
forall(k in 0 .. AantalTijdsblokken-1, i, a in 0 .. AantalArtiesten-1: a > i)
X[i][a]*sum(j in 0 .. AantalPodia-1)O[i][j][k] == X[i][a]*sum(j in 0 .. AantalPodia-1)O[a][j][k];
//De VolgOpVerschillendPodiumVariabele
forall(i,a in 0 .. AantalArtiesten-1: a != i , j,b in 0 .. AantalPodia-1: b!=j, k in 0 .. AantalTijdsblokken-2)
1+Z[i][a] >= O[i][j][k]+O[a][b][k+1];
Thanks!
#DecisionOptimization#MathematicalProgramming-General