Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  noOverlap From 2D conflicts array

    Posted 06/23/14 07:13 PM

    Originally posted by: BPVR_khaled_soradi


    This is my first program. I am trying to simple exam table scheduling problem. i have subjects that i need to schedule. I have the subject conflict table that contains pairs of subjects that should not scheduled at the same time. the program is working except the part of noOverlap over the conflicts array.

    I do not know how to write the "noOverlap" statement.

    Here is the program

    using CP;
    execute{
    }
    
    tuple SubjectInfo{
    key int id;
    string Name;
    int duration;
    };
    
    tuple ConflictInfo{
    int Subj1;
    int Subj2;
    };
    
    {SubjectInfo} Subjects=...;
    {ConflictInfo} SubjectsConflict=...;
    dvar interval SubjectAllocation[s in Subjects] size s.duration;
    dvar sequence p in SubjectAllocation;
    
    minimize max(s in Subjects) endOf(SubjectAllocation[s]);
    subject to {
    //The problem is here.
    forall (i in SubjectsConflict)
    noOverlap(p);
    }
    
    execute {
    }
    

    And this is the sample data file

    //Subjects Data
    Subjects={
    <1,"ARCN101",1>,
    <2,"ARCN102",1>,
    <3,"ARCN103",1>,
    <4,"ARCN104",1>
    };
    
    //Subjects Conflicts. this sample assumes that "ARCN101" 
    //should not scheduled with any other subject
    SubjectsConflict={
    <1,2>,
    <1,3>,
    <1,4>
    };
    

     


    #ConstraintProgramming-General
    #DecisionOptimization


  • 2.  Re: noOverlap From 2D conflicts array

    Posted 06/24/14 09:31 AM

    Originally posted by: ChrisBr


    Hello Khaled,

    You could try something like that:

    dvar sequence p[i in SubjectsConflict] in
        all(s in Subjects : s.id == i.Subj1 || s.id == i.Subj2) SubjectAllocation[s];

    ...
    forall (i in SubjectsConflict)
      noOverlap(p[i]);


    I hope this helps,

    Chris.
     


    #ConstraintProgramming-General
    #DecisionOptimization


  • 3.  Re: noOverlap From 2D conflicts array

    Posted 06/25/14 06:48 AM

    Originally posted by: BPVR_khaled_soradi


    Thank you very much

    it is worked fine


    #ConstraintProgramming-General
    #DecisionOptimization