Decision Optimization

 View Only
  • 1.  Tuple set issue

    Posted Thu April 30, 2020 10:28 AM
    Dear community team,

    I'm trying to solve an assignment scheduling problem. I define the problem set as follows:
    setof(int) workstation = asSet(1..5);
    setof(int) tasks = asSet(1..9);
    setof(int) workers = asSet(1..6);​
    Now, I need to create a link to define relations between the tasks. Therefore, I try using the tuple concept to do that. 
    tuple link{
       {int} task;
    };
    {link} relations[tasks]=
    [{<{1}>}, {<{1}>}, {<{1,2}>}, {<{1,2,3}>}, {<{4,7}>}, {<{6}>}, {<{6}>}, {<{5}>}, {<{8}>}];​
    Where "{<{1,2,3}>}" shows the precedence relationship to execute task 4.
    Also, I have constraints in the following form.
    \begin{equation}\sum_{h \in H} \sum_{i \in I} i . x_{i h j} \leq \sum_{h \in H} \sum_{i \in I} i . x_{i h t} \forall j, t \in N, j<t\end{equation}​

    Where index (i) belong to the workstation, (h) to the workers and (j,t) to the tasks. 
    My question is, how can I define the tuple set (relations) into the above constraint?  



    ------------------------------
    Best regards
    Abbas
    ------------------------------

    #DecisionOptimization


  • 2.  RE: Tuple set issue

    Posted Thu April 30, 2020 10:37 AM
    I am not sure I understand how exactly you want to add those sets into the constraints. Do you mean something like
    forall(t in tasks) ...
    and then
    sum(j in relations[t].task) ...
    ? Or do you mean something else? If you mean something else then maybe you can give a short example of the constraint that should be generated for the first task, lets say.

    ------------------------------
    Daniel Junglas
    ------------------------------



  • 3.  RE: Tuple set issue

    Posted Thu April 30, 2020 11:21 AM
    Dear Daniel,

    Many thanks for your response.
    Please let's say, I need to define j and t indices over the tasks set on the outer loop. 
      e4: forall(j,t in tasks: j<t)
      	sum(h in workers, i in workstation) i*x[i,h,j] <= 
      		sum(h in workers, i in workstation) i*x[i,h,t];​
    But, this constraint should determine refashions between tasks and whose precedence. this is why I defined such a tuple set. Also, I have tried to use the nested set as follows:
    setof(int) operations[tasks] = [{1}, {1}, {1,2}, {1,2,3}, {4,7}, {6}, {6}, {5}, {8}];​
     Instead of using tuple and define the constraint in the form:
      e4: forall(j,t in tasks, jj in operations[j], tt in operations[j]: j<t)
      	sum(h in workers, i in workstation) i*x[i,h,jj] <= 
      		sum(h in workers, i in workstation) i*x[i,h,tt];​
    But, when the model is solved, the results are not correct. 
    I was wondering if, where am I wrong and how can I fix this issue?

    ------------------------------
    Abbas Omidi
    ------------------------------



  • 4.  RE: Tuple set issue

    Posted Sat May 02, 2020 02:33 PM
    hi

    {int} tasks=asSet(1..9);
    {int} workstation={1,2};
    {int} workers={1,2};
    setof(int) operations[tasks]=[{1},{1}, {1,2}, {1,2,3}, {4,7}, {6}, {6}, {5}, {8}];
    
    
    
    dvar boolean x[workers,tasks,tasks];
    
    subject to
    {
      e4: forall(j,t in tasks: j in operations[t])
    sum(h in workers, i in workstation)i*x[i,h,j] <= 
    sum(h in workers,i in workstation)i*x[i,h,t];}



    ------------------------------
    ALEX FLEISCHER
    ------------------------------