Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  How to Generate Random Solutions?

    Posted 03/06/14 02:06 PM

    Originally posted by: CQSB_Onur_Cagirici


    Hello all!

    I have a model:

    dvar float x in 1..99;
    
    dvar float y in 1..99;
    
    dvar float z in 1..99;
    
    subject to
    
    { x + y - z == 41.3; }
    
    When I run the solver, I always get 41.3, 1, 1.

     

    But I want to get random solutions. Is this possible?

    One more question: May I get 5 random solutions?


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: How to Generate Random Solutions?

    Posted 03/12/14 05:12 PM

    Originally posted by: EdKlotz


    You are solving an LP.   Unless you go out of your way with non default settings to prevent it, CPLEX will provide a basic solution to your LP.  In your small example above, there are only 5 basic feasible solutions solutions, corresponding to the bases {x}, {y}, and {z} and various bound settings for the nonbasic variables.   CPLEX will only give you one of those 5 solutions.   To get random solutions, you could start with  all 5 basic solutions (41.3, 1, 1), (1, 41,3, 1), (99, 99, 156.7), (99, 1, 58.7),  and (1,99,58.7).   Any convex combination of those 5 solutions is also feasible.  So, you could take random convex combinations of those 5 solutions to generate random solutions.    Note that while this works for this one constraint, three variable model, enumerating all the basic feasible solutions in general is not computationally feasible at all.    This will only work for very small models.   If you need to do this with larger models, I think you need to first ask yourself what you want to do with random solutions if you could easily get them.   Maybe there's another way to accomplish the same thing.

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: How to Generate Random Solutions?

    Posted 03/12/14 07:21 PM

     

    You could generate an objective function with randomly chosen coefficients and first maximize, then minimize it. That should give you two distinct extreme points. Repeat as often as necessary, recognizing that (a) you are only getting extreme points and (b) you are sampling with replacement. Then, as Ed suggested, you can take convex combinations of the extreme points (with randomly chosen weights) to get a random sample of interior points.

     

     

     

     


    #CPLEXOptimizers
    #DecisionOptimization