Ask Your Question

pp's profile - activity

2020-04-14 23:15:59 -0500 received badge  Popular Question (source)
2019-04-27 07:30:49 -0500 received badge  Organizer (source)
2019-01-09 13:39:14 -0500 commented question Solve MILP by reading LP files

Hopefully, someone will look into that (and write a module for it). Nothing so far!

2018-12-30 17:54:44 -0500 received badge  Nice Question (source)
2018-12-30 13:23:59 -0500 asked a question Solve MILP by reading LP files

Sage has a wide range of solvers available to solve MILP problems. However, all these functionalities require that the problem is to be implemented following Sage's API.

In contrast, Gurobi allows to solve MILP problems, directly reading from an LP file. This comes in handy, as there's no need to follow Sage API. If the LP file is too large to handle, then the user can simply write another program that will create this file. Apart from being simple and scalable, LP formats can be used for porting to other (unsupported) library.

It seems that, Sage does not yet support directly reading LP files. It will be helpful if someone can comment specifically if such functionality is available or will be implemented in near future/a ticket can be initiated.

2018-02-05 10:02:52 -0500 commented answer Truth value of an expression (Boolean Polynomials)

Besides, bool(expr(s0=True, s1=True)) is not a solution; rather expr(s0=True, s1=True) & 1 is close to a solution.

2018-02-05 09:56:23 -0500 commented answer Truth value of an expression (Boolean Polynomials)

Should I create a ticket?

2018-02-05 09:54:07 -0500 commented answer Truth value of an expression (Boolean Polynomials)

Another problem, how can I use something like: (expr([s'%d'%(i)=True for i in range(2)])) ?

2018-02-05 09:49:52 -0500 received badge  Popular Question (source)
2016-08-10 18:24:00 -0500 received badge  Nice Question (source)
2016-08-06 13:25:00 -0500 received badge  Famous Question (source)
2016-08-03 12:14:30 -0500 received badge  Student (source)
2016-08-03 11:17:49 -0500 received badge  Notable Question (source)
2016-08-03 11:17:49 -0500 received badge  Popular Question (source)
2016-07-29 01:58:56 -0500 asked a question Installing Cryptominisat

I am using Linux Mint 17.3 64 bit, and installed sage from PPA as given here: help.ubuntu.com/community/SAGE. Then, I tried to install Cryptominisat package following this: doc.sagemath.org/pdf/en/reference/sat/sat.pdf. However, I get the following error:

$ sage -i cryptominist sagelib
make: *** No rule to make target `all-toolchain'.  Stop.

Later I found out for all -i option, it gives the same error. What should I do to install Cryptominisat?

2014-08-14 14:17:54 -0500 commented answer Solving boolean variables symbolically

Yes. These expressions are polynomials.

2014-08-14 08:46:30 -0500 asked a question Solving boolean variables symbolically

I need to solve some boolean variables symbolically (in terms of the other symbols):

Suppose we are given an expression like expr = (xy == 0), then I would like to have

solve(expr, x)

~y

Is it possible to do in sage? Something like this, but in boolean variables.

2014-08-10 01:15:41 -0500 received badge  Editor (source)
2014-08-09 21:21:15 -0500 asked a question How to get the variables present in an boolean expression

Consider the boolean variables x, y and z.

I need something like

 sage: variables(x+yz)
 [x, y, z]
 sage: variables(x+z)
 [x, z]

What should I do?

For a starting point, you may like (copied from the answer given here):

sage: R = BooleanPolynomialRing(3, 'x')
sage: x, y, z = R.gens()
2014-08-09 01:32:20 -0500 asked a question How to count degree of a monomial in boolean polynomial

As stated in the title, my question is:

Is there any way to count the degree of a monomial of a boolean polynomial in Sage?

Say, for example,

degree(xy) = 2  
degree(xyz) = 3
2013-11-26 05:32:40 -0500 commented answer Truth value of an expression (Boolean Polynomials)

@tmonteil Moreover, I found that instead of doing calculations over finite of degree 2, it simply calculates the value!!

2013-11-26 05:17:18 -0500 commented answer Truth value of an expression (Boolean Polynomials)

@tmonteil But, more than 256 variables is not allowed in this method!

2013-11-26 00:33:16 -0500 commented answer Truth value of an expression (Boolean Polynomials)

@tmonteil Thanks. In my current situation, I get the truth values of the variables from solving a SAT problem. Thus, I have a dictionary like `{s0: True, s1: False}`, I need that these values are put to the expression. But I am stuck with that! Can you help me?

2013-11-25 20:20:18 -0500 asked a question Truth value of an expression (Boolean Polynomials)

I need to find the truth value of an expression. Consider this:

sage: R = BooleanPolynomialRing( 2, \
        ['s%d'%(i) for i in range (2)])
sage: expr = R('s0') + R('s0')*R('s1')

Now I need expr is to be evaluated; given, say, both s0 and s1 are True. How can we do that?

2013-11-14 23:31:07 -0500 marked best answer SAT Solver

You can do:

sage: from sage.sat.boolean_polynomials import solve as solve_sat
sage: B.<x1,x2,x3> = BooleanPolynomialRing() ; B
Boolean PolynomialRing in x1, x2, x3
sage: f = (x1 + x2 * x3 - x2)*(x2 - x3) ; f
x1*x2 + x1*x3 + x2*x3 + x2
l = solve_sat([f], n=infinity) ; l
[{x3: 0, x2: 0, x1: 0},
 {x3: 1, x2: 1, x1: 1},
 {x3: 0, x2: 0, x1: 1},
 {x3: 1, x2: 1, x1: 0},
 {x3: 1, x2: 0, x1: 0},
 {x3: 0, x2: 1, x1: 1}]

It is possible that you will have to install the cryptominisat package first.

2013-11-03 16:21:52 -0500 commented answer SAT Solver output

Then why not use `cms()[1:]`? That will simplify the situation.

2013-11-03 15:44:00 -0500 asked a question SAT Solver

From the documentation of sage.sat.boolean_polynomials.solve (here), it is not clear how to use it. Can anyone cite me any detailed example?

Say, I need to solve (in a Boolean ring) (x1 + x2 * x3 = x2)*(x2 = x3) . Can we do it?

Regards.

2013-11-01 08:11:13 -0500 received badge  Supporter (source)
2013-11-01 08:09:02 -0500 marked best answer SAT Solver output

There is no 0 variable because there is no difference between 0 and -0. But python lists start with index 0. If you want the value of the variable 2, you will type:

sage: cms()[2]
True

Without the None at the beginning (standing for the value of the 0 variable that does not exist), you will get False (the value of the variable 3).

There seems not be any on-line documentation, but you can actually read it from the sage command line, if you type:

sage: cms?

You will read

OUTPUT:
* If this instance is SAT: A tuple of length "nvars()+1" where the
 "i"-th entry holds an assignment for the "i"-th variables (the
 "0"-th entry is always "None").

and

First, we do not assume anything, note that the first entry is
"None" because there is not "0"-th variable:
2013-11-01 08:09:02 -0500 received badge  Scholar (source)
2013-10-31 20:21:06 -0500 asked a question SAT Solver output

I need to solve a SAT problem. I searched and found the manual here, but can not figure out the output obtained:

sage: from sage.sat.solvers import CryptoMiniSat # optional - cryptominisat
sage: cms = CryptoMiniSat()                      # optional - cryptominisat
sage: cms.add_clause((1,2,-3))                   # optional - cryptominisat
sage: cms()                                      # optional - cryptominisat
(None, True, True, False)

There are 3 variables, then what does that None mean?