int main(const int argc, const char** argv) { if (argc <= 1) { throw("No param\n"); } int numberfunc; char var2, var1; std::string truth_table; vSet vertexList; BoolVertexEdge_list main_table; SlnTable solution; std::ifstream in(argv[1]); std::ofstream out(argv[2]); in >> numberfunc; for (int i = 0; i < numberfunc; i++) { in >> var1 >> var2 >> truth_table; func tempfunction(var1, var2, truth_table); BoolVertexEdge_list temp = get_edges_BoolVertex(tempfunction); for (const Edge &v: temp) { if (main_table.find(v) == main_table.end()) { main_table.insert(v); } vertexList.insert(v.first); vertexList.insert(v.second); } } Graph< BoolVertex, AreBoolVerticesConnected > g(vertexList.begin(), vertexList.end(), main_table.begin(), main_table.end()); std::vector< std::set< BoolVertex > > cond = g.build_condensation(); if (!SolutionExists(cond.begin(), cond.end())) { std::cout << "No solution\n"; return 0; } solution = MarkingBoolVertex(main_table, cond); print_solution(out, solution.begin(), solution.end()); return 0; }
fixed AirspaceAircraftPerformance::SolutionVertical(fixed distance, fixed altitude, fixed base, fixed top, fixed &intercept_alt) const { if (!SolutionExists(distance, altitude, base, top)) return fixed(-1); if (top <= base) { // unique solution fixed t_this = SolutionGeneral(distance, altitude - top); if (t_this < fixed_big) { intercept_alt = top; return t_this; } return fixed(-1); } AirspaceAircraftInterceptVertical aaiv(*this, distance, altitude, base, top); return aaiv.solve(intercept_alt); }
double AirspaceAircraftPerformance::SolutionVertical(double distance, double altitude, double base, double top, double &intercept_alt) const { if (!SolutionExists(distance, altitude, base, top)) return -1; if (top <= base) { // unique solution auto t_this = SolutionGeneral(distance, altitude - top); if (t_this < BIG) { intercept_alt = top; return t_this; } return -1; } AirspaceAircraftInterceptVertical aaiv(*this, distance, altitude, base, top); return aaiv.solve(intercept_alt); }
fixed AirspaceAircraftPerformance::SolutionHorizontal(fixed distance_min, fixed distance_max, fixed altitude, fixed h, fixed &intercept_distance) const { if (!SolutionExists(distance_max, altitude, h, h)) return fixed(-1); const fixed dh = altitude - h; if (distance_max <= distance_min) { // unique solution fixed t_this = SolutionGeneral(distance_max, dh); if (t_this != fixed_big) { intercept_distance = distance_max; return t_this; } return fixed(-1); } AirspaceAircraftInterceptHorizontal aaih(*this, distance_min, distance_max, dh); return aaih.solve(intercept_distance); }
double AirspaceAircraftPerformance::SolutionHorizontal(double distance_min, double distance_max, double altitude, double h, double &intercept_distance) const { if (!SolutionExists(distance_max, altitude, h, h)) return -1; const auto dh = altitude - h; if (distance_max <= distance_min) { // unique solution auto t_this = SolutionGeneral(distance_max, dh); if (t_this != BIG) { intercept_distance = distance_max; return t_this; } return -1; } AirspaceAircraftInterceptHorizontal aaih(*this, distance_min, distance_max, dh); return aaih.solve(intercept_distance); }