การบรรจุหีบห่อ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เป้าหมายของปัญหาpackingคือการค้นหาวิธีที่ดีที่สุดในการบรรจุชุดสินค้าตามขนาดที่กำหนดลงในคอนเทนเนอร์ที่มีpackingคงที่ การใช้งานทั่วไปคือการโหลดกล่องขึ้นรถบรรทุกอย่างมีประสิทธิภาพ
โดยส่วนใหญ่แล้ว จะไม่สามารถบรรจุสินค้าได้ทั้งหมดเนื่องจากข้อจำกัดด้านความจุ ในกรณีดังกล่าว ปัญหาคือการค้นหาสินค้าบางส่วนที่มีขนาดรวมสูงสุดซึ่งพอดีกับคอนเทนเนอร์
ปัญหาในการบรรจุหีบห่อมีหลายประเภท สิ่งสำคัญที่สุด 2 ประการคือ
ปัญหาของกระเป๋าเป้และการบรรจุหีบห่อ
ปัญหาเกี่ยวกับ Knapsack
ในโจทย์กระเป๋าเป้สะพายหลังที่เรียบง่ายจะมีคอนเทนเนอร์เดียว (กระเป๋าสะพายข้าง)
สินค้าต่างๆ จะมีค่าและขนาด โดยมีเป้าหมายคือการรวมสินค้าบางส่วนที่มีมูลค่ารวมสูงสุด
ในกรณีพิเศษที่ค่าเท่ากับขนาด เป้าหมายคือการเพิ่มขนาดรวมของสินค้าที่บรรจุให้สูงสุด
OR-Tools จะช่วยแก้ปัญหาต่างๆ เกี่ยวกับ Knapsack ได้ในคลังอัลกอริทึม
นอกจากนี้ยังมีโจทย์ปัญหาสะพายหลังเวอร์ชันทั่วไปเพิ่มเติมด้วย ลองดูตัวอย่างต่อไปนี้
ปัญหากระเป๋าสะพายหลังที่มีหลายมิติ ซึ่งสินค้ามีปริมาณที่จับต้องได้มากกว่า 1 รายการ เช่น น้ำหนักและปริมาณ และกระเป๋าบรรจุมีความจุสำหรับแต่ละจำนวน ในที่นี้
คำว่า ส่วนข้อมูล
ไม่จำเป็นต้องหมายถึงมิติเชิงพื้นที่
อย่างปกติของความสูง ความยาว และความกว้าง
แต่ปัญหาบางอย่างอาจเกี่ยวข้องกับมิติเชิงพื้นที่ เช่น การค้นหาวิธีที่เหมาะสมที่สุดในการบรรจุกล่องสี่เหลี่ยมผืนผ้าลงในถังเก็บของทรงสี่เหลี่ยมผืนผ้า
โจทย์เกี่ยวกับกระเป๋าเป้หลายใบ
ซึ่งมีกระเป๋าสะพายข้างอยู่หลายใบ และ
เป้าหมายคือการเพิ่มมูลค่าของสินค้าในแพ็กทั้งหมดให้ได้สูงสุด
โปรดทราบว่าคุณสามารถมีปัญหาหลายมิติกับกระเป๋าสะพายใบเดียว
หรือปัญหาเกี่ยวกับกระเป๋าเป้สะพายหลังหลายมิติที่มีมิติข้อมูลเพียงมิติเดียว
ปัญหาเกี่ยวกับการบรรจุหีบห่อ
ปัญหาด้านการบรรจุหีบห่อที่เป็นที่รู้จักมากที่สุดอย่างหนึ่งคือbin-packing ซึ่งจะมีคอนเทนเนอร์หลายใบ (เรียกว่าbin-packing) ที่ความจุเท่ากัน จำนวนถังไม่ได้รับการแก้ไข ซึ่งต่างจากปัญหากระเป๋าสะพายหลังจำนวนมาก แต่ให้หาถังขยะที่น้อยที่สุดที่จะเก็บสินค้าทุกชิ้นไว้
ต่อไปนี้เป็นตัวอย่างง่ายๆ เพื่อแสดงให้เห็นความแตกต่างระหว่างปัญหากระเป๋าสะพายข้างจำนวนมากและปัญหาการบรรจุหีบห่อ สมมติว่าบริษัทหนึ่งมีรถบรรทุก แต่ละคันมีน้ำหนัก 18,000 ปอนด์และสินค้าต้องส่งหนัก 130,000 ปอนด์
กระเป๋าเป้หลายใบ: คุณมีรถบรรทุก 5 คัน และคุณต้องการโหลดสินค้าส่วนหนึ่งที่มีน้ำหนักสูงสุดลงในรถบรรทุกเหล่านั้น
การบรรจุหีบห่อ: คุณมีรถบรรทุก 20 คัน (มากเกินพอที่จะเก็บของได้ทั้งหมด)
และคุณต้องการใช้รถบรรทุกให้น้อยที่สุดที่จะจุได้ทั้งหมด
ส่วนต่อไปนี้จะแสดงวิธีแก้ปัญหาการบรรจุหีบห่อประเภทต่างๆ ด้วย "หรือ" เครื่องมือ โดยเริ่มจากปัญหาเกี่ยวกับกล่องบรรจุหีบห่อ
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-08-09 UTC
[null,null,["อัปเดตล่าสุด 2024-08-09 UTC"],[[["\u003cp\u003ePacking problems involve finding the best way to pack items into containers, often with capacity constraints.\u003c/p\u003e\n"],["\u003cp\u003eKnapsack problems focus on maximizing the value of packed items within a single or multiple containers with limited capacity.\u003c/p\u003e\n"],["\u003cp\u003eBin packing aims to minimize the number of containers needed to pack all items, using bins of equal capacity.\u003c/p\u003e\n"],["\u003cp\u003eMultidimensional and multiple knapsack problems are variations that consider additional item properties or multiple containers.\u003c/p\u003e\n"],["\u003cp\u003eOR-Tools provides solvers and algorithms for tackling various packing problem types, including knapsack and bin packing.\u003c/p\u003e\n"]]],["Packing problems aim to pack items into containers with fixed capacities, often maximizing the total size or value of packed items. Key problem types include knapsack problems, where items have values and the goal is to maximize the total value in a single container, and bin-packing, which minimizes the number of containers needed to hold all items. Variations like multidimensional and multiple knapsack problems exist, with additional constraints or containers. OR-Tools offers solvers for these problems.\n"],null,["# Packing\n\nThe goal of *packing* problems is to find the best way to pack a set of\nitems of given sizes into containers with\nfixed *capacities*. A typical application is loading boxes onto delivery trucks\nefficiently.\nOften, it's not possible to pack all the items, due to the capacity\nconstraints. In that case, the problem is to find a subset of the items with\nmaximum total size that will fit in the containers.\n\nThere are many types of packing problems. Two of the most important are\n*knapsack problems* and *bin packing*.\n\nKnapsack problems\n-----------------\n\nIn the simple knapsack problem, there is a single container (a knapsack).\nThe items have *values* as well as sizes, and\nthe goal is to pack a subset of the items that has maximum total value.\n\nFor the special case in which value is equal to size, the\ngoal is to maximize the total size of the packed items.\n\nOR-Tools provides several solvers for knapsack problems in its\n[algorithms library](/optimization/reference/algorithms).\n\nThere are also more general versions of the knapsack problem. Here are a couple\nof examples:\n\n- *Multidimensional knapsack problems* , in which the items have\n more than one physical quantity, such as weight and volume,\n and the knapsack has a capacity for each quantity. Here,\n the term *dimension*\n does not necessarily refer to the usual spatial\n dimensions of height, length, and width.\n However, some problems might involve spatial dimensions,\n for example, finding the optimal way to pack rectangular boxes into a\n rectangular storage bin.\n\n- [*Multiple knapsack problems*](/optimization/pack/multiple_knapsack),\n in which there are multiple knapsacks, and\n the goal is to maximize the total value of the packed items in all knapsacks.\n\nNote that you can have a multidimensional problem\nwith a single knapsack, or a multiple knapsack problem with just one\ndimension.\n\nThe bin-packing problem\n-----------------------\n\nOne of the most well-known packing problems is\n*bin-packing* , in which there are multiple containers (called *bins*) of\nequal capacity. Unlike the multiple knapsack problem, the number of bins is not\nfixed. Instead, the\ngoal is to find the smallest number of bins that will hold all the items.\n\nHere's a simple example to illustrate the difference between the\nmultiple knapsack problem and the bin-packing problem. Suppose a company has\ndelivery trucks, each of which has an 18,000 pound weight capacity, and 130,000\npounds of items to deliver.\n\n- Multiple knapsack: You have five trucks and you want to load a subset of the\n items that has maximum weight onto them.\n\n- Bin packing: You have 20 trucks (more than enough to hold all the items)\n and you want to use the fewest trucks that will hold them all.\n\nThe following sections show how to solve various types of packing problems with\nOR-Tools, starting with the [knapsack problem](/optimization/pack/knapsack)."]]