资源

10X10 Job Shop调度问题(clp11)

/***************************************************************//*                                                             *//*S A S S A M P L E L I B R A R Y*//*                                                             *//*姓名:clp11*//*标题:10X10 Job Shop调度问题(clp11)*//*产品:或*//*系统:所有*//*关键字:或*//*程序:CLP、GANTT、SQL*//*数据:*//*                                                             *//*支持:更新:*//*参考:*//*MISC:CLP程序章节中的示例11*//*约束编程书*//*                                                             *//***************************************************************//*作业规范*/原始数据(下降=i mid);do i=1到10;输入mid_DURATION_@;_RESOURCE_=压缩('M'||put(mid,best.));产出;结束;数据线;2  44  3   5  5  58  4  97  0   9  7  84  8  77  9  96  1  58  6  894  15  7  31  1  87  8  57  0  77  3  85  2  81  5  39  9  73  6  219  82  6  22  4  10  3  70  1  49  0  40  8  34  2  48  7  80  5  711  91  2  17  7  62  5  75  8  47  4  11  3   7  6  72  9  35  0  556  71  1  90  3  75  0  64  2  94  8  15  4  12  7  67  9  20  5  507  70  5  93  8  77  2  29  4  58  6  93  3  68  1  57  9   7  0  526  87  1  63  4  26  5   6  2  82  3  27  7  56  8  48  9  36  0  950  36  5  15  8  41  9  78  3  76  6  84  4  30  7  76  2  36  1   85  88  2  81  3  13  6  82  4  54  7  13  8  29  9  40  1  78  0  759  88  4  54  6  64  7  32  0  52  2   6  8  54  5  82  3   6  1  26;/*创建“活动”数据集*/数据actdata(drop=i j);格式_ACTIVITY_$8_成功者_$8。;设置原始;_数量_=1;i=模量(n-1,10)+1;j=整数((_n_-1)/10)+1;_ACTIVITY_=压缩('J'||put(J,best.)||'P'||put(i,best..));作业=j;任务=i;如果i LT 10,则_SUCCESSOR_=压缩('J'||put(J,best.)||'P'|| put((i+1),best.));其他的_SUCCESSOR_='';产出;运行;/*调用PROC CLP以查找资源不受约束的计划*/proc-clp域=[0842]actdata=实际数据(drop=资源数量)schedout=sched_jobshop_un显示进度;计划完成=842;运行;/***************************************************************//*为图形输出定义实用程序宏*//***************************************************************//*%colorIdex创建资源模式颜色映射*//*%fnLegend使用脚注根据映射添加图例*//*%setPatterns根据映射执行模式语句*/%宏colorIdex(res_var=,proj=,palette=,out=);proc-sql;创建表格输出为(&O)从&proj;中选择distinct(&resvar);退出;数据输出;出发;删除名称tr颜色ct;格式颜色$10。;保留模式1;保留color_ct 1;名称tr=小写(strip(&res_var));如果name_tr eq'n/a'或name_tr eq'',则color='red';否则;color=扫描(&palette,color_ct);color_ct=color_ct+1;结束;产出;_模式=模式+1;运行;%修补colorIdex;/*宏%fnLegend使用脚注添加图例*//*职务*//*                                                                       *//*颜色条11文本。。。颜色条1n文本*//*颜色条m1文本。。。颜色条mn文本*/%宏fnLegend(tfact=1.75,h=10,xStart=5,rhs=100,nCol=,nRow=,title=“使用的资源”,map=,font=“Albany AMT”,var=_Resource_);%设rH=%sysevalf(&h/(&nRow+2));/*行高*/%让cW=%sysevalf((&rhs-2*&xStart)/&nCol);/*列宽*/%let rowsH=%sysevalf(&rH*&nRow);/*所有图例行的高度*/%设barH=%sysevalf(&rH*0.35);/*图例高度(彩色条)*/%让rTextH=%sysevalf(&barH*&tfact);/*图例行中的文字高度*/%let tiTextH=%sysevalf(&rTextH*1.2);/*标题行中的文本高度*/脚注;数据_全部_;调用执行('footnote1 f='||“&font”||'j=c h='||put(&tiTextH,最佳)||'pct'||'“'||&title||'”;');调用执行('footnote2 f='||“&font”||'h='||put(&rH,best.)||'pt“”;');运行;数据_全部_;设置&map end=完成;保留计数0;idxRow=int(计数/&nCol);idxCol=计数-idxRow*&nCol;x=&xStart+idxCol*&cW;y=&rowsH-idxRow*&rH;_fnlStr_=带材(&var);如果_fnlStr_ eq'',则_fnlStr_='N/A';如果计数等于0,则调用执行('footnote3 h='||put(&rowsH,best.)||'pct“”');如果小写(条带(颜色))等于“红色”,则调用执行(catx('','f=',“&font”,'h=',&barH,'ct','m=(',x,',',y,')pct','c=',颜色,'方框=1 bs=0 pct“”');其他的调用执行(catx('','f=',“&font”,'h=',&barH,'ct','m=(',x,',',y,')pct','c=',color,'bc=',颜色,'方框=1 bs=0 pct“”');调用执行(catx('','f=',“&font”,'h=',&rTextH,'ct','m=(+0.5,',y,')pct','c=黑色')||'“'||_fnlStr_||'”');计数=计数+1;如果完成,则调用execute(';');运行;%修正fnLegend;%宏setPatterns(map);数据_全部_;集合↦cstr=小写(条带(颜色));如果cstr eq为“红色”,则调用execute('pattern'|strip(put(_pattern,best.))||'v=e color='||cstr||'重复=1;');其他的调用execute('pattern'|strip(put(_pattern,best.))||'v=s color='||cstr||'重复=1;');运行;%修补setPatterns;/***************************************************************//*结束宏定义*//***************************************************************//*添加机器、图案和分段*/%let_palette='magenta蓝-黄-橙-青-棕-黑-灰-绿-紫';%colorIdex(res_var=_resource_,proj=actdata,palette=&_palette,输出=res_col_patn);proc-sql;将表schedgantt_jobshop_un创建为选择a.*、b.resource_、b.pattern、c.job、c.task作为segmt_no来自sched_jobshop un a、rescl_patn b、actdata c其中a.activity=c._activity_和b.resource_=c._resource_;退出;/*绘制甘特图*/%setPatterns(res_col_patn);title1 j=c h=5pct“10X10 Job Shop调度问题”;title2 j=c h=3pct“无约束计划”;%fnLegend(xStart=10,rhs=108,h=16,map=res_col_ptan,title='所需机器',nCol=5,nRow=2,var=_resource_);goptions vpos=30;proc-gantt数据=sched_gant_jobshop_un;图表/pcompress(压缩)诺霍布努姆诺列根id页面增量=60比例=0.2介于=4之间高度=1.8参考=20 617再贴标签s_start=开始s_finish=完成;id工作;运行;/*调用PROC CLP以查找资源受限的计划*/proc-clp域=[0842]actdata=实际数据schedout=调度作业点dpr=50重新启动=150显示进度;计划完成=842 edgefinder nf=1 nl=1;运行;/*添加机器、图案和分段*/proc-sql;将表schedgantt_jobshop创建为选择a.*、b.resource_、b.pattern、c.job、c.task作为segmt_no来自schedjobshop a、rescolpatn b、actdata c其中a.activity=c._activity_和b.resource_=c._resource_;退出;/*绘制甘特图*/title1 j=c h=5pct“10X10 Job Shop调度问题”;title2 j=c h=3pct“受限时间表”;%fnLegend(xStart=10,rhs=108,h=16,map=res_col_ptan,title='所需机器',nCol=5,nRow=2,var=_resource_);goptions vpos=30;proc-gantt数据=sched_gant_jobshop(obs=100);图表/pcompress(压缩)诺霍布努姆诺列根id页面增量=60刻度=0.15介于=4之间高度=1.8参考=842再贴标签s_start=开始s_finish=完成;id工作;跑步;goptions重置=全部;