Decision Optimization

Decision Optimization

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


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

how to get Normal distribution N(μ,δ2)?

  • 1.  how to get Normal distribution N(μ,δ2)?

    Posted 10/07/17 09:18 AM

    Originally posted by: ljb843


    execute{
        // to get Normal distribution
         var y1, y2, y3, y4, y5, y6;
         y1=Math.random();
         y2=Math.log(y1);
         y3=Math.sqrt(y2);
         y4=6.28*y1;
         y5=Math.sin(y4);
         y6=(-2)*y3*y5;
        DemandKS[1]=11000+1000*y6;
        DemandKS[2]=7500+500*y6;
        DemandKS[3]=15000+1000*y6;
        DemandKS[4]=12000+1000*y6;
        DemandKS[5]=19000+1000*y6;

    }

    I got " EXCEPTION_ACCESS_VIOLATION "error,why? thank you very much!!


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: how to get Normal distribution N(μ,δ2)?

    Posted 10/07/17 10:59 AM

    Hi

    float DemandKS[1..5];
     
     execute{
        // to get Normal distribution
         //var y1, y2, y3, y4, y5, y6;
         y1=Math.random();
         y2=Math.log(y1);
         y3=Math.sqrt(Math.abs(y2));
         y4=6.28*y1;
         y5=Math.sin(y4);
         y6=(-2)*y3*y5;
        writeln("y1=",y1);
        writeln("y2=",y2);
        writeln("y3=",y3);
        writeln("y4=",y4);
        writeln("y5=",y5);
        writeln("y6=",y6);
        DemandKS[1]=11000+1000*y6;
        DemandKS[2]=7500+500*y6;
        DemandKS[3]=15000+1000*y6;
        DemandKS[4]=12000+1000*y6;
        DemandKS[5]=19000+1000*y6;

    }

    gives

    y1=0.001251221
    y2=-6.683635642
    y3=2.585272837
    y4=0.007857666
    y5=0.007857585
    y6=-0.040628003

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer