53 lines
903 B
C++
53 lines
903 B
C++
#ifndef _light_hpp_INCLUDED
|
|
#define _light_hpp_INCLUDED
|
|
|
|
#include "utils/paras.hpp"
|
|
#include "preprocess.hpp"
|
|
#include <atomic>
|
|
#include <iostream>
|
|
#include <mutex>
|
|
typedef long long ll;
|
|
|
|
class basesolver;
|
|
class sharer;
|
|
|
|
extern std::atomic<int> terminated;
|
|
extern std::mutex mtx;
|
|
|
|
struct thread_inf{
|
|
int id, inf;
|
|
bool operator < ( const thread_inf &other ) const
|
|
{
|
|
return inf > other.inf;
|
|
}
|
|
};
|
|
|
|
struct light
|
|
{
|
|
public:
|
|
light();
|
|
~light();
|
|
|
|
char *filename;
|
|
paras *opt;
|
|
preprocess *pre;
|
|
vec<basesolver *> workers;
|
|
vec<sharer *> sharers;
|
|
|
|
int finalResult;
|
|
int winner;
|
|
int maxtime;
|
|
std::atomic<bool> globalEnding;
|
|
|
|
void arg_parse(int argc, char **argv);
|
|
void init_workers();
|
|
void diversity_workers();
|
|
void parse_input();
|
|
int run();
|
|
void share();
|
|
int solve();
|
|
void terminate_workers();
|
|
void print_model();
|
|
};
|
|
|
|
#endif |