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

Class and function documentation #333

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Dimosts
Copy link
Collaborator

@Dimosts Dimosts commented May 31, 2023

Having basic documentation of the functionality of classes and functions would be quite nice.

Following discussions in person, I generated automatically documentation starting for the global constraint classes. The documentation was auto generated using codiumAI (pycharm extention).

Let's see if it is good enough and if yes we can proceed with more functions and classes.

In the first commit, only the text generated automatically is included. In following commits I will check the texts and maybe change some parts if needed

"""
Main functionalities:
The Xor class is a subclass of the GlobalConstraint class and represents the exclusive-or constraint. It takes a list
of Boolean arguments and enforces that exactly one of them is true.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not quite correct: "xor" is true iff the number of true variables in the given list is odd (with only two arguments, xor is indeed equivalent to 'exactly one is true', but we allow more).

"""
Main functionalities:
The Element class is a CPMpy built-in global constraint that enforces that the result equals Arr[Idx] with 'Arr' an
array of constants of variables (the first argument) and 'Idx' an integer decision variable, representing the index into
Copy link
Collaborator

Choose a reason for hiding this comment

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

'of variables' -> 'or variables'

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think 'Idx' is not a "decision variable", but can ben any integer expression.

@JoD
Copy link
Collaborator

JoD commented Jun 2, 2023

I both like and hate this: it is 95% correct, and figuring out where it is incorrect is time consuming. I'd allow this if we put an "AI-generated"-tag next to it. People can remove that tag once they checked it manually.

It reminds me of why StackOverflow forbade the use of AI-generated answers: it looks correct, but figuring out whether it is correct is hard.

@Dimosts Dimosts added the blocked Pull request blocked by another pull request/issue. label Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Pull request blocked by another pull request/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants