Hi,
I'am doing a project consisting in finding a repartition of students in classes and a timetable. My problem is that though I write a cardinality constraint saying that all students must be placed in a class :
c2.add(IloRange(env, IloInfinity, N_VG_st));
c2.add(IloRange(env, N_VG_st , IloInfinity));
c2_size++;
c2_size++;
for (int i=0 ; i<N_MC_VG; i++) //We sum over all students in all classes
{
for (int j=0 ; j<N_VG_st; j++)
{
c2c2_size2.setCoef(y_iji*N_VG_st+j, 1.0);
}
}
for (int i=0 ; i<N_MC_VG; i++) //We sum over all students in all classes
{
for (int j=0 ; j<N_VG_st; j++)
{
c2c2_size1.setCoef(y_iji*N_VG_st+j, 1.0);
}
}
Playing with constraints that have strictly nothing to do with the total number of students I sometimes loose 1 or 2 of them... Could anyone tell me what can be the problem in such situation please? The constraints I play with deals the average level in French, German an Maths for example :
//French Average
for (int i=0 ; i< N_MC_VG ; i++)
{
c2.add(IloRange(env, IloInfinity, 0.0)); //Lower bound for the french average in a class
c2_size++;
for (int j=0; j< N_VG_st ; j++)
{
c2c2_size1.setCoef(y_iji*N_VG_st +j,1.58VG_Fr[j]);
}
}
Topic

Re: Repartition and Timetabling Problem
20121217T11:52:38ZThis is the accepted answer. This is the accepted answer.Hello,
You do not mention which engine you are using to solve your problem. Is it CPLEX or CP Optimizer?
If it is CPLEX, I suggest you post your message on the CPLEX Optimizer forum (http://www.ibm.com/developerworks/forums/forum.jspa?forumID=2059).
This being said, if I understand well, you say that in some cases, the solution found by the engine is such that some students are not assigned any class. It probably means that you are missing something in the formulation of the constraint "all students must be placed in a class".
Do you say somewhere that a given student cannot be placed in more than one class ? Could it be that some students are not allocated any class because some other students are allocated several classes ?
Philippe 
Re: Repartition and Timetabling Problem
20121217T13:27:45ZThis is the accepted answer. This is the accepted answer. SystemAdmin
 20121217T11:52:38Z
Hello,
You do not mention which engine you are using to solve your problem. Is it CPLEX or CP Optimizer?
If it is CPLEX, I suggest you post your message on the CPLEX Optimizer forum (http://www.ibm.com/developerworks/forums/forum.jspa?forumID=2059).
This being said, if I understand well, you say that in some cases, the solution found by the engine is such that some students are not assigned any class. It probably means that you are missing something in the formulation of the constraint "all students must be placed in a class".
Do you say somewhere that a given student cannot be placed in more than one class ? Could it be that some students are not allocated any class because some other students are allocated several classes ?
Philippe
Thanks a lot for your answer. I use CPLEX for solving this problem (thanks for the link!).
Otherwise, I indeed say that a student can be placed in at most one class and that the number total number of students placed in classes should be equal to the total number of students...
I never have a student which is placed in several classes so the problem is unfortunately not there :(.