define random parameter

Hi

I have a question…!

How can I define a parameter h(i,l) in format of table randomly which includes two arrays 0 or 1 such that number of arrays 1 for each index i are equal m(i) . Note that m(i) is random parameter too!

h(i,p) is random parameter
m(i) is random parameter
the number of 1 in each row of table related to index i is equal m(i) exactly


I will be grateful to you if you answer my question

regards,


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Dear Saba

I hope this help you.

set i /i1*i10/;

Set p /p1*p5/;


Parameter h(i,p);


scalar row /0/;

scalar coulmn /0/;

scalar loopcheck /1/;

parameter m(i);


loop(i,

\

  • Random values for m(i)

m(i)=ceil(uniform(0,card(p)));

loopcheck=0;

row=m(i);


while((loopcheck ne row) and (loopcheck lt card(p)),

\

  • Those columns that randomly should set to 1

coulmn= ceil(uniform(0,card(p)));

h(i,p)$(ord(p)=coulmn)=1;

loopcheck=sum(p,h(i,p)););


);


Display m,h;





Regards;

Hossein

On Tue, Jan 27, 2015 at 7:29 PM, saba wrote:


Hi

I have a question…!

How can I define a parameter h(i,l) in format of table randomly which includes two arrays 0 or 1 such that number of arrays 1 for each index i are equal m(i) . Note that m(i) is random parameter too!

h(i,p) is random parameter
m(i) is random parameter
the number of 1 in each row of table related to index i is equal m(i) exactly


I will be grateful to you if you answer my question

regards,


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Thank you very much…

On Tuesday, 27 January 2015 20:29:03 UTC+4:30, saba wrote:


Hi

I have a question…!

How can I define a parameter h(i,l) in format of table randomly which includes two arrays 0 or 1 such that number of arrays 1 for each index i are equal m(i) . Note that m(i) is random parameter too!

h(i,p) is random parameter
m(i) is random parameter
the number of 1 in each row of table related to index i is equal m(i) exactly


I will be grateful to you if you answer my question

regards,


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.