Three random choices in limitations

In summary, the Expert summarizer explains that they have six integer numbers x,y,z,a,b,c and wants to know how to randomly generate the next three numbers x,y,z which still satisfy what they mentioned earlier. They mention that they can code in Java or Vb, but haven't used them for long, and then explain that they like C++ and are now solving the networkflow problem in C++. They mention that they think they can make a success with the rand() function, but are having trouble checking the next move of the loop and randomizing the x,y,z to satisfy the condition.
  • #1
Pattielli
296
0
I have six integer numbers and let's call them x,y,z,a,b and c.
All of them are to be in the [1,30] domain and satisfy the following conditions:

[tex]x=y+z[/tex]

[tex]x<a , y<b , z<c[/tex]

Now, if I start by "choosing a,b and c randomly first", Would you please tell me how I can randomly pick out the next three numbers (x,y,z) which still satisfy what I already mention above ?

Thank you very much,
 
Computer science news on Phys.org
  • #2
This is the same as Kirchoff law in Electrics ? Please help me...
Go_in=go_out1+go_out2+...go_outn
 
  • #3
Randomly generate a,b, and c

test that [itex] a \geq b+c[/itex]

if the above condition isn't true then [itex]x<a, y<b, z<c[/itex] when [itex]x=y+z[/itex] will never be true and will put your program into an endless loop.

Once you have 'a', 'b', and 'c' values that meets the conditions you can then randomly generate the 'x' , 'y', and 'z' values. Generate an 'y' value within a while loop and test to see if it meets the criteria of being less than 'b'. If it does then exit the loop. Same for 'z'. Once you have a 'y' and 'z' you can then simply add them and store the result into 'x'.

I don't know which language you're using so I can't tell you exactly how to do the above. Each language does things differently (loops are pretty standard though) so you'll have to figure the specifics out on your own. It's not that tough.

Well, good luck.
 
Last edited:
  • #4
Another clearification:

Code:
a--fa/ca-->b--fb/cb-->...
|          |
x--fx/cx-->y--fy/cy-->...
ca,cb,cx,cy are all known in advance and they capacities fi are all flows. Now i have to generate flows randomly and this "random_ness" blocks my way...
All of the capacities are stored in a vector and I already have a network...
Now you already see how it is...please give me some hints...
Thank you,
 
  • #5
Thank faust very much for your help,
I can code in java, vb but I haven't used them for long...
I like C/C++ and now I am solving this networkflow problem in C++.
I think I can manage to make a success with rand() function and do as what you told me but the problem is that I can't check the next move of the loop and randomize the x,y,z to satisfy the condition..
For example, below is my network
Code:
0  1  1  0
0  0  1  1
0  0  0  1
0  0  0  0
and here is my capacity matrix
Code:
0  12  21  0
0   0   1   2
0   0   0   1
0   0   0   0

Again Thank you
 
  • #6
I still have not been able to make it work...Help me please ?
 
  • #7
I don't understand what exactly you are trying to do. Where exactly are you having a problem? Is it the generation of random values that is troubling you or are you having trouble generating randome values that meet your criteria?
 
  • #8
I nowwould like to make a matrix of flows that satisfies the above conditions, each flow value will be randomly chosen. And that is the problem i am having, flow value=1~20 and smaller than cappacity on each equivalent edge
 
  • #9
Pattielli said:
Thank faust very much for your help,
I can code in java, vb but I haven't used them for long...
I like C/C++ and now I am solving this networkflow problem in C++.
I think I can manage to make a success with rand() function and do as what you told me but the problem is that I can't check the next move of the loop and randomize the x,y,z to satisfy the condition..
For example, below is my network
Code:
0  1  1  0
0  0  1  1
0  0  0  1
0  0  0  0
and here is my capacity matrix
Code:
0  12  21  0
0   0   1   2
0   0   0   1
0   0   0   0

Again Thank you

Ok, I still don't know how you are using these matrices. Also, where are you having a problem? Are you having trouble generating and testing the variables or are you having trouble filling you arrays once you create your variable? How does the new criteria affect the variable tests? are you still bounded by the same criteria which you initially stated?
 
  • #10
Thank you,
As I already said, I used 2d vectors for storing these matrices..
Look at the capacity matrix, I now have to create another one and represent it as a flow matrix whose values are all randomly chosen between 1-20 and must satisfy the "Kirchoff" law (in=out), and that each element in flow matrix must be smaller than that in the capacity matrix (in an equivalent position I mean)...This is the way i am thinking of how to create this flow matrix, but if you have any other way to make this work and are willing to let me know, I will thank you very very much...

Do you have any instructions? Please help...
 

1. What is meant by "three random choices" in limitations?

In scientific research, the term "three random choices" refers to the selection of three distinct options or variables from a larger pool. This is often done to create a controlled experiment or to limit the scope of a study.

2. How are the three random choices determined in a study?

The three random choices are typically determined using a randomization method, such as a random number generator or a randomized controlled trial. This ensures that each choice has an equal chance of being selected and minimizes bias in the study.

3. What are the benefits of using three random choices in a study?

Using three random choices in a study can help reduce the impact of confounding variables and increase the reliability of the results. It also allows for a more focused and controlled analysis of the specific variables being studied.

4. Are there any limitations to using three random choices in a study?

While using three random choices can provide valuable insights, it may not always be feasible or practical. In some cases, there may be more than three relevant variables to consider, or the sample size may be too small to accurately represent the larger population.

5. How can researchers address potential limitations when using three random choices in a study?

To address potential limitations, researchers can carefully design their study and select a larger sample size to increase the reliability of their findings. They can also consider using additional statistical methods to analyze the data and account for any potential confounding factors.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
331
  • Precalculus Mathematics Homework Help
Replies
3
Views
2K
  • Precalculus Mathematics Homework Help
Replies
24
Views
930
  • Precalculus Mathematics Homework Help
Replies
29
Views
1K
  • Calculus and Beyond Homework Help
Replies
8
Views
343
  • Programming and Computer Science
Replies
1
Views
587
  • Calculus and Beyond Homework Help
Replies
3
Views
465
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
908
  • Precalculus Mathematics Homework Help
Replies
8
Views
319
  • Differential Equations
Replies
5
Views
608
Back
Top