对于我的硕士论文,我必须为放射学开发大量的尺寸模型。我用opl实现它,我对opl或编程一般都是新手。因此,经过大量的编程时间并试图让模型运行,它就会运行。但现在它告诉我0或negativ批次的解决方案。我将我的模型与我在互联网上找到的其他模型进行了比较,但我找不到任何错误。我唯一想到的是dvar boolean,我需要在MRT机器上设置检查类型。我是否必须告诉程序dvar必须等于1,当有一个检测典型的另一个时?如果是的话,我怎么能这样做,如果没有,有人会告诉我模型中有什么问题吗?我甚至不知道我是否必须使用CP或MIP ......
该模型是一个动态模型,有9个检验[i]捆绑批量大小,3个MRT机器[m]和10个周期[t]。
//Sets
{string} ExaminationTypes = ...;
{string} Machines = ...;
{int} Periods = {1,2,3,4,5,6,7,8,9,10};
{int} PreviousPeriodIncluded = {0,1,2,3,4,5,6,7,8,9,10};
//Parameters
float SetupCosts[Machines][Periods]=...;
float ProductionCosts[ExaminationTypes][Machines][Periods]=...;
float OpportunityCosts[Periods]=...; //when there are left overs of the prior period
float ScanDuration[ExaminationTypes]=...;
float Capacity[Machines][Periods]= ...;
int Demand[ExaminationTypes][Periods]= ...;
// constants
float Alpha = 0.75;
float SetupBeginTime = 9.50;
float SetupEndTime = 4.50;
int BigNumber = 999999;
float SetUpDuration = 2.00;
float CleaningDuration = 6.00;
一开始,在第0期概述了积压工作时出现了另一个问题。这就是为什么我建立了一组新的期间。但是现在积压量的解决方案已经开始于0期,应该避免。
//desicion variables
dvar boolean IsSetupNecessary[ExaminationTypes][Machines][Periods];
dvar boolean IsCapacityAvailable[Machines][Periods];
dvar int+ LotSize[ExaminationTypes][Machines][Periods];
dvar int+ BackLogs[ExaminationTypes][PreviousPeriodIncluded];
//objective function
dexpr float K = sum( i in ExaminationTypes , m in Machines, t in Periods )
(
SetupCosts[m][t] * IsSetupNecessary[i][m][t] +
ProductionCosts[i][m][t] * LotSize[i][m][t] +
OpportunityCosts[t] * BackLogs[i][t]
);
minimize K;
//contraints
subject to {
forall( t in Periods )
ctMeetingCapacity:
(
( sum ( i in ExaminationTypes, m in Machines )
(ScanDuration[i]*LotSize[i][m][t] + SetUpDuration*IsSetupNecessary[i][m][t] + CleaningDuration*LotSize[i][m][t])
)
<=
( Alpha * sum (m in Machines)
(
IsCapacityAvailable[m][t] *
1*
(Capacity[m][t] - (2 * SetupBeginTime + 2 * SetupEndTime))
)
)
);
forall( i in ExaminationTypes, m in Machines, t in Periods )
ctProduction:
(
LotSize[i][m][t] <= BigNumber * IsSetupNecessary[i][m][t]
);
forall( i in ExaminationTypes, m in Machines, t in Periods )
ctLogical:
(
IsSetupNecessary[i][m][t] <= IsCapacityAvailable[m][t]
);
forall( i in ExaminationTypes)
ctZeroBackLogWhenT=1:
(
// re-check
BackLogs[i][0] == 0
);
forall( i in ExaminationTypes, t in Periods )
ctMeetingDemand:
(
( sum ( m in Machines )
LotSize[i][m][t]
)
<=
( Demand[i][t] + BackLogs[i][t-1] )
);
forall( i in ExaminationTypes, t in Periods )
ctCalculationBackLog:
(
Demand[i][t] - ( sum ( m in Machines )LotSize[i][m][t]) - BackLogs[i][t-1] == BackLogs[i][t]
);
forall( i in ExaminationTypes, t in Periods )
ctBigNumber:
(
BigNumber >= Demand[i][t]
);
}
execute DISPLAY_RESULT{
//writeln("Gesamtkosten = ",K);
}
很抱歉这个漫长的表述。如果有人知道该怎么做,我会很高兴的!
答案 0 :(得分:0)
现在我想你已经毕业了,所以这不再相关了,但是对于将来=如果你想让别人重现错误,你必须提供一个可运行的东西:
float SetupCosts[Machines][Periods]=...;
float ProductionCosts[ExaminationTypes][Machines][Periods]=...;
float OpportunityCosts[Periods]=...; //when there are left overs of the prior period
float ScanDuration[ExaminationTypes]=...;
float Capacity[Machines][Periods]= ...;
int Demand[ExaminationTypes][Periods]= ...;
以上没有这些数据,例如您在目标中使用SetupCost ...