cloud-sat/light.hpp

53 lines
914 B
C++
Raw Normal View History

2022-08-30 15:42:35 +08:00
#ifndef _light_hpp_INCLUDED
#define _light_hpp_INCLUDED
#include "utils/paras.hpp"
2023-02-24 07:58:40 +00:00
#include "preprocess/preprocess.hpp"
2022-08-30 15:42:35 +08:00
#include <atomic>
#include <iostream>
2022-12-04 23:30:36 +08:00
#include <mutex>
2022-08-30 15:42:35 +08:00
typedef long long ll;
class basesolver;
2022-09-08 13:54:29 +08:00
class sharer;
2022-09-15 10:31:41 +08:00
extern std::atomic<int> terminated;
2022-12-04 23:30:36 +08:00
extern std::mutex mtx;
2022-08-30 15:42:35 +08:00
2022-08-31 09:16:12 +00:00
struct thread_inf{
int id, inf;
bool operator < ( const thread_inf &other ) const
{
return inf > other.inf;
}
};
2022-08-30 15:42:35 +08:00
struct light
{
public:
light();
~light();
char *filename;
paras *opt;
preprocess *pre;
2022-08-31 09:16:12 +00:00
vec<basesolver *> workers;
2022-09-08 13:54:29 +08:00
vec<sharer *> sharers;
2022-08-30 15:42:35 +08:00
int finalResult;
int winner;
int maxtime;
2022-09-15 10:31:41 +08:00
std::atomic<bool> globalEnding;
2022-08-30 15:42:35 +08:00
void arg_parse(int argc, char **argv);
2022-08-31 09:16:12 +00:00
void init_workers();
void diversity_workers();
2022-08-30 15:42:35 +08:00
void parse_input();
int run();
2022-09-08 13:54:29 +08:00
void share();
2022-08-30 15:42:35 +08:00
int solve();
2022-08-31 09:16:12 +00:00
void terminate_workers();
2022-08-30 15:42:35 +08:00
void print_model();
};
#endif