Skip to main content
Solved

Discrete Uniform Distribution

  • August 8, 2022
  • 1 reply
  • 52 views

Forum|alt.badge.img+3

Hello everyone, 

 

Is there a way to use a discrete uniform distribution inside of Aimms? I know there is a uniform distribution but it gives me real number values for my parameter. Instead i just want integer values to be drawn from the uniform distribution. Is this possible? 

 

Thank you for an answer.

 

Kind regards

Alex

Best answer by Chris Kuip

Hi Alex,

 

You can use round and uniform.  I created a small example as follows:

Procedure MainExecution {

    Body: {

        empty p_frequency ;

        while loopcount <= p_noDrawings do

            p_draw := uniform( -0.4999, 9.4999 );

            p_rndDraw := round( p_draw );

            ep_digit := p_rndDraw ;

            p_frequency( ep_digit ) += 1 ;

        endwhile ;

    }

    Parameter p_draw;

    Parameter p_rndDraw {

        InitialData: 10000;

    }

}

 


This example gives the following combination chart:

 

distribution of a million drawings

 

Hope this helps,

 

Chris.

1 reply

Chris Kuip
AIMMSian
Forum|alt.badge.img+7
  • AIMMSian
  • 125 replies
  • Answer
  • August 8, 2022

Hi Alex,

 

You can use round and uniform.  I created a small example as follows:

Procedure MainExecution {

    Body: {

        empty p_frequency ;

        while loopcount <= p_noDrawings do

            p_draw := uniform( -0.4999, 9.4999 );

            p_rndDraw := round( p_draw );

            ep_digit := p_rndDraw ;

            p_frequency( ep_digit ) += 1 ;

        endwhile ;

    }

    Parameter p_draw;

    Parameter p_rndDraw {

        InitialData: 10000;

    }

}

 


This example gives the following combination chart:

 

distribution of a million drawings

 

Hope this helps,

 

Chris.



Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator