Closed 6bdad4c1-1e26-4f2f-a442-a01a2292c181 closed 15 years ago
Class sage.numerical.mip
Attachment: 12428.patch.gz
If you want to try this code, you will find a short example there :
http://groups.google.com/group/sage-devel/browse_thread/thread/7c13a0a4ba3d87b6
Compiles and installs successfully on Sage 4.0.1 on Ubuntu x86.
The methods in MIP should have doctests/docstrings. e.g. I should be able to type
sage: MIP.addBound?
and see a nice example for how to add a bound.
I agree, this needs docstrings.
Installation of the spkg went fine on a macbook running 10.4.11. The patch seemed to apply okay. sage -testall on 4.1.rc1 passed except for failures in parallel/decorate (DeprecationWarning: os.popen2 is deprecated. ) and interfaces/sage0 (which could not be replicated).
The examples given in the sage-devel email (below) seemed to work okay, though I am not an expert on this stuff.
g=graphs.RandomGNP(10,.5)
p=MIP(max=True)
obj={}
for i in g.vertices():
obj["V"+str(i)]=1
p.setinteger("V"+str(i))
p.setobj(Constraint(obj,obj=True))
for (a,b,c) in g.edges():
obj={}
obj["V"+str(a)]=1
obj["V"+str(b)]=1
p.addconstraint(Constraint(obj,lt=1))
p.solve()
Patch numerical.mip-2.patch applies on top of 2428.patch
I hope you will like it !! I spent a lot of time on this LP for SAGE ! ;-)
Attachment: numerical.mip-2.patch.gz
Description changed:
---
+++
@@ -2,5 +2,3 @@
http://groups.google.com/group/sage-devel/browse_thread/thread/9da47e06bcdfc49f
This is the class sage.numerical.mip which is meant to be the common interface between SAGE and 3 different LP solvers : GLPK, Coin-Or, and CPLEX.
-
-For the moment, I only wrote the interface with Coin-Or, which I needed and which seems to work for simple problems. I will improve it over time, but it can already be used and I hope you will like it :-)
Description changed:
---
+++
@@ -2,3 +2,6 @@
http://groups.google.com/group/sage-devel/browse_thread/thread/9da47e06bcdfc49f
This is the class sage.numerical.mip which is meant to be the common interface between SAGE and 3 different LP solvers : GLPK, Coin-Or, and CPLEX.
+
+Trac ticket for GLPK : https://github.com/sagemath/sage-prod/issues/6602
+Trac ticker for COIN : https://github.com/sagemath/sage-prod/issues/6603
A small mistake in the detection of COIN -- fixed ! ;-)
Attachment: numerical.mip-3.patch.gz
Once this ticket has positive review, the SPKG at #6602 should also be merged in the standard packages repository. So in a sense, that SPKG is dependent on this ticket.
I got this problem:
wdj@hera:~/sagefiles/sage-4.1.1.alpha0$ ./sage
----------------------------------------------------------------------
| Sage Version 4.1.1.alpha0, Release Date: 2009-07-20 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
Loading Sage library. Current Mercurial branch is: OR2
sage: hg_sage.apply("/home/wdj/sagefiles/12428.patch")
cd "/home/wdj/sagefiles/sage-4.1.1.alpha0/devel/sage" && hg status
/home/wdj/sagefiles/sage-4.1.1.alpha0/local/lib/python2.6/site-packages/sage/misc/hg.py:240: DeprecationWarning: os.popen3 isdeprecated. Use the subprocess module.
x = os.popen3(s)
cd "/home/wdj/sagefiles/sage-4.1.1.alpha0/devel/sage" && hg status
cd "/home/wdj/sagefiles/sage-4.1.1.alpha0/devel/sage" && hg import "/home/wdj/sagefiles/12428.patch"
applying /home/wdj/sagefiles/12428.patch
patching file module_list.py
Hunk #1 succeeded at 240 with fuzz 2 (offset 13 lines).
patching file sage/numerical/all.py
Hunk #1 FAILED at 0
1 out of 1 hunks FAILED -- saving rejects to file sage/numerical/all.py.rej
abort: patch failed to apply
Any suggestions?
Replying to @wdjoyner:
I got this problem:
New patch including all the previously announced features and probably a bit more. It encompasses the previous patches, so you need only apply this one and forget about the others ! ;-)
Attachment: MIP-1.patch.gz
This was applied to 4.1.1.a0 and the following test failed:
zeus:~/sagefiles/sage-4.1.1.alpha0 davidjoyner$ ./sage -t "devel/sage/sage/numerical/mip.pyx"
sage -t "devel/sage/sage/numerical/mip.pyx"
sh: line 1: kpsewhich: command not found
sh: line 1: kpsewhich: command not found
**********************************************************************
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/devel/sage/sage/numerical/mip.pyx", line 37:
sage: p=MIP(sense=1)
Exception raised:
Traceback (most recent call last):
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_0[3]>", line 1, in <module>
p=MIP(sense=Integer(1))###line 37:
sage: p=MIP(sense=1)
NameError: name 'MIP' is not defined
**********************************************************************
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/devel/sage/sage/numerical/mip.pyx", line 39:
sage: for i in g.vertices():
Exception raised:
Traceback (most recent call last):
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_0[5]>", line 1
for i in g.vertices():###line 39:
sage: for i in g.vertices():
^
SyntaxError: unexpected EOF while parsing
**********************************************************************
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/devel/sage/sage/numerical/mip.pyx", line 40:
sage: obj[i]=1
Exception raised:
Traceback (most recent call last):
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_0[6]>", line 1
obj[i]=Integer(1)###line 40:
sage: obj[i]=1
^
IndentationError: unexpected indent
**********************************************************************
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/devel/sage/sage/numerical/mip.pyx", line 41:
sage: p.setinteger(i)
Exception raised:
Traceback (most recent call last):
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_0[7]>", line 1
p.setinteger(i)###line 41:
sage: p.setinteger(i)
^
IndentationError: unexpected indent
**********************************************************************
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/devel/sage/sage/numerical/mip.pyx", line 42:
sage: p.setobj(obj)
Exception raised:
Traceback (most recent call last):
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_0[8]>", line 1, in <module>
p.setobj(obj)###line 42:
sage: p.setobj(obj)
NameError: name 'p' is not defined
**********************************************************************
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/devel/sage/sage/numerical/mip.pyx", line 43:
sage: for (a,b,c) in g.edges():
Exception raised:
Traceback (most recent call last):
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_0[9]>", line 1
for (a,b,c) in g.edges():###line 43:
sage: for (a,b,c) in g.edges():
^
SyntaxError: unexpected EOF while parsing
**********************************************************************
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/devel/sage/sage/numerical/mip.pyx", line 44:
sage: cons={}
Exception raised:
Traceback (most recent call last):
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_0[10]>", line 1
cons={}###line 44:
sage: cons={}
^
IndentationError: unexpected indent
**********************************************************************
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/devel/sage/sage/numerical/mip.pyx", line 45:
sage: cons[a]=1
Exception raised:
Traceback (most recent call last):
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_0[11]>", line 1
cons[a]=Integer(1)###line 45:
sage: cons[a]=1
^
IndentationError: unexpected indent
**********************************************************************
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/devel/sage/sage/numerical/mip.pyx", line 46:
sage: cons[b]=1
Exception raised:
Traceback (most recent call last):
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_0[12]>", line 1
cons[b]=Integer(1)###line 46:
sage: cons[b]=1
^
IndentationError: unexpected indent
**********************************************************************
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/devel/sage/sage/numerical/mip.pyx", line 47:
sage: p.addconstraint(cons,max=1)
Exception raised:
Traceback (most recent call last):
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_0[13]>", line 1
p.addconstraint(cons,max=Integer(1))###line 47:
sage: p.addconstraint(cons,max=1)
^
IndentationError: unexpected indent
**********************************************************************
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/devel/sage/sage/numerical/mip.pyx", line 48:
sage: p.solve()
Exception raised:
Traceback (most recent call last):
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_0[14]>", line 1, in <module>
p.solve()###line 48:
sage: p.solve()
NameError: name 'p' is not defined
**********************************************************************
1 items had failures:
11 of 15 in __main__.example_0
***Test Failed*** 11 failures.
For whitespace errors, see the file /Users/davidjoyner/sagefiles/sage-4.1.1.alpha0/tmp/.doctest_mip.py
[4.9 s]
exit code: 1024
Does this make sense?
It seems Sage does not like something dealing with the indentation in the doctest of the class, as the example works when I am copying it manually... If you know the standard ( if there are any ) in this situation, please tell me because I am trying to fix this and changing the indentation ten thousand times hoping it will work is not my preferred way of debugging ^^;
Fixed in patch MIP-2.patch
As a sidenote, this ranks as the least interesting debugging I ever did, and I just achieved it because there was another example of a loop in a dosctring in Sage. Thanks to the brave developper of sage.combinat.dlx who conquered the docstrings ! ;-)
Attachment: MIP-2.patch.gz
I usually debug by just running sage -t with the file open in an editor until it passes:-)
Am I to apply MIP1 then MIP2? If so, there was a problem compiling (amd64, ubuntu 9.04):
wdj@hera:~/sagefiles/sage-4.1.1.alpha1$ ./sage -b
----------------------------------------------------------
sage: Building and installing modified Sage library files.
Installing c_lib
scons: `install' is up to date.
Updating Cython code....
Building modified file sage/numerical/mip.pyx.
python `which cython` --embed-positions --incref-local-binop -I/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage-OR -o sage/numerical/mip.cpp sage/numerical/mip.pyx
sage/numerical/mip.pyx --> /home/wdj/sagefiles/sage-4.1.1.alpha1/local//lib/python/site-packages//sage/numerical/mip.pyx
Time to execute 1 commands: 0.891119003296 seconds
Finished compiling Cython code (time = 1.45167207718 seconds)
running install
running build
running build_py
copying sage/numerical/all.py -> build/lib.linux-x86_64-2.6/sage/numerical
running build_ext
building 'sage.numerical.mip' extension
gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ilocal/include/ -I/home/wdj/sagefiles/sage-4.1.1.alpha1/local//include -I/home/wdj/sagefiles/sage-4.1.1.alpha1/local//include/csage -I/home/wdj/sagefiles/sage-4.1.1.alpha1/devel//sage/sage/ext -I/home/wdj/sagefiles/sage-4.1.1.alpha1/local/include/python2.6 -c sage/numerical/mip.cpp -o build/temp.linux-x86_64-2.6/sage/numerical/mip.o -w
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
sage/numerical/mip.cpp:132:38: error: ../../local/include/glpk.h: No such file or directory
sage/numerical/mip.cpp: In function ‘PyObject* __pyx_pf_4sage_9numerical_3mip_3MIP_solveGLPK(PyObject*, PyObject*, PyObject*)’:
sage/numerical/mip.cpp:2777: error: ‘glp_prob’ was not declared in this scope
sage/numerical/mip.cpp:2777: error: ‘__pyx_v_lp’ was not declared in this scope
sage/numerical/mip.cpp:2787: error: ‘glp_iocp’ was not declared in this scope
sage/numerical/mip.cpp:2787: error: ‘__pyx_v_iocp’ was not declared in this scope
sage/numerical/mip.cpp:2985: error: ‘glp_create_prob’ was not declared in this scope
sage/numerical/mip.cpp:2998: error: ‘glp_add_rows’ was not declared in this scope
sage/numerical/mip.cpp:3011: error: ‘glp_add_cols’ was not declared in this scope
sage/numerical/mip.cpp:3098: error: ‘glp_set_obj_coef’ was not declared in this scope
sage/numerical/mip.cpp:3241: error: ‘GLP_DB’ was not declared in this scope
sage/numerical/mip.cpp:3241: error: ‘glp_set_col_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3330: error: ‘GLP_UP’ was not declared in this scope
sage/numerical/mip.cpp:3330: error: ‘glp_set_col_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3419: error: ‘GLP_LO’ was not declared in this scope
sage/numerical/mip.cpp:3419: error: ‘glp_set_col_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3450: error: ‘GLP_FR’ was not declared in this scope
sage/numerical/mip.cpp:3450: error: ‘glp_set_col_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3764: error: ‘GLP_FX’ was not declared in this scope
sage/numerical/mip.cpp:3764: error: ‘glp_set_row_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3791: error: ‘GLP_DB’ was not declared in this scope
sage/numerical/mip.cpp:3791: error: ‘glp_set_row_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3846: error: ‘GLP_UP’ was not declared in this scope
sage/numerical/mip.cpp:3846: error: ‘glp_set_row_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3899: error: ‘GLP_LO’ was not declared in this scope
sage/numerical/mip.cpp:3899: error: ‘glp_set_row_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3912: error: ‘GLP_FR’ was not declared in this scope
sage/numerical/mip.cpp:3912: error: ‘glp_set_row_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3957: error: ‘GLP_MIN’ was not declared in this scope
sage/numerical/mip.cpp:3957: error: ‘glp_set_obj_dir’ was not declared in this scope
sage/numerical/mip.cpp:3969: error: ‘GLP_MAX’ was not declared in this scope
sage/numerical/mip.cpp:3969: error: ‘glp_set_obj_dir’ was not declared in this scope
sage/numerical/mip.cpp:4059: error: ‘GLP_IV’ was not declared in this scope
sage/numerical/mip.cpp:4059: error: ‘glp_set_col_kind’ was not declared in this scope
sage/numerical/mip.cpp:4108: error: ‘GLP_BV’ was not declared in this scope
sage/numerical/mip.cpp:4108: error: ‘glp_set_col_kind’ was not declared in this scope
sage/numerical/mip.cpp:4136: error: ‘GLP_CV’ was not declared in this scope
sage/numerical/mip.cpp:4136: error: ‘glp_set_col_kind’ was not declared in this scope
sage/numerical/mip.cpp:4156: error: ‘glp_load_matrix’ was not declared in this scope
sage/numerical/mip.cpp:4165: error: expected type-specifier before ‘glp_iocp’
sage/numerical/mip.cpp:4165: error: expected `;' before ‘glp_iocp’
sage/numerical/mip.cpp:4174: error: ‘glp_init_iocp’ was not declared in this scope
sage/numerical/mip.cpp:4183: error: ‘GLP_ON’ was not declared in this scope
sage/numerical/mip.cpp:4205: error: ‘GLP_MSG_OFF’ was not declared in this scope
sage/numerical/mip.cpp:4229: error: ‘GLP_MSG_ERR’ was not declared in this scope
sage/numerical/mip.cpp:4253: error: ‘GLP_MSG_ON’ was not declared in this scope
sage/numerical/mip.cpp:4265: error: ‘GLP_MSG_ALL’ was not declared in this scope
sage/numerical/mip.cpp:4276: error: ‘glp_intopt’ was not declared in this scope
sage/numerical/mip.cpp:4285: error: ‘glp_mip_obj_val’ was not declared in this scope
sage/numerical/mip.cpp:4314: error: ‘glp_delete_prob’ was not declared in this scope
sage/numerical/mip.cpp:4408: error: ‘glp_mip_col_val’ was not declared in this scope
sage/numerical/mip.cpp:4422: error: ‘glp_delete_prob’ was not declared in this scope
error: command 'gcc' failed with exit status 1
sage: There was an error installing modified sage library code.
real 0m3.367s
user 0m2.880s
sys 0m0.428s
Do you know what this means?
Yes, this time I know !!! ;-)
The first error is : sage/numerical/mip.cpp:132:38: error: ../../local/include/glpk.h: No such file or directory
And this is because you did not install GLPK ( https://github.com/sagemath/sage-prod/issues/6602 ) which is to be a standanrd package. And MIP-2 applies on top of MIP-1 !
Sorry for these details I may have forgotten ! ;-)
These patches applies to an amd64 ubuntu 9.04 machine passes sage -testall (except for the already reported errors for sage 4.1.1.a1).
Things are improving but there are some remaining issues:
For example linear function 3 * x - 2 * y + 3 * z
where x,y, and z are objects is represented as { x : 3, y : -2, z : -3 }
might have a sign error and should I think be
For example linear function 3 * x - 2 * y + 3 * z
where x,y, and z are objects is represented as { x : 3, y : -2, z : 3 }
You were right about the typo. And I hope you will find in MIP-3.patch all the docstrings you need ;-)
Attachment: MIP-3.patch.gz
Replying to @sagetrac-mvngu:
Once this ticket has positive review, the SPKG at #6602 should also be merged in the standard packages repository.
Correction: Once this ticket has positive review, the SPKG at #6602 should also be merged in the optional packages repository.
The 3 patches applied fione to 4.1.1.a1. But on an ubuntu 9.04 machine, I got the following failures:
wdj@hera:~/sagefiles/sage-4.1.1.alpha1$ ./sage -t "devel/sage/sage/numerical/mip.pyx"
sage -t "devel/sage/sage/numerical/mip.pyx"
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 280:
sage: p.show()
Exception raised:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_10[5]>", line 1, in <module>
p.show()###line 280:
sage: p.show()
File "mip.pyx", line 130, in sage.numerical.mip.MIP.show (sage/numerical/mip.cpp:1335)
File "mip.pyx", line 108, in sage.numerical.mip.MIP.export (sage/numerical/mip.cpp:1047)
File "mip.pyx", line 604, in sage.numerical.mip.Constraint.__init__ (sage/numerical/mip.cpp:5791)
AttributeError: 'NoneType' object has no attribute 'copy'
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 303:
sage: p.addbound("x",min=3,max=8)
Exception raised:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_11[4]>", line 1, in <module>
p.addbound("x",min=Integer(3),max=Integer(8))###line 303:
sage: p.addbound("x",min=3,max=8)
AttributeError: MIP instance has no attribute 'addbound'
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 304:
sage: p.show()
Exception raised:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_11[5]>", line 1, in <module>
p.show()###line 304:
sage: p.show()
File "mip.pyx", line 130, in sage.numerical.mip.MIP.show (sage/numerical/mip.cpp:1335)
File "mip.pyx", line 108, in sage.numerical.mip.MIP.export (sage/numerical/mip.cpp:1047)
File "mip.pyx", line 604, in sage.numerical.mip.Constraint.__init__ (sage/numerical/mip.cpp:5791)
AttributeError: 'NoneType' object has no attribute 'copy'
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 372:
sage: p.solve()
Expected:
[4.0, {'x': 2.0, 'y': 0.0}]
Got:
[2.6666666666666665, {'y': 1.3333333333333333, 'x': 0.0}]
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 374:
sage: p.solve(objective_only=True)
Expected:
4.0
Got:
2.6666666666666665
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 102:
sage: print p.export(format="text")
Exception raised:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_3[4]>", line 1, in <module>
print p.export(format="text")###line 102:
sage: print p.export(format="text")
File "mip.pyx", line 108, in sage.numerical.mip.MIP.export (sage/numerical/mip.cpp:1047)
File "mip.pyx", line 604, in sage.numerical.mip.Constraint.__init__ (sage/numerical/mip.cpp:5791)
AttributeError: 'NoneType' object has no attribute 'copy'
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 126:
sage: p.show()
Exception raised:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_4[5]>", line 1, in <module>
p.show()###line 126:
sage: p.show()
File "mip.pyx", line 130, in sage.numerical.mip.MIP.show (sage/numerical/mip.cpp:1335)
File "mip.pyx", line 108, in sage.numerical.mip.MIP.export (sage/numerical/mip.cpp:1047)
File "mip.pyx", line 604, in sage.numerical.mip.Constraint.__init__ (sage/numerical/mip.cpp:5791)
AttributeError: 'NoneType' object has no attribute 'copy'
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 159:
sage: p.solve()
Expected:
[4.0, {'x': 2.0, 'y': 0.0}]
Got:
[2.6666666666666665, {'y': 1.3333333333333333, 'x': 0.0}]
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 195:
sage: p.solve()
Expected:
[4.0, {'x': 2.0, 'y': 0.0}]
Got:
[2.6666666666666665, {'y': 1.3333333333333333, 'x': 0.0}]
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 214:
sage: p.show()
Exception raised:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_7[5]>", line 1, in <module>
p.show()###line 214:
sage: p.show()
File "mip.pyx", line 130, in sage.numerical.mip.MIP.show (sage/numerical/mip.cpp:1335)
File "mip.pyx", line 108, in sage.numerical.mip.MIP.export (sage/numerical/mip.cpp:1047)
File "mip.pyx", line 604, in sage.numerical.mip.Constraint.__init__ (sage/numerical/mip.cpp:5791)
AttributeError: 'NoneType' object has no attribute 'copy'
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 231:
sage: p.show()
Exception raised:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_8[5]>", line 1, in <module>
p.show()###line 231:
sage: p.show()
File "mip.pyx", line 130, in sage.numerical.mip.MIP.show (sage/numerical/mip.cpp:1335)
File "mip.pyx", line 108, in sage.numerical.mip.MIP.export (sage/numerical/mip.cpp:1047)
File "mip.pyx", line 604, in sage.numerical.mip.Constraint.__init__ (sage/numerical/mip.cpp:5791)
AttributeError: 'NoneType' object has no attribute 'copy'
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 248:
sage: p.show()
Exception raised:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_9[5]>", line 1, in <module>
p.show()###line 248:
sage: p.show()
File "mip.pyx", line 130, in sage.numerical.mip.MIP.show (sage/numerical/mip.cpp:1335)
File "mip.pyx", line 108, in sage.numerical.mip.MIP.export (sage/numerical/mip.cpp:1047)
File "mip.pyx", line 604, in sage.numerical.mip.Constraint.__init__ (sage/numerical/mip.cpp:5791)
AttributeError: 'NoneType' object has no attribute 'copy'
**********************************************************************
10 items had failures:
1 of 6 in __main__.example_10
2 of 6 in __main__.example_11
2 of 15 in __main__.example_12
1 of 5 in __main__.example_3
1 of 6 in __main__.example_4
1 of 7 in __main__.example_5
1 of 7 in __main__.example_6
1 of 6 in __main__.example_7
1 of 6 in __main__.example_8
1 of 6 in __main__.example_9
***Test Failed*** 12 failures.
For whitespace errors, see the file /home/wdj/sagefiles/sage-4.1.1.alpha1/tmp/.doctest_mip.py
[3.5 s]
exit code: 1024
----------------------------------------------------------------------
The following tests failed:
sage -t "devel/sage/sage/numerical/mip.pyx"
Total time for all tests: 3.5 seconds
There was also this compiling error:
wdj@hera:~/sagefiles/sage-4.1.1.alpha1$ ./sage -b
----------------------------------------------------------
sage: Building and installing modified Sage library files.
Installing c_lib
scons: `install' is up to date.
Updating Cython code....
Building sage/numerical/mip.pyx because it depends on ../../local/include/glpk.h.
python `which cython` --embed-positions --incref-local-binop -I/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage-OR2 -o sage/numerical/mip.cpp sage/numerical/mip.pyx
sage/numerical/mip.pyx --> /home/wdj/sagefiles/sage-4.1.1.alpha1/local//lib/python/site-packages//sage/numerical/mip.pyx
Time to execute 1 commands: 1.12334299088 seconds
Finished compiling Cython code (time = 2.04412698746 seconds)
running install
running build
running build_py
running build_ext
building 'sage.numerical.mip' extension
gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ilocal/include/ -I/home/wdj/sagefiles/sage-4.1.1.alpha1/local//include -I/home/wdj/sagefiles/sage-4.1.1.alpha1/local//include/csage -I/home/wdj/sagefiles/sage-4.1.1.alpha1/devel//sage/sage/ext -I/home/wdj/sagefiles/sage-4.1.1.alpha1/local/include/python2.6 -c sage/numerical/mip.cpp -o build/temp.linux-x86_64-2.6/sage/numerical/mip.o -w
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
sage/numerical/mip.cpp: In function ‘PyObject* __pyx_pf_4sage_9numerical_3mip_3MIP_solveGLPK(PyObject*, PyObject*, PyObject*)’:
sage/numerical/mip.cpp:2785: error: ‘glp_prob’ was not declared in this scope
sage/numerical/mip.cpp:2785: error: ‘__pyx_v_lp’ was not declared in this scope
sage/numerical/mip.cpp:2795: error: ‘glp_iocp’ was not declared in this scope
sage/numerical/mip.cpp:2795: error: ‘__pyx_v_iocp’ was not declared in this scope
sage/numerical/mip.cpp:2993: error: ‘glp_create_prob’ was not declared in this scope
sage/numerical/mip.cpp:3006: error: ‘glp_add_rows’ was not declared in this scope
sage/numerical/mip.cpp:3019: error: ‘glp_add_cols’ was not declared in this scope
sage/numerical/mip.cpp:3106: error: ‘glp_set_obj_coef’ was not declared in this scope
sage/numerical/mip.cpp:3249: error: ‘GLP_DB’ was not declared in this scope
sage/numerical/mip.cpp:3249: error: ‘glp_set_col_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3338: error: ‘GLP_UP’ was not declared in this scope
sage/numerical/mip.cpp:3338: error: ‘glp_set_col_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3427: error: ‘GLP_LO’ was not declared in this scope
sage/numerical/mip.cpp:3427: error: ‘glp_set_col_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3458: error: ‘GLP_FR’ was not declared in this scope
sage/numerical/mip.cpp:3458: error: ‘glp_set_col_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3772: error: ‘GLP_FX’ was not declared in this scope
sage/numerical/mip.cpp:3772: error: ‘glp_set_row_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3799: error: ‘GLP_DB’ was not declared in this scope
sage/numerical/mip.cpp:3799: error: ‘glp_set_row_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3854: error: ‘GLP_UP’ was not declared in this scope
sage/numerical/mip.cpp:3854: error: ‘glp_set_row_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3907: error: ‘GLP_LO’ was not declared in this scope
sage/numerical/mip.cpp:3907: error: ‘glp_set_row_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3920: error: ‘GLP_FR’ was not declared in this scope
sage/numerical/mip.cpp:3920: error: ‘glp_set_row_bnds’ was not declared in this scope
sage/numerical/mip.cpp:3965: error: ‘GLP_MIN’ was not declared in this scope
sage/numerical/mip.cpp:3965: error: ‘glp_set_obj_dir’ was not declared in this scope
sage/numerical/mip.cpp:3977: error: ‘GLP_MAX’ was not declared in this scope
sage/numerical/mip.cpp:3977: error: ‘glp_set_obj_dir’ was not declared in this scope
sage/numerical/mip.cpp:4067: error: ‘GLP_IV’ was not declared in this scope
sage/numerical/mip.cpp:4067: error: ‘glp_set_col_kind’ was not declared in this scope
sage/numerical/mip.cpp:4116: error: ‘GLP_BV’ was not declared in this scope
sage/numerical/mip.cpp:4116: error: ‘glp_set_col_kind’ was not declared in this scope
sage/numerical/mip.cpp:4144: error: ‘GLP_CV’ was not declared in this scope
sage/numerical/mip.cpp:4144: error: ‘glp_set_col_kind’ was not declared in this scope
sage/numerical/mip.cpp:4164: error: ‘glp_load_matrix’ was not declared in this scope
sage/numerical/mip.cpp:4173: error: expected type-specifier before ‘glp_iocp’
sage/numerical/mip.cpp:4173: error: expected `;' before ‘glp_iocp’
sage/numerical/mip.cpp:4182: error: ‘glp_init_iocp’ was not declared in this scope
sage/numerical/mip.cpp:4191: error: ‘GLP_ON’ was not declared in this scope
sage/numerical/mip.cpp:4213: error: ‘GLP_MSG_OFF’ was not declared in this scope
sage/numerical/mip.cpp:4237: error: ‘GLP_MSG_ERR’ was not declared in this scope
sage/numerical/mip.cpp:4261: error: ‘GLP_MSG_ON’ was not declared in this scope
sage/numerical/mip.cpp:4273: error: ‘GLP_MSG_ALL’ was not declared in this scope
sage/numerical/mip.cpp:4284: error: ‘glp_intopt’ was not declared in this scope
sage/numerical/mip.cpp:4293: error: ‘glp_mip_obj_val’ was not declared in this scope
sage/numerical/mip.cpp:4322: error: ‘glp_delete_prob’ was not declared in this scope
sage/numerical/mip.cpp:4416: error: ‘glp_mip_col_val’ was not declared in this scope
sage/numerical/mip.cpp:4430: error: ‘glp_delete_prob’ was not declared in this scope
error: command 'gcc' failed with exit status 1
sage: There was an error installing modified sage library code.
real 0m6.324s
user 0m3.516s
sys 0m0.604s
Ignore the last 2 errors. I think I know what happened. the experimental package 4ti2 on sage.math seems to be over-writing the glpk package. I need to start over ...
I reinstalled glpk and rebuilt the clone which had MIP1, MIP2, MIP3 applied. This time, it compiled fine:-)
Hopwever the was the following error:
wdj@hera:~/sagefiles/sage-4.1.1.alpha1$ ./sage -t "devel/sage/sage/numerical/mip.pyx"
sage -t "devel/sage/sage/numerical/mip.pyx"
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 280:
sage: p.show()
Exception raised:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_10[5]>", line 1, in <module>
p.show()###line 280:
sage: p.show()
File "mip.pyx", line 130, in sage.numerical.mip.MIP.show (sage/numerical/mip.cpp:1335)
File "mip.pyx", line 108, in sage.numerical.mip.MIP.export (sage/numerical/mip.cpp:1047)
File "mip.pyx", line 604, in sage.numerical.mip.Constraint.__init__ (sage/numerical/mip.cpp:5791)
AttributeError: 'NoneType' object has no attribute 'copy'
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 303:
sage: p.addbound("x",min=3,max=8)
Exception raised:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_11[4]>", line 1, in <module>
p.addbound("x",min=Integer(3),max=Integer(8))###line 303:
sage: p.addbound("x",min=3,max=8)
AttributeError: MIP instance has no attribute 'addbound'
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 304:
sage: p.show()
Exception raised:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_11[5]>", line 1, in <module>
p.show()###line 304:
sage: p.show()
File "mip.pyx", line 130, in sage.numerical.mip.MIP.show (sage/numerical/mip.cpp:1335)
File "mip.pyx", line 108, in sage.numerical.mip.MIP.export (sage/numerical/mip.cpp:1047)
File "mip.pyx", line 604, in sage.numerical.mip.Constraint.__init__ (sage/numerical/mip.cpp:5791)
AttributeError: 'NoneType' object has no attribute 'copy'
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 372:
sage: p.solve()
Expected:
[4.0, {'x': 2.0, 'y': 0.0}]
Got:
[2.6666666666666665, {'y': 1.3333333333333333, 'x': 0.0}]
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 374:
sage: p.solve(objective_only=True)
Expected:
4.0
Got:
2.6666666666666665
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 102:
sage: print p.export(format="text")
Exception raised:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_3[4]>", line 1, in <module>
print p.export(format="text")###line 102:
sage: print p.export(format="text")
File "mip.pyx", line 108, in sage.numerical.mip.MIP.export (sage/numerical/mip.cpp:1047)
File "mip.pyx", line 604, in sage.numerical.mip.Constraint.__init__ (sage/numerical/mip.cpp:5791)
AttributeError: 'NoneType' object has no attribute 'copy'
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 126:
sage: p.show()
Exception raised:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_4[5]>", line 1, in <module>
p.show()###line 126:
sage: p.show()
File "mip.pyx", line 130, in sage.numerical.mip.MIP.show (sage/numerical/mip.cpp:1335)
File "mip.pyx", line 108, in sage.numerical.mip.MIP.export (sage/numerical/mip.cpp:1047)
File "mip.pyx", line 604, in sage.numerical.mip.Constraint.__init__ (sage/numerical/mip.cpp:5791)
AttributeError: 'NoneType' object has no attribute 'copy'
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 159:
sage: p.solve()
Expected:
[4.0, {'x': 2.0, 'y': 0.0}]
Got:
[2.6666666666666665, {'y': 1.3333333333333333, 'x': 0.0}]
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 195:
sage: p.solve()
Expected:
[4.0, {'x': 2.0, 'y': 0.0}]
Got:
[2.6666666666666665, {'y': 1.3333333333333333, 'x': 0.0}]
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 214:
sage: p.show()
Exception raised:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_7[5]>", line 1, in <module>
p.show()###line 214:
sage: p.show()
File "mip.pyx", line 130, in sage.numerical.mip.MIP.show (sage/numerical/mip.cpp:1335)
File "mip.pyx", line 108, in sage.numerical.mip.MIP.export (sage/numerical/mip.cpp:1047)
File "mip.pyx", line 604, in sage.numerical.mip.Constraint.__init__ (sage/numerical/mip.cpp:5791)
AttributeError: 'NoneType' object has no attribute 'copy'
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 231:
sage: p.show()
Exception raised:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_8[5]>", line 1, in <module>
p.show()###line 231:
sage: p.show()
File "mip.pyx", line 130, in sage.numerical.mip.MIP.show (sage/numerical/mip.cpp:1335)
File "mip.pyx", line 108, in sage.numerical.mip.MIP.export (sage/numerical/mip.cpp:1047)
File "mip.pyx", line 604, in sage.numerical.mip.Constraint.__init__ (sage/numerical/mip.cpp:5791)
AttributeError: 'NoneType' object has no attribute 'copy'
**********************************************************************
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/devel/sage/sage/numerical/mip.pyx", line 248:
sage: p.show()
Exception raised:
Traceback (most recent call last):
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/home/wdj/sagefiles/sage-4.1.1.alpha1/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_9[5]>", line 1, in <module>
p.show()###line 248:
sage: p.show()
File "mip.pyx", line 130, in sage.numerical.mip.MIP.show (sage/numerical/mip.cpp:1335)
File "mip.pyx", line 108, in sage.numerical.mip.MIP.export (sage/numerical/mip.cpp:1047)
File "mip.pyx", line 604, in sage.numerical.mip.Constraint.__init__ (sage/numerical/mip.cpp:5791)
AttributeError: 'NoneType' object has no attribute 'copy'
**********************************************************************
10 items had failures:
1 of 6 in __main__.example_10
2 of 6 in __main__.example_11
2 of 15 in __main__.example_12
1 of 5 in __main__.example_3
1 of 6 in __main__.example_4
1 of 7 in __main__.example_5
1 of 7 in __main__.example_6
1 of 6 in __main__.example_7
1 of 6 in __main__.example_8
1 of 6 in __main__.example_9
***Test Failed*** 12 failures.
For whitespace errors, see the file /home/wdj/sagefiles/sage-4.1.1.alpha1/tmp/.doctest_mip.py
[3.3 s]
exit code: 1024
Do you know what these mean?
This was with sage 4.1.1.a1 and on an amd64 ubuntu 9.04 machine.
I do !!
It means first that I sent another patch without testing it in the end again ( for which I am sorry ), and also that I forgot some of the algorithms in the solvers were randomized, which explains for some results being different from time to time. I "corrected" this by picking examples for which the solutions are unique ;-)
Patch MIP-4 available ;-)
Attachment: MIP-4.patch.gz
This passed and the docstrings look good.
Positive review from me as an optional package.
Great job Nathann and thanks for creating this very useful package!
MIP-5.patch is available !
Two lines' worth of modifications to print different messages when wrong solvers are selected.. And I don't think I will have anything to add to that for the moment ;-)
And as soon as this patch is accepted into Sage, I post the new graph functions ;-)
Thank you so much again !!!
Attachment: MIP-5.patch.gz
This passed test as well.
is there anything left to do for this patch, now ? ;-)
Once someone posts it and your other packages to sagemath.org, you probably should post another email to sage-devel (and maybe sage-edu) to ask people to try it out. If you have looked at pygklp already then you can also comment on how your package compares to it.
And how is it possible for me to check on whether the patch have already been included in Sage ? Is there any page I can consult on which I could read when it is possible for the users to use this patch using sage -upgrade ?
Thank you for your help ! :-)
Nathann
Replying to @nathanncohen:
And how is it possible for me to check on whether the patch have already been included in Sage ?
It will go here: http://www.sagemath.org/packages/optional/
Is there any page I can consult on which I could read when it is possible for the users to use this patch using sage -upgrade ?
They will use sage -i
Of course, anyone can use sage -i http://www-sop.inria.fr/members/Nathann.Cohen/glpk-4.38.spkg to install glpk right now (or sage -f http://www-sop.inria.fr/members/Nathann.Cohen/glpk-4.38.spkg to force a reinstall).
Thank you for your help ! :-)
Nathann
They will use sage -upgrade to download the spkg, but what about this very patch ? Will there be any other way to install it than by meddling with hg_sage ? ;-)
Replying to @nathanncohen:
They will use sage -upgrade to download the spkg,
sage -i, not sage -upgrade.
but what about this very patch ? Will there be any other way to install it than by meddling with hg_sage ? ;-)
Once Minh or William posts a comment to this trac ticket saying "applied to sage x.y.z" and "status => closed" (or something like that) then it will be part of the next release of Sage. Until then, yes, a user should create a new clone and then apply your patches using hg_sage.
sage -i, sorry ^^;
Thanks for these explanations ! ;-)
One can use the following command in order to install glpk:
sage -f http://www.sagemath.org/packages/optional/glpk-4.38.spkg
Replying to @sagetrac-mvngu:
One can use the following command in order to install glpk:
sage -f http://www.sagemath.org/packages/optional/glpk-4.38.spkg
I don't see it listed on http://www.sagemath.org/packages/optional/. Am I missing something?
Replying to @wdjoyner:
Replying to @sagetrac-mvngu:
One can use the following command in order to install glpk:
sage -f http://www.sagemath.org/packages/optional/glpk-4.38.spkg
I don't see it listed on http://www.sagemath.org/packages/optional/. Am I missing something?
The Python script that is used for regenerating the packages HTML pages is not working for me at the moment. So I can't successfully run it in order to update any of the HTML pages that lists all known packages. But the good news is that you can be sure that the package glpk-4.38.spkg
is up on the optional packages repository. If you can't download that package from the link
http://www.sagemath.org/packages/optional/glpk-4.38.spkg
please tell me.
All patches up to MIP-5
Attachment: AllMIP.patch.gz
Hi Nathann. The timing of these patches is unfortunate :-( I'm about to release Sage 4.1.1 in a couple of hours. The release has been delayed far too long.
I got the following error after merging the patch AllMIP.patch
and rebuilding the modified library files. I was merging it on top of Sage 4.1.1.rc2.
<SNIP>
sage/numerical/mip.cpp:4051: error: ‘GLP_MIN’ was not declared in this scope
sage/numerical/mip.cpp:4051: error: ‘glp_set_obj_dir’ was not declared in this scope
sage/numerical/mip.cpp:4063: error: ‘GLP_MAX’ was not declared in this scope
sage/numerical/mip.cpp:4063: error: ‘glp_set_obj_dir’ was not declared in this scope
sage/numerical/mip.cpp:4153: error: ‘GLP_IV’ was not declared in this scope
sage/numerical/mip.cpp:4153: error: ‘glp_set_col_kind’ was not declared in this scope
sage/numerical/mip.cpp:4202: error: ‘GLP_BV’ was not declared in this scope
sage/numerical/mip.cpp:4202: error: ‘glp_set_col_kind’ was not declared in this scope
sage/numerical/mip.cpp:4230: error: ‘GLP_CV’ was not declared in this scope
sage/numerical/mip.cpp:4230: error: ‘glp_set_col_kind’ was not declared in this scope
sage/numerical/mip.cpp:4250: error: ‘glp_load_matrix’ was not declared in this scope
sage/numerical/mip.cpp:4259: error: expected type-specifier before ‘glp_iocp’
sage/numerical/mip.cpp:4259: error: expected `;' before ‘glp_iocp’
sage/numerical/mip.cpp:4268: error: ‘glp_init_iocp’ was not declared in this scope
sage/numerical/mip.cpp:4277: error: ‘GLP_ON’ was not declared in this scope
sage/numerical/mip.cpp:4299: error: ‘GLP_MSG_OFF’ was not declared in this scope
sage/numerical/mip.cpp:4323: error: ‘GLP_MSG_ERR’ was not declared in this scope
sage/numerical/mip.cpp:4347: error: ‘GLP_MSG_ON’ was not declared in this scope
sage/numerical/mip.cpp:4359: error: ‘GLP_MSG_ALL’ was not declared in this scope
sage/numerical/mip.cpp:4370: error: ‘glp_intopt’ was not declared in this scope
sage/numerical/mip.cpp:4379: error: ‘glp_mip_obj_val’ was not declared in this scope
sage/numerical/mip.cpp:4408: error: ‘glp_delete_prob’ was not declared in this scope
sage/numerical/mip.cpp:4502: error: ‘glp_mip_col_val’ was not declared in this scope
sage/numerical/mip.cpp:4516: error: ‘glp_delete_prob’ was not declared in this scope
error: command 'gcc' failed with exit status 1
sage: There was an error installing modified sage library code.
I got the above compilation errors because I didn't install the optional package glpk. So that spkg should be installed first, then apply the patch AllMIP.patch
. I'm putting this back to positive review. My bad :-(
GLPK is an optional spkg. So any doctests that use GLPK must be flagged as "# optional". Also, it looks like #6765 depends on this ticket.
I'm marking this ticket as "needs work" until the doctests that use GLPK or CBC, etc., are marked as "# optional".
The patches and GLPK should be wrapped up into an spkg. The patch AllMIP.patch
if applied as is would fail to compile. You can rectify that by first installing the optional spkg GLPK. But the patch AllMIP.patch
is to be applied to the Sage library, and when applied and shipping Sage, Sage would fail to compile because we don't ship optional spkg's. So put everything (the patches plus GLPK) into a self-contained spkg.
Following this message on SAGE-devel : http://groups.google.com/group/sage-devel/browse_thread/thread/9da47e06bcdfc49f
This is the class sage.numerical.mip which is meant to be the common interface between SAGE and 3 different LP solvers : GLPK, Coin-Or, and CPLEX.
Trac ticket for GLPK : https://github.com/sagemath/sage-prod/issues/6602 Trac ticker for COIN : https://github.com/sagemath/sage-prod/issues/6603
CC: @haraldschilly
Component: numerical
Issue created by migration from https://trac.sagemath.org/ticket/6502