Originally posted by: Adriano199
Hi,
Have been working on this (during break times). Has suggested i have taken a look on the examples. And came up with the following code. However it returns the following.
----------------------------------------------------------------------------
! Conflict refining - 28 constraints
! FailLimit = 10 000
! ----------------------------------------------------------------------------
! Iteration Number of constraints
* 1 28
* 2 14
* 3 7
* 4 4
* 5 2
* 6 1
* 7 1
* 8 1
! Conflict refining terminated
! ----------------------------------------------------------------------------
! Conflict status : Terminated normally, conflict found
! Conflict size : 1 constraint
! Number of iterations : 8
! Total memory usage : 626,0 kB
! Conflict computation time : 0,00s
I cant find where is the problem. Any ideas?
Thanks for the help.
Regards
using CP;
tuple RequestDat{
int woid;
};
tuple TaskDat{
int woid;
int taskid;
int ptime;
};
tuple ResourceDat{
string name;
string skill;
};
tuple STResourceDat{
string name;
int quantity;
};
{RequestDat} requests = ...;
{TaskDat} tasks = ...;
{ResourceDat} hresources = ...;
{STResourceDat} sresources = ...;
tuple Dependency{
int woida;
int woidb;
};
tuple Requirement{
int woid;
int taskid;
string hresource;
string sresource;
int quantity;
};
tuple Operation{
RequestDat request;
TaskDat task;
};
tuple Allocation {
Operation dmd;
Requirement req;
ResourceDat resource;
STResourceDat stresource;
};
// {Recipe} recipes = ...;
{Dependency} wodependencies = ...;
{Requirement} requirements = ...;
{Operation} operations = {<r, m> | r in requests , m in tasks:
r.woid == m.woid };
{Allocation} allocs = { < o, m ,r ,s> | o in operations, m in requirements, r in hresources, s in sresources :
o.task.woid == m.woid && r.skill == m.hresource && s.name == m.sresource};
dvar interval tirequests[requests];
dvar interval tiops[o in operations] size o.task.ptime;
dvar interval tiallocs[allocs] optional;
dvar interval ttask[tasks];
dvar sequence workers[r in hresources] in all(a in allocs: a.resource == r) tiallocs[a];
execute {
cp.param.FailLimit = 10000;
}
minimize sum(t in tasks) endOf(ttask[t]);
subject to {
forall(r in requests) {
span(tirequests[r], all(o in operations : o.request == r) tiops[o]);
forall (o in operations : o.request == r) {
forall (rc in requirements : rc.woid == o.task.woid) {
alternative(tiops[o], all(a in allocs : a.req == rc && a.dmd == o) tiallocs[a]);
}
forall(tc in wodependencies: tc.woida == r.woid && r.woid == o.task.woid) {
forall(o2 in operations : o2.request == r && tc.woidb == r.woid && r.woid == o.task.woid) {
endBeforeStart(tiops[o], tiops[o2], 0);
}
}
}
}
forall(r in hresources) {
noOverlap(workers[r]);
}
};
And the data file:
/*********************************************
* OPL 12.5.1.0 Data
* Author: Adriano-PC
* Creation Date: 28 de Jul de 2014 at 14:45:32
*********************************************/
hresources = {
// Workname--skill
<"ab1",G07>,
<"ab2",G02>,
<"ab3",S01>,
<"ab4",G03>,
<"ab5",T26>,
<"ab6",G00>,
};
sresources={
// SresourceID (Station Ressource Shared Between tasks)----Quantity
<R3,1>,
<R2,1>,
<O3,1>,
<V4,1>,
<S5,1>,
<T2,1>,
<AS7,1>,
};
requests = {
// WOID
<111001>,
<111002>,
<111003>,
<123104>,
<123105>,
<123206>,
};
tasks = {
// WOID-- taskID--ptime
<111001,111,100>,
<111002,101,112>,
<111003,102,182>,
<111003,123,172>,
<123104,131,114>,
<123105,128,125>,
<123206,122,216>,
};
requirements = {
//WOID--- taskID--skill(Human)--Sresources-Quantity
<111001,111,G07,R3,1>,
<111001,111,G07,R2,1>,
<111002,101,G02,R2,1>,
<111002,101,G02,O2,1>,
<111003,102,S01,V4,1>,
<111003,102,S01,S5,1>,
<111003,123,G03,S5,1>,
<123104,131,T26,AS7,1>,
<123104,131,T26,T2,1>,
<123105,128,G00,S5,1>,
<123105,128,G00,T2,1>,
<123206,122,G00,R3,1>,
<123206,122,G00,R2,1>,
};
wodependencies={
// WOID--WOID
<111001,123104>,
<111002,123206>,
<123206,111003>,
};
#DecisionOptimization#OPLusingCPOptimizer