Answers.Body: <p>You might want to start on googling the &quot;Irregular Cutting Stock Problem&quot;. I think your problem formulation is similar to Irregular Cutting Stock Problem. Some cool papers are up in the results such as this <a href="https://doi.org/10.1155/2016/8703782" rel="nofollow noreferrer">heuristic method</a> which is tested on real-world based problem instances.</p>
  <p>By browsing the existing heuristic/metaheuristic methods, you may get inspiration on how to represent the solution, how to evaluate immediate shapes placement, and the existing local search operators. By then, you can try ML-based adaptive operator selection (AOS) method so that given the current state of the sheet and the existing shapes, you can choose the &quot;best&quot; local search operator to improve the placement. On the other hand, if you can embed the current state of the sheet as well as the current considered shape, you can predict the action of placing that shape (x,y,rotation degree) and train your model with RL methods assuming you have defined the appropriate reward function for the action you've taken.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-30T13:18:26.990Z
Answers.Text: Hey Sanyou, thanks a lot for your response. I wanted to create my own environment with OpenAI Gym with the action space *select one of the three shapes, rotate it when you want and place it in the area*. Positiv rewards are given for placing a shape, considering the minimum distance of the shapes. When there is an overlap between shapes or the edge of the area then the reward is negativ. These rewards are given after every disposal of shapes. At the end (agent cannot place a further shape) I think I have to give also rewards concerning the quantity of shapes and the waste...
Answers.UserDisplayName: tueftla
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-30T14:56:18.700Z
Answers.Text: I think setting up the AI gym is straightforward as it is returning "raw" state and action choice(?) The challenge though is the reward function. The gym can be helpful, similiar to what you said, by giving penalty or do nothing when constraint is violated e.g.. shapes are intersected, or even terminate early. I said helpful because careful reward function design can help the model learn better. As for the final reward i.e., number of shapes and wasted area, you can aggregate them by linear/nonlinear combination, or you can treat them as separate reward and turn this into Multiple Objective RL
Answers.UserDisplayName: Sanyou
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-30T09:22:29.240Z
Answers.LastActivityDate: 2021-09-30T09:22:29.240Z
Answers.UserDisplayName: Sanyou
Body: <p>I have a rectangular area, where I need to place some 2 dimensional geometrical shapes - like a square or circle or a little more complicated shapes. And after the arrangement these shapes should be cut out.</p>
  <p>Requirements to the disposal of shapes:</p>
  <ul>
  <li>These shapes are not allowed to intersect</li>
  <li>And also they must disposed on the recatangular area</li>
  <li>They must have at least a minimum distance</li>
  <li>The waste should be minimized</li>
  <li>When more than one shape is arranged on this area it is desirably that the shapes have a certain quantity (e.g. shape A: 50 %, shape B: 30 %, shape C: 20 %)</li>
  </ul>
  <p>After the arrangement I get the coordinates of the single shapes so that I can cut out my shapes...</p>
  <p>To solve this I thought of (deep) reinforcement learning but <strong>because I'm new to ML</strong> I'm not sure if there is a more appropriate method to solve this problem.</p>
  <p>I hope that you can give me some hints or simply confirm my assumption that (deep) reinforcement learning is appropriate. And perhaps you can also offer me some useful links...</p>
  <p>Many thanks in advance for your help!</p>
  <p>And lastly a little picture which is showing a possible bad result because shape A and shape E intersect. And probably there is to much waste.</p>
  <p><a href="https://i.sstatic.net/ezNpy.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ezNpy.png" alt="enter image description here" /></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-09-30T07:48:00.963Z
