diff --git a/CHANGELOG.md b/CHANGELOG.md
index 018520b8c..e83c5ee29 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,7 @@ Legenda for the issue kind:
- [#573](https://github.com/ariadne-cps/ariadne/issues/573) (C) Use an LRU cache for modes in CompositeHybridAutomaton, avoid exhausting a given mode in HybridEvolver before changing mode
- [#580](https://github.com/ariadne-cps/ariadne/issues/580) (C) VectorFieldEvolver, IteratedMapEvolver and HybridEvolver now check that the initial enclosure is consistent
- [#592](https://github.com/ariadne-cps/ariadne/issues/592) (C) Enclosure now uses the global GraphicsManager drawer instead of having a dedicated configuration field
+- [#595](https://github.com/ariadne-cps/ariadne/issues/595) (C) Modify examples to use ariadne_main function for simplicity, tutorials are not changed
- [#539](https://github.com/ariadne-cps/ariadne/issues/539) (F) A segmentation fault sometimes would be issued when terminating the executable, due to logging
- [#557](https://github.com/ariadne-cps/ariadne/issues/557) (F) Fix behavior of StopWatch utility for concurrent code, enhance the class for choosing a duration type
- [#567](https://github.com/ariadne-cps/ariadne/issues/567) (F) Fix problem with state_time space creation when state space already contains the 't' variable
diff --git a/examples/continuous/attractor.cpp b/examples/continuous/attractor.cpp
index 765c9ff5d..e054f68f0 100644
--- a/examples/continuous/attractor.cpp
+++ b/examples/continuous/attractor.cpp
@@ -22,14 +22,10 @@
* along with Ariadne. If not, see .
*/
-#include "ariadne.hpp"
-
-using namespace std;
-using namespace Ariadne;
-
-int main(int argc, const char* argv[]) {
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
+#include "ariadne_main.hpp"
+void ariadne_main()
+{
RealVariable x("x"), y("y");
VectorField system = {{dot(x)=2*x-x*y,dot(y)=2*x*x-y}};
RealExpressionBoundedConstraintSet initial_set = {{0.9_dec<=x<=1,-2.2_dec<=y<=-2},{sqr(x)+sqr(y+2)<=1}};
diff --git a/examples/continuous/noisy/chemical-reactor.cpp b/examples/continuous/noisy/chemical-reactor.cpp
index 52f7f5ffa..02e40eb36 100644
--- a/examples/continuous/noisy/chemical-reactor.cpp
+++ b/examples/continuous/noisy/chemical-reactor.cpp
@@ -22,14 +22,11 @@
* along with Ariadne. If not, see .
*/
+#include "ariadne_main.hpp"
#include "chemical-reactor.hpp"
#include "noisy-utilities.hpp"
-using namespace Ariadne;
-
-
-int main(int argc, const char* argv[])
+void ariadne_main()
{
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
run_noisy_system(CR());
}
diff --git a/examples/continuous/noisy/dc-dc.cpp b/examples/continuous/noisy/dc-dc.cpp
index afb2b3092..093307e92 100644
--- a/examples/continuous/noisy/dc-dc.cpp
+++ b/examples/continuous/noisy/dc-dc.cpp
@@ -22,14 +22,11 @@
* along with Ariadne. If not, see .
*/
+#include "ariadne_main.hpp"
#include "dc-dc.hpp"
#include "noisy-utilities.hpp"
-using namespace Ariadne;
-
-
-int main(int argc, const char* argv[])
+void ariadne_main()
{
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
run_noisy_system(DC());
}
diff --git a/examples/continuous/noisy/higgins-selkov.cpp b/examples/continuous/noisy/higgins-selkov.cpp
index cf8aa32fc..1d6d0f724 100644
--- a/examples/continuous/noisy/higgins-selkov.cpp
+++ b/examples/continuous/noisy/higgins-selkov.cpp
@@ -22,14 +22,11 @@
* along with Ariadne. If not, see .
*/
+#include "ariadne_main.hpp"
#include "higgins-selkov.hpp"
#include "noisy-utilities.hpp"
-using namespace Ariadne;
-
-
-int main(int argc, const char* argv[])
+void ariadne_main()
{
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
run_noisy_system(HS());
}
diff --git a/examples/continuous/noisy/jerk16.cpp b/examples/continuous/noisy/jerk16.cpp
index 68c6ac0c5..c4465cf6c 100644
--- a/examples/continuous/noisy/jerk16.cpp
+++ b/examples/continuous/noisy/jerk16.cpp
@@ -22,14 +22,11 @@
* along with Ariadne. If not, see .
*/
+#include "ariadne_main.hpp"
#include "jerk16.hpp"
#include "noisy-utilities.hpp"
-using namespace Ariadne;
-
-
-int main(int argc, const char* argv[])
+void ariadne_main()
{
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
run_noisy_system(J16());
}
diff --git a/examples/continuous/noisy/jerk21.cpp b/examples/continuous/noisy/jerk21.cpp
index bc4a376e5..4bf93625a 100644
--- a/examples/continuous/noisy/jerk21.cpp
+++ b/examples/continuous/noisy/jerk21.cpp
@@ -22,14 +22,11 @@
* along with Ariadne. If not, see .
*/
+#include "ariadne_main.hpp"
#include "jerk21.hpp"
#include "noisy-utilities.hpp"
-using namespace Ariadne;
-
-
-int main(int argc, const char* argv[])
+void ariadne_main()
{
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
run_noisy_system(J21());
}
diff --git a/examples/continuous/noisy/jet-engine.cpp b/examples/continuous/noisy/jet-engine.cpp
index d52d86115..bd9d70991 100644
--- a/examples/continuous/noisy/jet-engine.cpp
+++ b/examples/continuous/noisy/jet-engine.cpp
@@ -22,14 +22,11 @@
* along with Ariadne. If not, see .
*/
+#include "ariadne_main.hpp"
#include "jet-engine.hpp"
#include "noisy-utilities.hpp"
-using namespace Ariadne;
-
-
-int main(int argc, const char* argv[])
+void ariadne_main()
{
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
run_noisy_system(JE());
}
diff --git a/examples/continuous/noisy/lorenz-attractor.cpp b/examples/continuous/noisy/lorenz-attractor.cpp
index 1056685c5..d4d68fbba 100644
--- a/examples/continuous/noisy/lorenz-attractor.cpp
+++ b/examples/continuous/noisy/lorenz-attractor.cpp
@@ -22,14 +22,11 @@
* along with Ariadne. If not, see .
*/
+#include "ariadne_main.hpp"
#include "lorenz-attractor.hpp"
#include "noisy-utilities.hpp"
-using namespace Ariadne;
-
-
-int main(int argc, const char* argv[])
+void ariadne_main()
{
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
run_noisy_system(LA());
}
diff --git a/examples/continuous/noisy/lotka-volterra.cpp b/examples/continuous/noisy/lotka-volterra.cpp
index 45cd50f9a..521c63153 100644
--- a/examples/continuous/noisy/lotka-volterra.cpp
+++ b/examples/continuous/noisy/lotka-volterra.cpp
@@ -22,14 +22,11 @@
* along with Ariadne. If not, see .
*/
+#include "ariadne_main.hpp"
#include "lotka-volterra.hpp"
#include "noisy-utilities.hpp"
-using namespace Ariadne;
-
-
-int main(int argc, const char* argv[])
+void ariadne_main()
{
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
run_noisy_system(LV());
}
diff --git a/examples/continuous/noisy/noisy-benchmark.cpp b/examples/continuous/noisy/noisy-benchmark.cpp
index 3fc0f3959..e6c82a92f 100644
--- a/examples/continuous/noisy/noisy-benchmark.cpp
+++ b/examples/continuous/noisy/noisy-benchmark.cpp
@@ -22,6 +22,8 @@
* along with Ariadne. If not, see .
*/
+#include "ariadne_main.hpp"
+
#include "higgins-selkov.hpp"
#include "chemical-reactor.hpp"
#include "lotka-volterra.hpp"
@@ -32,16 +34,10 @@
#include "rossler-attractor.hpp"
#include "jerk16.hpp"
#include "dc-dc.hpp"
-
#include "noisy-utilities.hpp"
-using namespace Ariadne;
-
-
-int main(int argc, const char* argv[])
+void ariadne_main()
{
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
-
List systems = {HS(),CR(),LV(),JE(),PI(),J21(),LA(),RA(),J16(),DC()};
for (SystemType s : systems) {
diff --git a/examples/continuous/noisy/pi-controller.cpp b/examples/continuous/noisy/pi-controller.cpp
index ef94538d0..b73411251 100644
--- a/examples/continuous/noisy/pi-controller.cpp
+++ b/examples/continuous/noisy/pi-controller.cpp
@@ -22,14 +22,11 @@
* along with Ariadne. If not, see .
*/
+#include "ariadne_main.hpp"
#include "pi-controller.hpp"
#include "noisy-utilities.hpp"
-using namespace Ariadne;
-
-
-int main(int argc, const char* argv[])
+void ariadne_main()
{
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
run_noisy_system(PI());
}
diff --git a/examples/continuous/noisy/rossler-attractor.cpp b/examples/continuous/noisy/rossler-attractor.cpp
index a5f76a778..c8baadd8e 100644
--- a/examples/continuous/noisy/rossler-attractor.cpp
+++ b/examples/continuous/noisy/rossler-attractor.cpp
@@ -22,14 +22,11 @@
* along with Ariadne. If not, see .
*/
+#include "ariadne_main.hpp"
#include "rossler-attractor.hpp"
#include "noisy-utilities.hpp"
-using namespace Ariadne;
-
-
-int main(int argc, const char* argv[])
+void ariadne_main()
{
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
run_noisy_system(RA());
}
diff --git a/examples/discrete/henon_map.cpp b/examples/discrete/henon_map.cpp
index 6b4256883..cedf79afa 100644
--- a/examples/discrete/henon_map.cpp
+++ b/examples/discrete/henon_map.cpp
@@ -22,59 +22,21 @@
* along with Ariadne. If not, see .
*/
-#include
-#include
+#include "ariadne_main.hpp"
-#include "config.hpp"
-#include "utility/attribute.hpp"
-#include "algebra/vector.hpp"
-#include "algebra/matrix.hpp"
-#include "algebra/algebra.hpp"
-#include "symbolic/space.hpp"
-#include "symbolic/expression.hpp"
-#include "function/taylor_model.hpp"
-#include "algebra/differential.hpp"
-#include "function/constraint.hpp"
-#include "function/function.hpp"
-#include "function/taylor_function.hpp"
-#include "function/formula.hpp"
-#include "solvers/solver.hpp"
-#include "symbolic/expression_set.hpp"
-#include "dynamics/enclosure.hpp"
-#include "geometry/box.hpp"
-#include "geometry/list_set.hpp"
-#include "dynamics/iterated_map.hpp"
-#include "dynamics/iterated_map_evolver.hpp"
-#include "io/figure.hpp"
-#include "io/logging.hpp"
-
-#include "geometry/grid_paving.hpp"
-#include "dynamics/reachability_analyser.hpp"
-
- #include "geometry/function_set.hpp"
- #include "geometry/affine_set.hpp"
-
-using namespace Ariadne;
-using namespace std;
-
-#define ARIADNE_PRINT(expr) { std::cout << #expr << ": " << (expr) << "\n"; }
-
-
-Int main(int argc, const char* argv[])
+void ariadne_main()
{
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
-
// The Henon map \f$(x,y)\mapsto(a-x^2+by,x)
Real a=Decimal(1.3), b=Decimal(0.3);
RealVariable x("x"), y("y");
IteratedMap henon({next(x)=a-x*x+b*y,next(y)=x});
- ARIADNE_PRINT(henon);
+ ARIADNE_LOG_PRINTLN_VAR(henon);
// Compute a fixed point
IntervalNewtonSolver solver(maximum_error=1e-2, maximum_number_of_steps=16);
ExactBoxType search_box({{0,1},{0,1}});
Point fixed_point = Point(solver.fixed_point(henon.update_function(),search_box));
- ARIADNE_PRINT(fixed_point);
+ ARIADNE_LOG_PRINTLN_VAR(fixed_point);
LabelledSet> labelled_fixed_point(henon.state_space(),fixed_point);
// Set up the evaluators
diff --git a/examples/hybrid/bouncingball.cpp b/examples/hybrid/bouncingball.cpp
index 2fc38cd35..ea265fed3 100644
--- a/examples/hybrid/bouncingball.cpp
+++ b/examples/hybrid/bouncingball.cpp
@@ -21,16 +21,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include
-#include "ariadne.hpp"
+#include "ariadne_main.hpp"
-using namespace Ariadne;
-using std::cout; using std::endl; using std::flush;
-
-Int main(Int argc, const char* argv[])
+void ariadne_main()
{
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
-
typedef GeneralHybridEvolver GeneralHybridEvolverType;
/// Set the system parameters
diff --git a/examples/hybrid/heating.cpp b/examples/hybrid/heating.cpp
index 485c6cb40..14f203bf2 100644
--- a/examples/hybrid/heating.cpp
+++ b/examples/hybrid/heating.cpp
@@ -21,48 +21,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include "ariadne_main.hpp"
-//! \file heating.cpp
-
-#include "ariadne.hpp"
-
-#include "hybrid/hybrid_automaton-composite.hpp"
-#include "hybrid/hybrid_set.hpp"
-#include "hybrid/hybrid_paving.hpp"
-#include "hybrid/hybrid_evolver.hpp"
-#include "hybrid/hybrid_simulator.hpp"
-#include "hybrid/hybrid_graphics.hpp"
-#include "hybrid/hybrid_enclosure.hpp"
-
-using namespace Ariadne;
-using std::cout; using std::cerr; using std::endl; using std::flush;
-
-typedef GeneralHybridEvolver HybridEvolverType;
-
-
-inline Void press_enter_to_continue() {
- std::cout << "Press ENTER to continue... " << flush;
- std::cin.ignore( std::numeric_limits ::max(), '\n' );
-}
-
-template
-Void nolines_plot(const char* filename, const Axes2d& axes, const Colour& fc1, const SET1& set1, const Colour& fc2, const SET2& set2,
- const Colour& fc3, const SET3& set3, const Colour& fc4, const SET4& set4) {
- HybridFigure g; g.set_axes(axes); g.set_line_style(false); g.set_fill_colour(fc1); draw(g,set1); g.set_fill_colour(fc2); draw(g,set2);
- g.set_fill_colour(fc3); draw(g,set3); g.set_fill_colour(fc4); draw(g,set4); g.write(filename); }
-
-
-template
-Void nolines_plot(const char* filename, const Axes2d& axes, const Colour& fc1, const SET1& set1, const Colour& fc2, const SET2& set2,
- const Colour& fc3, const SET3& set3, const Colour& fc4, const SET4& set4, const Colour& fc5, const SET5& set5) {
- HybridFigure g; g.set_axes(axes); g.set_line_style(false); g.set_line_width(0.0); g.set_fill_colour(fc1); draw(g,set1); g.set_fill_colour(fc2); draw(g,set2);
- g.set_fill_colour(fc3); draw(g,set3); g.set_fill_colour(fc4); draw(g,set4);
- g.set_fill_colour(fc5); draw(g,set5); g.write(filename); }
-
-Int main(Int argc, const char* argv[])
+void ariadne_main()
{
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
-
// Create the system
// Set the system dynamic parameters
RealConstant P("P",4.0_decimal);
@@ -94,7 +56,6 @@ Int main(Int argc, const char* argv[])
RealVariable C("C");
TimeVariable t;
- cerr<<"WARNING: Using different event labels for guard and invariant.\n";
// Create the heater subsystem
HybridAutomaton heater;
heater.new_mode( heating|on, {dot(T)=P+K*(Tav-Tamp*cos(2*pi*C)-T)} );
@@ -111,7 +72,7 @@ Int main(Int argc, const char* argv[])
clock.new_transition( midnight, next(C)=0, C>=1, EventKind::URGENT );
CompositeHybridAutomaton heating_system({clock,heater});
- cout << "heating_system=" << heating_system << "\n" << "\n";
+ ARIADNE_LOG_PRINTLN_VAR(heating_system);
// Create the analyser classes
@@ -122,13 +83,13 @@ Int main(Int argc, const char* argv[])
IntervalNewtonSolver solver(1e-12,8);
// Create a GeneralHybridEvolver object
- HybridEvolverType evolver(heating_system);
+ GeneralHybridEvolver evolver(heating_system);
evolver.set_solver(solver);
// Set the evolution parameters
evolver.configuration().set_maximum_enclosure_radius(0.25);
evolver.configuration().set_maximum_step_size(7.0/16);
- cout << evolver.configuration() << endl << endl;
+ ARIADNE_LOG_PRINTLN_VAR(evolver.configuration());
evolver.configuration().set_enable_reconditioning(true);
evolver.configuration().set_enable_subdivisions(true);
@@ -149,59 +110,56 @@ Int main(Int argc, const char* argv[])
Dyadic r=exp2(-10); Dyadic Ti=16.25_dy;
Real Tinitmin(Ti+r); Real Tinitmax(Ti+3*r); Real Cinitmin(0+r); Real Cinitmax(0+3*r); // Tinit=16.0;
HybridSet initial_set(heating|off, {Tinitmin<=T<=Tinitmax,Cinitmin<=C<=Cinitmax} );
- cout << "initial_set=" << initial_set << endl;
+ ARIADNE_LOG_PRINTLN_VAR(initial_set);
// Compute the initial set as a validated enclosure.
HybridEnclosure initial_enclosure = evolver.enclosure(initial_set);
- cout << "initial_enclosure="< series_orbit = evolver.orbit(initial_enclosure,evolution_time,Semantics::UPPER);
- cout << " done." << endl;
+ ARIADNE_LOG_PRINTLN("done.");
- cout << "\nComputed " << series_orbit.reach().size() << " reach enclosures and " << series_orbit.final().size() << " final enclosures.\n";
+ ARIADNE_LOG_PRINTLN("Computed " << series_orbit.reach().size() << " reach enclosures and " << series_orbit.final().size() << " final enclosures.");
Real tmax=evolution_time.continuous_time();
Real dTmin=Tmin.value(); Real dTmax=Tmax.value();
HybridRealBox guard(heating|off,{Ton_lower.value()<=T<=Ton_upper.value(),0<=C<=1,0<=t<=tmax});
HybridRealBox midnight_guard(heating|off,{dTmin<=T<=dTmax,0<=C<=1,1<=t<=2});
- cout << "\nPlotting time trace of orbit... " << flush;
+ ARIADNE_LOG_PRINTLN("Plotting time trace of orbit... ");
plot("heating-orbit-time.png",Axes2d(0<=t<=tmax,dTmin<=T<=dTmax), midnight_guard_colour, midnight_guard, guard_colour, guard, series_orbit_colour, series_orbit);
- cout << "done." << endl << endl;
+ ARIADNE_LOG_PRINTLN("done.");
HybridTerminationCriterion evolution_termination(2.75_bin,127,Set{midnight});
- cout << "evolution_termination=" << evolution_termination << endl;
+ ARIADNE_LOG_PRINTLN_VAR(evolution_termination);
- cout << "\nComputing event-terminated orbit using series integrator... \n" << flush;
+ ARIADNE_LOG_PRINTLN("Computing event-terminated orbit using series integrator...");
evolver.set_integrator(series_integrator);
series_orbit = evolver.orbit(initial_enclosure,evolution_termination,Semantics::UPPER);
- cout << " done." << endl;
+ ARIADNE_LOG_PRINTLN("done.");
- cout << "\nComputed " << series_orbit.reach().size() << " reach enclosures and " << series_orbit.final().size() << " final enclosures.\n";
+ ARIADNE_LOG_PRINTLN("Computed " << series_orbit.reach().size() << " reach enclosures and " << series_orbit.final().size() << " final enclosures.");
- cout << "\nPlotting time trace of orbit... " << flush;
+ ARIADNE_LOG_PRINTLN("Plotting time trace of orbit... ");
plot("heating-orbit-termination.png",Axes2d(0.0<=t<=1.25,dTmin<=T<=dTmax), midnight_guard_colour, midnight_guard, guard_colour, guard, series_orbit_colour, series_orbit);
- cout << "done." << endl << endl;
-
-
+ ARIADNE_LOG_PRINTLN("done.");
HybridReachabilityAnalyser analyser(evolver);
analyser.configuration().set_lock_to_grid_time(1+1.0/1024);
analyser.configuration().set_lock_to_grid_steps(1);
analyser.configuration().set_scaling(T,8.0);
analyser.configuration().set_scaling(C,1.0);
- std::cerr<<"max grid fineness="<
-#include "ariadne.hpp"
+#include "ariadne_main.hpp"
-using namespace Ariadne;
-using namespace std;
-
-Int main(Int argc, const char* argv[])
+void ariadne_main()
{
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
-
Real amplitude(4.0_dec);
Real frequency(50.0_dec);
Real Ron (10.0_dec);
@@ -152,7 +146,7 @@ Int main(Int argc, const char* argv[])
/// Finished building the automaton
- cout << "Automaton = " << rectifier << endl << endl;
+ ARIADNE_LOG_PRINTLN_VAR(rectifier);
/// Compute the system evolution
@@ -163,30 +157,30 @@ Int main(Int argc, const char* argv[])
evolver.configuration().set_maximum_enclosure_radius(MAX_ENCL_RADIUS);
evolver.configuration().set_maximum_step_size(MAX_STEP_SIZE);
evolver.configuration().set_enable_subdivisions(ENABLE_SUBDIV);
- std::cout << evolver.configuration() << std::endl;
+ ARIADNE_LOG_PRINTLN_VAR(evolver.configuration());
// Declare the type to be used for the system evolution
typedef GeneralHybridEvolver::OrbitType OrbitType;
- std::cout << "Computing evolution..." << std::endl;
+ ARIADNE_LOG_PRINTLN("Computing evolution...");
RealVariablesBox initial_box({t==0, vi==0, vo==Real(0.8_dec)*parameters[0]});
HybridSet initial_set(offoff,initial_box);
- std::cout << "Initial set=" << initial_set << std::endl;
+ ARIADNE_LOG_PRINTLN(initial_set);
HybridTime evolution_time(TIME_LIMIT,TRAN_LIMIT);
- std::cout << "Computing orbit... " << std::flush;
+ ARIADNE_LOG_PRINTLN("Computing orbit... ");
OrbitType orbit = evolver.orbit(initial_set,evolution_time,Semantics::UPPER);
- std::cout << "done." << std::endl;
+ ARIADNE_LOG_PRINTLN("done.");
- std::cout << "Orbit.final size="<
-#include "ariadne.hpp"
+#include "ariadne_main.hpp"
#include "tank.hpp"
#include "valve-hysteresis.hpp"
-#include "controller-hysteresis-permissive.hpp"
+#include "controller-hysteresis-urgent.hpp"
-using namespace Ariadne;
-using std::cout; using std::endl;
-
-Int main(Int argc, const char* argv[])
+void ariadne_main()
{
- // Acquire the verbosity value from the command line
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
-
// Declare the shared system variables required in the following
RealVariable aperture("aperture");
RealVariable height("height");
@@ -53,7 +46,7 @@ Int main(Int argc, const char* argv[])
CompositeHybridAutomaton watertank_system({tank_automaton,valve_automaton,controller_automaton});
// Print the system description on the command line
- cout << watertank_system << endl;
+ ARIADNE_LOG_PRINTLN_VAR(watertank_system)
// Compute the system evolution
@@ -66,7 +59,7 @@ Int main(Int argc, const char* argv[])
// Declare the type to be used for the system evolution
typedef GeneralHybridEvolver::OrbitType OrbitType;
- std::cout << "Computing evolution... " << std::flush;
+ ARIADNE_LOG_PRINTLN("Computing evolution... ")
// Define the initial set, by supplying the location as a list of locations for each composed automata, and
// the continuous set as a list of variable assignments for each variable controlled on that location
@@ -76,13 +69,13 @@ Int main(Int argc, const char* argv[])
HybridTime evolution_time(30.0_x,5);
// Compute the orbit using upper semantics
OrbitType orbit = evolver.orbit(initial_set,evolution_time,Semantics::UPPER);
- std::cout << "done." << std::endl;
+ ARIADNE_LOG_PRINTLN("done.")
// Plot the trajectory using two different projections
- std::cout << "Plotting trajectory... "<
-#include "ariadne.hpp"
+#include "ariadne_main.hpp"
#include "tank.hpp"
#include "valve-proportional-urgent.hpp"
-using namespace Ariadne;
-using std::cout; using std::endl;
-
-Int main(Int argc, const char* argv[])
+void ariadne_main()
{
- ARIADNE_LOG_SET_VERBOSITY(get_verbosity(argc,argv));
-
// Declare the shared system variables
RealVariable aperture("aperture");
RealVariable height("height");
@@ -48,7 +42,7 @@ Int main(Int argc, const char* argv[])
CompositeHybridAutomaton watertank_system({tank_automaton,valve_automaton});
// Print the system description on the command line
- cout << watertank_system << endl;
+ ARIADNE_LOG_PRINTLN_VAR(watertank_system)
// Compute the system evolution
@@ -61,7 +55,7 @@ Int main(Int argc, const char* argv[])
// Declare the type to be used for the system evolution
typedef GeneralHybridEvolver::OrbitType OrbitType;
- std::cout << "Computing evolution... " << std::flush;
+ ARIADNE_LOG_PRINTLN("Computing evolution...")
// Define the initial set, by supplying the location as a list of locations for each composed automata, and
// the continuous set as a list of variable assignments for each variable controlled on that location
@@ -71,15 +65,13 @@ Int main(Int argc, const char* argv[])
HybridTime evolution_time(80.0_x,5);
// Compute the orbit using upper semantics
OrbitType orbit = evolver.orbit(initial_set,evolution_time,Semantics::UPPER);
- std::cout << "done." << std::endl;
+ ARIADNE_LOG_PRINTLN("done.")
// Plot the trajectory using two different projections
- std::cout << "Plotting trajectory... "<