00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00035 #ifndef QPOASES_MESSAGEHANDLING_HPP
00036 #define QPOASES_MESSAGEHANDLING_HPP
00037
00038
00039 #include <stdio.h>
00040 #include <string.h>
00041
00042 #include <qpOASES/Constants.hpp>
00043
00044
00045 BEGIN_NAMESPACE_QPOASES
00046
00047
00056 enum returnValue
00057 {
00058 TERMINAL_LIST_ELEMENT = -1,
00059
00060 SUCCESSFUL_RETURN = 0,
00061 RET_DIV_BY_ZERO,
00062 RET_INDEX_OUT_OF_BOUNDS,
00063 RET_INVALID_ARGUMENTS,
00064 RET_ERROR_UNDEFINED,
00065 RET_WARNING_UNDEFINED,
00066 RET_INFO_UNDEFINED,
00067 RET_EWI_UNDEFINED,
00068 RET_AVAILABLE_WITH_LINUX_ONLY,
00069 RET_UNKNOWN_BUG,
00070 RET_PRINTLEVEL_CHANGED,
00071 RET_NOT_YET_IMPLEMENTED,
00072
00073 RET_INDEXLIST_MUST_BE_REORDERD,
00074 RET_INDEXLIST_EXCEEDS_MAX_LENGTH,
00075 RET_INDEXLIST_CORRUPTED,
00076 RET_INDEXLIST_OUTOFBOUNDS,
00077 RET_INDEXLIST_ADD_FAILED,
00078 RET_INDEXLIST_INTERSECT_FAILED,
00079
00080 RET_INDEX_ALREADY_OF_DESIRED_STATUS,
00081 RET_ADDINDEX_FAILED,
00082 RET_REMOVEINDEX_FAILED,
00083 RET_SWAPINDEX_FAILED,
00084 RET_NOTHING_TO_DO,
00085 RET_SETUP_BOUND_FAILED,
00086 RET_SETUP_CONSTRAINT_FAILED,
00087 RET_MOVING_BOUND_FAILED,
00088 RET_MOVING_CONSTRAINT_FAILED,
00089 RET_SHIFTING_FAILED,
00090 RET_ROTATING_FAILED,
00091
00092 RET_QPOBJECT_NOT_SETUP,
00093 RET_QP_ALREADY_INITIALISED,
00094 RET_NO_INIT_WITH_STANDARD_SOLVER,
00095 RET_RESET_FAILED,
00096 RET_INIT_FAILED,
00097 RET_INIT_FAILED_TQ,
00098 RET_INIT_FAILED_CHOLESKY,
00099 RET_INIT_FAILED_HOTSTART,
00100 RET_INIT_FAILED_INFEASIBILITY,
00101 RET_INIT_FAILED_UNBOUNDEDNESS,
00102 RET_INIT_FAILED_REGULARISATION,
00103 RET_INIT_SUCCESSFUL,
00104 RET_OBTAINING_WORKINGSET_FAILED,
00105 RET_SETUP_WORKINGSET_FAILED,
00106 RET_SETUP_AUXILIARYQP_FAILED,
00107 RET_NO_EXTERN_SOLVER,
00108 RET_QP_UNBOUNDED,
00109 RET_QP_INFEASIBLE,
00110 RET_QP_NOT_SOLVED,
00111 RET_QP_SOLVED,
00112 RET_UNABLE_TO_SOLVE_QP,
00113 RET_INITIALISATION_STARTED,
00114 RET_HOTSTART_FAILED,
00115 RET_HOTSTART_FAILED_TO_INIT,
00116 RET_HOTSTART_FAILED_AS_QP_NOT_INITIALISED,
00117 RET_ITERATION_STARTED,
00118 RET_SHIFT_DETERMINATION_FAILED,
00119 RET_STEPDIRECTION_DETERMINATION_FAILED,
00120 RET_STEPLENGTH_DETERMINATION_FAILED,
00121 RET_OPTIMAL_SOLUTION_FOUND,
00122 RET_HOMOTOPY_STEP_FAILED,
00123 RET_HOTSTART_STOPPED_INFEASIBILITY,
00124 RET_HOTSTART_STOPPED_UNBOUNDEDNESS,
00125 RET_WORKINGSET_UPDATE_FAILED,
00126 RET_MAX_NWSR_REACHED,
00127 RET_CONSTRAINTS_NOT_SPECIFIED,
00128 RET_INVALID_FACTORISATION_FLAG,
00129 RET_UNABLE_TO_SAVE_QPDATA,
00130 RET_STEPDIRECTION_FAILED_TQ,
00131 RET_STEPDIRECTION_FAILED_CHOLESKY,
00132 RET_CYCLING_DETECTED,
00133 RET_CYCLING_NOT_RESOLVED,
00134 RET_CYCLING_RESOLVED,
00135 RET_STEPSIZE,
00136 RET_STEPSIZE_NONPOSITIVE,
00137 RET_SETUPSUBJECTTOTYPE_FAILED,
00138 RET_ADDCONSTRAINT_FAILED,
00139 RET_ADDCONSTRAINT_FAILED_INFEASIBILITY,
00140 RET_ADDBOUND_FAILED,
00141 RET_ADDBOUND_FAILED_INFEASIBILITY,
00142 RET_REMOVECONSTRAINT_FAILED,
00143 RET_REMOVEBOUND_FAILED,
00144 RET_REMOVE_FROM_ACTIVESET,
00145 RET_ADD_TO_ACTIVESET,
00146 RET_REMOVE_FROM_ACTIVESET_FAILED,
00147 RET_ADD_TO_ACTIVESET_FAILED,
00148 RET_CONSTRAINT_ALREADY_ACTIVE,
00149 RET_ALL_CONSTRAINTS_ACTIVE,
00150 RET_LINEARLY_DEPENDENT,
00151 RET_LINEARLY_INDEPENDENT,
00152 RET_LI_RESOLVED,
00153 RET_ENSURELI_FAILED,
00154 RET_ENSURELI_FAILED_TQ,
00155 RET_ENSURELI_FAILED_NOINDEX,
00156 RET_ENSURELI_FAILED_CYCLING,
00157 RET_BOUND_ALREADY_ACTIVE,
00158 RET_ALL_BOUNDS_ACTIVE,
00159 RET_CONSTRAINT_NOT_ACTIVE,
00160 RET_BOUND_NOT_ACTIVE,
00161 RET_HESSIAN_NOT_SPD,
00162 RET_HESSIAN_INDEFINITE,
00163 RET_MATRIX_SHIFT_FAILED,
00164 RET_MATRIX_FACTORISATION_FAILED,
00165 RET_PRINT_ITERATION_FAILED,
00166 RET_NO_GLOBAL_MESSAGE_OUTPUTFILE,
00167 RET_DISABLECONSTRAINTS_FAILED,
00168 RET_ENABLECONSTRAINTS_FAILED,
00169 RET_ALREADY_ENABLED,
00170 RET_ALREADY_DISABLED,
00171 RET_NO_HESSIAN_SPECIFIED,
00172 RET_USING_REGULARISATION,
00173 RET_EPS_MUST_BE_POSITVE,
00174 RET_REGSTEPS_MUST_BE_POSITVE,
00175 RET_HESSIAN_ALREADY_REGULARISED,
00176 RET_CANNOT_REGULARISE_IDENTITY,
00177 RET_CANNOT_REGULARISE_SPARSE,
00178 RET_NO_REGSTEP_NWSR,
00179 RET_FEWER_REGSTEPS_NWSR,
00180 RET_CHOLESKY_OF_ZERO_HESSIAN,
00181 RET_CONSTRAINTS_ARE_NOT_SCALED,
00182 RET_ERROR_IN_CONSTRAINTPRODUCT,
00183
00184 RET_UPDATEMATRICES_FAILED,
00185 RET_UPDATEMATRICES_FAILED_AS_QP_NOT_SOLVED,
00186
00187 RET_UNABLE_TO_OPEN_FILE,
00188 RET_UNABLE_TO_WRITE_FILE,
00189 RET_UNABLE_TO_READ_FILE,
00190 RET_FILEDATA_INCONSISTENT,
00191
00192 RET_UNABLE_TO_ANALYSE_QPROBLEM,
00193
00194 RET_NWSR_SET_TO_ONE,
00195 RET_UNABLE_TO_READ_BENCHMARK,
00196 RET_BENCHMARK_ABORTED,
00197 RET_INITIAL_QP_SOLVED,
00198 RET_QP_SOLUTION_STARTED,
00199 RET_BENCHMARK_SUCCESSFUL,
00200
00201 RET_NO_DIAGONAL_AVAILABLE
00202 };
00203
00204
00215 class MessageHandling
00216 {
00217
00218
00219
00220 public:
00228 typedef struct {
00229 returnValue key;
00230 const char* data;
00231 VisibilityStatus globalVisibilityStatus;
00233 } ReturnValueList;
00234
00235
00236
00237
00238
00239 public:
00241 MessageHandling( );
00242
00244 MessageHandling( FILE* _outputFile
00245 );
00246
00248 MessageHandling( VisibilityStatus _errorVisibility,
00249 VisibilityStatus _warningVisibility,
00250 VisibilityStatus _infoVisibility
00251 );
00252
00254 MessageHandling( FILE* _outputFile,
00255 VisibilityStatus _errorVisibility,
00256 VisibilityStatus _warningVisibility,
00257 VisibilityStatus _infoVisibility
00258 );
00259
00261 MessageHandling( const MessageHandling& rhs
00262 );
00263
00265 ~MessageHandling( );
00266
00268 MessageHandling& operator=( const MessageHandling& rhs
00269 );
00270
00271
00278 returnValue throwError( returnValue Enumber,
00279 const char* additionaltext,
00280 const char* functionname,
00281 const char* filename,
00282 const unsigned long linenumber,
00283 VisibilityStatus localVisibilityStatus
00286 );
00287
00292 returnValue throwWarning( returnValue Wnumber,
00293 const char* additionaltext,
00294 const char* functionname,
00295 const char* filename,
00296 const unsigned long linenumber,
00297 VisibilityStatus localVisibilityStatus
00300 );
00301
00305 returnValue throwInfo( returnValue Inumber,
00306 const char* additionaltext,
00307 const char* functionname,
00308 const char* filename,
00309 const unsigned long linenumber,
00310 VisibilityStatus localVisibilityStatus
00313 );
00314
00315
00318 returnValue reset( );
00319
00320
00323 returnValue listAllMessages( );
00324
00325
00328 inline VisibilityStatus getErrorVisibilityStatus( ) const;
00329
00332 inline VisibilityStatus getWarningVisibilityStatus( ) const;
00333
00336 inline VisibilityStatus getInfoVisibilityStatus( ) const;
00337
00340 inline FILE* getOutputFile( ) const;
00341
00344 inline int getErrorCount( ) const;
00345
00346
00348 inline void setErrorVisibilityStatus( VisibilityStatus _errorVisibility
00349 );
00350
00352 inline void setWarningVisibilityStatus( VisibilityStatus _warningVisibility
00353 );
00354
00356 inline void setInfoVisibilityStatus( VisibilityStatus _infoVisibility
00357 );
00358
00360 inline void setOutputFile( FILE* _outputFile
00361 );
00362
00366 inline returnValue setErrorCount( int _errorCount
00367 );
00368
00371 static const char* getErrorCodeMessage( const returnValue _returnValue
00372 );
00373
00374
00375
00376
00377
00378 protected:
00382 returnValue throwMessage(
00383 returnValue RETnumber,
00384 const char* additionaltext,
00385 const char* functionname,
00386 const char* filename,
00387 const unsigned long linenumber,
00388 VisibilityStatus localVisibilityStatus,
00391 const char* RETstring
00392 );
00393
00394
00395
00396
00397
00398 protected:
00399 VisibilityStatus errorVisibility;
00400 VisibilityStatus warningVisibility;
00401 VisibilityStatus infoVisibility;
00403 FILE* outputFile;
00405 int errorCount;
00406 };
00407
00408
00409 #ifndef __FUNCTION__
00410
00411 #define __FUNCTION__ 0
00412 #endif
00413
00414 #ifndef __FILE__
00415
00416 #define __FILE__ 0
00417 #endif
00418
00419 #ifndef __LINE__
00420
00421 #define __LINE__ 0
00422 #endif
00423
00424
00426 #define THROWERROR(retval) ( getGlobalMessageHandler( )->throwError((retval),0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE) )
00427
00429 #define THROWWARNING(retval) ( getGlobalMessageHandler( )->throwWarning((retval),0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE) )
00430
00432 #define THROWINFO(retval) ( getGlobalMessageHandler( )->throwInfo((retval),0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE) )
00433
00434
00438 MessageHandling* getGlobalMessageHandler( );
00439
00440
00441 END_NAMESPACE_QPOASES
00442
00443 #include <qpOASES/MessageHandling.ipp>
00444
00445 #endif
00446
00447
00448
00449
00450