Giter Club home page Giter Club logo

approxmc's Introduction

License: MIT build Docker Hub

ApproxMC6: Approximate Model Counter

ApproxMCv6 is a state-of-the-art approximate model counter utilizing an improved version of CryptoMiniSat to give approximate model counts to problems of size and complexity that were not possible before.

This work is the culmination of work by a number of people, including but not limited to, Mate Soos, Jiong Yang, Stephan Gocht, Yash Pote, and Kuldeep S. Meel. Publications: published in AAAI-19, in CAV2020, and in CAV2023. A large part of the work is in CryptoMiniSat.

ApproxMC handles CNF formulas and performs approximate counting.

  1. If you are interested in exact model counting, visit our exact counter Ganak
  2. If you are instead interested in DNF formulas, visit our approximate DNF counter Pepin.

How to use the Python interface

Install using pip:

pip install pyapproxmc

Then you can use it as:

import pyapproxmc
c = pyapproxmc.Counter()
c.add_clause([1,2,3])
c.add_clause([3,20])
count = c.count()
print("Approximate count is: %d*2**%d" % (count[0], count[1]))

The above will print that Approximate count is: 11*2**16. Since the largest variable in the clauses was 20, the system contained 2**20 (i.e. 1048576) potential models. However, some of these models were prohibited by the two clauses, and so only approximately 11*2**16 (i.e. 720896) models remained.

If you want to count over a projection set, you need to call count(projection_set), for example:

import pyapproxmc
c = pyapproxmc.Counter()
c.add_clause([1,2,3])
c.add_clause([3,20])
count = c.count(range(1,10))
print("Approximate count is: %d*2**%d" % (count[0], count[1]))

This now prints Approximate count is: 7*2**6, which corresponds to the approximate count of models, projected over variables 1..10.

How to Build a Binary

To build on Linux, you will need the following:

sudo apt-get install build-essential cmake
apt-get install libgmp3-dev

Then, build CryptoMiniSat, Arjun, and ApproxMC:

# not required but very useful
sudo apt-get install zlib1g-dev

git clone https://github.com/meelgroup/cadical
cd cadical
git checkout mate-only-libraries-1.8.0
./configure
make
cd ..

git clone https://github.com/meelgroup/cadiback
cd cadiback
git checkout mate
./configure
make
cd ..

git clone https://github.com/msoos/cryptominisat
cd cryptominisat
mkdir build && cd build
cmake ..
make
cd ../..

git clone https://github.com/meelgroup/sbva
cd sbva
mkdir build && cd build
cmake ..
make
cd ../..

git clone https://github.com/meelgroup/arjun
cd arjun
mkdir build && cd build
cmake ..
make
cd ../..

git clone https://github.com/meelgroup/approxmc
cd approxmc
mkdir build && cd build
cmake ..
make
sudo make install
sudo ldconfig

How to Use the Binary

First, you must translate your problem to CNF and just pass your file as input to ApproxMC. Then issue ./approxmc myfile.cnf, it will print the number of solutions of formula.

Providing a Sampling Set (or Projection Set)

For some applications, one is not interested in solutions over all the variables and instead interested in counting the number of unique solutions to a subset of variables, called sampling set (also called a "projection set"). ApproxMC allows you to specify the sampling set using the following modified version of DIMACS format:

$ cat myfile.cnf
c p show 1 3 4 6 7 8 10 0
p cnf 500 1
3 4 0

Above, using the c p show line, we declare that only variables 1, 3, 4, 6, 7, 8 and 10 form part of the sampling set out of the CNF's 500 variables 1,2...500. This line must end with a 0. The solution that ApproxMC will be giving is essentially answering the question: how many different combination of settings to this variables are there that satisfy this problem? Naturally, if your sampling set only contains 7 variables, then the maximum number of solutions can only be at most 2^7 = 128. This is true even if your CNF has thousands of variables.

Running ApproxMC

In our case, the maximum number of solutions could at most be 2^7=128, but our CNF should be restricting this. Let's see:

