[sage-support] Re: Vehicle routing problems in sage

2012-03-16 Thread Chris Kees
Hi Nathann,

Thanks! I spent some time with the graph and milp support today, and it's
exactly what I was looking for.  Do you have an idea of how the current
implementations scale with the size of the graph? Any interest in adding
support for parallel algorithms?  I'm interested in the underlying data
structures for the graphs and how the objective function expressions are
being passed to the low level implementations (e.g. Coin)

Chris

On Friday, March 16, 2012, Nathann Cohen  wrote:
>> If I wanted to change the last constraint to be w[0]-w[1]-w[2]>=1 can I
do this without resetting the whole p?
>
> Not for the moment, but this can be added with a small patch. We just
need to expose the functions from the solver's API :-)
> Nathann
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to
sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at
http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: sage server in OS 10.6

2012-03-16 Thread Dan Drake
On Fri, 16 Mar 2012 at 04:11PM -0700, Mike OS wrote:
> When I save and quit the worksheet, I go back to my home page.
> If I click sign out, nothing happens.

Are you using Firefox? This happens with some recent versions of
Firefox. Does that same thing happen with another browser?

Dan

--
---  Dan Drake
-  http://mathsci.kaist.ac.kr/~drake
---


signature.asc
Description: Digital signature


[sage-support] Re: sage server in OS 10.6

2012-03-16 Thread kcrisman


On Mar 16, 7:11 pm, Mike OS  wrote:
> Jason and Dan,
>
> Thank you for the info and suggestions.  It took a while, but we got
> it running.
>
> One thing that I'm experiencing seems odd.
> I created an account,  logged in, made a worksheet.
>
> When I save and quit the worksheet, I go back to my home page.
> If I click sign out, nothing happens.  If I kill the browser window,
> then open a new one and go back to the server, I get my home page
> (without logging in).  If I quit firefox, then I do have to login.
>
> But!  If I open a worksheet and don't quit it, then it seems to keep
> running even
> after I quit  firefox.  I restart firefox, relogin and there it is,
> the worksheet still running.
>
> This seems odd, is that how it should be?

This is actually a feature.  I've used this once in a while when
moving between the office and classroom.

> Won't this lead to a lot of unused stuff being stored when people,
> unthinkingly
> leave notebooks open?

There is a default timeout, I believe... and you can set it.  I think
that "notebook?" should answer this for you.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Using mpi4py in sage 'online' notebook (atsagenb.org)

2012-03-16 Thread Volker Braun
You can't install MPI on the public Sage server without administrative 
privileges.

Also, unless you want to learn MPI for educational purposes your are using 
the wrong tool to run stuff on a single machine. For tightly coupled 
problems you can't beat threads that way, and for very parallel problems 
you should just go with fork and the @parallel decorator.



On Friday, March 16, 2012 6:06:18 PM UTC-4, ravi wrote:
>
> I just started using sage and am loving it! However, I was wondering, 
> is there a way to use the mpi4py package in the online (sagenb.org) 
> notebook ? 

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: sage server in OS 10.6

2012-03-16 Thread Mike OS
Jason and Dan,

Thank you for the info and suggestions.  It took a while, but we got
it running.

One thing that I'm experiencing seems odd.
I created an account,  logged in, made a worksheet.

When I save and quit the worksheet, I go back to my home page.
If I click sign out, nothing happens.  If I kill the browser window,
then open a new one and go back to the server, I get my home page
(without logging in).  If I quit firefox, then I do have to login.

But!  If I open a worksheet and don't quit it, then it seems to keep
running even
after I quit  firefox.  I restart firefox, relogin and there it is,
the worksheet still running.

This seems odd, is that how it should be?
Won't this lead to a lot of unused stuff being stored when people,
unthinkingly
leave notebooks open?

Also shouldnt sign out send me back to the login page?
Is there a setting that needs to be ... set?

Mike

On Mar 6, 6:46 pm, Jason Grout  wrote:
> On 3/6/12 2:53 PM, Mike OS wrote:
>
>
>
>
>
>
>
>
>
> > I'd like to set up a sage notebook server at my campus. Since this is
> > beyond my expertise, I asked the College IT specialists to handle it.
> > Of course, they are very concerned about vulnerabilities, so they
> > will only allow access from on campus.
>
> > We browsed some of the available information and most concerns Ubuntu
> > not OS X.  I received the following from Bill Morris, our IT guru.
> > Could anyone answer his questions and validate his understanding of
> > things? Also, please address the overarching issue, which I have
> > seen discussed quite a bit in recent posts: security in setting up a
> > server.
>
> > Thank you!
>
> > - I invested a couple of hours yesterday trying
> > to unwind the "setting up a sage server" question. I think the issues
> > are these:
>
> > 1. Sage's notebook server is built in to sage ... it is likely the
> > same sort of python based web server as is used in zope.
>
> I don't think it's the same as zope, but it is a python-based web
> server.  Sage uses the twisted web server [1].
>
> > 2. Coupling sage with apache is basically running apache with little
> > more than a proxy to port 8000, the port sage's notebook server runs
> > on.
>
> That's correct.  Well, it's really a "reverse proxy".
>
>
>
>
>
>
>
>
>
>
>
> > 3. The part of the "how-to" instructions that leave me coldest are
> > the "here is where we create the accounts sage1 ... sageN" on the
> > server and try our best to keep people from exploiting them. They
> > even go as far as talking about filesystem ACLs ... which tells me we
> > don't want to go anywhere near this.
>
> > So, my question to you, as someone who hopefully understands the
> > desired outcome better than I, is:
>
> > Does a sage notebook server require interactive logins? I'm
> > thinking, but am not quite sure, that the interactive logins are for
> > students to run sage from a command line, and as long as one creates
> > sufficient accounts in the notebook server itself (not accounts on
> > the host where the notebook server is hosted) the notebook server can
> > exist without interactive logins.
>
> When a user executes a worksheet on the Sage server, a sage session is
> started up on the server to execute their commands.  This sage session
> is basically giving them shell access on the server.  If you don't
> create something like the sageN accounts (i.e., if you don't use the
> server_pool option when starting up the notebook server), then this sage
> session is started up as the notebook user (i.e., the sageserver user,
> if you're following these instructions [1]).  This is bad, because it
> means that any notebook user can then delete the entire notebook data
> directory (because their worksheet commands have those user
> permissions).  So instead, we create restricted sage0 through sage9
> accounts (one account is all that is really necessary).  These
> restricted accounts are used for executing user code.  This provides
> privilege separation between the Sage notebook server, which maintains
> the list of worksheets and communicates with users, and the user code
> that is being run.
>
> Does that help?
>
> It would help to add clarifications to the instructions.  The page is a
> wiki page---feel free to edit it to clarify things, if you'd like!  Or
> let your IT person know that they are welcome to create a wiki account
> and edit it to make it more friendly to IT people.
>
> Thanks,
>
> Jason
>
> [1]http://twistedmatrix.com/trac/
>
> [2]http://wiki.sagemath.org/SageServer

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Using mpi4py in sage 'online' notebook (atsagenb.org)

2012-03-16 Thread ravine
Hi,

I just started using sage and am loving it! However, I was wondering,
is there a way to use the mpi4py package in the online (sagenb.org)
notebook ?

I was hoping to do so, but am stuck due to the following two issues:

1) The documentation at Sage (http://www.sagemath.org/doc/
numerical_sage/mpi4py.html) says that one can execute this code by
running "./local/bin/mpirun -np 5 ./sage -python filename.py" from
command line of the system. However, I do not know how to do the same
in the online notebook.

