Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

guicho271828
Copy link
Contributor

No description provided.

@@ -1,6 +1,6 @@
#!/usr/bin/ruby

require 'ftools'
Copy link
Member

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.

Copy link
Collaborator

@jendrikseipp jendrikseipp left a 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
Copy link
Collaborator

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.
Copy link
Collaborator

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
"""
Copy link
Collaborator

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)")
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants