-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStrategy.cpp
More file actions
41 lines (38 loc) · 939 Bytes
/
Strategy.cpp
File metadata and controls
41 lines (38 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// Created by WADwi on 2021/3/2.
//
#include "Strategy.h"
namespace CNF_Strategies {
int linear(CNF &cnf) {
for (int i = 0; i < cnf.literals_len; i++) {
if (cnf.literals[i].val == undefined) {
return cnf.literals[i].id;
}
}
return -1;
}
int frequential(CNF &cnf) {
int temp = 0;
int id;
for(int i = 0; i < cnf.literals_len; i++){
if(cnf.literals[i].val == undefined && cnf.literals[i].count > temp){
id = i + 1;
temp = cnf.literals[i].count;
}
}
return id;
}
//
// int random(CNF &cnf) {
// std::vector<Literal> filtered;
// auto src = cnf.literals;
// std::copy_if(src.begin(), src.end(), std::back_inserter(filtered),
// [](const Literal &l) {
// return l.val == undefined && l.count > 0;
// });
// std::random_device rd;
// std::mt19937 mt(rd());
// std::uniform_int_distribution<int> dist(0, filtered.size()-1);
// return filtered[dist(mt)].id;
// };
}