Optimization 具有优化方法的群指派问题

Optimization 具有优化方法的群指派问题,optimization,cplex,ampl,lindo,Optimization,Cplex,Ampl,Lindo,有一家公司组织了一个研讨会,60名学员将参加。该公司计划将学员分成10组,每组6名学员。事先要求每个学员选择5名他们愿意合作的其他学员。这五个元素的权重相等。 问题是我们如何将参与者分配到小组中,以便优化总体满意度 让我给您举一个小例子,说明OPL中CPLEX中的CPO: //There’s a company organising a seminar, where 60 trainees will attend. //The company plans to divide the parti

有一家公司组织了一个研讨会,60名学员将参加。该公司计划将学员分成10组,每组6名学员。事先要求每个学员选择5名他们愿意合作的其他学员。这五个元素的权重相等。
问题是我们如何将参与者分配到小组中,以便优化总体满意度

让我给您举一个小例子,说明OPL中CPLEX中的CPO:

//There’s a company organising a seminar, where 60 trainees will attend. 
//The company plans to divide the participants into 10 groups, each of 6 trainees. 
//Each of the trainees was asked beforehand to choose 5 other trainees they would like to work with. 
//And each of the five is weighted equally. 
//The problem is how we can assign the participants into groups so that the total satisfaction could to optimised. 

using CP;

execute
{
cp.param.timelimit=20;
}

int nbTrainees=60;
int nbGroups=10;
int nbWishes=5;
int sizeGroup=nbTrainees div nbGroups;



range trainees=1..nbTrainees;
range groups=1..nbGroups;
range likes=1..nbWishes;

// let us start with the nbWishes next trainees
int wishes[t in trainees][w in likes]=(t+w-1) mod nbTrainees+1;

assert forall(t in trainees,w in likes) wishes[t][w] in trainees;
assert forall(t in trainees,w in likes) wishes[t][w] != t;

// a gievn trainee belongs to a given group ?
dvar boolean x[trainees][groups];

dvar int satisfaction;

maximize satisfaction;
subject to
{

// trainees belong to one and only one group
forall(t in trainees) sum(g in groups) x[t][g]==1;

// group size
forall(g in groups) sum(t in trainees) x[t][g]==sizeGroup;

// satisfaction formula
satisfaction==sum(t in trainees,w in likes,g in groups) ((x[t][g]*x[wishes[t][w]][g]));

}

{int} team[g in groups]={ i | i in trainees : x[i][g]==1};

execute
{
writeln(team);
}

定义总满意度如果一名受训者被指派与另一名他/她喜欢(更喜欢)的人一起工作,那么满意度加1分。如果没有,那么是0。到目前为止,你尝试了什么?你能再解释一下为什么这里是模运算吗?int愿望[t in培训生][w in likes]=(t+w-1)mod NB培训生+1;谢谢。这帮助我不费吹灰之力就输入了价值观:1:2,3,4,5,6的朋友和60:1,2,3,4,5的朋友,我应该如何在优化函数中解释x[t][g]*x[wisks[t][w][g]?我对后面的部分感到很困惑。如果两个因素都是1,则x[t][g]*x[wishes[t][w][g]是1,这意味着学员t在g组,而他的朋友wishes[t][w]也在g组