cloud-sat/light.hpp

51 lines
863 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"
#include "preprocess.hpp"
#include <atomic>
#include <iostream>
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-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