leungll / PM-Coding

Solver algorithm in #3 Paper: Diversified Top-K MaxSAT Solving with MaxSAT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PM-Coding

Solver algorithm in #3 Paper: Diversified Top-K MaxSAT Solving with MaxSAT.

GitHub last commit C++11 GitHub repo size GitHub license

Server Address

/home/zhoujp/liangll/PM_Coding

Compile & Run

Compile

g++ -std=c++11 PM-Coding.cpp -o PM-Coding

Run

./PM-Coding XXX.XXX K 1
  • XXX.XXX : input file
  • K : number of extended variables
  • 1 : the first vertex sorting method , currently tentatively 1

Example of Variable Numbering

Input File

  • V2.wcnf
  • K = 3
p wcnf 4 5 20
20 1 3 0
20 -2 -3 -4 0
1 -1 2 0
1 -2 0
1 -3 0

Run

./PM-Coding V2.wcnf 3 1

Serial Number

  • Extended Variables

      X11 X12 X13                                  1  2  3
      X21 X22 X23                                  4  5  6
      X31 X32 X33                                  7  8  9
      X41 X42 X43                                  10 11 12
    
  • Hard Clause

    X11 ∨ X31                                     1  7
    X12 ∨ X32                                     2  8
    X13 ∨ X33                                     3  9
    ㄱX21 ∨ ㄱX31 ∨ ㄱX41                          -4 -7 -10
    ㄱX22 ∨ ㄱX32 ∨ ㄱX42                          -5 -8 -11
    ㄱX23 ∨ ㄱX33 ∨ ㄱX43                          -6 -9 -12
    
  • Soft Clause

    ㄱX11 ∨ ㄱX12 ∨ ㄱX13 ∨ X21 ∨ X22 ∨ X23        -1 -2 -3 4 5 6 
    ㄱX21 ∨ ㄱX22 ∨ ㄱX23                          -4 -5 -6
    ㄱX31 ∨ ㄱX32 ∨ ㄱX33                          -7 -8 -9    
    

Variable Ordering

  • {3, 1, 2, 4}

  • X31 X32 X33     
    X11 X12 X13     
    X21 X22 X23       
    X41 X42 X43     
    
  • X32 = X33 = X13 = 0

  • Renumber the Extension Variable

    X11 X12         1  2  
    X21 X22 X23     3  4  5
    X31             6
    X41 X42 X43     7  8  9
    

Result

  • Hard Clause

    X11 ∨ X31                                     1  6
    X12                                           2
    ㄱX21 ∨ ㄱX31 ∨ ㄱX41                          -3 -6 -7     
    
  • Soft Clause

    ㄱX11 ∨ ㄱX12 ∨ X21 ∨ X22 ∨ X23               -1 -2 3 4 5 
    ㄱX21 ∨ ㄱX22 ∨ ㄱX23                          -3 -4 -5
    ㄱX31                                         -6
    

Output File

p wcnf 7 6 20
1 -1 -2 3 4 5 0
1 -3 -4 -5 0
1 -6 0
20 1 6 0
20 2 0
20 -3 -6 -7 0

About

Solver algorithm in #3 Paper: Diversified Top-K MaxSAT Solving with MaxSAT

License:Apache License 2.0


Languages

Language:C++ 100.0%