You are not logged in.
Pages: 1
I appreciate your help. Your formula requires defining large, medium, and small. It's like paying taxes in brackets. Those who earn between X and Y will pay 30%...
I'm thinking about finding a way to compare values so I can define how large a value is compared to the others, so I can apply a reduction in that proportion. So, the "largest" values would reduce the most, the "intermediate" ones would reduce the least, and the "lowest" values would not reduce at all.
We can do it visually; why can't we do it mathematically?
I appreciate your help. This is the visual way to make the smallest values complete. Visually, we see that the last three values are lower, so we include them completely, and distribute the remaining space proportionally among the larger values.
If all the values are lower than the limit, then they are all completely included.
But I'm wondering if there's a formula or C function that detects the disproportionality between the large values and the small ones and applies a proportional value that will subtract more from the large values and little or nothing from the small ones.
For example (invented values), if the largest value is 3500, a proportional reduction of 1.8 could be applied based on its "weight" relative to the rest of the values. For the value 900, a proportion of 1.3, for 500, 1.1, and for the rest, nothing.
If I have a limit of 3000 for the sum of some values and I have some values like [3500, 900, 500, 200, 50], how can I use a proportional that takes into account the specific weight of each value with respect to the rest so that, in practice, it hardly reduces the value 500 and does not reduce the values 200 and 50.
I would like someone to make a C function
Can't edit or delete it? Delete this post and we'll start with a new one I've already created. Thanks.
A company sends its customers a box that is always the same size and contains seed samples from various plant varieties, and those seeds are all of a similar size. There may be some extra space in the box, but it's not relevant.
For example, the customer may request seeds from chickpea, lentil, and bean varieties.
The seller checks his stock and realizes he has the following quantities available:
Chickpeas -> [Variety1 = 30, Variety2 = 0, Variety3 = 100, Variety4 = 50, Variety5 = 30] Total: 210 Importance = 100
Lentils -> [Variety1 = 20, Variety2 = 40, Variety3 = 90, Variety4 = 10, Variety5 = 0] Total: 160 Importance = 80
Beans -> [Variety1 = 1, Variety2 = 5, Variety3 = 20, Variety4 = 0, Variety5 = 500] Total: 526 Importance = 60
The total sum is 896, but the box he will send to the customer only holds 200.
So the seller seeks to reduce the highest values of each seed variety proportionally (No. equalizing) but trying not to remove seeds with low values. This way, the customer can plant the maximum possible number of seeds of the same type that fit in their box. That is, if the highest values for a seed type are 100 and 80, they would be reduced to 90 and 72.
In addition, the customer assigns each seed variety a variable called "Importance" from 0 to 100, so they can request fewer "Lentil" seeds to be sent to benefit from having more "Chickpea" seeds. If "Importance = 0," it means they don't want that type of seed sent to them. If the customer indicates "Importance = 60" for Lentils, it means they only want 60% of that type of seed, but always trying to reduce the highest numbers and keep the lowest.
Example with a single seed type:
Seller has -> [30, 0, 100, 90, 30] = 250
Sends to the customer -> [30, 0, 70, 70, 30] = 200
----------------
I almost forgot: But we should try to keep the lowest values from decreasing. Example:
Having [30, 0, 100, 90, 30] = 250
Ideally, [30, 0, 70, 70, 30] = 200
Proportionally decrease the values of one or more lists to reach a target sum.
Consider these three or more lists of integer values:
[30, 0, 100, 50, 30] = 210, Importance = 100
[20, 40, 90, 10, 0] = 160, Importance = 80
[1, 10, 30, 0, 500] = 550, Importance = 60
Their total sum is 920. The goal is to make the new "target" sum of all the lists, for example, 200.
What would be a good way to proportionally decrease the values of the lists to achieve the new sum? The values should remain integers.
Additional:
1. In each list, if necessary, try to decrease the highest values more and decrease the lowest values less or not at all.
2.- Each list can have an additional value called "importance," ranging from 0 to 100. 0 indicates that the values in this list are not used. 60 indicates that we give the list 60% importance. This way, we can make the values in one list lower, favoring the values in the other lists.
If possible, I need an example C function.
Pages: 1