-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #600 from conjure-cp/enum-in-partition
Enum in partition
- Loading branch information
Showing
16 changed files
with
2,008 additions
and
8 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
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,64 @@ | ||
letting w be 6000 | ||
letting v be 6000 | ||
letting b be 2 | ||
|
||
letting groceries be new type enum{ | ||
"Bread", | ||
"Carrots", | ||
"Broccoli", | ||
"Spinach", | ||
"Apples", | ||
"Bananas", | ||
"Oranges", | ||
"Rice", | ||
"Cereal", | ||
"Soft Drinks", | ||
"Ice Cream" | ||
} | ||
|
||
letting weight be function( | ||
"Bread" --> 500, | ||
"Carrots" --> 500, | ||
"Broccoli" --> 600, | ||
"Spinach" --> 200, | ||
"Apples" --> 1000, | ||
"Bananas" --> 700, | ||
"Oranges" --> 900, | ||
"Rice" --> 1000, | ||
"Cereal" --> 500, | ||
"Soft Drinks" --> 1000, | ||
"Ice Cream" --> 700 | ||
) | ||
|
||
letting volume be function( | ||
"Bread" --> 1000, | ||
"Carrots" --> 1000, | ||
"Broccoli" --> 1500, | ||
"Spinach" --> 500, | ||
"Apples" --> 1500, | ||
"Bananas" --> 1000, | ||
"Oranges" --> 1600, | ||
"Rice" --> 1200, | ||
"Cereal" --> 700, | ||
"Soft Drinks" --> 2000, | ||
"Ice Cream" --> 1000 | ||
) | ||
|
||
letting importance be function( | ||
"Bread" --> 8, | ||
"Carrots" --> 7, | ||
"Broccoli" --> 8, | ||
"Spinach" --> 8, | ||
"Apples" --> 8, | ||
"Bananas" --> 7, | ||
"Oranges" --> 9, | ||
"Rice" --> 10, | ||
"Cereal" --> 7, | ||
"Soft Drinks" --> 4, | ||
"Ice Cream" --> 5 | ||
) | ||
|
||
find bags : partition (numParts 2) from groceries | ||
|
||
such that forAll bag in bags . (sum item in bag . weight(item)) <= 5000 | ||
|
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,4 @@ | ||
rm -rf conjure-output *.solution | ||
conjure solve eip.essence | ||
cat *.solution | ||
rm -rf conjure-output *.solution |
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,16 @@ | ||
Generating models for eip.essence | ||
Generated models: model000001.eprime | ||
Saved under: conjure-output | ||
Savile Row: model000001.eprime | ||
Running minion for domain filtering. | ||
Running solver: minion | ||
Copying solution to: eip.solution | ||
language Essence 1.3 | ||
|
||
letting bags be | ||
partition({"Bread", "Cereal", "Soft Drinks", "Ice Cream"}, | ||
{"Carrots", "Broccoli", "Spinach", "Apples", "Bananas", "Oranges", "Rice"}) | ||
$ Visualisation for bags | ||
$ "Bread" "Cereal" "Soft Drinks" "Ice Cream" | ||
$ "Carrots" "Broccoli" "Spinach" "Apples" "Bananas" "Oranges" "Rice" | ||
|
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
Oops, something went wrong.