$ approxmc --seed 5 myfile.cnf
c ApproxMC version 3.0
[...]
c CryptoMiniSat SHA revision [...]
c Using code from 'When Boolean Satisfiability Meets Gauss-E. in a Simplex Way'
[...]
[appmc] using seed: 5
[appmc] Sampling set size: 7
[appmc] Sampling set: 1, 3, 4, 6, 7, 8, 10,
[appmc] Using start iteration 0
[appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 0
[appmc] [    0.01 ] bounded_sol_count looking for   73 solutions -- hashes active: 1
[appmc] [    0.01 ] bounded_sol_count looking for   73 solutions -- hashes active: 0
[...]
[appmc] FINISHED ApproxMC T: 0.04 s
c [appmc] Number of solutions is: 48*2**1
s mc 96

ApproxMC reports that we have approximately 96 (=48*2) solutions to the CNF's independent support. This is because for variables 3 and 4 we have banned the false,false solution, so out of their 4 possible settings, one is banned. Therefore, we have 2^5 * (4-1) = 96 solutions.

Guarantees

ApproxMC provides so-called "PAC", or Probably Approximately Correct, guarantees. In less fancy words, the system guarantees that the solution found is within a certain tolerance (called "epsilon") with a certain probability (called "delta"). The default tolerance and probability, i.e. epsilon and delta values, are set to 0.8 and 0.2, respectively. Both values are configurable.

Library usage

The system can be used as a library:

#include <approxmc/approxmc.h>
#include <vector>
#include <complex>
#include <cassert>

using std::vector;
using namespace ApproxMC;
using namespace CMSat;

int main() {
    AppMC appmc;
    appmc.new_vars(10);

    vector<Lit> clause;

    //add "-3 4 0"
    clause.clear();
    clause.push_back(Lit(2, true));
    clause.push_back(Lit(3, false));
    appmc.add_clause(clause);

    //add "3 -4 0"
    clause.clear();
    clause.push_back(Lit(2, false));
    clause.push_back(Lit(3, true));
    appmc.add_clause(clause);

    SolCount c = appmc.count();
    uint32_t cnt = std::pow(2, c.hashCount)*c.cellSolCount;
    assert(cnt == std::pow(2, 9));

    return 0;
}

ApproxMC5: Sparse-XOR based Approximate Model Counter

Note: this is beta version release, not recommended for general use. We are currently working on a tight integration of sparse XORs into ApproxMC based on our LICS-20 paper. You can turn on the sparse XORs using the flag --sparse 1 but beware as reported in LICS-20 paper, this may slow down solving in some cases. It is likely to give a significant speedup if the number of solutions is very large.

Issues, questions, bugs, etc.

Please click on "issues" at the top and create a new issue. All issues are responded to promptly.

How to Cite

If you use ApproxMC, please cite the following papers: AAAI-19, in CAV2020, and in CAV2023. CAV20, AAAI19 and IJCAI16. If you use sparse XORs, please also cite the LICS20 paper. ApproxMC builds on a series of papers on hashing-based approach: Related Publications

The benchmarks used in our evaluation can be found here.

approxmc's People

Contributors

al-jiongyang avatar alvarna avatar eric-vin avatar fanosta avatar horenmar avatar kuldeepmeel avatar msoos avatar priyanka-golia avatar tanyongkiam avatar uddaloksarkar avatar yashpote avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

approxmc's Issues

Speeding up ApproxMC by reusing models

Hi,

During the binary search phase, whenever ApproxMC decrements the number of XORs, the models found with a higher number of XORs always satisfy the CNF-XOR with fewer constraints. So we can simply block those and find fewer solutions. For example, for a CNF with 100 variables and 60 x 2^30 solutions, the modified code would look like :-

XORs     SAT calls
1            73
2            73
4            73
8            73
16           73
32           15 (+1 UNSAT) {these 15 models satisfy all instances with fewer XORs}
24           58
28           58
30           45 (+1 UNSAT) {now we have 60 useful models}
29           13            {60 + 13 = 73}

This way, ApproxMC can find, on average, 33% fewer models.

I have modified the code and tested this. There was a speedup of around 25% and 1172/1896 problems were solved, 3 more than the unmodified ApproxMC.

Thanks,
Yash

Infinite loops

Hi,

I found an input for which ApproxMC seemingly goes into an infinite loop in the first iteration itself.
approxmc --threshold 3 --measure 1 test.txt
test.txt

It's the same for thresholds in {1,2,3}.

I tried with different seeds, {1,2,3,4,5}, and for each seed ApproxMC went into an infinite loop when threshold=1.

Thanks,
Yash

README bug

approxmc also required me to sudo apt-get install libgmp3-dev before I could build without issues; might be worth adding it to the README

Incremental interface

Hi,

I have a project where I want to use ApproxMC to count the number of satisfying assignments.
However, I have to make many, many such calls for very similar formulas. It is not feasible to
create a new solver object, or write that many files to the file system. Would it be possible to
extend ApproxMC with an incremental interface that supports assumptions, similar to the one
used in SAT solvers?

Best regards ,
Vedad

memory manager can't handle load

I am getting a memory manager can't handle load error when processing a 3gb CNF file. The error message tells me to recompile with -DLARGEMEM=ON but i am not sure which binary i am supposed to recompile with this flag. I tried recompiling all 3 by adding the -DLARGEMEM=ON flag to the cmake command but i get a warning from cmake that the flag is not used for both arjun and approxmc.

Recompiling all 3 binaries (CMS, arjun and ApproxMC) still results in the same error. I can also see that in COMPILE_DEFINES when running ApproxMC that it does not see the DLARGEMEM flag.

Is there something that i am missing?

Docker image does not read "c ind" correctly.

When running approxmc on the following cnf file:

p cnf 6 12
c ind 1 3 0
2 0
-4 0
-5 -3 2 0
-5 3 4 0
5 3 -4 0
5 -3 -2 0
-6 -1 2 0
-6 1 -5 0
6 1 5 0
6 -1 -2 0
6 0
-6 0

The following ominous warning is printed:

[appmc] WARNING! Sampling set was not declared with 'c ind var1 [var2 var3 ..] 0' notation in the CNF.
[appmc] we may work substantially worse!

The command being run is:
cat formula.cnf | docker run -i -a stdin -a stdout msoos/approxmc

ApproxMC4 dumps core on small examples

E.g., from your co-authored paper "Principled Network Reliability Approximation: A Counting-Based Approach" I encoded Fig 1. like so:

c ind 1 2 3 4 5 0
p cnf 11 14
2 -3 -9 0
-7 4 -1 0
4 -3 -10 0
2 -6 -1 0
3 -4 -10 0
-3 -1 0
-8 1 -5 0
1 -6 -2 0
-8 5 -1 0
1 -4 -7 0
-5 4 -11 0
3 -2 -9 0
1 3 0
-11 -4 5 0

Running ApproxMC4 dumps core on a failed assertion:

c ApproxMC SHA revision df6d9fc8d112d758301d7527817e2eb1029fa5eb
c ApproxMC version 4.0.1
c ApproxMC compilation env CMAKE_CXX_COMPILER = /usr/lib/ccache/bin/c++ | CMAKE_CXX_FLAGS =  -Wall -Wextra -Wunused -Wsign-compare -fno-omit-frame-pointer -Wtype-limits -Wuninitialized -Wno-deprecated -Wstrict-aliasing -Wpointer-arith -fvisibility=hidden -Wpointer-arith -Wformat-nonliteral -Winit-self -Wparentheses -Wunreachable-code -g -fvisibility=hidden -Wlogical-op -Wrestrict -Wnull-dereference -Wdouble-promotion -Wshadow -Wformat=2 -Wextra-semi -pedantic | COMPILE_DEFINES =  | STATICCOMPILE = ON | Boost_FOUND = TRUE | ZLIB_FOUND = TRUE | VALGRIND_FOUND =  | GMP_FOUND = TRUE | ENABLE_ASSERTIONS = ON | MY_TARGETS =  | compilation date time = Oct  2 2020 22:34:49
c ApproxMC compiled with gcc version 10.2.0
c CryptoMiniSat version 5.8.0
c CMS Copyright Mate Soos ([email protected])
c CMS SHA revision 6477e8bc43b0fda7038965bb148b64b8637c804b
c CMS is GPL licensed due to M4RI being linked. Build without M4RI to get MIT version
c Using VMTF code by Armin Biere from CaDiCaL
c Using Yalsat by Armin Biere, see Balint et al. Improving implementation of SLS solvers [...], SAT'14
c Using WalkSAT by Henry Kautz, see Kautz and Selman Pushing the envelope: planning, propositional logic, and stochastic search, AAAI'96,
c Using code from 'When Boolean Satisfiability Meets Gauss-E. in a Simplex Way'
c       by C.-S. Han and J.-H. Roland Jiang in CAV 2012. Fixes by M. Soos
c Using CCAnr from 'CCAnr: A Conf. Checking Based Local Search Solver [...]'
c       by Shaowei Cai, Chuan Luo, and Kaile Su, SAT 2015
c CMS compilation env CMAKE_CXX_COMPILER = /usr/lib/ccache/bin/c++ | CMAKE_CXX_FLAGS =  -fvisibility=hidden -Wall -Wextra -Wunused -Wsign-compare -fno-omit-frame-pointer -Wtype-limits -Wuninitialized -Wno-deprecated -Wstrict-aliasing -Wpointer-arith -Wpointer-arith -Wformat-nonliteral -Winit-self -Wparentheses -Wunreachable-code -g -Wno-class-memaccess -mpopcnt -msse4.2 -ggdb3 -Wlogical-op -Wrestrict -Wnull-dereference -Wdouble-promotion -Wshadow -Wformat=2 -Wextra-semi -pedantic | COMPILE_DEFINES =  -DEXTENDED_FEATURES -DUSE_GAUSS -DUSE_ZLIB -DYALSAT_FPU -DUSE_M4RI | STATICCOMPILE = ON | ONLY_SIMPLE = OFF | Boost_FOUND = TRUE | STATS = OFF | SQLITE3_FOUND = FALSE | ZLIB_FOUND = TRUE | VALGRIND_FOUND =  | ENABLE_TESTING = OFF | M4RI_FOUND = TRUE | NOM4RI = OFF | SLOW_DEBUG = OFF | ENABLE_ASSERTIONS = ON | PYTHON_EXECUTABLE = /usr/bin/python2.7 | PYTHON_LIBRARY = PYTHON_LIBRARY-NOTFOUND | PYTHON_INCLUDE_DIRS =  | MY_TARGETS =  | LARGEMEM = OFF | LIMITMEM = OFF | BREAKID_LIBRARIES =  | BREAKID-VER = . | BOSPHORUS_LIBRARIES =  | BOSPH-VER = . | compilation date time = Oct  2 2020 22:34:07
c CMS compiled with gcc version 10.2.0
c executed with command line: /home/cerebus2/projects/pynet-a/scratch/approxmc-linux-x64 formula.cnf
c -- header says num vars:             11
c -- header says num clauses:          14
c -- clauses added: 14
c -- xor clauses added: 0
c -- vars added 11
c [appmc] Sampling set size: 5
c [appmc] Sampling set: 1, 2, 3, 4, 5, 
c [sparse] Using match: 0 sampling set size: 5 prev end inclusive is: -1 this end inclusive is: 50 next end inclusive is: 100 sampl size: 5
c [appmc] threshold set to 72 sparse: 0
c [appmc] Starting up, initial measurement
c [appmc] Starting at hash count: 1
c [appmc] [    0.00 ] round:  0 hashes:      1
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 1
c WHAAAAT Detach issue. All below must be 1 to work ---
c -- can_detach: 0
c -- mfinder.no_irred_nonxor_contains_clash_vars(): 0
c -- !conf.gaussconf.autodisable: 1
c -- conf.xor_detach_reattach: 1
c [appmc] [    0.00 ] round:  0 hashes:      1
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 1
c [appmc] simplifying
c [appmc] [    0.00 ] round:  1 hashes:      1
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 1
c WHAAAAT Detach issue. All below must be 1 to work ---
c -- can_detach: 0
c -- mfinder.no_irred_nonxor_contains_clash_vars(): 0
c -- !conf.gaussconf.autodisable: 1
c -- conf.xor_detach_reattach: 1
c [appmc] [    0.00 ] round:  1 hashes:      0
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 0
c [appmc] simplifying
c [appmc] [    0.00 ] round:  2 hashes:      1
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 1
c WHAAAAT Detach issue. All below must be 1 to work ---
c -- can_detach: 0
c -- mfinder.no_irred_nonxor_contains_clash_vars(): 0
c -- !conf.gaussconf.autodisable: 1
c -- conf.xor_detach_reattach: 1
c [appmc] [    0.00 ] round:  2 hashes:      0
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 0
c [appmc] simplifying
c [appmc] [    0.00 ] round:  3 hashes:      1
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 1
c WHAAAAT Detach issue. All below must be 1 to work ---
c -- can_detach: 0
c -- mfinder.no_irred_nonxor_contains_clash_vars(): 0
c -- !conf.gaussconf.autodisable: 1
c -- conf.xor_detach_reattach: 1
c [appmc] [    0.00 ] round:  3 hashes:      0
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 0
c [appmc] simplifying
c [appmc] [    0.00 ] round:  4 hashes:      1
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 1
c WHAAAAT Detach issue. All below must be 1 to work ---
c -- can_detach: 0
c -- mfinder.no_irred_nonxor_contains_clash_vars(): 0
c -- !conf.gaussconf.autodisable: 1
c -- conf.xor_detach_reattach: 1
c [appmc] [    0.00 ] round:  4 hashes:      0
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 0
c [appmc] simplifying
c [appmc] [    0.00 ] round:  5 hashes:      1
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 1
c WHAAAAT Detach issue. All below must be 1 to work ---
c -- can_detach: 0
c -- mfinder.no_irred_nonxor_contains_clash_vars(): 0
c -- !conf.gaussconf.autodisable: 1
c -- conf.xor_detach_reattach: 1
c [appmc] [    0.00 ] round:  5 hashes:      0
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 0
c [appmc] simplifying
c [appmc] [    0.00 ] round:  6 hashes:      1
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 1
c WHAAAAT Detach issue. All below must be 1 to work ---
c -- can_detach: 0
c -- mfinder.no_irred_nonxor_contains_clash_vars(): 0
c -- !conf.gaussconf.autodisable: 1
c -- conf.xor_detach_reattach: 1
c [appmc] [    0.00 ] round:  6 hashes:      0
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 0
c [appmc] simplifying
c [appmc] [    0.00 ] round:  7 hashes:      1
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 1
c WHAAAAT Detach issue. All below must be 1 to work ---
c -- can_detach: 0
c -- mfinder.no_irred_nonxor_contains_clash_vars(): 0
c -- !conf.gaussconf.autodisable: 1
c -- conf.xor_detach_reattach: 1
c [appmc] [    0.00 ] round:  7 hashes:      0
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 0
c [appmc] simplifying
c [appmc] [    0.00 ] round:  8 hashes:      1
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 1
c WHAAAAT Detach issue. All below must be 1 to work ---
c -- can_detach: 0
c -- mfinder.no_irred_nonxor_contains_clash_vars(): 0
c -- !conf.gaussconf.autodisable: 1
c -- conf.xor_detach_reattach: 1
c [appmc] [    0.00 ] round:  8 hashes:      0
c [appmc] [    0.00 ] bounded_sol_count looking for   73 solutions -- hashes active: 0
approxmc-linux-x64: /home/soos/development/sat_solvers/approxmc/src/counter.cpp:447: ApproxMC::SolCount Counter::count(): Assertion `numHashList.size() > 0 && "UNSAT should not be possible"' failed.
aborted (core dumped)

I'm not sure if this affect results on larger graphs. I've run counts on more substantial CNFs and get results, but nothing I've been able to verify by other methods.

ApproxMC returning UNSAT for formula with solution

Hello! I've recently been trying to use ApproxMC for approximate model counting on the number of solutions for a boolean formula and have been relatively impressed with the precision and runtime compared to older techniques. The only issue I've been really running into is calling approxmc on more complicated formulas leads to UNSAT even when the formulas are satisfiable. I have verified this by taking the cnf file that I have been giving as input to approxmc and converting it into assertions to add to z3. z3 will confirm that the same formula is satisfiable even though approxmc says it is not. Is there any reason that ApproxMC would consistently fail to return SAT? I have included one of the cnf files for reference (its been gzipped because of how large it is)
test_file.cnf.gz

Why doesn't multithreading help?

I want to utilize the multithreading feature of cryptominisat5, so I added data->counter.solver->set_num_threads(3); to AppMC::AppMC(). I can see multiple thread running, but approxmc is even slower. Am I not doing it correctly?

Setting parameters epsilon and delta

Hi, is there any possibility of setting the values of parameters epsilon and delta? In you paper, you write that they are set to 0.8 and 0.1, respectively... Are they built in the code or can be passed as parameters (in the --help this option does not appear). Thanks!

CMake compile error in Ubuntu 16.04 - broken C Compiler

OS: Ubuntu 16.04
GCC Version - 7.5
G++ Version - 7.5
CMake version - 3.5.1

When trying to compile approxmc 4.0.0 and as I run the commands,

git clone https://github.com/msoos/cryptominisat
cd cryptominisat
mkdir build && cd build
cmake ..

When i execute the cmake command I get the following error,

-- The CXX compiler identification is GNU 7.5.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- LIB directory is ''
-- BIN directory is ''
-- You can choose the type of build, options are:Debug;Release;RelWithDebInfo;MinSizeRel
-- Doing a RelWithDebInfo build
-- The C compiler identification is unknown
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- broken
CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/usr/bin/cc" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /home/ashwathv/cryptominisat/build/CMakeFiles/CMakeTmp

  

  Run Build Command:"/usr/bin/make" "cmTC_c68dd/fast"

  /usr/bin/make -f CMakeFiles/cmTC_c68dd.dir/build.make
  CMakeFiles/cmTC_c68dd.dir/build

  make[1]: Entering directory
  '/home/ashwathv/cryptominisat/build/CMakeFiles/CMakeTmp'

  Building C object CMakeFiles/cmTC_c68dd.dir/testCCompiler.c.o

  /usr/bin/cc -o CMakeFiles/cmTC_c68dd.dir/testCCompiler.c.o -c
  /home/ashwathv/cryptominisat/build/CMakeFiles/CMakeTmp/testCCompiler.c

  
  /home/ashwathv/cryptominisat/build/CMakeFiles/CMakeTmp/testCCompiler.c:2:3:
  error: #error "The CMAKE_C_COMPILER is set to a C++ compiler"

   # error "The CMAKE_C_COMPILER is set to a C++ compiler"
     ^~~~~

  CMakeFiles/cmTC_c68dd.dir/build.make:65: recipe for target
  'CMakeFiles/cmTC_c68dd.dir/testCCompiler.c.o' failed

  make[1]: *** [CMakeFiles/cmTC_c68dd.dir/testCCompiler.c.o] Error 1

  make[1]: Leaving directory
  '/home/ashwathv/cryptominisat/build/CMakeFiles/CMakeTmp'

  Makefile:126: recipe for target 'cmTC_c68dd/fast' failed

  make: *** [cmTC_c68dd/fast] Error 2

  

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:91 (PROJECT)


-- Configuring incomplete, errors occurred!
See also "/home/ashwathv/cryptominisat/build/CMakeFiles/CMakeOutput.log".
See also "/home/ashwathv/cryptominisat/build/CMakeFiles/CMakeError.log".

I have tried to build it directly by using -DCMAKE_C_COMPILER=gcc along with the cmake command. The 'build-essentials' package is also the latest.
It does however work with Ubuntu version 18.04 and Cmake version v3.10.2.

Was wondering whether there is a specification for running/compiling the source (whether you need a specific version of OS/Cmake/Any prerequisite). Or is it targeting a specific piece of code in the source, that needs to be changed ?
Thanks!

Timeout on benchmark

Hello!
I have found a case where the tool times out (5000s). The file is pdtvisgray0_100.cnf in the attached zip archive: benchmark-files.zip
810 vars, 1909 clauses, 404 sampling set size.

Description
What we are trying to do is uniformly sample from the n-length traces of a symbolic transition system. To this end, we unroll an aig 'n' times and then convert it into CNF and specify the variables corresponding to the state bits as the sampling set. I have attached the cnf file corresponding to the pdtvisgray0.aig benchmark (hwmcc) with 100 unrollings.
After reducing the size of the network, the aig has 4 latches, 1 primary input, 1 primary output. This file is also attached.
First, we remove the original primary outputs (no use for it) and pull out the latch outputs as primary outputs so that on unrolling the transition system, copies of all intermediate state bits are present as primary outputs (they wouldn't on simply unrolling them). A blif file corresponding to this is attached
We then unroll it 100 times in abc as follows:
strash; frames -F 100
Convert the latch input and outputs to primary inputs and primary outputs respectively:
comb
And then write this to a cnf file:
write_cnf dump
We have found out the cnf variables corresponding to all the primary outputs and added them to the cnf file as the sampling set.
Since Unigen was timing out on this file and it uses ApproxMC, I tried using ApproxMCv3 on the file but it times out as well.

Files:
pdtvisgray0.aig
pdtvisgray0.blif - blif file with latch outputs pulled out as primary outputs
pdtvisgray0_100.cnf - 100 unrollings
pdtvisgray0_1000.cnf - 1000 unrollings

Mismatch between README example and pyapproxmc

Hello,

I was using the python interface (pyapproxmc v 4.1.14) and trying to recreate the example in the README):

>>> from pyapproxmc import Counter
>>> s = Counter()
>>> s.add_clause([1, 2])
>>> cells, hashes = s.count()
>>> print("There are approx ", cells*2**hashes, " solutions")
There are 55 solutions, approximately

However, I get:

There are approx  3  solutions

Given that the number of variables is 2, and the single clause requiring 1 or 2 == True, 3 seems to be the right answer. Should I update this README as well, and add it to #36 ?

Thanks

Incorrect Probability of Generating Random XOR

The probability of generating random bits for XOR is not exactly 0.5.

As shown here, the function uniform_int_distribution uniformly samples a number from [0, 1000]. If the sampled number is less than 500, we generate 1; otherwise, we generate 0. The probability of generating 1 is 500/1001, while the probability of generating 0 is 501/1001. The probability is not as expected as 0.5.

Instead, we should sample from [0, 999] to obtain the probability of 0.5.

Improbable infinite loop in one_measurement_count

I'll start by noting that this infinite loop is highly improbable to trigger in practice, so it's debatable whether it needs to be fixed.

I guess it is possible if you are extremely unlucky or the randomness in your C/OS is broken.

Consider the following foo.cnf which has 128 solutions:

p cnf 7 0

In the extremely unlucky case where, for the hashes, we generated 6 empty random XORs (i.e., the random generator returned a '0' bit 6 * 8 = 48 times in a row), then approxmc will go into an infinite loop.

This happens because the following branch of the code does not correctly handle the case where all of the XORs have already been generated but we are still over the threshold:

https://github.com/meelgroup/approxmc/blob/master/src/counter.cpp#L602

To trigger the infinite loop more reliably, set the random cutoff to a low value (so that '0's are much more likely)

@@ -655,7 +663,7 @@ string Counter::gen_rnd_bits(
 {
     string randomBits;
     std::uniform_int_distribution<uint32_t> dist{0, 1000};
-    uint32_t cutoff = 500;
+    uint32_t cutoff = 5;

Then run this bash loop over a few seeds until you hit one that gets into a loop:

for i in {1..1000}
do
  ./approxmc --arjun 0 -s $i foo.cnf
done

A plausible fix is to return a dummy value in the edge case explicitly, such as in the following:

diff --git a/src/counter.cpp b/src/counter.cpp
index f6362ca..b004468 100644
--- a/src/counter.cpp
+++ b/src/counter.cpp
@@ -580,6 +580,14 @@ void Counter::one_measurement_count(
                 return;
             }
 
+            // No further hashes possible
+            if (hashCount == total_max_xors - 1)
+            {
+                numHashList.push_back(total_max_xors);
+                numCountList.push_back(1);
+                return;
+            }
+
             threshold_sols[hashCount] = 0;
             sols_for_hash[hashCount] = num_sols;

Citation info wrong and missing

In the How to cite section of the README, the CAV20 citation is referencing the AAAI19 bibfile and the LICS20 citation is missing.

Problem with installation using pip: "cl.exe failed with exit code2"

Hello everyone,

Thank you for providing a Python interface for your repository. However, when trying to use pip to install it I face the problem described in the error message below. This error seems to be caused by some problem to compile the code. Does anyone else have the same problem? Does a solution exist? Is there maybe a precompiled wheel that I can use?

I have tried to solve the problem by following this article: https://copyprogramming.com/howto/cl-exe-failed-with-exit-status-2-while-installing-pycrypto?utm_content=cmp-true. However, I wasn't able to fix it. Any help is appreciated.

Best regards,
Alex Frey

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools>pip install pyapproxmc
Collecting pyapproxmc
  Using cached pyapproxmc-4.1.15.tar.gz (452 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyapproxmc
  Building wheel for pyapproxmc (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pyapproxmc (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      running bdist_wheel
      running build
      running build_clib
      building 'picosatlib' library
      creating build
      creating build\temp.win32-cpython-311
      creating build\temp.win32-cpython-311\python
      creating build\temp.win32-cpython-311\python\cryptominisat
      creating build\temp.win32-cpython-311\python\cryptominisat\src
      creating build\temp.win32-cpython-311\python\cryptominisat\src\picosat
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\bin\HostX86\x86\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Ipython/cryptominisat/src/ "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /Tcpython/cryptominisat/src/picosat/picosat.c /Fobuild\temp.win32-cpython-311\python/cryptominisat/src/picosat/picosat.obj
      picosat.c
      python/cryptominisat/src/picosat/picosat.c(854): warning C4244: "=": Konvertierung von "unsigned __int64" in "unsigned int", m”glicher Datenverlust
      python/cryptominisat/src/picosat/picosat.c(1171): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
      python/cryptominisat/src/picosat/picosat.c(2252): warning C4146: Einem vorzeichenlosen Typ wurde ein un„rer Minus-Operator zugewiesen. Das Ergebnis ist weiterhin vorzeichenlos.
      python/cryptominisat/src/picosat/picosat.c(2269): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
      python/cryptominisat/src/picosat/picosat.c(3285): warning C4244: "=": Konvertierung von "double" in "unsigned int", m”glicher Datenverlust
      python/cryptominisat/src/picosat/picosat.c(3287): warning C4146: Einem vorzeichenlosen Typ wurde ein un„rer Minus-Operator zugewiesen. Das Ergebnis ist weiterhin vorzeichenlos.
      python/cryptominisat/src/picosat/picosat.c(3291): warning C4244: "=": Konvertierung von "double" in "unsigned int", m”glicher Datenverlust
      python/cryptominisat/src/picosat/picosat.c(3304): warning C4244: "=": Konvertierung von "double" in "unsigned int", m”glicher Datenverlust
      python/cryptominisat/src/picosat/picosat.c(3308): warning C4244: "=": Konvertierung von "double" in "unsigned int", m”glicher Datenverlust
      python/cryptominisat/src/picosat/picosat.c(3314): warning C4244: "=": Konvertierung von "double" in "unsigned int", m”glicher Datenverlust
      python/cryptominisat/src/picosat/picosat.c(3267): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
      python/cryptominisat/src/picosat/picosat.c(3279): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
      python/cryptominisat/src/picosat/picosat.c(5655): warning C4244: "=": Konvertierung von "unsigned __int64" in "unsigned int", m”glicher Datenverlust
      python/cryptominisat/src/picosat/picosat.c(8148): fatal error C1083: Datei (Include) kann nicht ge”ffnet werden: "sys/time.h": No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.37.32822\\bin\\HostX86\\x86\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyapproxmc
Failed to build pyapproxmc
ERROR: Could not build wheels for pyapproxmc, which is required to install pyproject.toml-based projects

ApproxMC ignores SIGINT

Hello @kuldeepmeel and @msoos ,

It appears that ApproxMC ignores SIGINT which makes it hard to be stopped without sending SIGKILL to the process. I think it might be a good idea to be able to either stop when receiving SIGINT or supports timeout as a switch?

Thanks
Xiao Liang

main.cpp(265): error C2065: 'solver': undeclared identifier

Hello,

I just tried to build ApproxMC on my local machine (Windows OS) and I met this error during the build process. I've checked this line of code in the main.cpp file. It seems that we didn't declare the variable "solver" before we use it (there are one "solver2" and one "appmc->solver"). Is that a typo? I'm just wondering which variable we should use here. Hope I can get some explanation for that. Thank you very much!

P.S. I built it successfully in the Mac OS with the same source code. No idea why there didn't appear any error during the building process.

Confusing message during execution

Hi,

I noticed this output while running approxmc:

c WHAAAAT Detach issue. All below must be 1 to work ---
c -- can_detach: 1
c -- mfinder.no_irred_nonxor_contains_clash_vars(): 0
c -- !conf.gaussconf.autodisable: 1
c -- conf.xor_detach_reattach: 1

I'm not quite sure how to interpret this. I'm mostly concerned with distinguishing between two cases: does this indicate that a cryptominisat error that invalidates the approxmc results? Or is it just an unexpected case that does not affect the correctness results?

Potentially of interest:
This particular CNF was generated by simplifying SMTLIB constraints with z3 (including applying some tactics that eliminate unconstrained variables). mis did not produce an MIS for the instance.

The following is printed when execution starts:

c -- header says num vars:         216610
c -- header says num clauses:     1729257
c -- clauses added: 1729257
c -- xor clauses added: 0
c -- vars added 254984

Installing on Mac

Hi, is there any chance to install ApproxMC (v3) on my Mac? I already have cryptominisat installed and tried to perform the steps needed for Linux, but the "make" command failed, reporting the following message:

=========
[ 25%] Building CXX object approxmc-src/CMakeFiles/approxmc.dir/approxmc.cpp.o
/Users/Daniele/Desktop/MyComputer/MieiArticoli/model counting/python/Python/approxmc/src/approxmc.cpp:470:21: error: 
      no member named 'get_text_version_info' in 'CMSat::SATSolver'
    cout << solver->get_text_version_info();
            ~~~~~~  ^
1 error generated.
make[2]: *** [approxmc-src/CMakeFiles/approxmc.dir/approxmc.cpp.o] Error 1
make[1]: *** [approxmc-src/CMakeFiles/approxmc.dir/all] Error 2
make: *** [all] Error 2
=========

Is it a Mac related problem or do I need to perform some other step?
Thanks

Dan

python interface shows ImportError

I use python 3.10 version on my machine with ubuntu 22. I installed normally the package but when I try to use it, I got the following error:
from pyapproxmc import Counter
ImportError: /home/xxxx/.local/lib/python3.10/site-packages/pyapproxmc.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZTIN5boost7archive6detail14basic_iarchiveE

I've tried other version of python (3.8), and I still get the same error on Linux machine

Problem with Boost program_options

Hello,

I am trying to install ApproxMC (and Cryptominisat) on a machine which comes with Boost preinstalled (and I do not have admin privileges)
. However, due to some unknown linking problem, I get "undefined reference" errors for boost program_options functions. At this point I'm unsure about the reason for this -- the output of CMake confirmed that Boost along with program_options was found, but when linking the ApproxMC executable in the final step of running make, it throws the undefined reference errors. I faced the same problem while compiling cryptominisat as well, but I was able to circumvent it by fiddling with CMakeLists.txt. The same thing didn't work for ApproxMC

As the problem might be on my side, I was wondering if there is a cleaner way to disable Boost all together, like setting some flag. I have attached a file approxmc_output.txt showing some of the errors thrown during make. Thanks a lot!

Question about probabilistic guarantees over multiple runs

Hi,

I was wondering how the probabilistic guarantees are affected by runnnig ApproxMC on the same model multiple times. I'm thinking that if the seed is the same, we get the same result every time as ApproxMC is designed to be deterministic. But what about multiple runs of the same problem with different seeds? Can these be treated as independent random experiments?

Best,
Marcel

A potential bug with CNF Examples while using Approxmc

Hi!
I recently encountered an issue while utilizing Approxmc. I attempted to process two CNF files using Approxmc. I set the timeout of running the model counter to 600 seconds.
The new.cnf file is generated by performing the operation of replacing positive literals with negative literals and vice versa on the origin.cnf file. Both CNF files should have the same number of satisfiable solutions. However, the output of Approxmc for origin.cnf was 7995392, and for new.cnf it is 6422528. The results for the two CNF files are different. Despite Approxmc is an approximate model counter, the numerical difference should not be so significant for values that are expected to be equal.
I think Approxmc may have a potential bug, and I hope this information can assist you to address the potential bugs. The two example files are attached here for your reference.
Best regards,

Haiyan and Jifeng
CSTAR group

Some issue about Arjun

Dear Developers:

I am trying to install unigen. When I tried to install approxmc, I encountered some issue. Roughly speaking, I encountered the following two errors when I tried to make.

/home/leven/Projects/Sampling/unigen/approxmc/src/main.cpp: In function ‘int main(int, char**)’:
/home/leven/Projects/Sampling/unigen/approxmc/src/main.cpp:574:88: error: cannot convert ‘bool’ to ‘const std::vector<unsigned int>&’
  574 | = arjun->get_fully_simplified_renumbered_cnf(sampling_vars, false, true);
      |                                                             ^~~~~
      |                                                             |
      |                                                             bool
/usr/local/include/cryptominisat5/dimacsparser.h:438:17: error: ‘class ArjunNS::Arjun’ has no member named ‘add_red_clause’; did you mean ‘add_xor_clause’?
  438 |         solver->add_red_clause(lits);
      |         ~~~~~~~~^~~~~~~~~~~~~~
      |         add_xor_clause

The detailed information about building is as follows:

~/Projects/Sampling/unigen/approxmc/build$ cmake -DSTATICCOMPILE=ON ..
-- The CXX compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- LIB directory is ''
-- BIN directory is ''
-- You can choose the type of build, options are:Debug;Release;RelWithDebInfo;MinSizeRel
-- Doing a RelWithDebInfo build
-- The C compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- build type is RelWithDebInfo
-- Performing Test HAVE_FLAG_-Wall
-- Performing Test HAVE_FLAG_-Wall - Success
-- Performing Test HAVE_FLAG_-Wextra
-- Performing Test HAVE_FLAG_-Wextra - Success
-- Performing Test HAVE_FLAG_-Wunused
-- Performing Test HAVE_FLAG_-Wunused - Success
-- Performing Test HAVE_FLAG_-Wsign-compare
-- Performing Test HAVE_FLAG_-Wsign-compare - Success
-- Performing Test HAVE_FLAG_-fno-omit-frame-pointer
-- Performing Test HAVE_FLAG_-fno-omit-frame-pointer - Success
-- Performing Test HAVE_FLAG_-Wtype-limits
-- Performing Test HAVE_FLAG_-Wtype-limits - Success
-- Performing Test HAVE_FLAG_-Wuninitialized
-- Performing Test HAVE_FLAG_-Wuninitialized - Success
-- Performing Test HAVE_FLAG_-Wno-deprecated
-- Performing Test HAVE_FLAG_-Wno-deprecated - Success
-- Performing Test HAVE_FLAG_-Wstrict-aliasing
-- Performing Test HAVE_FLAG_-Wstrict-aliasing - Success
-- Performing Test HAVE_FLAG_-Wpointer-arith
-- Performing Test HAVE_FLAG_-Wpointer-arith - Success
-- Performing Test HAVE_FLAG_-Wheader-guard
-- Performing Test HAVE_FLAG_-Wheader-guard - Failed
-- Performing Test HAVE_FLAG_-fvisibility=hidden
-- Performing Test HAVE_FLAG_-fvisibility=hidden - Success
-- Performing Test HAVE_FLAG_-Wformat-nonliteral
-- Performing Test HAVE_FLAG_-Wformat-nonliteral - Success
-- Performing Test HAVE_FLAG_-Winit-self
-- Performing Test HAVE_FLAG_-Winit-self - Success
-- Performing Test HAVE_FLAG_-Wparentheses
-- Performing Test HAVE_FLAG_-Wparentheses - Success
-- Performing Test HAVE_FLAG_-Wunreachable-code
-- Performing Test HAVE_FLAG_-Wunreachable-code - Success
-- Performing Test HAVE_FLAG_-g
-- Performing Test HAVE_FLAG_-g - Success
-- Compiling for static library use
-- GIT hash found: 8ab5426e690aeb64469904c6a425a179a8da78c9
-- PROJECT_VERSION: 4.1.15
-- PROJECT_VERSION_MAJOR: 4
-- PROJECT_VERSION_MINOR: 1
-- PROJECT_VERSION_PATCH: 15
-- Cannot find help2man, not creating manpage
-- All defines at startup:
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.46") found components: program_options serialization
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.a (found version "1.2.11")
-- OK, Found ZLIB!
-- Found GMP: /usr/include/x86_64-linux-gnu  
-- GMP dynamic lib: /usr/lib/x86_64-linux-gnu/libgmp.a
-- GMP include header location: /usr/include/x86_64-linux-gnu
-- Found CryptoMiniSat 5.x
-- CryptoMiniSat5 dynamic lib: cryptominisat5
-- CryptoMiniSat5 static lib:  cryptominisat5
-- CryptoMiniSat5 static lib deps:
-- CryptoMiniSat5 include dirs: /usr/local/include
-- Found Arjun
-- Arjun dynamic lib : arjun
-- Arjun include dirs: /usr/local/include
-- Found Louvain Communities library
-- Louvain Communities dynamic lib: louvain_communities
-- Louvain Communities include dirs: /home/leven/Projects/meelgroup/projects/louvain-community/build/include
-- Performing Test HAVE_FLAG_-Wno-bitfield-constant-conversion
-- Performing Test HAVE_FLAG_-Wno-bitfield-constant-conversion - Failed
-- Performing Test HAVE_FLAG_-Wlogical-op
-- Performing Test HAVE_FLAG_-Wlogical-op - Success
-- Performing Test HAVE_FLAG_-Wrestrict
-- Performing Test HAVE_FLAG_-Wrestrict - Success
-- Performing Test HAVE_FLAG_-Wnull-dereference
-- Performing Test HAVE_FLAG_-Wnull-dereference - Success
-- Performing Test HAVE_FLAG_-Wdouble-promotion
-- Performing Test HAVE_FLAG_-Wdouble-promotion - Success
-- Performing Test HAVE_FLAG_-Wshadow
-- Performing Test HAVE_FLAG_-Wshadow - Success
-- Performing Test HAVE_FLAG_-Wformat=2
-- Performing Test HAVE_FLAG_-Wformat=2 - Success
-- Performing Test HAVE_FLAG_-Wextra-semi
-- Performing Test HAVE_FLAG_-Wextra-semi - Success
-- Performing Test HAVE_FLAG_-pedantic
-- Performing Test HAVE_FLAG_-pedantic - Success
CMake Warning at CMakeLists.txt:510 (message):
  Testing is disabled


-- Configuring done
-- Generating done
-- Build files have been written to: /home/leven/Projects/Sampling/unigen/approxmc/build
~/Projects/Sampling/unigen/approxmc/build$ make
[  9%] Building CXX object apx-src/CMakeFiles/approxmc.dir/approxmc.cpp.o
[ 18%] Building CXX object apx-src/CMakeFiles/approxmc.dir/counter.cpp.o
[ 27%] Building CXX object apx-src/CMakeFiles/approxmc.dir/constants.cpp.o
[ 36%] Building CXX object apx-src/CMakeFiles/approxmc.dir/GitSHA1.cpp.o
[ 45%] Linking CXX static library ../lib/libapproxmc.a
[ 45%] Built target approxmc
Copying approxmc.h to /home/leven/Projects/Sampling/unigen/approxmc/build/include/approxmc
[ 45%] Built target CopyPublicHeaders
[ 54%] Building CXX object apx-src/CMakeFiles/approxmc-bin.dir/main.cpp.o
/home/leven/Projects/Sampling/unigen/approxmc/src/main.cpp: In function ‘int main(int, char**)’:
/home/leven/Projects/Sampling/unigen/approxmc/src/main.cpp:574:88: error: cannot convert ‘bool’ to ‘const std::vector<unsigned int>&’
  574 | = arjun->get_fully_simplified_renumbered_cnf(sampling_vars, false, true);
      |                                                             ^~~~~
      |                                                             |
      |                                                             bool

In file included from /home/leven/Projects/Sampling/unigen/approxmc/src/main.cpp:45:
/usr/local/include/arjun/arjun.h:76:42: note:   initializing argument 2 of ‘std::tuple<std::pair<std::vector<std::vector<CMSat::Lit, std::allocator<CMSat::Lit> >, std::allocator<std::vector<CMSat::Lit, std::allocator<CMSat::Lit> > > >, unsigned int>, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int> ArjunNS::Arjun::get_fully_simplified_renumbered_cnf(const std::vector<unsigned int>&, const std::vector<unsigned int>&, uint32_t)’
   76 |             const std::vector<uint32_t>& empty_vars,
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from /home/leven/Projects/Sampling/unigen/approxmc/src/main.cpp:43:
/usr/local/include/cryptominisat5/dimacsparser.h: In instantiation of ‘bool CMSat::DimacsParser<C, S>::parseComments(C&, const string&) [with C = CMSat::StreamBuffer<gzFile_s*, CMSat::GZ>; S = ArjunNS::Arjun; std::string = std::__cxx11::basic_string<char>]’:
/usr/local/include/cryptominisat5/dimacsparser.h:642:18:   required from ‘bool CMSat::DimacsParser<C, S>::parse_DIMACS_main(C&) [with C = CMSat::StreamBuffer<gzFile_s*, CMSat::GZ>; S = ArjunNS::Arjun]’
/usr/local/include/cryptominisat5/dimacsparser.h:698:11:   required from ‘bool CMSat::DimacsParser<C, S>::parse_DIMACS(T, bool, uint32_t) [with T = gzFile_s*; C = CMSat::StreamBuffer<gzFile_s*, CMSat::GZ>; S = ArjunNS::Arjun; uint32_t = unsigned int]’
/home/leven/Projects/Sampling/unigen/approxmc/src/main.cpp:296:29:   required from ‘void read_in_file(const string&, T*) [with T = ArjunNS::Arjun; std::string = std::__cxx11::basic_string<char>]’
/home/leven/Projects/Sampling/unigen/approxmc/src/main.cpp:449:21:   required from ‘void read_input_cnf(T*) [with T = ArjunNS::Arjun]’
/home/leven/Projects/Sampling/unigen/approxmc/src/main.cpp:564:23:   required from here
/usr/local/include/cryptominisat5/dimacsparser.h:438:17: error: ‘class ArjunNS::Arjun’ has no member named ‘add_red_clause’; did you mean ‘add_xor_clause’?
  438 |         solver->add_red_clause(lits);
      |         ~~~~~~~~^~~~~~~~~~~~~~
      |         add_xor_clause

pip install pyapproxmc - install error with picogcnf.c

I installed microsoft visual studio build tools for a C++ compiler.
When running pip install pyapproxmc, i get the following error code:

  
  Building wheel for pyapproxmc (pyproject.toml) did not run successfully.
  exit code: 1
  
  [16 lines of output]
  running bdist_wheel
  running build
  running build_clib
  building 'picosatlib' library
  creating build
  creating build\temp.win-amd64-cpython-39
  creating build\temp.win-amd64-cpython-39\python
  creating build\temp.win-amd64-cpython-39\python\cryptominisat
  creating build\temp.win-amd64-cpython-39\python\cryptominisat\src
  creating build\temp.win-amd64-cpython-39\python\cryptominisat\src\picosat
  "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Ipython/cryptominisat/src/ "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcpython/cryptominisat/src/picosat/picogcnf.c /Fobuild\temp.win-amd64-cpython-39\python/cryptominisat/src/picosat/picogcnf.obj
  picogcnf.c
  python/cryptominisat/src/picosat/picogcnf.c(32): error C2010: '.': unexpected in macro parameter list
  python/cryptominisat/src/picosat/picogcnf.c(79): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
  python/cryptominisat/src/picosat/picogcnf.c(90): warning C4996: 'fscanf': This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.35.32215\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  [end of output]
  

Can you please help with this issue?

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.