Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Fonction Random

    Posted 03/22/16 12:14 PM

    Originally posted by: SAFA


    Fonction Random in CPLEX (windows 64bits)


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Fonction Random

    Posted 03/22/16 01:34 PM

    Ahem, please be more specific. What exactly is your question?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Fonction Random

    Posted 03/22/16 03:03 PM

    Originally posted by: SAFA


    can you tell me the code of the fonction random in CPLEX. (i have windows 7 64 bits)


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Fonction Random

    Posted 03/23/16 08:25 AM

    Sorry, I still don't get it. "the code of the function random in CPLEX"? Do you mean the source code for that function? I don't even know what function you are talking about since to the best of my knowledge CPLEX does not provide a function called "random". Did you check the reference documentation?


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Fonction Random

    Posted 03/23/16 08:30 AM

    Originally posted by: SAFA


    i need to have the sourcecode of the fonction Rand that is used for the uncertain data with my operating system (Windows 7 64bits)


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Fonction Random

    Posted 03/24/16 12:35 PM

    Since CPLEX is not an open source product we cannot show you any source code.

    Why do you need to know how this function is implemented? Does the reference documentation for the function not provide all the details you need?

    By the way, I am still not exactly clear what function you are talking about. Is this Opl.rand()? Or something else? Could you provide a link to the reference documentation for the function you have in mind?


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Fonction Random

    Posted 03/25/16 04:41 AM

    Originally posted by: SAFA


     

    I try to use this code but i have a probem: the matrix c (uncertain) contain always the same number.


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Fonction Random

    Posted 03/25/16 06:27 AM

    Hi,

    some examples:

    range r=1..10;
     int a[i in r]=rand(10);
     
     int b[r];
     float c[r];
     
     execute
     {
     for(var i in r)
     {
      b[i]=Opl.rand(10);
      c[i]=Math.random();
    }  
     writeln(a,b,c);
     }

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: Fonction Random

    Posted 03/29/16 12:31 PM

    Function srand() initializes the random number seed. You should instead use rand() when initializing the matrix c. This will give you random numbers.

    Call srand() only once in the beginning to set the random number seed. Like so:

    execute {
      var now = new Date();
      Opl.srand(Math.round(now.getTime()/1000000000));
      for (var p in P) {
        for (var s in S) {    
          c[p][s] = Opl.rand(100); // random number in [0,100[     
        }  
      }
    }
    

     


    #CPLEXOptimizers
    #DecisionOptimization