57 cout <<
"[Aleph Geometry Example] " << title <<
"\n";
58 cout <<
"============================================================\n";
75 const Point & p = it.get_current_vertex();
104 file << fixed << setprecision(8);
105 file <<
"type,index,x,y,objective,wkt\n";
110 const Vertex & v = it.get_current_vertex();
111 file <<
"vertex," << idx <<
","
117 file <<
"optimum,-1,"
120 << best_value <<
",\n";
122 file <<
"polygon,-1,,,,\"";
133 cout <<
"Feasible region of constraints:" <<
endl;
134 cout <<
" x >= 0, y >= 0, x <= 4, y <= 4, x + y <= 6" <<
endl;
135 cout <<
"Objective: maximize z = 3x + 2y" <<
endl;
150 cout <<
"\nFeasible polygon vertices:" <<
endl;
157 const Vertex & v = it.get_current_vertex();
171 cout <<
"\nOptimal vertex for z=3x+2y: ("
174 cout <<
"Optimal value z* = " << best_value <<
endl;
177 (
argc > 1) ?
argv[1] :
"halfplane_intersection_output.csv";
181 cout <<
"Warning: cannot export CSV to: " <<
csv_path <<
endl;
183 cout <<
"STATUS: OK" <<
endl;
Simple dynamic array with automatic resizing and functional operations.
T & append(const T &data)
Append a copy of data
bool has_curr() const noexcept
Return true if the iterator has current item.
Exact bounded intersection of half-planes.
Represents a point with rectangular coordinates in a 2D plane.
const Geom_Number & get_x() const noexcept
Gets the x-coordinate value.
const Geom_Number & get_y() const noexcept
Gets the y-coordinate value.
A general (irregular) 2D polygon defined by a sequence of vertices.
const bool & is_closed() const
Check if the polygon is closed.
const size_t & size() const
Get the number of vertices.
A vertex in a polygon's doubly linked vertex list.
Computational geometry algorithms.
static Geom_Number objective(const Point &p)
static void write_polygon_wkt(ostream &out, const Polygon &poly)
static bool export_csv(const char *path, const Polygon &feasible, const Point &best_point, const Geom_Number &best_value)
static void print_banner(const char *title)
Main namespace for Aleph-w library functions.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
double geom_number_to_double(const Geom_Number &n)
Converts a Geom_Number to its double precision representation.
Iterator over the vertices of a polygon.