2) I tried to simply evaluate the sample program given in the
documentation page for mpi4py in sage:
from mpi4py import MPI
import numpy
rank=MPI.rank
size=MPI.size
v=numpy.array([rank]*5,dtype=float)
MPI.COMM_WORLD.Send(v,dest=(rank+1)%size)
data=MPI.COMM_WORLD.Recv(source=(rank-1)%size)
print(``my rank is %d"%n)
print(``I received this:'')
print(data)

However, it throws the error: "ImportError: No module named mpi4py"

It also does not allow me to install the "optional" mpi4py package on
its own server using "install_package" (since I obviously don't have
the required permissions).

So, is there a way that i can use mpi4py in the online notebook ?

Thanks a lot !
Ravi

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Excluding range from plot

2012-03-16 Thread kcrisman


On Mar 16, 9:20 am, Anthony Wickstead  wrote:
> But in your example the first range is empty. I changed the exclude value to 
> [1..2,3..4] and again the first interval is fine and the second wrong.

Good point, I changed everything else to avoid the pi but not that!
Hmm, maybe that's a clue...

By the way,

sage: [pi..2*pi,3*pi..4*pi]
[pi, pi + 1, pi + 2, pi + 3, 3*pi, 3*pi + 1, 3*pi + 2, 3*pi + 3]


I've updated the ticket with some more examples that have ticks placed
so that it's easy to compare.  Perhaps these will be illuminating to
someone:

sage: plot(sin(pi*x)^cos(pi*x),(x,0,4),exclude=[3,4],ymax=20)
sage: plot(sin(pi*x)^cos(pi*x),(x,0,4),exclude=[1,2,3,4],ymax=20)

Also, here is the relevant code in Sage 4.8, for those playing at
home:

http://hg.sagemath.org/sage-main/file/c239be1054e0/sage/plot/plot.py#l3271

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


RE: [sage-support] Re: Excluding range from plot

2012-03-16 Thread Anthony Wickstead
But in your example the first range is empty. I changed the exclude value to 
[1..2,3..4] and again the first interval is fine and the second wrong.

Tony

Thanks for this bug report.  Sometimes this happens even for the first range.

sage: plot(sin(pi*x)^cos(pi*x),(x,0,4),exclude=[pi..2,3..4],ymax=20)

This is now http://trac.sagemath.org/sage_trac/ticket/12676.
Hopefully it's just something easy to fix with the exclude code.

- kcrisman

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Excluding range from plot

2012-03-16 Thread kcrisman


On Mar 16, 6:29 am, Anthony Wickstead  wrote:
> I am trying to understand the behaviour of the option exclude in plot() when 
> a range of values is included.
>
> It looks to me that if a simple range like "exclude=[pi..2*pi]" is used and 
> the function is defined and real-valued in that range then the end points and 
> integer points between are excluded from the plot, whilst if the function is 
> not real-valued in the range, e.g. "sin(x)^cos(x)",  then the whole range is 
> excluded.

> However, if several ranges are specified then when the function is 
>real-valued the behaviour is like that for a single range, whilst if the 
>function is not real-valued then the graph *is* plotted, incorrectly, for 
>ranges after the first. For example the graph of 
>"plot(sin(x)^cos(x),(x,0,4*pi),exclude=[pi..2*pi,3*pi..4*pi])" contains a 
>straight line between 3*pi and 4*pi. Surely this cannot be the intended 
>behaviour?

Thanks for this bug report.  Sometimes this happens even for the first
range.

sage: plot(sin(pi*x)^cos(pi*x),(x,0,4),exclude=[pi..2,3..4],ymax=20)

This is now http://trac.sagemath.org/sage_trac/ticket/12676.
Hopefully it's just something easy to fix with the exclude code.

- kcrisman

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Vehicle routing problems in sage

2012-03-16 Thread Nathann Cohen
>
> If I wanted to change the last constraint to be w[0]-w[1]-w[2]>=1 can I do
> this without resetting the whole p?
>

Not for the moment, but this can be added with a small patch. We just need
to expose the functions from the solver's API :-)

Nathann

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Vehicle routing problems in sage

2012-03-16 Thread Vincent Knight
I didn't know that SAGE could handle MILP (awesome!), I'm just playing
around with it now and was wondering if there was a way to remove a
constrain from a particular problem or indeed modify it without reseting
the whole problem.

For example:

Say I wanted to solve the problem described in the online tutorial, I would
input:

sage: p = MixedIntegerLinearProgram(maximization=False) sage: w =
p.new_variable(integer=True) sage: p.add_constraint(w[0] + w[1] + w[2]
- 14*w[3] == 0) sage: p.add_constraint(w[1] + 2*w[2] - 8*w[3] == 0)
sage: p.add_constraint(2*w[2] - 3*w[3] == 0) sage:
p.add_constraint(w[0] - w[1] - w[2] >= 0)sage: p.add_constraint(w[3]
>= 1) sage: _ = [ p.set_min(w[i], None) for i in range(1,4) ] sage:
p.set_objective(w[3]) sage: p.show()


If I wanted to change the last constraint to be w[0]-w[1]-w[2]>=1 can I do
this without resetting the whole p?

(Sorry to hijack the original question).

Thanks,
Vince

On 16 March 2012 10:45, Nathann Cohen  wrote:

> Sage has a class name 'Mixed integer linear programming' for modeling
>> MIPs and class for LP Solver backends like Co-in, CPLEX, GLPK and Gurobi.
>> At the moment I haven't know any sage class only for vehicle routing
>> problem.
>>
>
> Yep ! There's a short tutorial about its use there :
> http://steinertriples.fr/ncohen/tut/LP/
>
> And we also have a TSP function implemented :-)
>
>
> http://www.sagemath.org/doc/reference/sage/graphs/generic_graph.html#sage.graphs.generic_graph.GenericGraph.traveling_salesman_problem
>
> Nathann
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>



