Skip to main content Accessibility help
×
Hostname: page-component-586b7cd67f-dsjbd Total loading time: 0 Render date: 2024-11-27T16:54:03.302Z Has data issue: false hasContentIssue false

8 - Knapsack

Published online by Cambridge University Press:  07 May 2024

Rahul Vaze
Affiliation:
Tata Institute of Fundamental Research, Mumbai, India
Get access

Summary

Introduction

In this chapter, we discuss the online version of one of the most versatile combinatorial problems, called the knapsack. In the classical offline version of the knapsack problem, we are provided with a set of items I and a knapsack of size or capacity C. Each item i * I has value v(i) and size w(i), and the problem is to select a subset of I that maximizes the sum of the value of the selected items, subject to the sum of the sizes of the selected items being less than the capacity C of the knapsack.

Because of the two unrelated attributes for each item, value and size, the knapsack problem is sufficient to model various real-world problems where the objective is to maximize a utility function subject to an independent capacity constraint. Important examples of the knapsack problem are scheduling with resource capacity constraints, budgeted auctions, combinatorial resource allocation, etc.

In the online version, the knapsack capacity constraint is available ahead of time, but each item is presented sequentially when its value and size are revealed. An item on its arrival has to be permanently accepted or rejected, irrevocably. It is worth mentioning that the secretary problem considered in Chapter 7 is a special case of the online knapsack problem, where the size of each item is 1 and the knapsack capacity is also 1. Thus, unfortunately, the result that no algorithm is competitive for the secretary problem under the adversarial input carries over for the knapsack problem. Therefore, in this chapter, we primarily consider the secretarial input and present an online algorithm whose competitive ratio is a constant.

We show that a randomized algorithm based on the sample and price philosophy is 1/10ecompetitive in expectation for the knapsack problem with the secretarial input model. We also consider the worst-case input, though with resource augmentation, where an online algorithm is allowed more capacity than the optimal offline algorithm, and an online algorithm is also allowed to reject previously accepted items.

Type
Chapter
Information
Online Algorithms , pp. 139 - 160
Publisher: Cambridge University Press
Print publication year: 2023

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure [email protected] is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • Knapsack
  • Rahul Vaze, Tata Institute of Fundamental Research, Mumbai, India
  • Book: Online Algorithms
  • Online publication: 07 May 2024
  • Chapter DOI: https://doi.org/10.1017/9781009349178.009
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • Knapsack
  • Rahul Vaze, Tata Institute of Fundamental Research, Mumbai, India
  • Book: Online Algorithms
  • Online publication: 07 May 2024
  • Chapter DOI: https://doi.org/10.1017/9781009349178.009
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • Knapsack
  • Rahul Vaze, Tata Institute of Fundamental Research, Mumbai, India
  • Book: Online Algorithms
  • Online publication: 07 May 2024
  • Chapter DOI: https://doi.org/10.1017/9781009349178.009
Available formats
×