-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rewrite Pegsol in python #20
base: main
Are you sure you want to change the base?
Conversation
@@ -1,6 +1,6 @@ | |||
#!/usr/bin/ruby | |||
|
|||
require 'ftools' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If ftools/fileutils is only used to create non-nested directories, then Dir.mkdir(string)
is enough.
No need to require a library that may change again in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good. I have some minor nitpicks, though. And we'll need a simple test for the new script.
@@ -1,2 +1,4 @@ | |||
test: | |||
ruby converter.rb | |||
# ruby -I. generator.rb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove the comment?
@@ -1,2 +1,4 @@ | |||
test: | |||
ruby converter.rb | |||
# ruby -I. generator.rb | |||
./pegsol-instances.py # Only analyzes instances, doesn't generate them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a simple test for the new Python script?
|
||
The original code was probably written for ruby 1.8. | ||
The code was fixed for ruby 2.x. | ||
This ruby code reproduces instances takes from the book. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ruby code reproduces instances takes from the book. | |
This ruby code reproduces instances taken from the book. |
|
||
""" | ||
A randomized Pegsol generator for sequential STRIPS with negative preconditions. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add: "Generated instances are not guaranteed to be solvable."
parser.add_argument("--rowcuts", type=int, default=2, help="Number of rows to cut from each corner. Should be less than floor(rows/2)") | ||
parser.add_argument("--colcuts", type=int, default=2, help="Number of cols to cut from each corner. Should be less than floor(cols/2)") | ||
parser.add_argument("occupancy", type=float, help="Probability that the pegs are initially occupied. (0, 1]") | ||
# parser.add_argument("--european", action="store_true", help="If present, corners are cut in a triangular form (a European pegsol board)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment.
# cols = 7 | ||
# rowcuts = 2 | ||
# colcuts = 2 | ||
# occupancy = 0.8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment?
No description provided.