Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8881273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:18:42+00:00 2026-06-14T20:18:42+00:00

i am unsure if i have even identified the problem correctly, but reading up

  • 0

i am unsure if i have even identified the problem correctly, but reading up on Knapsack problem seems the closest to what i am trying to solve:

A cook has several ingredients of varying quantities. for example:

8 eggs
3 sausages
500 mL milk
12 strawberries

There is a finite list of recipes, each consisting varying ingredients of varying quantities. The universe of ingredients is finite, as is the quantity of each ingredient in all recipes.

Each recipe may or may not contain any of the ingredients the cook has.

The cook wants to use up all his ingredients as much as possible to minimize waste on 1 recipe.

There is a case where the cook wants to use all his ingredients on 2 or 3 different recipes, with minimal leftovers.

What is his optimized solution?

EDIT: My question is a more complex version of the following knapsack problem
http://www.g12.cs.mu.oz.au/wiki/doku.php?id=simple_knapsack

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:18:43+00:00Added an answer on June 14, 2026 at 8:18 pm

    This doesn’t sound like the knapsack problem if i’m not missing anything in your Q.
    The amount of each ingredient to go into each recipe is known
    so your slot size isn’t a variable.

    If i read your Q correctly, all you need to do is to run the
    ingredients thru each recipe, see whether the amounts are sufficient,
    and if so, calculate the value of the ingredients
    to be left out on that one. the recipe with the minimum of
    such positive values is your answer. takes \theta(m*n)
    time with direct access to the ingredients list– m & n the number
    of ingredients and the recipes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm really unsure if this is even possible but we have an issue where
I have a custom list menu style but I am unsure how to align
I have the following code but I am unsure how I would adjust it
I have been reading up on Linq to SQL security and am unsure of
I have a url that contains valid xml, but unsure on how I could
I have been working in C++ for some time now, but I am unsure
OK, I have the logic, but unsure how to write to specific positions in
I have posted this to ServerFault, but the Node.js community seems tiny there, so
I am unsure if this is even possible, but I thought I would ask.
I have two scenarios for using Paperclip, but I'm unsure of how to tweak

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.