Partitioning a whole number in a particular way

  • I
  • Thread starter robertjordan
  • Start date
In summary, the conversation discusses how to distribute P slices of pizza among n people while using their weights to determine the number of slices they get. The goal is to find a set of whole numbers that minimizes the sum of the differences between each person's assigned slices and their weight compared to the total weight and number of slices. There is a discussion about rounding and the criteria for assigning at least one slice to a person. Ultimately, the solution involves assigning any remaining unassigned slices to the last person.
  • #1
robertjordan
71
0
Hi,

Let W be the sum of all the people's weights, let P be the total number of pizza slices available.

If:
  • I have P slices of pizza (P<=W)
  • I have n people I want to split the pizza with
  • I want to use people's weight to determine how many slices they get (more weight -> more slices)
  • I don't want to split any slices. (I want to leave all slices whole)
  • A person cannot eat more slices than the value of their weight. (ai<=wi)

If w1, w2, ... , wn are the weights of the n people, and a1, a2, ... , an are the numbers of slices each of the n people get (where each ai is a whole number >= 0), I want to find the set {a1, ... , an} such that:

ni = 1| ai/P - wi/W |

is minimized.

Is there a formula (some uses of ceiling, floor?) or algorithm to find this set {a1, ... , an} ?
 
Last edited:
Physics news on Phys.org
  • #2
robertjordan said:
Hi,

If:
  • I have P slices of pizza
  • I have n people I want to split the pizza with
  • I want to use people's weight to determine how many slices they get
  • I don't want to split any slices. (I want to leave all slices whole)
How can I decide how many slices to give each person? I know some people may end up with 0 pieces, but that's okay.

You could give all P slices to the heaviest person. Or, to the lightest.
 
  • #3
In order to decide how to distribute the slices you need a more quantitative rule (or set of rules) than just "To use people's weight". Use people's weight how? For example, does a heavy, apparently well fed person get more pieces than a skinny, emaciated person or the other way around? What criteria must be met for a person to get at least one piece? And so on.

Of course you can always rely on probability. You can have the people toss coins and get a slice every time they get heads. You assign progressively fewer coin tosses to the people you think should get fewer slices following whatever weight criterion you have.
 
  • #4
Shouldn’t you just take ##w_i/W## and round to the nearest 1/P
 
  • #5
Dale said:
Shouldn’t you just take ##w_i/W## and round to the nearest 1/P
It depends on one's particular weighting philosophy. I tried some examples using ##(w_i/W)^n##. Positive values of ##n## favor the heavy people while negative values favor the skinny people. One can also try exponentials a la partition function, I guess.
 
  • #6
Dale said:
Shouldn’t you just take ##w_i/W## and round to the nearest 1/P

Thanks for the replies.
I don't mind so much favoring someone more than others as long as:

  • (ai<=wi) is not violated
  • we assign exactly P pieces of pizza. no more, no less
  • only whole slices can be assigned (no fractions for ai)
For example, if we have

w1 = 25
w2 = 9
W = 34
P = 17

Then ROUND(P*w1/W) = 13
and ROUND(P*w2/W) = 5

Which means we've just assigned 18 pieces of pizza but we only have 17.I'm trying to find an algorithm that can ensure we give out exactly the P pieces and we also don't violate (ai<=wi).
 
Last edited:
  • #7
Don’t round up. Round off. It should work unless you get exactly 0.5
 
  • #8
Dale said:
Don’t round up. Round off. It should work unless you get exactly 0.5

I'm not sure what round off means.

If round off means raise anything with a decimal >= .5 the next whole number and anything with a decimal <.5 to the next whole number down, then the example will still lead to 18 pieces being assigned.
 
  • #9
I think that is just because of being exactly 0.5.
 
  • #10
Dale said:
I think that is just because of being exactly 0.5.

Another example is:

w1 = 11
w2 = 39
w3 = 3
W = 53
P = 25

ROUND(P*w1/W) = 5
ROUND(P*w2/W) = 18
ROUND(P*w3/W) = 1

This sums to 24 but we have 25 pieces.
 
  • #11
robertjordan said:
This sums to 24 but we have 25 pieces.
I faced the same issue when I rounded so I solved the problem by assigning to the last person whatever number of pieces are left unassigned. Simple, no?
 
  • #12
Yup, you are right. No 0.5’s so that isn’t the problem
 

1. How can I partition a whole number in a particular way?

To partition a whole number in a particular way, you can use the process of division. This involves dividing the number into equal parts or groups.

2. Why is it important to learn how to partition a whole number?

Partitioning a whole number is an important skill in mathematics as it helps in understanding the relationship between numbers and their properties. It also helps in problem-solving and making calculations easier.

3. What are some strategies for partitioning a whole number?

Some strategies for partitioning a whole number include using visual aids such as arrays or number lines, using manipulatives like counters or blocks, and using the distributive property.

4. How does partitioning a whole number relate to place value?

Partitioning a whole number is closely related to place value as it involves breaking a number into its individual place values. This helps in understanding the value of each digit and how they contribute to the overall value of the number.

5. Can partitioning a whole number be applied to fractions and decimals?

Yes, partitioning a whole number can be applied to fractions and decimals as well. In fractions, it involves dividing the numerator and denominator into equal parts, while in decimals it involves understanding the relationship between the digits before and after the decimal point.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
30
Views
5K
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
876
Replies
10
Views
2K
Replies
52
Views
2K
Replies
16
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
16
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
1K
Back
Top