Comments.Text: Have you looked at https://en.wikipedia.org/wiki/Knapsack_problem ?
Comments.UserDisplayName: Oliver Mason
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-09-30T08:23:48.977Z
Comments.Text: @OliverMason: I know the Knapsack problem, but I‘m not sure how I can solve my problem with this. For me it‘s necessary to know the distinct position of the shapes on the rectangular area. After a proper positioning I want to cut the shapes out. I edited also my question for hope of being more precise...
Comments.UserDisplayName: tueftla
Tags: <machine-learning><reinforcement-learning><deep-rl><ai-design><ai-basics>
Title: Appropriate ML algorithm to solve a cutting pattern problem
UserDisplayName: tueftla
ThreadText: # Appropriate ML algorithm to solve a cutting pattern problem
  
  (Asked by: username_0 on 2021-09-30)
  
  I have a rectangular area, where I need to place some 2 dimensional geometrical shapes - like a square or circle or a little more complicated shapes. And after the arrangement these shapes should be cut out.
  
  Requirements to the disposal of shapes:
  
  * These shapes are not allowed to intersect
  * And also they must disposed on the recatangular area
  * They must have at least a minimum distance
  * The waste should be minimized
  * When more than one shape is arranged on this area it is desirably that the shapes have a certain quantity (e.g. shape A: 50 %, shape B: 30 %, shape C: 20 %)
  
  After the arrangement I get the coordinates of the single shapes so that I can cut out my shapes...
  
  To solve this I thought of (deep) reinforcement learning but **because I'm new to ML** I'm not sure if there is a more appropriate method to solve this problem.
  
  I hope that you can give me some hints or simply confirm my assumption that (deep) reinforcement learning is appropriate. And perhaps you can also offer me some useful links...
  
  Many thanks in advance for your help!
  
  And lastly a little picture which is showing a possible bad result because shape A and shape E intersect. And probably there is to much waste.
  
  [![enter image description here](https://i.sstatic.net/ezNpy.png)](https://i.sstatic.net/ezNpy.png)
  
  **Tags:** machine-learning, reinforcement-learning, deep-rl, ai-design, ai-basics
  
  > **Comments:**
  > **username_1**: Have you looked at https://en.wikipedia.org/wiki/Knapsack_problem ?  
  > **username_0**: @username_1: I know the Knapsack problem, but I‘m not sure how I can solve my problem with this. For me it‘s necessary to know the distinct position of the shapes on the rectangular area. After a proper positioning I want to cut the shapes out. I edited also my question for hope of being more precise...  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2021-09-30. Score: 0 | Accepted answer
  
  You might want to start on googling the "Irregular Cutting Stock Problem". I think your problem formulation is similar to Irregular Cutting Stock Problem. Some cool papers are up in the results such as this [heuristic method](https://doi.org/10.1155/2016/8703782) which is tested on real-world based problem instances.
  
  By browsing the existing heuristic/metaheuristic methods, you may get inspiration on how to represent the solution, how to evaluate immediate shapes placement, and the existing local search operators. By then, you can try ML-based adaptive operator selection (AOS) method so that given the current state of the sheet and the existing shapes, you can choose the "best" local search operator to improve the placement. On the other hand, if you can embed the current state of the sheet as well as the current considered shape, you can predict the action of placing that shape (x,y,rotation degree) and train your model with RL methods assuming you have defined the appropriate reward function for the action you've taken.
  
  > **Comments:**
  > **username_0**: Hey username_2, thanks a lot for your response. I wanted to create my own environment with OpenAI Gym with the action space *select one of the three shapes, rotate it when you want and place it in the area*. Positiv rewards are given for placing a shape, considering the minimum distance of the shapes. When there is an overlap between shapes or the edge of the area then the reward is negativ. These rewards are given after every disposal of shapes. At the end (agent cannot place a further shape) I think I have to give also rewards concerning the quantity of shapes and the waste...  
  > **username_2**: I think setting up the AI gym is straightforward as it is returning "raw" state and action choice(?) The challenge though is the reward function. The gym can be helpful, similiar to what you said, by giving penalty or do nothing when constraint is violated e.g.. shapes are intersected, or even terminate early. I said helpful because careful reward function design can help the model learn better. As for the final reward i.e., number of shapes and wasted area, you can aggregate them by linear/nonlinear combination, or you can treat them as separate reward and turn this into Multiple Objective RL  
  
  ---
  
  