OS  2.9.3
OSParameters.h
Go to the documentation of this file.
1 /* $Id: OSParameters.h 4985 2015-03-12 14:14:49Z tkr $ */
16 //kipp fix up the infinity issue
17 //kipp define OSINFINITY to COIN_DBL_MAX
18 
19 #ifndef OSPARAMETERS
20 #define OSPARAMETERS
21 
22 #include "OSConfig.h"
23 
24 #include <string>
25 #include <limits>
26 
27 #define OS_PLUS 1001
28 #define OS_SUM 1002
29 #define OS_MINUS 1003
30 #define OS_NEGATE 1004
31 #define OS_TIMES 1005
32 #define OS_DIVIDE 1006
33 #define OS_POWER 1009
34 #define OS_PRODUCT 1010
35 #define OS_ABS 2001
36 #define OS_SQUARE 2005
37 #define OS_SQRT 2006
38 #define OS_LN 2007
39 #define OS_EXP 2010
40 #define OS_ERF 2023
41 #define OS_SIN 3001
42 #define OS_COS 3002
43 #define OS_MIN 4010
44 #define OS_MAX 4011
45 #define OS_NUMBER 5001
46 #define OS_PI 5003
47 #define OS_E 5004
48 #define OS_VARIABLE 6001
49 #define OS_IF 7001
50 #define OS_ALLDIFF 7016
51 
52 #define OS_MATRIX_DETERMINANT 8001
53 #define OS_MATRIX_TRACE 8002
54 #define OS_MATRIX_TO_SCALAR 8003
55 
56 
57 #define OS_MATRIX_PLUS 8501
58 #define OS_MATRIX_SUM 8502
59 #define OS_MATRIX_MINUS 8503
60 #define OS_MATRIX_NEGATE 8504
61 #define OS_MATRIX_TIMES 8505
62 #define OS_MATRIX_PRODUCT 8506
63 #define OS_MATRIX_INVERSE 8510
64 #define OS_MATRIX_TRANSPOSE 8515
65 #define OS_MATRIX_SCALARTIMES 8518
66 #define OS_MATRIX_DOTTIMES 8520
67 #define OS_IDENTITY_MATRIX 8536
68 #define OS_MATRIX_LOWERTRIANGLE 8537
69 #define OS_MATRIX_UPPERTRIANGLE 8538
70 #define OS_MATRIX_DIAGONAL 8539
71 #define OS_DIAGONAL_MATRIX_FROM_VECTOR 8540
72 #define OS_MATRIX_REFERENCE 8541
73 #define OS_MATRIX_SUBMATRIX_AT 8544
74 
75 
76 
77 #define OS_E_VALUE exp(1.0)
78 #define OS_PI_VALUE 2*asin(1.0)
79 
80 #define OS_SCHEMA_VERSION "2.0"
81 
86 #define OS_NEAR_EQUAL 1e-2
87 
88 #define OS_EPS 1e-12
89 
90 const double OSDBL_MAX = std::numeric_limits<double>::max();
91 const int OSINT_MAX = std::numeric_limits<int>::max();
92 
94 extern "C" bool OSIsnan(double x);
96 extern "C" double OSNaN();
97 
98 std::string OSgetVersionInfo();
99 
105 {
114 
115  ENUM_OUTPUT_LEVEL_NUMBER_OF_LEVELS // insert other values above this one...
116 };
117 
118 #define DEFAULT_OUTPUT_LEVEL ENUM_OUTPUT_LEVEL_error
119 
126 {
144 
145  ENUM_OUTPUT_AREA_NUMBER_OF_AREAS // insert other values above this one...
146 };
147 
148 /****************************************************************************************
149  * In the OSxL schemas there is a growing number of string elements that can only take *
150  * a small number of values. In C++ this can be implemented using enumerations, but the *
151  * elements appear in the schemas as strings, so they must be stored internally *
152  * as strings also. Below we list the enumerations and provide two utility methods *
153  * that make working with them convenient: *
154  * return...() functions that return the integer value associated with that enumeration *
155  * verify...() functions that check that a string has a legal value for the enumeration *
156  ****************************************************************************************/
157 
159 {
171 };
172 
173 inline int returnCPUSpeedUnit(std::string unit)
174 {
175  if (unit == "hertz" ) return ENUM_CPUSPEEDUNIT_hertz;
176  if (unit == "kilohertz") return ENUM_CPUSPEEDUNIT_kilohertz;
177  if (unit == "megahertz") return ENUM_CPUSPEEDUNIT_megahertz;
178  if (unit == "gigahertz") return ENUM_CPUSPEEDUNIT_gigahertz;
179  if (unit == "terahertz") return ENUM_CPUSPEEDUNIT_terahertz;
180  if (unit == "flops" ) return ENUM_CPUSPEEDUNIT_flops;
181  if (unit == "kiloflops") return ENUM_CPUSPEEDUNIT_kiloflops;
182  if (unit == "megaflops") return ENUM_CPUSPEEDUNIT_megaflops;
183  if (unit == "gigaflops") return ENUM_CPUSPEEDUNIT_gigaflops;
184  if (unit == "teraflops") return ENUM_CPUSPEEDUNIT_teraflops;
185  if (unit == "petaflops") return ENUM_CPUSPEEDUNIT_petaflops;
186  return 0;
187 }//returnCPUSpeedUnit
188 
189 inline bool verifyCPUSpeedUnit(std::string unit)
190 {
191  return (returnCPUSpeedUnit(unit) > 0);
192 }//verifyCPUSpeedUnit
193 
195 {
205 };
206 
207 inline int returnStorageUnit(std::string unit)
208 {
209  if (unit == "byte" ) return ENUM_STORAGEUNIT_byte;
210  if (unit == "kilobyte" ) return ENUM_STORAGEUNIT_kilobyte;
211  if (unit == "megabyte" ) return ENUM_STORAGEUNIT_megabyte;
212  if (unit == "gigabyte" ) return ENUM_STORAGEUNIT_gigabyte;
213  if (unit == "terabyte" ) return ENUM_STORAGEUNIT_terabyte;
214  if (unit == "petabyte" ) return ENUM_STORAGEUNIT_petabyte;
215  if (unit == "exabyte" ) return ENUM_STORAGEUNIT_exabyte;
216  if (unit == "zettabyte") return ENUM_STORAGEUNIT_zettabyte;
217  if (unit == "yottabyte") return ENUM_STORAGEUNIT_yottabyte;
218  return 0;
219 }//returnStorageUnit
220 
221 inline bool verifyStorageUnit(std::string unit)
222 {
223  return (returnStorageUnit(unit) > 0);
224 }//verifyCPUSpeedUnit
225 
227 {
237 };
238 
239 inline int returnTimeUnit(std::string unit)
240 {
241  if (unit == "tick" ) return ENUM_TIMEUNIT_tick;
242  if (unit == "millisecond") return ENUM_TIMEUNIT_millisecond;
243  if (unit == "second" ) return ENUM_TIMEUNIT_second;
244  if (unit == "minute" ) return ENUM_TIMEUNIT_minute;
245  if (unit == "hour" ) return ENUM_TIMEUNIT_hour;
246  if (unit == "day" ) return ENUM_TIMEUNIT_day;
247  if (unit == "week" ) return ENUM_TIMEUNIT_week;
248  if (unit == "month" ) return ENUM_TIMEUNIT_month;
249  if (unit == "year" ) return ENUM_TIMEUNIT_year;
250  return 0;
251 }//returnTimeUnit
252 
253 inline bool verifyTimeUnit(std::string unit)
254 {
255  return (returnTimeUnit(unit) > 0);
256 }//verifyTimeUnit
257 
259 {
263 };
264 
265 inline int returnTimeType(std::string type)
266 {
267  if (type == "cpuTime" ) return ENUM_TIMETYPE_cpuTime;
268  if (type == "elapsedTime") return ENUM_TIMETYPE_elapsedTime;
269  if (type == "other" ) return ENUM_TIMETYPE_other;
270  return 0;
271 }//returnTimeType
272 
273 inline bool verifyTimeType(std::string type)
274 {
275  return (returnTimeType(type) > 0);
276 }//verifyTimeType
277 
279 {
287 };
288 
289 inline int returnTimeCategory(std::string category)
290 {
291  if (category == "total" ) return ENUM_TIMECATEGORY_total;
292  if (category == "input" ) return ENUM_TIMECATEGORY_input;
293  if (category == "preprocessing" ) return ENUM_TIMECATEGORY_preprocessing;
294  if (category == "optimization" ) return ENUM_TIMECATEGORY_optimization;
295  if (category == "postprocessing") return ENUM_TIMECATEGORY_postprocessing;
296  if (category == "output" ) return ENUM_TIMECATEGORY_output;
297  if (category == "other" ) return ENUM_TIMECATEGORY_other;
298  return 0;
299 }//returnTimeCategory
300 
301 inline bool verifyTimeCategory(std::string category)
302 {
303  return (returnTimeCategory(category) > 0);
304 }//verifyTimeCategory
305 
307 {
311 };
312 
313 inline int returnLocationType(std::string type)
314 {
315  if (type == "local") return ENUM_LOCATIONTYPE_local;
316  if (type == "http" ) return ENUM_LOCATIONTYPE_http;
317  if (type == "ftp" ) return ENUM_LOCATIONTYPE_ftp;
318  return 0;
319 }//returnLocationType
320 
321 inline bool verifyLocationType(std::string type)
322 {
323  return (returnLocationType(type) > 0);
324 }//verifyLocationType
325 
327 {
333 };
334 
335 inline int returnTransportType(std::string type)
336 {
337  if (type == "osp" ) return ENUM_TRANSPORT_TYPE_osp;
338  if (type == "http" ) return ENUM_TRANSPORT_TYPE_http;
339  if (type == "smtp" ) return ENUM_TRANSPORT_TYPE_smtp;
340  if (type == "ftp" ) return ENUM_TRANSPORT_TYPE_ftp;
341  if (type == "other") return ENUM_TRANSPORT_TYPE_other;
342  return 0;
343 }//returnTransportType
344 
345 inline bool verifyTransportType(std::string type)
346 {
347  return (returnTransportType(type) > 0);
348 }//verifyTransportType
349 
351 {
359 };
360 
361 inline int returnServiceType(std::string type)
362 {
363  if (type == "analyzer" ) return ENUM_SERVICE_TYPE_analyzer;
364  if (type == "solver" ) return ENUM_SERVICE_TYPE_solver;
365  if (type == "scheduler" ) return ENUM_SERVICE_TYPE_scheduler;
366  if (type == "modeler" ) return ENUM_SERVICE_TYPE_modeler;
367  if (type == "registry" ) return ENUM_SERVICE_TYPE_registry;
368  if (type == "agent" ) return ENUM_SERVICE_TYPE_agent;
369  if (type == "simulations") return ENUM_SERVICE_TYPE_simulations;
370  return 0;
371 }//returnServiceType
372 
373 inline bool verifyServiceType(std::string type)
374 {
375  return (returnServiceType(type) > 0);
376 }//verifyServiceType
377 
379 {
383 };
384 
385 inline int returnGeneralResultStatus(std::string status)
386 {
387  if (status == "error" ) return ENUM_GENERAL_RESULT_STATUS_error;
388  if (status == "warning") return ENUM_GENERAL_RESULT_STATUS_warning;
389  if (status == "normal" ) return ENUM_GENERAL_RESULT_STATUS_normal;
390  return 0;
391 }//returnGeneralResultStatus
392 
393 inline bool verifyGeneralResultStatus(std::string status)
394 {
395  return (returnGeneralResultStatus(status) > 0);
396 }//verifyGeneralResultStatus
397 
399 {
405 };
406 
407 inline int returnSystemCurrentState(std::string status)
408 {
409  if (status == "busy" ) return ENUM_SYSTEM_CURRENT_STATE_busy;
410  if (status == "busyButAccepting" ) return ENUM_SYSTEM_CURRENT_STATE_busyButAccepting;
411  if (status == "idle" ) return ENUM_SYSTEM_CURRENT_STATE_idle;
412  if (status == "idleButNotAccepting") return ENUM_SYSTEM_CURRENT_STATE_idleButNotAccepting;
413  if (status == "noResponse" ) return ENUM_SYSTEM_CURRENT_STATE_noResponse;
414  return 0;
415 }//returnSystemCurrentState
416 
417 inline bool verifySystemCurrentState(std::string status)
418 {
419  return (returnSystemCurrentState(status) > 0);
420 }//verifySystemCurrentState
421 
423 {
429 };
430 
431 inline int returnJobStatus(std::string status)
432 {
433  if (status == "waiting" ) return ENUM_JOB_STATUS_waiting;
434  if (status == "running" ) return ENUM_JOB_STATUS_running;
435  if (status == "killed" ) return ENUM_JOB_STATUS_killed;
436  if (status == "finished") return ENUM_JOB_STATUS_finished;
437  if (status == "unknown" ) return ENUM_JOB_STATUS_unknown;
438  return 0;
439 }//returnJobStatus
440 
441 inline bool verifyJobStatus(std::string status)
442 {
443  return (returnJobStatus(status) > 0);
444 }//verifyJobStatus
445 
454 {
463 };
464 
465 inline int returnBasisStatus(std::string status)
466 {
467  if (status == "basic" ) return ENUM_BASIS_STATUS_basic;
468  if (status == "atLower" ) return ENUM_BASIS_STATUS_atLower;
469  if (status == "atUpper" ) return ENUM_BASIS_STATUS_atUpper;
470  if (status == "atEquality") return ENUM_BASIS_STATUS_atEquality;
471  if (status == "isFree" ) return ENUM_BASIS_STATUS_isFree;
472  if (status == "superBasic") return ENUM_BASIS_STATUS_superbasic;
473  if (status == "unknown" ) return ENUM_BASIS_STATUS_unknown;
474  return 0;
475 }//returnBasisStatus
476 
477 inline bool verifyBasisStatus(std::string status)
478 {
479  return (returnBasisStatus(status) > 0);
480 }//verifyBasisStatus
481 
482 inline std::string returnBasisStatusString(ENUM_BASIS_STATUS status)
483 {
484  if (status == ENUM_BASIS_STATUS_basic ) return "basic";
485  if (status == ENUM_BASIS_STATUS_atLower ) return "atLower";
486  if (status == ENUM_BASIS_STATUS_atUpper ) return "atUpper";
487  if (status == ENUM_BASIS_STATUS_atEquality) return "atEquality";
488  if (status == ENUM_BASIS_STATUS_isFree ) return "isFree";
489  if (status == ENUM_BASIS_STATUS_superbasic) return "superBasic";
490  if (status == ENUM_BASIS_STATUS_unknown ) return "unknown";
491  return "status???";
492 }//returnBasisStatus
493 
494 
496 {
507 };
508 
509 inline int returnSolutionStatus(std::string status)
510 {
511  if (status == "unbounded" ) return ENUM_SOLUTION_STATUS_unbounded;
512  if (status == "globallyOptimal") return ENUM_SOLUTION_STATUS_globallyOptimal;
513  if (status == "locallyOptimal" ) return ENUM_SOLUTION_STATUS_locallyOptimal;
514  if (status == "optimal" ) return ENUM_SOLUTION_STATUS_optimal;
515  if (status == "bestSoFar" ) return ENUM_SOLUTION_STATUS_bestSoFar;
516  if (status == "feasible" ) return ENUM_SOLUTION_STATUS_feasible;
517  if (status == "infeasible" ) return ENUM_SOLUTION_STATUS_infeasible;
518  if (status == "unsure" ) return ENUM_SOLUTION_STATUS_unsure;
519  if (status == "error" ) return ENUM_SOLUTION_STATUS_error;
520  if (status == "other" ) return ENUM_SOLUTION_STATUS_other;
521  return 0;
522 }//returnSolutionStatus
523 
524 inline bool verifySolutionStatus(std::string status)
525 {
526  return (returnSolutionStatus(status) > 0);
527 }//verifySolutionStatus
528 
530 {
534 };
535 
536 inline int returnSolutionSubstatusType(std::string type)
537 {
538  if (type == "stoppedByLimit" ) return ENUM_SOLUTION_SUBSTATUSTYPE_stoppedByLimit;
539  if (type == "stoppedByBounds") return ENUM_SOLUTION_SUBSTATUSTYPE_stoppedByBounds;
540  if (type == "other" ) return ENUM_SOLUTION_SUBSTATUSTYPE_other;
541  return 0;
542 }//returnSolutionSubstatusType
543 
544 inline bool verifySolutionSubstatusType(std::string type)
545 {
546  return (returnSolutionSubstatusType(type) > 0);
547 }//verifySolutionSubstatusType
548 
550 {
554 };
555 
557 {
564 };
565 
566 inline int returnVarType(char vt)
567 {
568  if (vt == 'C') return ENUM_VARTYPE_continuous;
569  if (vt == 'B') return ENUM_VARTYPE_binary;
570  if (vt == 'I') return ENUM_VARTYPE_integer;
571  if (vt == 'S') return ENUM_VARTYPE_string;
572  if (vt == 'D') return ENUM_VARTYPE_semicontinuous;
573  if (vt == 'J') return ENUM_VARTYPE_semiinteger;
574  return 0;
575 }//returnVarType
576 
577 inline bool verifyVarType(char vt)
578 {
579  return (returnVarType(vt) > 0);
580 }//verifyVarType
581 
582 
584 {
589 };
590 
597 {
598  ENUM_MATRIX_TYPE_zero = 1, // matrix is empty
599 
600  ENUM_MATRIX_TYPE_constant = 10, // matrix elements contain constant values
601  ENUM_MATRIX_TYPE_varref, // matrix elements contain indexes of variables in the core
602  ENUM_MATRIX_TYPE_linear, // matrix contains linear expressions
603  ENUM_MATRIX_TYPE_quadratic, // matrix contains quadratic expressions
604  ENUM_MATRIX_TYPE_general, // matrix contains general nonlinear expressions
605 
606  ENUM_MATRIX_TYPE_conref = 20, // matrix elements contain indexes of objectives in the core
607  ENUM_MATRIX_TYPE_objref, // matrix elements contain indexes of constraints in the core
608  ENUM_MATRIX_TYPE_mixedref, // mixed reference to objectives and constraints
609 
610  ENUM_MATRIX_TYPE_jumbled = 30, // mixture of matrix elements that is unsuited for further use
611 
613 
614 };
615 
616 inline int returnMatrixType(std::string type)
617 {
618  if (type == "zero" ) return ENUM_MATRIX_TYPE_zero;
619  if (type == "constant" ) return ENUM_MATRIX_TYPE_constant;
620  if (type == "varref" ) return ENUM_MATRIX_TYPE_varref;
621  if (type == "linear" ) return ENUM_MATRIX_TYPE_linear;
622  if (type == "quadratic" ) return ENUM_MATRIX_TYPE_quadratic;
623  if (type == "general" ) return ENUM_MATRIX_TYPE_general;
624 
625  if (type == "conref" ) return ENUM_MATRIX_TYPE_conref;
626  if (type == "objref" ) return ENUM_MATRIX_TYPE_objref;
627  if (type == "mixedref" ) return ENUM_MATRIX_TYPE_mixedref;
628 
629  if (type == "jumbled" ) return ENUM_MATRIX_TYPE_jumbled;
630  if (type == "unknown" ) return ENUM_MATRIX_TYPE_unknown;
631  return 0;
632 }//returnMatrixType
633 
634 inline std::string returnMatrixTypeString(ENUM_MATRIX_TYPE type)
635 {
636  if (type == ENUM_MATRIX_TYPE_zero) return "zero";
637  if (type == ENUM_MATRIX_TYPE_constant) return "constant";
638  if (type == ENUM_MATRIX_TYPE_varref) return "varref";
639  if (type == ENUM_MATRIX_TYPE_linear) return "linear";
640  if (type == ENUM_MATRIX_TYPE_quadratic) return "quadratic";
641  if (type == ENUM_MATRIX_TYPE_general) return "general";
642  if (type == ENUM_MATRIX_TYPE_conref) return "conref";
643  if (type == ENUM_MATRIX_TYPE_objref) return "objref";
644  if (type == ENUM_MATRIX_TYPE_mixedref) return "mixedref";
645  if (type == ENUM_MATRIX_TYPE_jumbled) return "jumbled";
646  if (type == ENUM_MATRIX_TYPE_unknown) return "unknown";
647  return "unknown";
648 }//returnMatrixTypeString
649 
650 inline bool verifyMatrixType(std::string type)
651 {
652  return (returnMatrixType(type) > 0);
653 }//verifyMatrixType
654 
659 {
660  // two matrices of same type
661  if (type1 == type2) return type1;
662 
663  // if one matrix is jumbled, the result must be a jumbled matrix
664  if (type1 == ENUM_MATRIX_TYPE_jumbled || type2 == ENUM_MATRIX_TYPE_jumbled)
666 
667  if (type1 == ENUM_MATRIX_TYPE_unknown) return type1;
668  if (type2 == ENUM_MATRIX_TYPE_unknown) return type2;
669  if (type1 == ENUM_MATRIX_TYPE_zero) return type2;
670  if (type2 == ENUM_MATRIX_TYPE_zero) return type1;
671 
672  // column and objective references can be mixed --- in some circumstances
673  if (type1 >= ENUM_MATRIX_TYPE_conref) // row reference (objective or constraint)
674  {
675  if (type2 >= ENUM_MATRIX_TYPE_conref)
677  else
679  }
680  else // linear or nonlinear expression
681  {
683  else // varref must be treated like linear if it is mixed with any other remaining type
684  if (type1 < type2)
685  if (type2 == ENUM_MATRIX_TYPE_varref)
687  else
688  return type2;
689  else
690  if (type1 == ENUM_MATRIX_TYPE_varref)
692  else
693  return type1;
694  }
696 }//returnMatrixType
697 
699 {
707 };
708 
710 {
711  if (symmetry == ENUM_MATRIX_SYMMETRY_none ) return "none";
712  if (symmetry == ENUM_MATRIX_SYMMETRY_upper ) return "upper";
713  if (symmetry == ENUM_MATRIX_SYMMETRY_lower ) return "lower";
714  if (symmetry == ENUM_MATRIX_SYMMETRY_skewUpper ) return "skewUpper";
715  if (symmetry == ENUM_MATRIX_SYMMETRY_skewLower ) return "skewLower";
716  if (symmetry == ENUM_MATRIX_SYMMETRY_HermitianLower) return "HermitianLower";
717  if (symmetry == ENUM_MATRIX_SYMMETRY_HermitianLower) return "HermitianLower";
718  return "none";
719 }//returnMatrixSymmetryString
720 
721 inline int returnMatrixSymmetry(std::string symmetry)
722 {
723  if (symmetry == "none" ) return ENUM_MATRIX_SYMMETRY_none;
724  if (symmetry == "upper" ) return ENUM_MATRIX_SYMMETRY_upper;
725  if (symmetry == "lower" ) return ENUM_MATRIX_SYMMETRY_lower;
726  if (symmetry == "skewUpper" ) return ENUM_MATRIX_SYMMETRY_skewUpper;
727  if (symmetry == "skewLower" ) return ENUM_MATRIX_SYMMETRY_skewLower;
728  if (symmetry == "HermitianLower") return ENUM_MATRIX_SYMMETRY_HermitianLower;
729  if (symmetry == "HermitianLower") return ENUM_MATRIX_SYMMETRY_HermitianLower;
730  return 0;
731 }//returnMatrixSymmetry
732 
733 inline bool verifyMatrixSymmetry(std::string symmetry)
734 {
735  return (returnMatrixSymmetry(symmetry) > 0);
736 }//verifyMatrixSymmetry
737 
738 
740 {
748 };
749 
750 inline int returnMatrixConstructorType(std::string cType)
751 {
752  if (cType == "baseMatrix" ) return ENUM_MATRIX_CONSTRUCTOR_TYPE_baseMatrix;
753  if (cType == "elements" ) return ENUM_MATRIX_CONSTRUCTOR_TYPE_elements;
754  if (cType == "transformation") return ENUM_MATRIX_CONSTRUCTOR_TYPE_transformation;
755  if (cType == "blocks" ) return ENUM_MATRIX_CONSTRUCTOR_TYPE_blocks;
756  if (cType == "block" ) return ENUM_MATRIX_CONSTRUCTOR_TYPE_block;
757  if (cType == "matrix" ) return ENUM_MATRIX_CONSTRUCTOR_TYPE_matrix;
758  return 0;
759 }//returnMatrixConstructorType
760 
761 inline bool verifyMatrixConstructorType(std::string type)
762 {
763  return (returnMatrixConstructorType(type) > 0);
764 }//verifyMatrixConstructorType
765 
766 
771 {
772  ENUM_COMBINE_ARRAYS_replace, // silently replace previous data (if any)
773  ENUM_COMBINE_ARRAYS_merge, // merge two vectors into one
774  ENUM_COMBINE_ARRAYS_ignore, // silently ignore current vector if previous data exist
775  ENUM_COMBINE_ARRAYS_throw // throw an error if previous data detected
776 };
777 
778 
779 /* An enumeration to track the shape of a nonlinear expression */
781 {
787 };
788 
789 inline int returnNlExprShape(std::string shape)
790 {
791  if (shape == "general" ) return ENUM_NL_EXPR_SHAPE_general;
792  if (shape == "convex" ) return ENUM_NL_EXPR_SHAPE_convex;
793  if (shape == "quadratic") return ENUM_NL_EXPR_SHAPE_quadratic;
794  if (shape == "linear" ) return ENUM_NL_EXPR_SHAPE_linear;
795  return 1;
796 }//returnNlExprShape
797 
798 inline std::string returnExprShapeString(ENUM_NL_EXPR_SHAPE shape)
799 {
800  if (shape == ENUM_NL_EXPR_SHAPE_general ) return "general";
801  if (shape == ENUM_NL_EXPR_SHAPE_convex ) return "convex";
802  if (shape == ENUM_NL_EXPR_SHAPE_quadratic) return "quadratic";
803  if (shape == ENUM_NL_EXPR_SHAPE_linear ) return "linear";
804  return "";
805 }//returnExprShapeString
806 
807 inline bool verifyNlExprShape(std::string shape)
808 {
809  return (returnNlExprShape(shape) > 0);
810 }//verifyNlExprShape
811 
812 
814 {
835 };
836 
837 inline int returnConeType(std::string type)
838 {
839  if (type == "nonnegative" ) return ENUM_CONE_TYPE_nonnegative;
840  if (type == "nonpositive" ) return ENUM_CONE_TYPE_nonpositive;
841  if (type == "orthant" ) return ENUM_CONE_TYPE_orthant;
842  if (type == "polyhedral" ) return ENUM_CONE_TYPE_polyhedral;
843  if (type == "quadratic" ) return ENUM_CONE_TYPE_quadratic;
844  if (type == "rotatedQuadratic" ) return ENUM_CONE_TYPE_rotatedQuadratic;
845  if (type == "normed" ) return ENUM_CONE_TYPE_normed;
846  if (type == "rotatedNormed" ) return ENUM_CONE_TYPE_rotatedNormed;
847  if (type == "semidefinite" ) return ENUM_CONE_TYPE_semidefinite;
848  if (type == "copositiveMatrices" ) return ENUM_CONE_TYPE_copositiveMatrices;
849  if (type == "completelyPositiveMatrices") return ENUM_CONE_TYPE_completelyPositiveMatrices;
850  if (type == "hyperbolicity" ) return ENUM_CONE_TYPE_hyperbolicity;
851  if (type == "sumOfSquaresPolynomials" ) return ENUM_CONE_TYPE_sumOfSquaresPolynomials;
852  if (type == "nonnegativePolynomials" ) return ENUM_CONE_TYPE_nonnegativePolynomials;
853  if (type == "moments" ) return ENUM_CONE_TYPE_moments;
854  if (type == "product" ) return ENUM_CONE_TYPE_product;
855  if (type == "intersection" ) return ENUM_CONE_TYPE_intersection;
856  if (type == "dual" ) return ENUM_CONE_TYPE_dual;
857  if (type == "polar" ) return ENUM_CONE_TYPE_polar;
858  if (type == "unknown" ) return ENUM_CONE_TYPE_unknown;
859  return 0;
860 }//returnConeType
861 
862 inline bool verifyConeType(std::string type)
863 {
864  return (returnConeType(type) > 0);
865 }//verifyConeType
866 
867 
868 #endif
const int OSINT_MAX
Definition: OSParameters.h:91
int returnMatrixSymmetry(std::string symmetry)
Definition: OSParameters.h:721
ENUM_SOLUTION_STATUS
Definition: OSParameters.h:495
ENUM_PROBLEM_COMPONENT
Definition: OSParameters.h:549
int returnSolutionSubstatusType(std::string type)
Definition: OSParameters.h:536
std::string returnExprShapeString(ENUM_NL_EXPR_SHAPE shape)
Definition: OSParameters.h:798
bool verifyJobStatus(std::string status)
Definition: OSParameters.h:441
bool verifyLocationType(std::string type)
Definition: OSParameters.h:321
ENUM_STORAGEUNIT
Definition: OSParameters.h:194
ENUM_VARTYPE
Definition: OSParameters.h:556
ENUM_MATRIX_TYPE mergeMatrixType(ENUM_MATRIX_TYPE type1, ENUM_MATRIX_TYPE type2)
A function to merge two matrix types so we can infer the type of a matrix recursively.
Definition: OSParameters.h:658
int returnVarType(char vt)
Definition: OSParameters.h:566
ENUM_COMBINE_ARRAYS
An enum to streamline set() methods of vectors.
Definition: OSParameters.h:770
int returnTimeType(std::string type)
Definition: OSParameters.h:265
int returnMatrixConstructorType(std::string cType)
Definition: OSParameters.h:750
std::string returnMatrixTypeString(ENUM_MATRIX_TYPE type)
Definition: OSParameters.h:634
int returnSystemCurrentState(std::string status)
Definition: OSParameters.h:407
bool verifyVarType(char vt)
Definition: OSParameters.h:577
ENUM_MATRIX_SYMMETRY
Definition: OSParameters.h:698
std::string OSgetVersionInfo()
ENUM_CONE_TYPE
Definition: OSParameters.h:813
ENUM_TRANSPORT_TYPE
Definition: OSParameters.h:326
int returnLocationType(std::string type)
Definition: OSParameters.h:313
bool verifyMatrixType(std::string type)
Definition: OSParameters.h:650
bool verifyTransportType(std::string type)
Definition: OSParameters.h:345
int returnJobStatus(std::string status)
Definition: OSParameters.h:431
ENUM_NL_EXPR_SHAPE
Definition: OSParameters.h:780
bool verifyMatrixSymmetry(std::string symmetry)
Definition: OSParameters.h:733
ENUM_TIMETYPE
Definition: OSParameters.h:258
bool verifyServiceType(std::string type)
Definition: OSParameters.h:373
int returnTransportType(std::string type)
Definition: OSParameters.h:335
bool verifyGeneralResultStatus(std::string status)
Definition: OSParameters.h:393
int returnMatrixType(std::string type)
Definition: OSParameters.h:616
int returnGeneralResultStatus(std::string status)
Definition: OSParameters.h:385
bool OSIsnan(double x)
checks whether a given double is NaN
int returnSolutionStatus(std::string status)
Definition: OSParameters.h:509
bool verifyBasisStatus(std::string status)
Definition: OSParameters.h:477
ENUM_JOB_STATUS
Definition: OSParameters.h:422
bool verifyMatrixConstructorType(std::string type)
Definition: OSParameters.h:761
int returnTimeUnit(std::string unit)
Definition: OSParameters.h:239
ENUM_PATHPAIR
Definition: OSParameters.h:583
int returnBasisStatus(std::string status)
Definition: OSParameters.h:465
bool verifySolutionStatus(std::string status)
Definition: OSParameters.h:524
double OSNaN()
returns the value for NaN used in OS
bool verifyTimeType(std::string type)
Definition: OSParameters.h:273
bool verifyStorageUnit(std::string unit)
Definition: OSParameters.h:221
std::string returnBasisStatusString(ENUM_BASIS_STATUS status)
Definition: OSParameters.h:482
int returnNlExprShape(std::string shape)
Definition: OSParameters.h:789
int returnTimeCategory(std::string category)
Definition: OSParameters.h:289
bool verifyConeType(std::string type)
Definition: OSParameters.h:862
bool verifyCPUSpeedUnit(std::string unit)
Definition: OSParameters.h:189
ENUM_SYSTEM_CURRENT_STATE
Definition: OSParameters.h:398
ENUM_CPUSPEEDUNIT
Definition: OSParameters.h:158
ENUM_OUTPUT_LEVEL
Enumeration for the different verbosity levels that can be used in producing output.
Definition: OSParameters.h:104
std::string returnMatrixSymmetryString(ENUM_MATRIX_SYMMETRY symmetry)
Definition: OSParameters.h:709
ENUM_MATRIX_CONSTRUCTOR_TYPE
Definition: OSParameters.h:739
ENUM_MATRIX_TYPE
An enum to track the many different types of values that a matrix can contain Note that these types a...
Definition: OSParameters.h:596
ENUM_BASIS_STATUS
Enumeration for the different states that can be used in representating a basis The last state...
Definition: OSParameters.h:453
ENUM_SOLUTION_SUBSTATUSTYPE
Definition: OSParameters.h:529
bool verifyNlExprShape(std::string shape)
Definition: OSParameters.h:807
ENUM_GENERAL_RESULT_STATUS
Definition: OSParameters.h:378
int returnStorageUnit(std::string unit)
Definition: OSParameters.h:207
int returnCPUSpeedUnit(std::string unit)
Definition: OSParameters.h:173
bool verifySolutionSubstatusType(std::string type)
Definition: OSParameters.h:544
ENUM_SERVICE_TYPE
Definition: OSParameters.h:350
int returnServiceType(std::string type)
Definition: OSParameters.h:361
bool verifySystemCurrentState(std::string status)
Definition: OSParameters.h:417
bool verifyTimeCategory(std::string category)
Definition: OSParameters.h:301
const double OSDBL_MAX
Definition: OSParameters.h:90
ENUM_TIMECATEGORY
Definition: OSParameters.h:278
int returnConeType(std::string type)
Definition: OSParameters.h:837
ENUM_OUTPUT_AREA
Enumeration for the different areas that can produce output.
Definition: OSParameters.h:125
ENUM_TIMEUNIT
Definition: OSParameters.h:226
bool verifyTimeUnit(std::string unit)
Definition: OSParameters.h:253
ENUM_LOCATIONTYPE
Definition: OSParameters.h:306