-
Notifications
You must be signed in to change notification settings - Fork 25
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
rework docs: simpler readme/index, modeling file as goto place #349
Conversation
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.
Really like the new docs, it reads super smooth and touches upon all the major parts.
Left some suggestions for re-ordering, streamlining or typos :)
cpmpy/expressions/variables.py
Outdated
@@ -21,7 +21,7 @@ | |||
================== | |||
|
|||
A decision variable is a variable whose value will be determined by the solver. | |||
|
|||
h |
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.
?
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.
probably a typo
cpmpy/model.py
Outdated
if len(con) == 1: | ||
con = con[0] | ||
|
||
else: |
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 also be an elif but this is more readable
docs/modeling.md
Outdated
```python | ||
import cpmpy as cp | ||
``` | ||
which we will use below. |
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.
which is how we will use it?
docs/modeling.md
Outdated
|
||
`solution_hint()` tells the solver that it could use these variable-values first during search, e.g. typically from a previous solution: | ||
```python | ||
from cpmpy import * |
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.
use import cpmpy as cp?
docs/modeling.md
Outdated
You provide it with the name of the function you want to call, as well as the arguments: | ||
|
||
```python | ||
from cpmpy import * |
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.
use import cpmpy as cp?
docs/modeling.md
Outdated
Note that any argument given will be checked for whether it needs to be mapped to a native solver variable. This may give errors on complex arguments, or be inefficient. You can tell the `DirectConstraint` not to scan for variables with `noarg` argument, for example: | ||
|
||
```python | ||
from cpmpy import * |
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.
use import cpmpy as cp?
docs/modeling.md
Outdated
The `DirectConstraint("AddAllDifferent", iv)` is equivalent to the following code, which demonstrates that you can mix the use of CPMpy with calling the underlying solver directly: | ||
|
||
```python | ||
from cpmpy import * |
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.
use import cpmpy as cp?
@tias yes, this is better to avoid confusion. |
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.
sgtm! (execpt the typo)
pulled out the code changes, all other feedback should be in. I will merge this somewhere tomorrow, can still be improved afterwards |
merged different versions of 'usage' docs into the file 'modeling'
then reworked it substantially to be more extensive, to be oriented to starting users, and to Python users specifically, so little to no CP knowledge.
It raised a range of other questions/loose ends, some of them indicated in the text (to be removed), some of them half-implemented. All code changes in this PR will be spun out in separate pull requests.
I tried to be succinct yet introduce cases people should know about in
modeling.md
. Helene @363734 is this in line with what you were looking for? Anything you feel missing or should be clarified?