-- 
Dr Vincent Knight
Cardiff School of Mathematics
Senghennydd Road,
Cardiff
CF24 4AG
(+44) 29 2087 5548
www.vincent-knight.com
@drvinceknight 
Skype: drvinceknight

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Vehicle routing problems in sage

2012-03-16 Thread Nathann Cohen

>
> Sage has a class name 'Mixed integer linear programming' for modeling 
> MIPs and class for LP Solver backends like Co-in, CPLEX, GLPK and Gurobi.
> At the moment I haven't know any sage class only for vehicle routing 
> problem.
>

Yep ! There's a short tutorial about its use there 
: http://steinertriples.fr/ncohen/tut/LP/

And we also have a TSP function implemented :-)

http://www.sagemath.org/doc/reference/sage/graphs/generic_graph.html#sage.graphs.generic_graph.GenericGraph.traveling_salesman_problem

Nathann

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Excluding range from plot

2012-03-16 Thread Anthony Wickstead


I am trying to understand the behaviour of the option exclude in plot() when a 
range of values is included.

It looks to me that if a simple range like "exclude=[pi..2*pi]" is used and the 
function is defined and real-valued in that range then the end points and 
integer points between are excluded from the plot, whilst if the function is 
not real-valued in the range, e.g. "sin(x)^cos(x)",  then the whole range is 
excluded.  However, if several ranges are specified then when the function is 
real-valued the behaviour is like that for a single range, whilst if the 
function is not real-valued then the graph *is* plotted, incorrectly, for 
ranges after the first. For example the graph of 
"plot(sin(x)^cos(x),(x,0,4*pi),exclude=[pi..2*pi,3*pi..4*pi])" contains a 
straight line between 3*pi and 4*pi. Surely this cannot be the intended 
behaviour?

I am using Sage 4.8, under Ubuntu 11.10 in a VirtualBox. 

Prof. A.W. Wickstead
Pure Mathematics Research Centre
Queen's University Belfast
University Road
Belfast BT7 1NN
Northern Ireland
Phone: 028 90976004
Fax: 028 90976060

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Non-commutative ring over a field with generators

2012-03-16 Thread Noud Aldenhoven
Hello,

This is exactly what I was looking for, thank you. But now I also have
a second question: is it possible to add inverses for x and y? I would
also like to calculate things like 1/(x+y)^10.

Best regards,
Noud

On 15 March 2012 14:31, Simon King  wrote:
> Hi Noud!
>
> On 15 Mrz., 13:28, Noud Aldenhoven  wrote:
>> Is it possible to make a non-commutative ring over QQ with three
>> generators x, y and z in Sage? So is it possible to make some sort of
>> polynomial ring Q[x, y, z] with the extra properties that xy /= yx, xz
>> /= zx and yz /= zy?
>
> Do you mean a free associative unital algebra?
>  sage: F. = FreeAlgebra(QQ,3)
>  sage: x*y == y*x
>  False
>
> Note that in sage-5.0 it will be possible to define so-called G-
> algebras (See http://www.singular.uni-kl.de/Manual/3-1-3/sing_452.htm
> for example)
>
> Or do you mean different kind of algebras?
>
> Cheers,
> Simon
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Vehicle routing problems in sage

2012-03-16 Thread Raniere Gaia Silva
Chris,
Sage has a class name 'Mixed integer linear programming' for modeling MIPs
and class for LP Solver backends like Co-in, CPLEX, GLPK and Gurobi.
At the moment I haven't know any sage class only for vehicle routing
problem.

Raniere Gaia Costa da Silva

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org