-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
1a53e58
commit b476f88
Showing
16 changed files
with
243 additions
and
97 deletions.
There are no files selected for viewing
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,10 @@ | ||
{ | ||
"cut_width": 10, | ||
"max_length": 1010, | ||
"target_sizes": [ | ||
{ | ||
"length": 500, | ||
"quantity": 4 | ||
} | ||
] | ||
} |
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,10 @@ | ||
{ | ||
"cut_width": 10, | ||
"max_length": 1000, | ||
"target_sizes": [ | ||
{ | ||
"length": 1000, | ||
"quantity": 4 | ||
} | ||
] | ||
} |
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 |
---|---|---|
@@ -1,11 +1,22 @@ | ||
{ | ||
"cut_width": 2, | ||
"max_length": 1500, | ||
"target_sizes": { | ||
"500": 11, | ||
"300": 7, | ||
"250": 5, | ||
"840": 3, | ||
"100": 12 | ||
} | ||
"cut_width": 5, | ||
"max_length": 2000, | ||
"target_sizes": [ | ||
{ | ||
"length": 750, | ||
"quantity": 5 | ||
}, | ||
{ | ||
"length": 500, | ||
"quantity": 5 | ||
}, | ||
{ | ||
"length": 300, | ||
"quantity": 10 | ||
}, | ||
{ | ||
"length": 100, | ||
"quantity": 15 | ||
} | ||
] | ||
} |
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 |
---|---|---|
@@ -1,9 +1,18 @@ | ||
{ | ||
"cut_width": 2, | ||
"max_length": 1500, | ||
"target_sizes": { | ||
"500": 6, | ||
"300": 4, | ||
"100": 4 | ||
} | ||
"cut_width": 5, | ||
"max_length": 1000, | ||
"target_sizes": [ | ||
{ | ||
"length": 500, | ||
"quantity": 4 | ||
}, | ||
{ | ||
"length": 300, | ||
"quantity": 3 | ||
}, | ||
{ | ||
"length": 100, | ||
"quantity": 1 | ||
} | ||
] | ||
} |
File renamed without changes.
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,10 @@ | ||
{ | ||
"cut_width": 0, | ||
"max_length": 1000, | ||
"target_sizes": [ | ||
{ | ||
"length": 500, | ||
"quantity": 4 | ||
} | ||
] | ||
} |
File renamed without changes.
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
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
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
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,33 @@ | ||
from app.solver.solver import ( | ||
_solve_bruteforce, | ||
_solve_FFD, | ||
) | ||
from tests.test_fixtures import * | ||
|
||
|
||
# close to the max for bruteforce! | ||
@pytest.mark.parametrize("solver", [_solve_bruteforce, _solve_FFD]) | ||
def test_m(testjob_m, solver): | ||
orig_job = testjob_m.model_copy(deep=True) | ||
solved = solver(testjob_m) | ||
|
||
assert solved == [[(500, '')], | ||
[(500, ''), (300, '')], | ||
[(500, ''), (300, '')], | ||
[(500, ''), (300, ''), (100, '')]] | ||
assert orig_job == testjob_m | ||
|
||
|
||
@pytest.mark.parametrize("solver", [_solve_FFD]) | ||
def test_l(testjob_l, solver): | ||
orig_job = testjob_l.model_copy(deep=True) | ||
solved = solver(testjob_l) | ||
|
||
assert solved == [[(750, ''), (750, ''), (300, ''), (100, '')], | ||
[(750, ''), (750, ''), (300, ''), (100, '')], | ||
[(750, ''), (500, ''), (500, ''), (100, ''), (100, '')], | ||
[(500, ''), (500, ''), (500, ''), (300, ''), (100, '')], | ||
[(300, ''), (300, ''), (300, ''), (300, ''), (300, ''), (300, ''), (100, '')], | ||
[(300, ''), (100, ''), (100, ''), (100, ''), (100, ''), (100, ''), (100, ''), (100, ''), | ||
(100, ''), (100, '')]] | ||
assert orig_job == testjob_l |
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
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,46 @@ | ||
from app.solver.solver import ( | ||
_solve_bruteforce, | ||
_solve_FFD, | ||
) | ||
from tests.test_fixtures import * | ||
|
||
|
||
@pytest.mark.skip(reason="bug #63") | ||
@pytest.mark.parametrize("solver", [_solve_bruteforce, _solve_FFD]) | ||
def test_cuts(testjob_cuts, solver): | ||
orig_job = testjob_cuts.model_copy(deep=True) | ||
solved = solver(testjob_cuts) | ||
|
||
assert solved == [ | ||
[(500, ''), (500, '')], | ||
[(500, ''), (500, '')] | ||
] | ||
assert orig_job == testjob_cuts | ||
|
||
|
||
@pytest.mark.skip(reason="bug #59") | ||
@pytest.mark.parametrize("solver", [_solve_bruteforce, _solve_FFD]) | ||
def test_zero_cuts(testjob_zero_cuts, solver): | ||
orig_job = testjob_zero_cuts.model_copy(deep=True) | ||
solved = solver(testjob_zero_cuts) | ||
|
||
assert solved == [ | ||
[(500, ''), (500, '')], | ||
[(500, ''), (500, '')] | ||
] | ||
assert orig_job == testjob_zero_cuts | ||
|
||
|
||
@pytest.mark.skip(reason="bug #64") | ||
@pytest.mark.parametrize("solver", [_solve_bruteforce, _solve_FFD]) | ||
def test_equal(testjob_equal, solver): | ||
orig_job = testjob_equal.model_copy(deep=True) | ||
solved = solver(testjob_equal) | ||
|
||
assert solved == [ | ||
[(1000, '')], | ||
[(1000, '')], | ||
[(1000, '')], | ||
[(1000, '')] | ||
] | ||
assert orig_job == testjob_equal |
Oops, something went wrong.