## Algorithm for cutting rods with minimum waste

Given a set of cuts and their lengths we need to find out the minimum number of rods (of constant length) and the cuts required which will lead to minimum wastage.

Here we bundle the rods and cut them all at once. So we can have a bundle with any number of rods.

For example:

Input data – Consider a rod of length 120 inches

( Quantity of Cuts Required, Length (in inches) ) = (5,16") , (5,30") , (24,36") , (4,18") , (4,28") , (6,20")

So here we required cuts such that we get 5 rods of 16 inches, 5 rods of 30 inches..so on.

Output:

Imagine each row (in the image) is a rod of 120 inches and each table is a bundle with rows as the number of rods in that bundle. So the first table is a bundle with 5 rods with cuts [16,30,36,36] and second table is a bundle of 4 rods with cuts [18,28,36,36] and so on. We can see that we have satisfied the input data we get (5,16") five rods of sixteen inches and so on.

Given input with (just like above) number of cuts and their lengths. how do we find the bundle of rods and their cuts having minimum amount of wastage?

## ICPC DP Question: Cutting a slab of marble, such that we minimize the amount of wasted marble

I’m struggling to come up with an approach towards this problem. Any hints would be much appreciated.

## Cutting Words timing when playing online

Lore Bard’s Cutting Words feature states the following:

Also at 3rd level, you learn how to use your wit to distract, confuse, and otherwise sap the confidence and competence of others. When a creature that you can see within 60 feet of you makes an attack roll, an ability check, or a damage roll, you can use your reaction to expend one of your uses of Bardic Inspiration, rolling a Bardic Inspiration die and subtracting the number rolled from the creature’s roll. You can choose to use this feature after the creature makes its roll, but before the DM determines whether the attack roll or ability check succeeds or fails, or before the creature deals its damage. The creature is immune if it can’t hear you or if it’s immune to being charmed.

What exactly does that mean. At what time do I have to say my DM I interrupt them?

When playing at a table, my DM usually goes this way: “The goblin attacks [player character] with their bow and [rolls] hits”. I can hear the dice roll and I say I want to know the result in order to decide if I want to use Cutting Words.

Now with the current sanitary situation, we play online, and the DM usually rolls their own physical dice and tells whether it hits or not because they have all our ACs registered. This basically forbids me to use my Cutting Words.

So what is the exact timing where I can interrupt the DM, online, and use my Cutting Words?

## Can a Multiclass Bard/Druid use cutting words while wild-shaped

I’m playing a 6th level bard/2nd level Druid and I was wondering if I could use cutting words while using the feature wild-shape.

My DM wasn’t sure, so I was wondering if you could enlighten me on the subject.

## Optimal substructure of rod cutting?

How do you show the optimal substructure of the rod cutting problem(defined as in Optimal substructure and dynamic programming for a variant of the rod cutting problem). I am trying to follow the guideline steps

So suppose someone told us one of the cuts of the rod $$R$$ in an optimal solution OPT for $$R$$.

This cut of OPT paritions $$R$$ into two smaller rods $$R_1$$ and $$R_2$$, one of length $$i$$, and the other of length $$n-1$$.

Here is the only argument that I can think of: (Again, trying to follow steps 3 and 4 now but the argument does not seem like one that would suffice)

Suppose that $$R_1$$ is not an optimal solution in itself, then OPT would not have given an optimal cut in the first place which contradicts our starting supposition that OPT is an optimal solution.

Also, the argument seems too “easy” to appear like something that is not just informal.

How would you prove the optimal substructure?

## Cutting matrix in 2 congruent pieces [closed]

I have a matrix with 0 and 1. The 1 resembles a pattern , a shape. Cut the shape in 2 congruent pieces and make it in the matrix with 2 and 3. In c++ and keep it simple pls

## What are some variants of the rod cutting problem?

I am looking at the possible implementations for solving the rod cutting problem (CLRS). Do you know of any variants of this problem and their use in industry?

## Label Die Cutting Machine

Specifications for automatic flat bed die cutting machine
Model LT-320B LT-420B LT-520B
Die Cutting speed 20-300 pcs/min 20-300 pcs/min 20-280 pcs/min
Max. unwinding diameter 500mm 500mm 500mm
Max. web width 320mm 420mm 520mm
Max. die cutting size 320x300mm 420x400mm 520x500mm
Precision 卤0.10mm 卤0.10mm 卤0.10mm
Power 7.5kw 7.5kw 8kw
Voltage 380v卤10% 380v卤10% 380v卤10%
Machine weight 1800kg 2100kg 2500kg
Dimension 2700x1050x1400mm 2900x1150x1400mm 2900x1250x1400mm
Application
1. Glue-based products: 3C parts, foot pad, silicone, velcro backing, conductive tape, double-side tape, 3M tape and all kinds of glue-based products.
2. Dust-proof materials: cosmetic cotton, camera cotton, high density sponge, filtering sponge, dust-proof filter, non-woven fabric, etc.
3. Shockproof materials: EVA tape, rubber cushion, PORON cushion, 3M, flame-resistant EVA, EPDM, etc.
4. Insulation/shielding materials: EMI Shielding material, fireproof paper, aluminum foil, copper foil, PVC, PET, k paper, sponge sheath, pearl cotton sheath and so on.
5. Heat-conductive/ heat-proof materials : silicon sheet, transparent mica, fiber cloth, heat insulation cotton and so on.
6. Other materials which are suitable for die cutting.
Machine specification
All of our products passed the and sgs certification
Manufacture and exporting all kinds of paper and plastic packing machine, such as slitting and rewinding machine, flexo printing machine gravure printing machine,paper cutting machine, A4 paper cutting machine, rotary paper sheeting machine, paper core making machine,paper core cutting machine,coating and laminating machine and plastic bag making machine.
We have a young, motivated and excellent team, which is led by packing machine experts. Our philosophy is “Professional lead you to success “. Label Die Cutting Machine
website:http://www.cuttingmachinecn.com/die-cutting-machine/label-die-cutting-machine/

## CNC Cutting Machine

The group is consisted of Dongtai Yaoqiang machinery Co.,Ltd & Jiangsu Silver Coast International Trade Development Co.,Ltd. The group owns modern office building and professional manufacturing plant which includes 2 sets of workshops connecting to each other and total 150,000 square meters. Holding the idea of humanity first, customer supreme, the group always contributes to optimize modern management and customer service system, thus to enhance Yaoqiang Technology as a high-tech enterprice brand, build top creative team to make ourselves being a base of whole set, heavy type welding equipments production.

Mainly engaged in research & develop and product H-beam welding production line (light type, heavy type), box beam welding production line, horizontal assembly&welding production line, shot blasting machine and CNC drilling & milling & shotting & blasting all in one CNC steel structure secondary processing equipment, end milling, milling machine, CNC plasma, fine plasma cutting precision machinery, is the biggest steel structure equipment manufacturing base.

The products are widely used in steel structure, shipbuilding, bridge building, boiler, chemical industry, metallurgy, electrical power industries etc.

We have passed the ISO CE SGS testing standard, besides, our machine have honor to won many patents, like H-beam manufacturing equipment patents, fuel tank in wall clean machine patents and etc.

We also use advanced equipment. Which allow us to working by a high precision and to manufacture the customized machines according your requires.

We have exported to more than 20 countries. UK, USA, Russia, Spain, ARGENTINA, South Korea, Singapore, Iran, EGYPT, VIETNAM, Bengal Bulgaria, and other countries, gradually into the machinery manufacturing developed countries.

Our professionally foreigner-sales team is on hand to assure the quality and effectiveness of your machine purchase. We will attend and manage your orders and enquiries very carefully to assist you to choosing the best machine to fit your needs and also to help you to save more during your business.
The Technical Department and Sales Department are working coordinately to achieve the best solution for you and attend faster your requirements. Our team is committed to bring you professional and fast solutions that will meet your business requirements, helping you to produce tangible business outcomes for your company.CNC Cutting Machine
website:http://www.wxsilvercoast.com/

## Why this greedy algorithm fails in rod cutting problem?

Recall the rod cutting problem.

Given a rod of length $$n$$ inches and a table of prices $$p_{i}$$ for $$i=1,2,3,4,\,.\,.\,.$$ determine the maximum revenue $$r_n$$ obtainable by cutting up the rod and selling the pieces. You may assume no cutting cost.

The following is a question from CLRS 15.1-2.

Show, by means of a counterexample, that the following ‘greedy’ strategy does not always determine an optimal way to cut rods. Define the density of a rod of length i to be p_i/i, that is, its value per inch. The greedy strategy for a rod of length n cuts off a first piece of length i, where 1≤i≤n, having maximum density. It then continues by applying the greedy strategy to the remaining piece of length n-i.

Consider prices up to length $$4$$ are $$p_1=1, p_2=5, p_3= 8, p_4 = 9$$ respectively. So, densities are $$d_1=1, d_2 = 2.5, d_3= 2.67, d_4 = 2.25$$ respectively.

If we are given a rod of length $$4,$$ then an optimal way of cutting the rod to maximize revenue is $$2$$ pieces of length $$2$$ each, generating $$5+5 = 10.$$

However, greedy algorithm above will suggest cutting the rod into 2 pieces of length $$3$$ and $$1$$, generating revenue $$8+1=9.$$

I obtain this example by merely following the same prices given in CLRS but do not understand why such greedy algorithm fails to provide optimal way of cutting the rod.