Re: [sage-support] Re: Linear Programming - loading LP or MPS file?

2015-09-01 Thread Stephen Hartke
> On Tuesday, 1 September 2015 07:00:39 UTC-7, Craig E Larson wrote: >> I see that there are methods for saving a LP as and LP or MPS file in >> Sage. Is it possible to *load* an LP from one of these file types? The >> online help that I've found doesn't mention this or give examples of how to >>

Re: [sage-support] Re: add_constraint becomes slow in presence of many constraints

2014-04-29 Thread Stephen Hartke
Adding row constraints one at a time is slow because of the internal data structures that simplex solvers use. In large LPs/IPs, the constraint matrix is almost always sparse, and so allocating an entire dense matrix doesn't make sense. Instead, a packed sparse matrix is used. Because of the

Re: [sage-support] Re: Binary variables in Integer Programs solved with CPLEX have wrong bounds

2014-01-07 Thread Stephen Hartke
On Tue, Jan 7, 2014 at 1:58 AM, Nathann Cohen nathann.co...@gmail.comwrote: Something is indeed wrong, and I have experienced similar problems in the past. What version of CPLEX and which version of Sage are you using? I am using IBM ILOG CPLEX 12.5.1.0, and Sage 5.12 on Fedora Linux 19 and

Re: [sage-support] Re: Binary variables in Integer Programs solved with CPLEX have wrong bounds

2014-01-06 Thread Stephen Hartke
Sorry for the delay in responding, but I was traveling over the holidays. Happy New Year! On Sun, Dec 15, 2013 at 5:18 AM, Nathann Cohen nathann.co...@gmail.comwrote: {0: 2.0, 1: 0.0} Note that x[0] has the solution 2, which shouldn't happen for a binary variable. When I ran the example

[sage-support] Binary variables in Integer Programs solved with CPLEX have wrong bounds

2013-12-14 Thread Stephen Hartke
It seems that Integer Programs solved with CPLEX sometimes have the wrong bounds on binary variables. For instance, p=MixedIntegerLinearProgram(solver=CPLEX) x=p.new_variable(dim=1) #,binary=True) p.add_constraint(x[0]+x[1]==2) p.set_objective(None) p.set_binary(x) p.show() p.solve() print

Re: [sage-support] Bug in edge_cut of undirected weighted graphs

2012-04-02 Thread Stephen Hartke
Doug, thanks for the smaller example! The bug may be dependent on the labels of the vertices, as all the similar small examples I tried to create worked successfully with edge_cut. I've created a trac request: ticket 12797http://trac.sagemath.org/sage_trac/ticket/12797 . Best wishes, Stephen

[sage-support] Bug in edge_cut of undirected weighted graphs

2012-03-24 Thread Stephen Hartke
While generating subtour elimination constraints for a traveling salesman problem, I bound a bug in the edge_cut method for undirected weighted graphs. Specifically, when using the Ford-Fulkerson method, the value of the minimum cut is correct, but sometimes the returned edge cut does not have

Re: [sage-support] Re: Exporting Sage notebook worksheet to SageTeX?

2012-02-10 Thread Stephen Hartke
Ivan and Karl, Thanks for pointing out Huss and Marik's sws2tex! That's mostly what I want. As discussed on ask.sagemath.org, there are some problems: with solutions: turning off syntax highlighting, turning off the attach file, saving the TeX file no (yet!) solutions: aligns of equations are

[sage-support] Exporting Sage notebook worksheet to SageTeX?

2012-02-08 Thread Stephen Hartke
I've been writing a series of handouts for my class. When writing them, I like to initially use the Sage notebook as it allows me to quickly and easily experiment with different examples, while still writing most of the explanations. However, for various reasons I'd like to be able to post pdf

Re: [sage-support] Re: Exporting Sage notebook worksheet to SageTeX?

2012-02-08 Thread Stephen Hartke
On 2/8/12 10:30 PM, Stephen Hartke wrote: I could not immediately find a feature to export to SageTeX. If such a feature does not already exist, how hard would it be to implement it? On Wed, Feb 8, 2012 at 10:37 PM, Jason Grout jason-s...@creativetrax.comwrote: I don't think it exists

Re: [sage-support] sagetex and combinatorial graphs

2011-03-13 Thread Stephen Hartke
On Sun, Mar 13, 2011 at 12:08 AM, pong wypon...@gmail.com wrote: A quick question. How to use sagetex to display a graph (edges and vertices) produced by sage without saving it first manually then \includegraphics. Plotting graphs works by calling sageplot on the graph's plot:

[sage-support] Word-wrap in printed notebook worksheets

