📄 glpmpl.h
字号:
#define fp_mul _glp_mpl_fp_muldouble fp_mul(MPL *mpl, double x, double y);/* floating-point multiplication */#define fp_div _glp_mpl_fp_divdouble fp_div(MPL *mpl, double x, double y);/* floating-point division */#define fp_idiv _glp_mpl_fp_idivdouble fp_idiv(MPL *mpl, double x, double y);/* floating-point quotient of exact division */#define fp_mod _glp_mpl_fp_moddouble fp_mod(MPL *mpl, double x, double y);/* floating-point remainder of exact division */#define fp_power _glp_mpl_fp_powerdouble fp_power(MPL *mpl, double x, double y);/* floating-point exponentiation (raise to power) */#define fp_exp _glp_mpl_fp_expdouble fp_exp(MPL *mpl, double x);/* floating-point base-e exponential */#define fp_log _glp_mpl_fp_logdouble fp_log(MPL *mpl, double x);/* floating-point natural logarithm */#define fp_log10 _glp_mpl_fp_log10double fp_log10(MPL *mpl, double x);/* floating-point common (decimal) logarithm */#define fp_sqrt _glp_mpl_fp_sqrtdouble fp_sqrt(MPL *mpl, double x);/* floating-point square root */#define fp_sin _glp_mpl_fp_sindouble fp_sin(MPL *mpl, double x);/* floating-point trigonometric sine */#define fp_cos _glp_mpl_fp_cosdouble fp_cos(MPL *mpl, double x);/* floating-point trigonometric cosine */#define fp_atan _glp_mpl_fp_atandouble fp_atan(MPL *mpl, double x);/* floating-point trigonometric arctangent */#define fp_atan2 _glp_mpl_fp_atan2double fp_atan2(MPL *mpl, double y, double x);/* floating-point trigonometric arctangent */#define fp_round _glp_mpl_fp_rounddouble fp_round(MPL *mpl, double x, double n);/* round floating-point value to n fractional digits */#define fp_trunc _glp_mpl_fp_truncdouble fp_trunc(MPL *mpl, double x, double n);/* truncate floating-point value to n fractional digits *//**********************************************************************//* * * PSEUDO-RANDOM NUMBER GENERATORS * * *//**********************************************************************/#define fp_irand224 _glp_mpl_fp_irand224double fp_irand224(MPL *mpl);/* pseudo-random integer in the range [0, 2^24) */#define fp_uniform01 _glp_mpl_fp_uniform01double fp_uniform01(MPL *mpl);/* pseudo-random number in the range [0, 1) */#define fp_uniform _glp_mpl_uniformdouble fp_uniform(MPL *mpl, double a, double b);/* pseudo-random number in the range [a, b) */#define fp_normal01 _glp_mpl_fp_normal01double fp_normal01(MPL *mpl);/* Gaussian random variate with mu = 0 and sigma = 1 */#define fp_normal _glp_mpl_fp_normaldouble fp_normal(MPL *mpl, double mu, double sigma);/* Gaussian random variate with specified mu and sigma *//**********************************************************************//* * * DATE/TIME * * *//**********************************************************************/#define fn_gmtime _glp_mpl_fn_gmtimedouble fn_gmtime(MPL *mpl);/* obtain the current calendar time (UTC) */#define fn_str2time _glp_mpl_fn_str2timedouble fn_str2time(MPL *mpl, const char *str, const char *fmt);/* convert character string to the calendar time */#define fn_time2str _glp_mpl_fn_time2strvoid fn_time2str(MPL *mpl, char *str, double t, const char *fmt);/* convert the calendar time to character string *//**********************************************************************//* * * CHARACTER STRINGS * * *//**********************************************************************/#define create_string _glp_mpl_create_stringSTRING *create_string( MPL *mpl, char buf[MAX_LENGTH+1] /* not changed */);/* create character string */#define copy_string _glp_mpl_copy_stringSTRING *copy_string( MPL *mpl, STRING *str /* not changed */);/* make copy of character string */#define compare_strings _glp_mpl_compare_stringsint compare_strings( MPL *mpl, STRING *str1, /* not changed */ STRING *str2 /* not changed */);/* compare one character string with another */#define fetch_string _glp_mpl_fetch_stringchar *fetch_string( MPL *mpl, STRING *str, /* not changed */ char buf[MAX_LENGTH+1] /* modified */);/* extract content of character string */#define delete_string _glp_mpl_delete_stringvoid delete_string( MPL *mpl, STRING *str /* destroyed */);/* delete character string *//**********************************************************************//* * * SYMBOLS * * *//**********************************************************************/struct SYMBOL{ /* symbol (numeric or abstract quantity) */ double num; /* numeric value of symbol (used only if str == NULL) */ STRING *str; /* abstract value of symbol (used only if str != NULL) */};#define create_symbol_num _glp_mpl_create_symbol_numSYMBOL *create_symbol_num(MPL *mpl, double num);/* create symbol of numeric type */#define create_symbol_str _glp_mpl_create_symbol_strSYMBOL *create_symbol_str( MPL *mpl, STRING *str /* destroyed */);/* create symbol of abstract type */#define copy_symbol _glp_mpl_copy_symbolSYMBOL *copy_symbol( MPL *mpl, SYMBOL *sym /* not changed */);/* make copy of symbol */#define compare_symbols _glp_mpl_compare_symbolsint compare_symbols( MPL *mpl, SYMBOL *sym1, /* not changed */ SYMBOL *sym2 /* not changed */);/* compare one symbol with another */#define delete_symbol _glp_mpl_delete_symbolvoid delete_symbol( MPL *mpl, SYMBOL *sym /* destroyed */);/* delete symbol */#define format_symbol _glp_mpl_format_symbolchar *format_symbol( MPL *mpl, SYMBOL *sym /* not changed */);/* format symbol for displaying or printing */#define concat_symbols _glp_mpl_concat_symbolsSYMBOL *concat_symbols( MPL *mpl, SYMBOL *sym1, /* destroyed */ SYMBOL *sym2 /* destroyed */);/* concatenate one symbol with another *//**********************************************************************//* * * N-TUPLES * * *//**********************************************************************/struct TUPLE{ /* component of n-tuple; the n-tuple itself is associated with its first component; (note that 0-tuple has no components) */ SYMBOL *sym; /* symbol, which the component refers to; cannot be NULL */ TUPLE *next; /* the next component of n-tuple */};#define create_tuple _glp_mpl_create_tupleTUPLE *create_tuple(MPL *mpl);/* create n-tuple */#define expand_tuple _glp_mpl_expand_tupleTUPLE *expand_tuple( MPL *mpl, TUPLE *tuple, /* destroyed */ SYMBOL *sym /* destroyed */);/* append symbol to n-tuple */#define tuple_dimen _glp_mpl_tuple_dimenint tuple_dimen( MPL *mpl, TUPLE *tuple /* not changed */);/* determine dimension of n-tuple */#define copy_tuple _glp_mpl_copy_tupleTUPLE *copy_tuple( MPL *mpl, TUPLE *tuple /* not changed */);/* make copy of n-tuple */#define compare_tuples _glp_mpl_compare_tuplesint compare_tuples( MPL *mpl, TUPLE *tuple1, /* not changed */ TUPLE *tuple2 /* not changed */);/* compare one n-tuple with another */#define build_subtuple _glp_mpl_build_subtupleTUPLE *build_subtuple( MPL *mpl, TUPLE *tuple, /* not changed */ int dim);/* build subtuple of given n-tuple */#define delete_tuple _glp_mpl_delete_tuplevoid delete_tuple( MPL *mpl, TUPLE *tuple /* destroyed */);/* delete n-tuple */#define format_tuple _glp_mpl_format_tuplechar *format_tuple( MPL *mpl, int c, TUPLE *tuple /* not changed */);/* format n-tuple for displaying or printing *//**********************************************************************//* * * ELEMENTAL SETS * * *//**********************************************************************/#if 2 + 2 == 5struct ELEMSET /* see ARRAY */{ /* elemental set of n-tuples; formally it is a "value" assigned to members of model sets (like numbers and symbols, which are values assigned to members of model parameters); note that a simple model set is not an elemental set, it is 0-dimensional array, the only member of which (if it exists) is assigned an elemental set */#endif#define create_elemset _glp_mpl_create_elemsetELEMSET *create_elemset(MPL *mpl, int dim);/* create elemental set */#define find_tuple _glp_mpl_find_tupleMEMBER *find_tuple( MPL *mpl, ELEMSET *set, /* not changed */ TUPLE *tuple /* not changed */);/* check if elemental set contains given n-tuple */#define add_tuple _glp_mpl_add_tupleMEMBER *add_tuple( MPL *mpl, ELEMSET *set, /* modified */ TUPLE *tuple /* destroyed */);/* add new n-tuple to elemental set */#define check_then_add _glp_mpl_check_then_addMEMBER *check_then_add( MPL *mpl, ELEMSET *set, /* modified */ TUPLE *tuple /* destroyed */);/* check and add new n-tuple to elemental set */#define copy_elemset _glp_mpl_copy_elemsetELEMSET *copy_elemset( MPL *mpl, ELEMSET *set /* not changed */);/* make copy of elemental set */#define delete_elemset _glp_mpl_delete_elemsetvoid delete_elemset( MPL *mpl, ELEMSET *set /* destroyed */);/* delete elemental set */#define arelset_size _glp_mpl_arelset_sizeint arelset_size(MPL *mpl, double t0, double tf, double dt);/* compute size of "arithmetic" elemental set */#define arelset_member _glp_mpl_arelset_memberdouble arelset_member(MPL *mpl, double t0, double tf, double dt, int j);/* compute member of "arithmetic" elemental set */#define create_arelset _glp_mpl_create_arelsetELEMSET *create_arelset(MPL *mpl, double t0, double tf, double dt);/* create "arithmetic" elemental set */#define set_union _glp_mpl_set_unionELEMSET *set_union( MPL *mpl, ELEMSET *X, /* destroyed */ ELEMSET *Y /* destroyed */);/* union of two elemental sets */#define set_diff _glp_mpl_set_diffELEMSET *set_diff( MPL *mpl, ELEMSET *X, /* destroyed */ ELEMSET *Y /* destroyed */);/* difference between two elemental sets */#define set_symdiff _glp_mpl_set_symdiffELEMSET *set_symdiff( MPL *mpl, ELEMSET *X, /* destroyed */ ELEMSET *Y /* destroyed */);/* symmetric difference between two elemental sets */#define set_inter _glp_mpl_set_interELEMSET *set_inter( MPL *mpl, ELEMSET *X, /* destroyed */ ELEMSET *Y /* destroyed */);/* intersection of two elemental sets */#define set_cross _glp_mpl_set_crossELEMSET *set_cross( MPL *mpl, ELEMSET *X, /* destroyed */ ELEMSET *Y /* destroyed */);/* cross (Cartesian) product of two elemental sets *//**********************************************************************//* * * ELEMENTAL VARIABLES * * *//**********************************************************************/struct ELEMVAR{ /* elemental variable; formally it is a "value" assigned to members of model variables (like numbers and symbols, which are values assigned to members of model parameters) */ int j; /* LP column number assigned to this elemental variable */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -