Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00045
00046
00047
00048 #include <acado_optimal_control.hpp>
00049 #include <acado_gnuplot.hpp>
00050
00051
00052
00053 int main( ){
00054
00055 USING_NAMESPACE_ACADO
00056
00057
00058
00059 DifferentialState x1,x2,x3;
00060 Control u;
00061
00062 DifferentialEquation f(0.0,1.0);
00063
00064
00065
00066
00067 f << dot(x1) == -u*(x1-10.0*x2);
00068 f << dot(x2) == u*(x1-10.0*x2)-(1.0-u)*x2;
00069 f << dot(x3) == u/10.0;
00070
00071
00072
00073
00074 OCP ocp(0.0,1.0,25);
00075 ocp.minimizeMayerTerm( 0, -(1.0-x1-x2));
00076 ocp.minimizeMayerTerm( 1, x3 );
00077
00078 ocp.subjectTo( f );
00079
00080 ocp.subjectTo( AT_START, x1 == 1.0 );
00081 ocp.subjectTo( AT_START, x2 == 0.0 );
00082 ocp.subjectTo( AT_START, x3 == 0.0 );
00083
00084 ocp.subjectTo( 0.0 <= x1 <= 1.0 );
00085 ocp.subjectTo( 0.0 <= x2 <= 1.0 );
00086 ocp.subjectTo( 0.0 <= x3 <= 1.0 );
00087 ocp.subjectTo( 0.0 <= u <= 1.0 );
00088
00089
00090
00091
00092 MultiObjectiveAlgorithm algorithm(ocp);
00093
00094 algorithm.set( PARETO_FRONT_GENERATION , PFG_WEIGHTED_SUM );
00095 algorithm.set( PARETO_FRONT_DISCRETIZATION, 11 );
00096 algorithm.set( HESSIAN_APPROXIMATION, EXACT_HESSIAN );
00097
00098
00099
00100
00101 algorithm.solve();
00102
00103 algorithm.getWeights("catatlyst_mixing_ws_weights.txt");
00104 algorithm.getAllDifferentialStates("catalyst_mixing_ws_states.txt");
00105 algorithm.getAllControls("catalyst_mixing_ws_controls.txt");
00106
00107
00108
00109
00110 VariablesGrid paretoFront;
00111 algorithm.getParetoFront( paretoFront );
00112
00113 GnuplotWindow window1;
00114 window1.addSubplot( paretoFront, "Pareto Front", "Conversion","Catalyst", PM_POINTS );
00115 window1.plot( );
00116
00117
00118
00119
00120 algorithm.printInfo();
00121
00122
00123
00124
00125 paretoFront.print( "catalyst_mixing_ws_pareto.txt" );
00126
00127 return 0;
00128 }
00129
00130