Undergrad Distribute gold among items depending on demand

  • Thread starter Thread starter Addez123
  • Start date Start date
  • Tags Tags
    Gold
Click For Summary
SUMMARY

The forum discussion centers on the challenge of distributing a fixed amount of gold among items based on their demand. The initial formula used, price = (1 - demand/totalDemand) * goldToDistribute, leads to an over-allocation of gold, as demonstrated by the example where 15 gold is distributed instead of the intended 10. Participants suggest that a more effective approach involves calculating a stake for each item based on its demand relative to total demand, followed by adjusting the formula to account for desired prices and default demand. The goal is to derive a formula that accurately reflects the relationship between demand and price while ensuring the total gold distributed does not exceed the available amount.

PREREQUISITES
  • Understanding of basic algebraic equations and functions.
  • Familiarity with concepts of demand and supply in economic contexts.
  • Knowledge of programming principles for implementing algorithms.
  • Experience with game design mechanics related to resource allocation.
NEXT STEPS
  • Research algorithms for resource distribution based on demand, such as the Weighted Average method.
  • Explore mathematical modeling techniques for pricing strategies in game development.
  • Learn about the implementation of dynamic pricing models in programming languages like Python or JavaScript.
  • Investigate case studies on demand-based pricing in gaming and e-commerce.
USEFUL FOR

Game developers, economists, and programmers interested in resource allocation strategies and dynamic pricing models will benefit from this discussion.

Addez123
Messages
199
Reaction score
21
TL;DR
I have a table of items.
Each item has a
- demand, representing how many items has been sold
- desiredPrice: Given defaultDemand, the price should equal desiredPrice

There's a pot of gold that should be distributed among all items.
Items with high demand should receive LESS gold, and items with little demand should receive MORE gold.

The total gold in the pot equals the sum of all desiredPrice's among the items.

How do I calculate the price from demand?
How do I calculate defaultDemand?
This turned out to be more difficult than I thought!

Right now my calculations for the price for each item:
price = (1 - demand/totalDemand) * goldToDistribute

It doesn't work, example case:
goldToDistribute = 10

a.demand = 10
b.demand = 90
c.demand = 100
totalDemand = 200
a.price = (1 - 10/200)* 10 = 9.5
b.price = (1 - 90/200)* 10 = 5.5

already here we can see we've distributed 15gold when we only had 10 gold to distribute.
What would be a better function for price?

Basically what I'm looking for is a solution to
price = f(demand, totalDemand, goldToDistribute)
 
Physics news on Phys.org
Addez123 said:
Summary: I have a table of items.
Each item has a
- demand, representing how many items has been sold
- desiredPrice: Given defaultDemand, the price should equal desiredPrice
In your example, you show only the demand and a price, but not the desired price.
Addez123 said:
There's a pot of gold that should be distributed among all items.
Items with high demand should receive LESS gold, and items with little demand should receive MORE gold.

The total gold in the pot equals the sum of all desiredPrice's among the items.

How do I calculate the price from demand?
How do I calculate defaultDemand?

This turned out to be more difficult than I thought!

Right now my calculations for the price for each item:
price = (1 - demand/totalDemand) * goldToDistribute

It doesn't work, example case:
goldToDistribute = 10

a.demand = 10
b.demand = 90
c.demand = 100
totalDemand = 200
a.price = (1 - 10/200)* 10 = 9.5
b.price = (1 - 90/200)* 10 = 5.5

already here we can see we've distributed 15gold when we only had 10 gold to distribute.
What would be a better function for price?

Basically what I'm looking for is a solution to
price = f(demand, totalDemand, goldToDistribute)
What is the DesiredPrice? What is DefaultDemand? Is your task to come up with a formula for price?

It seems like there is a lot of information that is missing. If this is a textbook problem, what is the exact problem statement?
 
  • Like
Likes FactChecker
Mark44 said:
In your example, you show only the demand and a price, but not the desired price.

What is the DesiredPrice? What is DefaultDemand? Is your task to come up with a formula for price?

It seems like there is a lot of information that is missing. If this is a textbook problem, what is the exact problem statement?
I'm also interested in this question... for non homework reasoning.

I believe the desired price he's looking for is not a number, rather a percentage. The desired price is 100% of what it demands at the default demand. He then gives demand for each item, but at 200%. Indicating its twice the amount of available currency, which is 10.

Should not you cancel the 200% into 100% by halfing the values of...x(??) Then split the 10 gold to the three items based on what percentage of the 100% each is.
 
Mark44 said:
What is the DesiredPrice? What is DefaultDemand? Is your task to come up with a formula for price?
So it's a coding problem for a game I do on my spare time.

desiredPrice could be any number. It's irrelevant to the equation but it's calculated based on the time it takes to obtain said item.

Default demand is what I need to calculate.
Basically, if I set the demand of every item to defaultDemand, then the price should end up being our desiredPrice.

Mark44 said:
Is your task to come up with a formula for price?
Yes. And after that a formula to calculate defaultDemand based on the price formula.
 
zeanah said:
Should not you cancel the 200% into 100% by halfing the values of...x(??) Then split the 10 gold to the three items based on what percentage of the 100% each is.

Changing the formula to
price = (1 - demand/totalDemand) * goldToDistribute * 100/totalDemand
works for this example but doesn't work if c = 200
 
Basically you can calculate the price through this process:a.demand = 10
b.demand = 90
c.demand = 100
totalDemand = 200

a.stake = 1 - a.demand/totalDemand
b.stake = ...

totalStake = a.stake + b.stake + c.stake

a.price = a.stake/totalStake * goldToDistribute

But if I use this approach I have no way of calculating defaultDemand.
For example, what should a.demand be in order to get a.price = 6?
 
Addez123 said:
Basically you can calculate the price through this process:a.demand = 10
b.demand = 90
c.demand = 100
totalDemand = 200

a.stake = 1 - a.demand/totalDemand
b.stake = ...

totalStake = a.stake + b.stake + c.stake

a.price = a.stake/totalStake * goldToDistribute

But if I use this approach I have no way of calculating defaultDemand.
For example, what should a.demand be in order to get a.price = 6?
It should be 150% of whatever b.demand + c.demand equals right? Considering you have 10, want to allocate 6 of that to a, leaving the other two some combination that equals 4. 6 is 150% of 4, do that is the answer? I'm not to great at math either tbh, but I have a very similar problem like this i am trying to code as it relates to a game also. It had to do with classifying different tasks based in their averaged gold/second return and comparing.. Yada yada
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 67 ·
3
Replies
67
Views
15K
  • · Replies 25 ·
Replies
25
Views
8K
  • · Replies 4 ·
Replies
4
Views
9K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 9 ·
Replies
9
Views
4K