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

Linear Programming in Tutorial's Tour ! #6765

Closed
nathanncohen mannequin opened this issue Aug 16, 2009 · 17 comments
Closed

Linear Programming in Tutorial's Tour ! #6765

nathanncohen mannequin opened this issue Aug 16, 2009 · 17 comments

Comments

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Aug 16, 2009

Hello !!!

Following http://groups.google.com/group/sage-devel/browse_thread/thread/9d9b09274f1eab83/79938a2139ba25d9?lnk=gst&q=isr#79938a2139ba25d9 , here is the requested Tutorial page for Linear Programming.

To doctest it, you will need the spkg GLPK from #6867 and numerical.MIP from #6869

I hope you will like it !!! And thanks to Minh for helping me with Sphinx !

CC: @sagetrac-mvngu

Component: documentation

Reviewer: John Palmieri

Issue created by migration from https://trac.sagemath.org/ticket/6765

@nathanncohen nathanncohen mannequin added this to the sage-4.3 milestone Aug 16, 2009
@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Aug 22, 2009

folded patch

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Aug 22, 2009

comment:2

Attachment: trac_6765-tutorial-lp-folded.patch.gz

The patch trac_6765-tutorial-lp-folded.patch folds all three patches in tutorial_lp.patch. With the folded patch, changes are easier to review. Only trac_6765-tutorial-lp-folded.patch should be reviewed.

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Aug 23, 2009

comment:3

I get the following error even after installing both GLPK and CBC:

----------------------------------------------------------------------
| Sage Version 4.1.1, Release Date: 2009-08-14                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: linear_function = {"variable1" : 2, "variable2" : -1}
sage: linear_function = {1 : 2, 2 : -1}
sage: linear_function={(1,1) : 1, (1,2) : 2, (2,1) : 3, (2,2) : 4}
sage: p = MIP(sense=1)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

/home/mvngu/.sage/temp/sage.math.washington.edu/28962/_home_mvngu__sage_init_sage_0.py in <module>()

NameError: name 'MIP' is not defined

Nathann, you need to give commands on how to use the MIP capabilities of CBC. Where is MIP() defined? How do I import and use it? Please include those information in your patch.

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Aug 23, 2009

comment:4

Here's a conversion in IRC with Nathann:

05:00 < ncohen> mvngu: I do not understand the problem you have with MIP. It seems you copied some part of the examples into Sage
05:00 < ncohen> mvngu: and Sage answered it did not know where to find the class MIP
05:01 < ncohen> mvngu: even though I have added in sage/numerical/all.py a line : from MIP import *
05:01 < mvngu> ncohen: David Joyner replied to me in an email that it depends on #6502.
05:01 < mvngu> So I'll mark #6765 as depending on #6502.
05:02 < ncohen> ooooops
05:02 < ncohen> sorry ^^;
05:02 < mvngu> This means that #6502 must be merged first.
05:02 < ncohen> I've been working on this for some timme so sometimes I forget about it... ^^;
05:02 < ncohen> indeed
05:02 < ncohen> the thing is that I already posted something like 5 or 6 patches based upon #6502
05:02 < ncohen> LP is so useful for graphs !
05:03 < mvngu> Since GLPK is an optional spkg at the moment, so the doctests that depends on GLPK should be flagged as optional.
05:03 < mvngu> Do so with the flag "# optional" in doctests.
05:04 < mvngu> That way, when the test suite is run, anything with the flag "# optional" would be skipped over.
05:04 < mvngu> Unless you have the required optional spkg installed.
05:05 < ncohen> I see... :-/
05:05 < mvngu> And any doctests that depend on CBC must also be flagged as "# optional".

Also, this ticket depends on #6502.

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Aug 24, 2009

comment:5

I just updated tutorial_lp.patch. Please do not use trac_6765-tutorial-lp-folded.patch which is now an outdated version !

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Aug 31, 2009

comment:6

As the functions dealing with LP have not been reviewed, I prefer to rewrite the MIP class for Sage to make it easier to use. I will post a new version of the MIP patch as soon as possible, along with all the patches for functions using it.

Sorry for the trouble, I'll try to make it quick !

Nathann

@nathanncohen

This comment has been minimized.

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Sep 3, 2009

comment:9

The new LP tutorial matching the Trac ticket #6869 is here, ready for review ;-)

Nathann

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Sep 29, 2009

Attachment: tutorial_lp.patch.gz

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Sep 29, 2009

comment:10

New version coherent with the changes from #7012

@jhpalmieri
Copy link
Member

Reviewer: John Palmieri

@jhpalmieri
Copy link
Member

comment:11

Some comments:

(1) When I run "sage -docbuild tutorial html", it complains

/Applications/sage/devel/sage/doc/en/tutorial/tour_LP.rst:64: (WARNING/2) Title underline too short.

Variables in ``MixedIntegerLinearProgram``
""""""""""""""""""""""""""

The string of double quotes should line up exactly with the previous line. (Maybe it's good enough it is at least as long, but I think it should be the same length.)

(2) In a string like minimized ( for example `2 x + y` ), you shouldn't have a space after ( or before ): it should say minimized (for example `2 x + y`). This happens throughout the document. Along the same lines, there should be no space before "?" or before ":". Before a block of examples (like lines 69-70), I think you want a visible colon, and you achieve that by having "::" with no preceding space. (Using "::" with a preceding space signals a block of examples but doesn't print a colon at all.)

(3) On line 75, "remperature" should presumably be "temperature". Try running a spell check.

(4) You don't have a period at the sentence ending the paragraph "What is a Mixed Integer Linear Program ?" I haven't done any more careful proofreading, but you should check for other spelling, usage, and grammar errors.

(5) In multiline doctests, you need to change "....:" to "...". As it stands, doctesting bombs on these lines.

(6) If I don't have GLPK or numerical.MIP installed, doctests have to pass anyway. Also, if I don't have them, I absolutely don't want doctesting to try to install them, which the lines

     sage: # To install GLPK
     sage: install_package('glpk')
     sage: # To install Coin-OR Branch and Cut ( CBC )
     sage: install_package('cbc')

will do. Maybe mark those lines as "# not tested"?

@jhpalmieri
Copy link
Member

comment:12

One more thing: since the content depends on the optional packages, you should say that at the beginning of the section, not the end. Otherwise, someone may start working through the examples, only to have nothing go as advertised, and they quit trying before they get to the disclaimer at the end.

@williamstein
Copy link
Contributor

comment:13

We (me, John P., and Minh) discussed this on irc and think that optional packages shouldn't be required to work through the main Sage tutorial.

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Dec 8, 2009

comment:14

Feel free to open another ticket to put the linear programming tutorial in the Constructions document.

@sagetrac-mvngu sagetrac-mvngu mannequin removed this from the sage-4.3 milestone Dec 8, 2009
@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Dec 10, 2009

comment:15

Could I do the same with my former ( and refused ) Graph Tour ?

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Dec 10, 2009

comment:16

Replying to @nathanncohen:

Could I do the same with my former ( and refused ) Graph Tour ?

Sure! Go for it.

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

No branches or pull requests

2 participants