Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Unable to get solution

    Posted 02/07/19 01:43 AM

    Originally posted by: ithu95


    I had modelled an optimization problem in cplex. When I gave the input data of a variable as a high value, it doesn't provide me the solution even though the number of constraints and variables are same. The engine log is continuously running and branches continuously even though I waited for 5 hours.  


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Unable to get solution

    Posted 02/07/19 02:17 AM

    This is not unexpected. Since this is an NP hard problem, it is expected that the algorithm's complexity grows exponentially with the problem input.

    In any case, can you provide more information about the issue? For example post the log output or even the model?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Unable to get solution

    Posted 02/07/19 02:31 AM

    Originally posted by: ithu95


    Sir, I will explain in detail.

    I had modelled an evacuation chain. The model is designed for the transportation of people from disaster-affected areas to evacuation camps using 3 modes of transportation. The value of Ek in the data file is causing the problem. I got the solution for a small value for Ek, but couldn't get it for large values for example [80,50].

    I also attached my model and data file as a single text file. Kindly help me Sir.


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Unable to get solution

    Posted 02/07/19 04:46 AM

    Two things:

    1. Since you are "using CP" you are probably better off asking this question at the CPO forums: https://www.ibm.com/developerworks/community/forums/html/category?id=33333333-0000-0000-0000-000000000268
    2. Setting Ek=[80,50] I can reproduce your problem. However, when I use CPLEX instead of CPO (just remove the "using CP" line) then the model solves in a blink here. So if that is an option you could just switch the solvers.

    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Unable to get solution

    Posted 02/11/19 01:42 AM

    Originally posted by: ithu95


    Sir thank you...

    I got the solution using this. But I need to know two things properly.

    first thing is what is the difference between these two solvers.

    Second, in my problem there is a decision variable L. It is a boolean variable. Here in the solution, the variable takes all values as 1. According to my problem, I just need the value of L as 1 only when Nkhp takes values greater than zero.

    I also attach the original problems solution as a text file.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Unable to get solution

    Posted 02/11/19 02:11 AM

    CPLEX solves "mathematical programming" problems while CP solves "constraint programming" problems. For more details see either the CPLEX documentation  (there are chapters about CPLEX and CP Optimizer that explain the two solvers in more detail) or check for example Wikipedia for the definition of these two problem types.

    In your model there is nothing that prevents L from being 1 and there is no cost associated with L, hence the solver is free to just fix all those L variables to 1. To model the constraint you are missing you could just add

    forall(k in  K, h in H, p in P) Nkhp[k][h][p] >= L[k][h][p];

    That will force L to 0 if N is 0.


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Unable to get solution

    Posted 02/11/19 11:26 PM

    Originally posted by: ithu95


    Sir, I got the solution by following your steps. Thank you very much.

    Sir as a part of my curiosity  I need an extension of my problem. In my problem, the Bh is a decision variable. Bh is the camp existence( camp opening) variable. I need to make sure that if Ek is [50,30] or the total value of Ek is not exceeding the camp capacity  Caph =100. I need a solution of Bh as [1 0]. That means it is not necessary to open all camps. 

    To be specific Bh is the opening of an evacuation camp.

    If the number of people required to evacuated is more ( exceeds the camp capacity =100) then only another evacuation camp should be opened. How it can be incorporated into this model.  That means I need camp filling checking. If one camp is filled then only another need to open. Last night I am thinking deeply about it, but I couldn't get it. You are free to define new variables and constraints.


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Unable to get solution

    Posted 02/12/19 03:00 AM

    One option would be to add the B variables to the objective.

    Another option would be that given the number of people and the capacity of the camps, you can know exactly how many camps you will need (assuming all camps have the same capacity). Then you can fix the number of B variables that can be non-zero.

    Note that your problem statement is not well defined. Assume that each camp can accommodate for 100 people and you have 550 people. Then you will need 6 camps. But what are the requirements for these camps? Do 5 camps have 100 people assigned and one camp 50? If so, which camp is the one that has to handle exactly 50 people? Or can the 550 people be distributed freely over the 6 selected camps? So that for example the camps have 100, 90, 80, 70, 60, 100 people?


    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: Unable to get solution

    Posted 02/13/19 01:40 AM

    Originally posted by: ithu95


    I will define my problem more clearly. If we have 550 people, then we need to open 6 camps. Fill all the 5 camps one by one. The last camp (6 th ) can hold 50 people. Please make the changes according to my problem and kindly remodel it.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: Unable to get solution

    Posted 02/14/19 06:24 AM

    Well, I think you can model that on your own. Just add a logical constraint that says

    If camp N is opened (the binary decision variable for N is 1) then the sum of people assigned to camp N-1 must be 100.

    You can use the "=>" (implies) operator for this. Something like

    forall(n in range 2..periods) (open[n] == 1) => (sum people_assign_to[n-1] == 100);


    #CPLEXOptimizers
    #DecisionOptimization