Inspiration
We wanted to optimize grocery store shopping for the university student faced with a tight budget.
What it does
The user inputs the items they want to buy, as well as the item's price and the utility. Based on the Cobb Douglas utility function, we generate a utility function modeling the grocery items, taking the form U = x^util1 * y^util2 * z^util3, and so on. Then we take the gradient of the function and equate MUi/Pi for each variable (MUx/Px = MUy/Py = MUz/Pz=and so on). We then input the solutions derived above into the budget constraint. Ultimately, the program outputs how much the user should buy of each item based on the utility to the user.
How we built it
We used sympy to generate the utility function and used sympy's diff to take the partial derivatives of utility function for n variables. Then we used sympy's solve to equate the marginal utility/item price for each of the variables input by the user.
Challenges we ran into
We weren't certain how to go about generated the utility function for a variable number of items n, so we decided to set the grocery items to 10. We also faced some challenges importing Sympy. Although our program isn't functional, we learned some valuable information about doing symbolic math in Python.
Accomplishments that we're proud of
We think that with a bit more work in the future, we can make the program functional.
What we learned
Intro to symbolic math using sympy and numpy.
What's next for BetterShopping
Getting the program to work.

Log in or sign up for Devpost to join the conversation.