Git Product home page Git Product logo

healthify_base's Introduction

Healthify_Base

This mini-project is a real life implementation of Dynamic Programming(Knapsack problem) in our daily lives.We use DP to make our personal diet planner that chooses food items to maximixe protein intake.

Approach We need to make sure that a person is intaking meals per day and is well balanced in calorie to protein intake.We find out the best-balanced diet for a customer, concerning our problem statement. The customer chooses, what type of lifestyle he/she is following i.e, Active or Sedentary. Then we make them punch in their height and weight to calculate their BMI. We compare the BMI with the data to check if he/she is overweight, under-weight, or optimal weight. Then we ask them how to move on with their diet, i.e, muscle gain, fat loss, etc. Depending on the above choice and his lifestyle we define his/her PPG(Protein Per Kilogram) Like this using ppg and weight, we calculate protein intake per day. We already have fixed his calorie intake which is 2000 cal(which can be set accordingly), and find out the best food item list he/she should consume in a day to maintain his protein and calorie intake for bodybuilding, bulking, cutting, etc.

So, we need to maximize the person’s protein intake keeping calorie intake constant or less. Hence maximization problem comes under the optimization problem .Here we make use of Dynamic Programming.More specifically Knapsack 1\0 Dynamic Programming, where we maximize protein(profit) while keeping calorie(knapsack capacity) less or equal. We already have the list of food items with their calorie and protein content %. (Items of knapsack) We adopt the Bottom-up approach or tabulation method for the same as it is less complex and easy to implement.

We store the food ITEMs characteristics Name → string Array items[ ] Calorie→ integer array calorie[ ] Protein → integer array Protein_content[ ] We make use of the function make_list() to find out the calorie, and protein intake along with the food items he/she would consume in a day accordingly to maintain protein and calorie intake per day.

Data Structures and Algorithms Used

  1. Data Structure We store the food ITEMs characteristics : Name → string Array items[ ] Calorie→ integer array calorie[ ] Protein → integer array Protein_content[ ] DP Table to find max protein content and list of food items→2D integer array K[ ]. Retrieval of the food item list→ integer array sols[ ]
  2. Algorithm Knapsack 0/1 Dynamic Programming. DP Bottom-Up or tabulation method.

Q. Why are we implementing Dynamic Programming here?

Sol. Our Problem is a maximization problem i.e, an optimization problem, and we know Dynamic Programming is used to solve optimization problems as it always gives a solution, if it exists. And our problem satisfies two conditions that are needed for a problem to be able to solve via DP Optimal substructure Overlapping subproblem

healthify_base's People

Contributors

joy7103 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.