Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

ILOG New Search Problem

  • 1.  ILOG New Search Problem

    Posted 10/11/11 03:16 PM

    Originally posted by: memo85


    Hello.
    I develop a algorithm using ILOG Cplex. I have written my algorithm code. But I have a problem. When I run the algorithm, ILOG shows only one solution which is not a optimum. It does not shows the other solutions and the algorithm ends. I tried to use "StartNewSearch" Function to solve my problem. However the method is not to be solution. I attach my code file in below. To solve this problem is important for my master thesis improvement. Please help me. thank you very much in advance.
    #ConstraintProgramming-General
    #DecisionOptimization


  • 2.  Re: ILOG New Search Problem

    Posted 10/12/11 04:17 AM

    Originally posted by: SystemAdmin


    Hi,

    Can you post the file containing your model ?

    CP Optimizer stops the search when a solution has been found (in case of a decision problem) or when an optimal solution has been found (in case of an optimization problem) or when a limit has been reached. In you case, you must verify that you have stated an objective function.

    If the problem is that a first solution found is not improved by search then you can try to strengthen your problem by adding redundant constraints that triggers more domain reductions or to add a search phase to improve search capabilities of finding solutions.

    Philippe
    #ConstraintProgramming-General
    #DecisionOptimization


  • 3.  Re: ILOG New Search Problem

    Posted 10/12/11 06:43 AM

    Originally posted by: memo85


    Hi Philippe,

    Thank you very much for your interest. I have posted my code file but it didn't upload. I paste my code below. Thanks.

    OPL 12.2 Model
    using CP;
    int maxmustsay=50;
    int maxistsay=5;
    int gorsay=11;
    //float toppi;
    range gorev = 1..gorsay;
    range istasyon = 1..maxistsay;
    range mustsay=1..maxmustsay;
    int gorsur gorev = 6, 2, 5, 7, 1, 2, 3, 6, 5, 5, 4;
    int oncelikgorevgorev=...;
    //float muistasyon;
    float piistasyonhttp://0..maxmustsayhttp://0..maxmustsay;
    //int vristasyon;
    float Tistasyonmustsay;
    //float Tg;
    //int istsuristasyon;
    //float topsurmustsay;
    float lambdamustsay;

    dvar int+ istnogorev;
    dexpr float objective = lambdamaxmustsay;

    maximize objective;

    subject to
    {
    forall(i in gorev){
    istno[i]<=maxistsay;
    istno[i]>=1;
    }
    istno[1]<=istno[2];
    istno[1]<=istno[3];
    istno[1]<=istno[4];
    istno[1]<=istno[5];
    istno[2]<=istno[6];
    istno[3]<=istno[7];
    istno[4]<=istno[7];
    istno[5]<=istno[7];
    istno[6]<=istno[8];
    istno[7]<=istno[9];
    istno[8]<=istno10;
    istno[9]<=istno11;
    istno10<=istno11;
    }

    main {
    var status = 0;
    thisOplModel.generate();

    var mu = new Array();
    var vr = new Array();
    var istsurmain = new Array();
    var Tg;
    var topsur = new Array();
    var toppi;
    var istnomain = new Array();

    for (var a in thisOplModel.gorev){
    istnomain[a]=thisOplModel.istno[a]
    };

    for (var i in thisOplModel.istasyon){
    for(a in thisOplModel.gorev){
    if (istnomain[a]=i){
    istsurmain[i]=istsurmain[i]+thisOplModel.gorsur[a];
    };

    mu[i]=1/istsurmain[i];
    thisOplModel.pi[i][0][0]=1;
    vr[i]=1;
    };
    };

    for (var k in thisOplModel.mustsay){
    Tg=0;
    for (i in thisOplModel.istasyon){
    for(var j=1; j<=k; j++){
    Tg=+Tg + (j/mu[i])*thisOplModel.pi[i]j-1k-1;
    };
    thisOplModel.T[i][k]=Tg;
    };
    topsur[k]=thisOplModel.T[i][k]*vr[i]
    thisOplModel.lambda[k]=k/topsur[k];

    for (i in thisOplModel.istasyon){
    toppi=0;
    for(j=1; j<=k; j++){
    thisOplModel.pi[i][j][k]=(thisOplModel.lambda[k]/mu[i])*thisOplModel.pi[i]j-1k-1*vr[i];
    toppi=toppi+thisOplModel.pi[i][j][k]
    };
    thisOplModel.pi[i][0][k]=1-toppi;

    };
    };

    var n=0;
    cp.startNewSearch();
    while (cp.next()) {
    n++;

    thisOplModel.postProcess();
    writeln(thisOplModel.objective);
    }

    }
    #ConstraintProgramming-General
    #DecisionOptimization


  • 4.  Re: ILOG New Search Problem

    Posted 10/12/11 10:28 AM

    Originally posted by: SystemAdmin


    Can you try to attach the source as a file ? Some characters are removed from your post. If you can't I will try to recover the source.

    Philippe
    #ConstraintProgramming-General
    #DecisionOptimization


  • 5.  Re: ILOG New Search Problem

    Posted 10/12/11 02:19 PM

    Originally posted by: memo85


    Sorry Philippe,

    I tried to attach my code file but it is not loaded. I try to load again. Thanks

    Memo.
    #ConstraintProgramming-General
    #DecisionOptimization


  • 6.  Re: ILOG New Search Problem

    Posted 10/12/11 03:27 PM

    Originally posted by: memo85


    Philippe, I can't load my code file. Whe I try to attach, the browser shows this error message "Note, attachments are not saved with a message draft.". :( I don't know why this message occurs.
    #ConstraintProgramming-General
    #DecisionOptimization


  • 7.  Re: ILOG New Search Problem

    Posted 10/14/11 03:20 AM

    Originally posted by: memo85


    This is my code file.
    #ConstraintProgramming-General
    #DecisionOptimization


  • 8.  Re: ILOG New Search Problem

    Posted 10/14/11 10:50 AM

    Originally posted by: SystemAdmin


    I think this model runs as expected.
    However you must add a call to endSearch at the end of the main function to see the end of the log.
    cp.startNewSearch();
    while (cp.next()) {
    n++;

    thisOplModel.postProcess();
    writeln(thisOplModel.objective);
    }
    cp.endSearch(); // Addition
    writeln(n," solutions ");

    and now you get the full search log in OPL:

    !
    ! Maximization problem - 11 variables, 35 constraints
    ! Initial process time : 0,00s (0,00s extraction + 0,00s propagation)
    ! . Log search space : 341,0 (before), 25,5 (after)
    ! . Memory usage : 331,4 KB (before), 331,4 KB (after)
    ! Using parallel search with 2 workers.
    !
    ! Best Branches Non-fixed W Branch decision
    * 0 3 0,00s 1 -
    !
    ! Search terminated normally, 1 solution found.
    ! Best objective : 0 (optimal - effective tol. is 1,000000e-009)
    ! Number of branches : 6
    ! Number of fails : 8
    ! Total memory usage : 2,0 MB (1,1 MB CP Optimizer + 0,9 MB Concert)
    ! Time spent in solve : 0,00s (0,00s engine + 0,00s extraction)
    ! Search speed (br. / s) : 600,0
    !

    The log shows that CPO finds only one solution and that it is optimal.

    Regards,

    Philippe
    #ConstraintProgramming-General
    #DecisionOptimization


  • 9.  Re: ILOG New Search Problem

    Posted 10/21/11 06:54 PM

    Originally posted by: memo85


    Thank you very much Philippe. If I have another question, I will ask to you. Regards.

    Mehmet
    #ConstraintProgramming-General
    #DecisionOptimization


  • 10.  Re: ILOG New Search Problem

    Posted 10/29/11 05:04 PM

    Originally posted by: memo85


    Hi Philippe.

    I tried your suggestions.
    My decision variable is "istno" . When I run the code, ILOG can find a solution. But all decision variables are equal "1". This solution is inital solution for solving my problem. But optimal solution must be following as below.

    istno1=1 istno2=1 istno3=3 istno4=4 istno5=2 istno6=1 istno7=4 istno8=2 istno9=5 istno10=3 istno11=5

    I suppose ILOG doesn't use all solution branches to solve my problem.
    Also I want to see all solution that ILOG try to solve the problem. How can I see all feasible solutions?

    Thanks your helps in advance.

    Mehmet.
    #ConstraintProgramming-General
    #DecisionOptimization


  • 11.  Re: ILOG New Search Problem

    Posted 10/31/11 07:17 AM

    Originally posted by: GGR


    Hi

    Can you tell us exactly what is the report of the engine at the end of the search.

    That is as shown in the former message of Philippe this output line

    ! ! Search terminated normally, 1 solution found.
    ! Best objective : 0 (optimal - effective tol. is 1,000000e-009)
    ! Number of branches : 6
    ! Number of fails : 8
    ! Total memory usage : 2,0 MB (1,1 MB CP Optimizer + 0,9 MB Concert)
    ! Time spent in solve : 0,00s (0,00s engine + 0,00s extraction)
    ! Search speed (br. / s) : 600,0
    !

    It is in Best Objective the engine tell if or if not the optimal is proven.

    Cheers
    #ConstraintProgramming-General
    #DecisionOptimization


  • 12.  Re: ILOG New Search Problem

    Posted 10/31/11 09:22 AM

    Originally posted by: memo85


    Hi

    I received the message same as Philippe. But my problem is that the solution is not optimum. Because I know optimal solution as can be seen above. I don't understand why the soluton is not optimum. What can be probable causes? I hope I get through to my problem. Thanks.

    Regards.
    #ConstraintProgramming-General
    #DecisionOptimization


  • 13.  Re: ILOG New Search Problem

    Posted 10/31/11 11:19 AM

    Originally posted by: SystemAdmin


    Hello Mehmet.

    In your model I see:
    
    
    
    int maxmustsay=50; ... 
    
    float lambda[mustsay]; ... dvar int+ istno[gorev]; dexpr 
    
    float objective = lambda[maxmustsay]; maximize objective;
    

    So maxmustsay is a constant (50), lambda is a constant array (it seems it is initialized by a script before the model is solved). As a result, expression "objective" is also a constant. Therefore objective value of all solutions is the same and so every solution is optimal. CP Optimizer stops the search as soon as it finds optimal solution. that means in your case after the first solution because it is always optimal.

    I guess the problem is in the "objective" expression, it should depend on your decision variables istno somehow.

    Best regards, Petr
    #ConstraintProgramming-General
    #DecisionOptimization


  • 14.  Re: ILOG New Search Problem

    Posted 11/04/11 04:28 AM

    Originally posted by: memo85


    Thank you very much for your interest, Petr Vilím. I'll try your suggestions.

    Regards, Mehmet.
    #ConstraintProgramming-General
    #DecisionOptimization