53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <chrono>
|
|
#include <thread>
|
|
#include <fstream>
|
|
#include <mpi.h>
|
|
|
|
#include "../light.hpp"
|
|
#include "../utils/cmdline.h"
|
|
#include "../paras.hpp"
|
|
#include "heartbeat.h"
|
|
|
|
|
|
void do_simplify(light* S, std::stringstream &ss) {
|
|
auto pre = new preprocess();
|
|
|
|
char *filename = const_cast<char*>(S->opt->instance.c_str());
|
|
pre->do_preprocess(filename);
|
|
|
|
ss << "p cnf " << pre->vars << " " << pre->clause.size() << std::endl;
|
|
for (int i = 1; i <= pre->clauses; i++) {
|
|
int l = pre->clause[i].size();
|
|
for (int j = 0; j < l; j++)
|
|
ss << pre->clause[i][j] << " ";
|
|
ss << "0" << std::endl;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void leader_main(light* S, int num_procs, int rank) {
|
|
|
|
printf("[leader] reading and do simplify ...\n");
|
|
|
|
// read file
|
|
// std::stringstream ss;
|
|
// do_simplify(S, ss);
|
|
// const auto& str_ref = ss.str();
|
|
// const char* cstr = str_ref.c_str();
|
|
|
|
// printf("[leader] hand out simplified cnf ...\n");
|
|
|
|
// HeartBeat *hb = new HeartBeat(num_procs);
|
|
|
|
// printf("[leader] waiting for connection...\n");
|
|
// hb->waiting_all();
|
|
|
|
// for(int i=1; i<=10; i++) {
|
|
// printf("[leader] check: %d\n", i);
|
|
// hb->update();
|
|
// std::this_thread::sleep_for(std::chrono::seconds(1));
|
|
// }
|
|
} |