Hello,
changeovers could be modeled using functions
typeOfNext (or symmetrically by typOfPrev).
Here is the doc for OPL:
https://www.ibm.com/support/knowledgecenter/SSSA5P_12.10.0/ilog.odms.ide.help/OPL_Studio/opllang_quickref/topics/tlr_oplsch_typeOfNext.htmlAnd general documentation that describes the function mathematically (scroll down the page):
https://www.ibm.com/support/knowledgecenter/SSSA5P_12.10.0/ilog.odms.cpo.help/refcppcpoptimizer/html/interval_sequence.htmlSequence variable allows to define "types" for interval variables it consists of. In your case template is the type. Using
typeOfNext(seq, itv) it is possible to test whether the interval scheduled right after
itv on sequence var
seq has the same type or not. If it is not the same then it is a changeover.
There are two details that needs to be handled though. First, types must be integers and templates are strings. So we need to translate strings into integer ids, for example this way:
int TemplateIds[Templates];
execute {
var id=0;
for (t in Templates)
TemplateIds[t] = id++;
}Then we can extend
usageTool by types:
dvar sequence usageTool[t in Tools] in all (tm in Tool_Template_Map: t==tm.Tool)JobToolTemplate[tm]
types all(tm in Tool_Template_Map: t==tm.Tool) TemplateIds[tm.Templates];
The second detail is that integer variables are optional. Naturally, absent interval doesn't have a "next" on the sequence. Similarly, an interval that is scheduled last on the sequence also doesn't have a next. Function
typeOfNext has two additional arguments that specify what to return in those cases. We don't want to count those cases as changeovers so we want
typeOfNext to return the current template id:
dexpr int nbChangeovers = sum(tm in Tool_Template_Map) (typeOfNext(usageTool[tm.Tool], JobToolTemplate[tm], TemplateIds[tm.Templates], TemplateIds[tm.Templates]) != TemplateIds[tm.Templates]);
Now you can use the
nbChangeovers in your objective in any way you like. For example, you may use
staticLex to minimize the delay first and then number of changeovers:
minimize staticLex(Delay, nbChangeovers);
Best regards, Petr
------------------------------
Petr Vilím
IBM
------------------------------
Original Message:
Sent: Mon July 13, 2020 09:49 AM
From: HUI ZHAO
Subject: how to model changeover minimization in CP
Hi Everyone,
I have a question about how to model the changeover minimization in CP (Constraint Programming).
Problem statement:
I have a number of jobs to be processed on a number of tools with templates. Each job requires a tool and a template to work together. A job may have multiple available tools and/or templates.The jobs have different priority and processing time.
Objective:
(1) minimize the total delay of all jobs with respect to the priority,
(2) minimize the total number of template changeovers on all tools.
I already have all the constraints and the total delay minimization, but I do not know how to model the template changeover on tools. Can you help? Please see my simple model and data files in the attachment.
Thank you very much.
------------------------------
HUI ZHAO
------------------------------
#DecisionOptimization