我正在解决Cplex中的医院员工日程安排问题,我是Cplex的新手。
但Cplex无法配置决策html" target="_blank">变量的答案。
我想可能是我的模型设计问题。
这是一个很长的模型。
如果我能得到帮助,我将不胜感激。
模型
--设置:
{string}E=...;//经验等级集(高级,新秀)
{字符串}I=…;//全套医生
{string}为=//具有S级经验的一组医生
{字符串}Ir=//具有R级经验的一组医生
{字符串}K=//班次类型(o
{字符串}A1=//轮班工作(白天、晚上、晚上)
{string}A2=...;//一组shift t work(白天,晚上,晚上1,晚上2)
--参数
int D=...;
范围日=1... D;//规划范围
int Co[Is]=//具有高级经验的医生i的雇佣成本
int Ct[红外]=//具有新手经验的医生i的招聘成本
int北大=//医生执行轮班o的最长天数
int Pkd=//医生轮班的最短天数
int Pkuh=//医生执行t班的最长天数
int Pkdh=//医生执行t班的最短天数
int s=...;//最大限度。连续工作日
int dosd=//“高级”医生的轮班工作需求
int剂量=//轮班o“高级”医生的夜间工作需求
int dos n=...;//“高级”医生夜班需求
int dord=//轮班“新手”医生的日间工作需求
int dore=//轮班o“新手”医生的夜间工作需求
int dorn=//“新手”医生夜班需求
int dtsd=...;//“高级”医生的日间工作需求
int dtse=//t班“高级”医师夜间工作需求
int dtsn1=//t班夜间1“高级”医生工作需求
int dtsn2=//t班夜间2“高级”医生工作需求
int dtrd=...;//“菜鸟”医生的日间工作需求
int dtre=...;//shift t晚间工作对“菜鸟”医生的需求
int dtrn1=...;//shift t night 1对“菜鸟”医生的工作需求
int dtrn2=//t班夜间2“新手”医生工作需求
--二进制十进制变量
dvar int x2[I][Day][A2]in 0...1;//1,如果高级班次t其中一项工作
dvar int y1[I][Day][A1]in 0...1;//1,如果菜鸟换班o其中一项工作
0中的dvar int y2[I][Day][A2]。。1; //1,如果新手轮班
--决策变量的表达式
dexpr float cost =sum(i in Is, d in Day, a in A1)Co[i]*x1[i][d][a]
+ sum(i in Is, d in Day, a in A2)Co[i]*x2[i][d][a]
+ sum(i in Ir, d in Day, a in A1)Ct[i]*y1[i][d][a]
+ sum(i in Ir, d in Day, a in A2)Ct[i]*y2[i][d][a] ;
--目标函数
降低成本;
--约束条件
subject to
{
forall(d in Day, Day in A1)
{
sum(i in Is) x1[i, d ,"Day"] == dosd; //Daily demand:Senior+shift o+day work
}
forall(d in Day, Evening in A1)
{
sum(i in Is ) x1[i, d, "Evening"] == dose; //Daily demand:Senior+shift o+evening work
}
forall(d in Day, Night in A1)
{
sum(i in Is ) x1[i, d, "Night"] == dosn; //Daily demand:Senior+shift o+night work
}
forall(d in Day, Day in A2)
{
sum(i in Is) x2[i, d, "Day"] == dtsd; //Daily demand:Senior+ shift t +day work
}
forall(d in Day, Evening in A2)
{
sum(i in Is) x2[i, d, "Evening"] == dtse; //Daily demand:Senior+shift t+evening work
}
forall(d in Day, Night1 in A2)
{
sum(i in Is) x2[i, d, "Night1"] == dtsn1; //Daily demand:Senior+shift t+night1 work
}
forall(d in Day, Night2 in A2)
{
sum(i in Is) x2[i, d, "Night2"] == dtsn2; //Daily demand:Senior+shift t+night2 work
}
forall(d in Day, Day in A1)
{
sum(i in Ir) y1[i, d, "Day"] == dord; //Daily demand:Rookie+shift o+day work
}
forall(d in Day, Evening in A1)
{
sum(i in Ir) y1[i, d, "Evening"] == dore; //Daily demand:Rookie+shift o+evening work
}
forall(d in Day, Night in A1)
{
sum(i in Ir) y1[i, d, "Night"] == dorn; //Daily demand:Rookie+shift o+night work
}
forall(d in Day, Day in A2)
{
sum(i in Ir) y2[i, d, "Day"] == dtrd; //Daily demand:Rookie+shift t+day work
}
forall(d in Day, Evening in A2)
{
sum(i in Ir) y2[i, d, "Evening"] == dtre; //Daily demand:Rookie+shift t+evening work
}
forall(d in Day, Night1 in A2)
{
sum(i in Ir) y2[i, d, "Night1"] == dtrn1; //Daily demand:Rookier+shift t+night1 work
}
forall(d in Day, Night2 in A2)
{
sum(i in Ir) y2[i, d, "Night2"] == dtrn2; //Daily demand:Rookie+shift t+night2 work
}
forall(i in Is, d in Day:d<D, Evening in A1)
{
x1[i, d, "Evening"]+ x1[i,(d+1), "Day"]<=1; //(Senior)For shift type o,if previous day is evening
work, can't have day work the following day'
}
forall(i in Is, d in Day:d<D, Evening in A2)
{
x2[i, d, "Evening"]+ x2[i,(d+1), "Day"]<=1; //(Senior)For shift type t,if previous day is evening
work, can't have day work the following day'
}
forall(i in Ir, d in Day:d<D, Evening in A1)
{
y1[i, d, "Evening"]+ y1[i,(d+1), "Day"]<=1; //(Rookie)For shift type o,if previous day is evening
work, can't have day work the following day'
}
forall(i in Ir, d in Day:d<D, Evening in A2)
{
y2[i, d, "Evening"]+ y2[i,(d+1), "Day"]<=1; //(Rookie)For shift type t,if previous day is evening
work, can't have day work the following day'
}
forall(i in Is, d in Day:d<D, Night in A1)
{
x1[i, d,"Night"]+ x1[i,(d+1),"Day"]<=1; //(Senior)For shift type o,if previous day is night work,
can't have day work the following day'
}
forall(i in Is, d in Day:d<D, Night1 in A2)
{
x2[i, d,"Night1"]+ x2[i,(d+1),"Day"]<=1; //(Senior)For shift type t,if previous day is night1 work,
can't have day work the following day'
}
forall(i in Is, d in Day:d<D, Night2 in A2)
{
x2[i, d,"Night2"]+ x2[i,(d+1),"Day"]<=1; //(Senior)For shift type t,if previous day is night2 work,
can't have day work the following day'
}
forall(i in Ir, d in Day:d<D, Night in A1)
{
y1[i, d,"Night"]+ y1[i,(d+1),"Day"]<=1; //(Rookie)For shift type o,if previous day is night work,
can't have day work the following day'
}
forall(i in Ir, d in Day:d<D, Night1 in A2)
{
y2[i, d,"Night1"]+ y2[i,(d+1),"Day"]<=1; //(Rookie)For shift type t,if previous day is night1 work,
can't have day work the following day'
}
forall(i in Ir, d in Day:d<D, Night2 in A2)
{
y2[i, d,"Night2"]+ y2[i,(d+1),"Day"]<=1; //(Rookie)For shift type t,if previous day is night2 work,
can't have day work the following day'
}
forall (i in Is, d in Day)
{
sum(a in A1)x1[i,d,a] + sum(a in A2)x2[i,d,a] <=1; //(Senior)each day can only have one work with
one shift
}
forall (i in Ir, d in Day)
{
sum(a in A1)y1[i,d,a] + sum(a in A2)y2[i,d,a] <=1; //(Rookie)each day can only have one work with
one shift
}
forall(i in Is, a in A1)
{
sum(d in Day)x1[i,d,a] <=Pku; //(Senior) can’t have shift type o that more than upper bound. (in
days)
}
forall(i in Ir, a in A1)
{
sum(d in Day)y1[i,d,a] <=Pku; //(Rookie) can’t have shift type o that more than upper bound. (in
days)
}
forall(i in Is, a in A1)
{
sum(d in Day)x1[i,d,a]>=Pkd; //(Senior) can’t have shift type o that less than lower bound. (in
days)
}
forall(i in Ir, a in A1)
{
sum(d in Day)y1[i,d,a]>=Pkd; //(Rookie) can’t have shift type o that less than lower bound. (in
days)
}
forall(i in Is, a in A2)
{
sum(d in Day)x2[i,d,a]<=Pkuh; //(Senior) can’t have shift type t that more than upper bound. (in
days)
}
forall(i in Ir, a in A2)
{
sum(d in Day)y2[i,d,a]<=Pkuh; //(Rookie) can’t have shift type t that more than upper bound. (in
days)
}
forall(i in Is, a in A2)
{
sum(d in Day)x2[i,d,a]>=Pkdh; //(Senior) can’t have shift type t that less than lower bound. (in
days)
}
forall(i in Ir, a in A2)
{
sum(d in Day)y2[i,d,a]>=Pkdh; //(Rookie) can’t have shift type t that less than lower bound. (in
days)
}
forall(i in Is)
{
sum(d in Day:d<=(D-s), a in A1)x1[i,d,a]+sum(d in Day:d<=(D-s), a in A2)x2[i,d,a]<=s; //(Senior)
can’t have consecutive working days (regardless of shift type) that more than upper bound. (in days)
}
forall(i in Ir)
{
sum(d in Day:d<=(D-s), a in A1)y1[i,d,a]+sum(d in Day:d<=(D-s), a in A2)y2[i,d,a]<=s; //(Rookie)
can’t have consecutive working days (regardless of shift type) that more than upper bound. (in days)
}
E={“高级”,“新手”};
I={“A”,“B”,“C”,“D”,“E”,“F”,“G”,“H”,“I”,“J”,“K”,“L”,“M”,“N”,“O”,“P”,“Q”,“R”,“S”,“T”,“W”,“X”,“Y”,“Z”};
is={"A","B","C","D","E","F","G","H"};
Ir={“I”,“J”,“K”,“L”,“M”,“N”,“O”,“P”,“Q”,“R”,“S”,“T”,“W”,“X”,“Y”,“Z”};
K={“o”,“t”};
A1={“白天”、“晚上”、“晚上”};
A2={“白天”、“晚上”、“晚上1”、“晚上2”};
D=7;
Co=[12001150110010501000950900850];
ct=[800,750,750,750,700,700,700,700,700,700,650,650,650,650,650,650];
Pku=10;
pkd=5;
Pkuh=8;
pkdh=4;
s=5;
你的模式可能不可行。如果你给你的约束贴上标签,那么CPLEX会给你一些放松和冲突,这会帮助你理解为什么。我的建议是标记所有约束。
例如,您可以更改
forall(d in Day, Day in A1)
{
sum(i in Is) x1[i, d ,"Day"] == dosd; //Daily demand:Senior+shift o+day work
}
进入
forall(d in Day, Day in A1)
ct1:sum(i in Is) x1[i, d ,"Day"] == dosd; //Daily demand:Senior+shift o+day work
我试图在目标函数中加入变量的乘法。我有一个整数x_t,还有一个二进制变量w_t_1。我想在目标函数中有-1200*w\u t\u 1*x\u t。我怎么做?我在IBM文档中找不到任何东西。
主类:
下面有一个程序,我正在调用getTotalPasserian(pm)方法,但在获取用户输入的值时遇到了问题。 pm=0、cm=0、pi=0、ci=0、ps=0、cs=0,或者当我试着做pm=gettotalposysers(pm=0)时,它可以工作,但没有向用户显示主菜单printmenu.menu();从上面除了system.out.println(“输入来自马耳他的乘客总数:”);首先从方法中
问题内容: 我正在尝试创建类似于JOptionPane的内容,但将从输入中获取多个(3)变量。所以我想我将使用一个具有三个textField的单独的JFrame。我使用了诸如Get和Set之类的访问方法来将变量从一个类获取到另一个类,但是我得到了空指针。我认为我将以错误的方式获取变量,并且很难找到可行的解决方案。 问题答案: 同样,为什么不使用JOptionPane?许多人误解了这些有用的结构,以
我需要的是一种适当的方法,让这个方法获得值。 将这个“sdk.root”放在哪里,以便IntelliJ提取它?在属性文件中还是在bash中?
React函数里打印fetchdata变量,为什么是空值?这个值在useEffect里是有值的,全局变量, const { fetchdata, currentRef } = props const [tdata, settdata] = useState<any>([]) 从父组件里传过来的,可是为什么Select的onChange事件,打印变量全是空数组呢? 自己调试了很久找不到方法。 全部源