Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Constraint Programming .NET

    Posted Wed May 18, 2016 02:49 PM

    Originally posted by: BabakArh


    I code the exact example of, IBM tutorial in C#. the objective value, and start time of interval is wrong. I think the lib dont work for me. it return 20 for obj and 0 for all interval start

     the problem minimize MAKE SPAN for scheduling problem.

    here is my code

    /*
     * Created by SharpDevelop.
     * User: bbka2
     * Date: 05/18/2016
     * Time: 8:54 PM
     * 
     * To change this template use Tools | Options | Coding | Edit Standard Headers.
     */
    using System;
    using System.IO;
    using ILOG.CP;
    using ILOG.Concert;


    namespace test_here
    {
        /// <summary>
        /// Description of CMAX.
        /// </summary>
        public class CMAX
        {
            public IIntExpr makespan;
            public IIntervalVar[] act_;
            public IIntExpr[] end;
            public CP scheduler;
            public IObjective obj;
            public int n_;
            public CMAX()
            {
                initial();
                disp();
            }
            public void initial()
            {
                n_=5;
                scheduler=new CP();
                act_=new IIntervalVar[n_];
                makespan=scheduler.Constant(0,"MakeSpan");
                for (int i = 0; i < n_; i++) {
                    act_[i]=scheduler.IntervalVar(4,"act"+i.ToString());
                    act_[i].EndMax=30;
                    act_[i].EndMin=0;
                    act_[i].StartMax=30;
                    act_[i].StartMin=0;
                    act_[i].LengthMax=4;
                    act_[i].LengthMin=4;
                    Console.WriteLine(act_[i].ToString());
                    makespan=scheduler.Sum(makespan,scheduler.EndOf(act_[i]));
                    Console.WriteLine(makespan.ToString());
                }
                scheduler.NoOverlap(act_);
                scheduler.AddMinimize(makespan);
                scheduler.SetParameter(CP.IntParam.SearchType,CP.ParameterValues.DepthFirst);
            }
            public void disp()
            {
                if (scheduler.Solve()) {
                    //scheduler.Solve();
                    Console.WriteLine("this is th obj {0}",scheduler.ObjValue);
                    for (int i = 0; i < n_; i++) {
                        Console.WriteLine("the act {0}, has start {1}",i,scheduler.GetStart(act_[i]));
                    }
                }
            }
        }
    }

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Constraint Programming .NET

    Posted Wed May 18, 2016 03:14 PM


  • 3.  Re: Constraint Programming .NET

    Posted Wed May 18, 2016 03:15 PM

    Originally posted by: BabakArh


    it is make span for one machine 5 job, all job has 4 as a time. the start time should be 0,4,8,12,16 but it returns 0 to all
     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Constraint Programming .NET

    Posted Wed May 18, 2016 03:52 PM

    Hi,

    So let me give you the OPL version:

    using CP;

    dvar interval act[1..5] in 0..30 size 4;

    dexpr int makespan=max(i in 1..5) endOf(act[i]);

    minimize makespan;
    subject to
    {
    noOverlap(act);

    }

    execute
    {
    writeln("makespan=",makespan);
    writeln("act=",act);
    }

    and that gives

     

    makespan=20
    act= [<1 0 4 4> <1 4 8 4> <1 12 16 4> <1 16 20 4>
         <1 8 12 4>]

    regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Constraint Programming .NET

    Posted Wed May 18, 2016 04:13 PM

    Originally posted by: BabakArh


    i think I wrote sum(p_time) for abject, it could give me 4+8+12+16+20

    and for the start time i get 0 for all.

    is it wrong what I code which gave me 0 for start time?


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Constraint Programming .NET