-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ACN:Add new Packing Algorithm. Bins are sorted to optimize bin choos…
…ing.'
- Loading branch information
Showing
3 changed files
with
87 additions
and
3 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
Core/src/main/java/com/polytech4A/cuttingstock/core/packing/GuillotineSortBFFSortBin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* | ||
* * Project to resolve 2D cutting stock problem for Discreet Optimizations course at Polytech Lyon | ||
* * Copyright (C) 2015. CARON Antoine and CHAUSSENDE Adrien | ||
* * | ||
* * This program is free software: you can redistribute it and/or modify | ||
* * it under the terms of the GNU Affero General Public License as | ||
* * published by the Free Software Foundation, either version 3 of the | ||
* * License, or (at your option) any later version. | ||
* * | ||
* * This program is distributed in the hope that it will be useful, | ||
* * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* * GNU Affero General Public License for more details. | ||
* * | ||
* * You should have received a copy of the GNU Affero General Public License | ||
* * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
package com.polytech4A.cuttingstock.core.packing; | ||
|
||
import com.polytech4A.cuttingstock.core.model.Box; | ||
import com.polytech4A.cuttingstock.core.model.PlacedBox; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.Comparator; | ||
|
||
/** | ||
* Created by Antoine CARON on 26/04/2015. | ||
* | ||
* @author Antoine CARON | ||
* @version 1.0 | ||
*/ | ||
public class GuillotineSortBFFSortBin extends GuillotineSortBFF { | ||
|
||
public GuillotineSortBFFSortBin(ArrayList<Comparator<Box>> boxComparators) { | ||
super(boxComparators); | ||
} | ||
|
||
/** | ||
* Place the box on the pattern. | ||
* | ||
* @param bins List of bins that will be generated. | ||
* @param box Box to be placed. | ||
* @return The box that is now placed. Return null if it can't be placed. | ||
*/ | ||
@Override | ||
public PlacedBox generatePlacedBox(ArrayList<Bin> bins, Box box) { | ||
Collections.sort(bins); | ||
return super.generatePlacedBox(bins, box); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
.../src/test/java/com/polytech4A/cuttingstock/core/packing/GuillotineSortBFFSortBinTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* | ||
* * Project to resolve 2D cutting stock problem for Discreet Optimizations course at Polytech Lyon | ||
* * Copyright (C) 2015. CARON Antoine and CHAUSSENDE Adrien | ||
* * | ||
* * This program is free software: you can redistribute it and/or modify | ||
* * it under the terms of the GNU Affero General Public License as | ||
* * published by the Free Software Foundation, either version 3 of the | ||
* * License, or (at your option) any later version. | ||
* * | ||
* * This program is distributed in the hope that it will be useful, | ||
* * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* * GNU Affero General Public License for more details. | ||
* * | ||
* * You should have received a copy of the GNU Affero General Public License | ||
* * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
package com.polytech4A.cuttingstock.core.packing; | ||
|
||
/** | ||
* Created by Antoine CARON on 26/04/2015. | ||
* | ||
* @author Antoine CARON | ||
* @version 1.0 | ||
*/ | ||
public class GuillotineSortBFFSortBinTest extends GuillotineSortBFFTest { | ||
} |