2011-02-17 Thread Stephen Hartke
When using the Print feature on a worksheet in the notebook, a new webpage is generated for easy printing of the new worksheet. In the to print worksheet, the word wrap of the output text is fixed at something less than 70, resulting in short output lines when printed. This wastes a lot of the

Re: [sage-support] Labeled Graphs

2010-11-28 Thread Stephen Hartke
On Wed, Nov 24, 2010 at 2:20 PM, Minh Nguyen nguyenmi...@gmail.com wrote: But I can't figure out how to get G.show() to display the edge weights. You can just call G.show(edge_labels=True), which displays the vertex names (by default) and the edge labels. Of course, the layout is whatever the

[sage-support] Re: Potential memory leak when calling binomial

2009-07-26 Thread Stephen Hartke
On Sun, Jul 26, 2009 at 12:31 AM, Carlo Hamalainen carlo.hamalai...@gmail.com wrote: On Sat, Jul 25, 2009 at 5:08 PM, Stephen Hartkehar...@gmail.com wrote: Might this be related to how binomial is evaluated using GiNaC? Valgrind says yes: ==26568== 4 bytes in 1 blocks are definitely lost

[sage-support] Potential memory leak when calling binomial

2009-07-25 Thread Stephen Hartke
The following code ends up using a lot of memory: print get_memory_usage() for i in range(10): b=binomial(5,2) print get_memory_usage() Output: 133.48828125 135.015625 So 1.5 extra megabytes is used after the 100,000 calls of binomial. If repeated calls to binomial are made, eventually

[sage-support] Re: Potential memory leak when calling binomial

2009-07-25 Thread Stephen Hartke
On Sat, Jul 25, 2009 at 1:54 PM, Justin C. Walker jus...@mac.com wrote: I just tried this on 4.0.2 and 4.1 (on Mac OS X, 10.5.7), and got the same values before and after the loop, so something else must be involved. Justin, Thanks for your response! Did you run it from the command line or

[sage-support] Re: Potential memory leak when calling binomial

2009-07-25 Thread Stephen Hartke
On Sat, Jul 25, 2009 at 6:04 PM, Justin C. Walker jus...@mac.com wrote: I noticed that in the notebook, the code does create a problem, ^ not?? but random values do. Yes, I missed a not. Yup. I now see what you see: memory usage increases

[sage-support] Re: showing the status of a computation without generating long output

2009-02-25 Thread Stephen Hartke
On Wed, Feb 25, 2009 at 6:52 AM, Marco Streng marco.str...@gmail.comwrote: I'm doing a long computation in Sage and I'd like to be able to print some status information to the screen, such as the number of database entries that I have tested, or the total time spent on different parts of an

[sage-support] Re: NB to pdf

2009-02-02 Thread Stephen Hartke
On Mon, Feb 2, 2009 at 10:04 AM, Jason Grout jason-s...@creativetrax.comwrote: kcrisman wrote: I don't believe that turning a notebook worksheet into a pdf is implemented (and thanks to Dan D. for SageTeX, which unfortunately I have been printing worksheets to PDF files using my web

[sage-support] Re: integer linear programming in Sage?

2008-10-07 Thread Stephen Hartke
I have created a spkg to install lp_solve into Sage; it can be obtained at: http://www.math.unl.edu/~shartke2/files/lp_solve-5.5.0.13.spkg I have posted to sage-devel suggesting this spkg for inclusion into Sage. lp_solve includes a linear programming solver (simplex based) and an integer

[sage-support] Questions about Matrices and Solving Linear Systems

2008-09-30 Thread Stephen Hartke
Hi! I have some questions about matrices and solving linear systems of equations. These issues arose out of my using Sage for examples in my Linear Optimization class (it's great for demonstrating how the simplex algorithm works!) and for research I'm doing involving finite fields. If I have a

[sage-support] Re: Question about calling Cython code

2008-04-30 Thread Stephen Hartke
[EMAIL PROTECTED] wrote: On Fri, Apr 25, 2008 at 6:56 AM, Stephen Hartke [EMAIL PROTECTED] wrote: I currently have some Sage code in a file called main.sage. I call this from the Sage command line interpreter with load main.sage. After profiling my code, I moved a few functions

[sage-support] Question about calling Cython code

2008-04-25 Thread Stephen Hartke
I currently have some Sage code in a file called main.sage. I call this from the Sage command line interpreter with load main.sage. After profiling my code, I moved a few functions into a cfuncs.spyx which I call with a load cfuncs.spyx command in main.sage. This works great, and cfuncs.spyx is