Comments (7)
Could it be that the number of solutions is higher now due to additional switching variables?
If you sort and filter the solutions with respect to the original input variables, the number of different solutions could be 256 as expected.
Greetings,
Axel
from bosphorus.
Hi,
First of all, thanks for the message. Indeed, @a1880 is on the right track -- we don't guarantee equivalent number of solutions. However, you can get the number of solutions as well. The way to do this is:
-
Get the CNF from Bosphorus by running:
./bosphorus --anfread myanf.anf --cnfwrite mycnf.cnf --solmap mysolmap.txt
-
Take the
solution-var
variables inmysolmap.txt
, shift them up by 1, and add them to the CNF asc ind VAR1 VAR2 ... VARN 0
For example, if you have:
Internal-ANF-var 7 = solution-var 0
Internal-ANF-var 6 = solution-var 1
Internal-ANF-var 2 = solution-var 2
Internal-ANF-var 8 = solution-var 48
Internal-ANF-var 1 = solution-var 98
Write c ind 1 2 3 49 5 99
at the top of the CNF file (after p cnf ...
).
- Run on CryptoMiniSat with:
./cryptominisat --maxsol 1000000 mycnf.cnf
Alternatively, you can run a projected model counter such as ApproxMC, it will use the projection set. This will work much better for large number of solutions (>500).
from bosphorus.
(Actually, this is such a great question, I will now fix this in the README and make it part of it)
from bosphorus.
Yay! I have now improved bosphorus
so you don't need to do all that complicated stuff above! You can just do this:
./bosphorus --anfread task2.txt --cnfwrite x.cnf
cryptominisat --maxsol 10000 x.cnf
The projection set is automatically written to the CNF :) Also, you can use approximate counting too!
./bosphorus --anfread task2.txt --cnfwrite x.cnf
approxmc x.cnf
I hope this helps. Also, I thanked you personally @hadipourh for this in the commit eaed7ea and added a howto to the README :) Thanks again,
Mate
from bosphorus.
Thanks for your answers. The new feature added by Mate, makes the solution counting much easier. I appreciate it a lot.
As far as I know, the problem of ANF to CNF conversion has been well studied so far, and Bosphorus is one of the most efficient tools to do this task. However, to the best of my knowledge Bosphorus uses an extremely naive approach to convert a CNF to ANF in which the given CNF is translated to a set of ANF-s clause by clause. Hence, each clause is converted to an ANF individually without taking into account that whether there is an overlap between multiple clauses. Hence, it'd be very good if Bosphorus could support the more advanced methods such as the one proposed in On conversions from CNF to ANF. So, do you have a plan to improve the CNF to ANF converter of Bosphorus? If so, the Bosphorus will be a great bridge from the world of SAT solvers to the world of Algebraic methods.
Best wishes,
Hosein
from bosphorus.
Hi,
That sounds like a great project for you to do it! I strongly recommend that you get working at once to implement it. You can start creating a Pull Request once you are done, please see here how:
We'll be glad to merge it, in case its quality is such that it can be merged with Bosphorus and it has associated test cases and/or fuzz tests as we have now.
Good luck with the work, and please let us know when you are done,
Mate
from bosphorus.
Hi,
I am creating a new tool in which CNF->ANF conversion is necessary. So, I'm currently implementing the algorithm proposed in On conversions from CNF to ANF. Let me know please if there is a better method.
Given that Polybori is simply accessible via the SageMath, I'd prefer to create a preliminary prototype building upon the SageMath at first. Next, I'll try my best to work on Bosphorus, if I have enough time. I also will be happy if I can add it to the Bosphorus, and will inform you if I could do it.
Kind regards,
Hosein
from bosphorus.
Related Issues (20)
- Unexpected behavior on a factored system HOT 3
- Bug in `subsitute` function? HOT 7
- Thoughts on Bosphorus HOT 2
- Bosphorus reports unsat but CryptoMiniSat can solve this SHA-256 CNF HOT 9
- Tests gone missing HOT 4
- How to count the number of solutions to an ANF input?
- Error running: Segmentation fault (core dumped) HOT 2
- cnf simplification problem with double equations HOT 3
- CryptoMiniSat embedded in SageMath can solve these ANFs but Bosphous reports UNSAT HOT 5
- --solvewrite() within Bosphorus is faster than Cryptominisat5 to solve cnf file HOT 7
- If the Bosporus has executable file in Windows system? HOT 1
- It can't convert ANF to CNF. HOT 2
- Multi-thread trigger assertion HOT 5
- The executable file about the newest bosphorus HOT 4
- cnf to anf conversion makes it unsat HOT 2
- ANF independent set is not translated to CNF indep set HOT 1
- CNF reading does not care about independent set and will lose/create solutions.
- ANF projection set parsing skips file after first comment HOT 1
- Missing end-to-end tests
- Paper link and bib link broken HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bosphorus.