#ifndef __PortfolioMode__
#define __PortfolioMode__
#include <filesystem>
#include "Forwards.hpp"
#include "Lib/ScopedPtr.hpp"
#include "Kernel/Problem.hpp"
#include "Shell/Property.hpp"
#include "Schedules.hpp"
namespace CASC
{
using namespace Lib;
using namespace Shell;
class PortfolioMode {
PortfolioMode(Kernel::Problem* problem);
public:
static bool perform(Kernel::Problem* problem);
static void rescaleScheduleLimits(const Schedule& sOld, Schedule& sNew, float limit_multiplier);
static void addScheduleExtra(const Schedule& sOld, Schedule& sNew, std::string extra);
private:
unsigned getSliceTime(const std::string &sliceCode);
bool searchForProof();
bool prepareScheduleAndPerform(const Shell::Property& prop);
void getSchedules(const Property& prop, Schedule& quick, Schedule& champions);
bool runSchedule(Schedule schedule);
bool runScheduleAndRecoverProof(Schedule schedule);
[[noreturn]] void runSlice(std::string sliceCode, int remainingTime, bool scheduleRepeat);
[[noreturn]] void runSlice(Options& strategyOpt);
#if VDEBUG
DHSet<pid_t> childIds;
#endif
unsigned _numWorkers;
std::filesystem::path _path;
ScopedPtr<Problem> _prb;
float _slowness;
};
}
#endif