qsopt.h
Go to the documentation of this file.
00001 /*  $RCSfile: qsopt.h,v $ $Revision: 1.3 $ $Date: 2003/11/05 16:57:39 $" */
00002 #ifndef __QS_QSOPT_H
00003 #define __QS_QSOPT_H
00004 
00005 #include <stdio.h>
00006 
00007 #ifdef WIN32 
00008 
00009 #ifdef QSLIB_EXPORTS
00010 #define QSLIB_INTERFACE __declspec(dllexport)
00011 #else
00012 #define QSLIB_INTERFACE __declspec(dllimport)
00013 #endif
00014 
00015 #else 
00016 #define QSLIB_INTERFACE extern 
00017 #endif 
00018 
00019 #ifdef WIN32 
00020 typedef struct QSLIB_INTERFACE qsdata *QSprob;
00021 typedef struct QSLIB_INTERFACE qsbasis *QSbas;
00022 #else 
00023 typedef struct qsdata *QSprob;
00024 typedef struct qsbasis *QSbas;
00025 #endif 
00026 
00027 /****************************************************************************/
00028 /*                                                                          */
00029 /*                 PARAMETERS TO SPECIFY OBJECTIVE SENSE                    */
00030 /*                                                                          */
00031 /****************************************************************************/
00032 
00033 #define QS_MIN       (1)
00034 #define QS_MAX       (-1)
00035 
00036 /****************************************************************************/
00037 /*                                                                          */
00038 /*                 PARAMETERS THAT CAN BE SET BY setparam                   */
00039 /*                                                                          */
00040 /****************************************************************************/
00041 
00042 
00043 #define QS_PARAM_PRIMAL_PRICING    0
00044 #define QS_PARAM_DUAL_PRICING      2
00045 #define QS_PARAM_SIMPLEX_DISPLAY   4
00046 #define QS_PARAM_SIMPLEX_MAX_ITERATIONS 5
00047 #define QS_PARAM_SIMPLEX_MAX_TIME  6
00048 #define QS_PARAM_SIMPLEX_SCALING   7
00049 
00050 
00051 /****************************************************************************/
00052 /*                                                                          */
00053 /*                     VALUES FOR PRICING PARAMETERS                        */
00054 /*                                                                          */
00055 /****************************************************************************/
00056 
00057 #define QS_PRICE_PDANTZIG 1
00058 #define QS_PRICE_PDEVEX 2
00059 #define QS_PRICE_PSTEEP 3
00060 #define QS_PRICE_PMULTPARTIAL 4
00061 
00062 #define QS_PRICE_DDANTZIG 6
00063 #define QS_PRICE_DSTEEP 7
00064 #define QS_PRICE_DMULTPARTIAL 8
00065 #define QS_PRICE_DDEVEX 9
00066 
00067 
00068 /****************************************************************************/
00069 /*                                                                          */
00070 /*                         VALUES FOR BASIS STATUS                          */
00071 /*                                                                          */
00072 /****************************************************************************/
00073 
00074 
00075 #define QS_COL_BSTAT_LOWER     '0'
00076 #define QS_COL_BSTAT_BASIC     '1'
00077 #define QS_COL_BSTAT_UPPER     '2'
00078 #define QS_COL_BSTAT_FREE      '3'
00079 
00080 #define QS_ROW_BSTAT_LOWER     '0'
00081 #define QS_ROW_BSTAT_BASIC     '1'
00082 #define QS_ROW_BSTAT_UPPER     '2'
00083 
00084 
00085 /****************************************************************************/
00086 /*                                                                          */
00087 /*         Return Status for QSopt_primal, QSopt_dual, QSget_status         */
00088 /*                                                                          */
00089 /****************************************************************************/
00090 
00091 #define QS_LP_OPTIMAL           1
00092 #define QS_LP_INFEASIBLE        2
00093 #define QS_LP_UNBOUNDED         3
00094 #define QS_LP_ITER_LIMIT        4
00095 #define QS_LP_TIME_LIMIT        5
00096 #define QS_LP_UNSOLVED          6
00097 #define QS_LP_ABORTED           7
00098 #define QS_LP_MODIFIED        100
00099 
00100 /*
00101 #define QS_LP_PRIMAL_FEASIBLE   11
00102 #define QS_LP_PRIMAL_INFEASIBLE 12
00103 #define QS_LP_PRIMAL_UNBOUNDED  13
00104 #define QS_LP_DUAL_FEASIBLE     14
00105 #define QS_LP_DUAL_INFEASIBLE   15
00106 #define QS_LP_DUAL_UNBOUNDED    16
00107 */
00108 
00109 
00110 /****************************************************************************/
00111 /*                                                                          */
00112 /*                         QSopt Constants                                  */
00113 /*                                                                          */
00114 /****************************************************************************/
00115 
00116 #define QS_MAXDOUBLE (1e30)
00117 
00118 
00119 /****************************************************************************/
00120 /*                                                                          */
00121 /*                      QSopt Library Functions                             */
00122 /*                                                                          */
00123 /****************************************************************************/
00124 #ifdef  __cplusplus 
00125 extern "C" {
00126 #endif
00127 
00128 #ifdef WIN32
00129 /* 
00130  *  in WINDOWS we make 
00131  *     solver_main/reader_main part of DLL
00132  */
00133 QSLIB_INTERFACE int solver_main(int argc, char **argv); 
00134 QSLIB_INTERFACE int reader_main(int argc, char **argv); 
00135 #endif 
00136 
00137 QSLIB_INTERFACE void
00138     QSfree (void *ptr),
00139     QSfree_prob (QSprob p),
00140     QSfree_basis (QSbas B);
00141 
00142 QSLIB_INTERFACE int
00143     QSopt_primal (QSprob p, int *status),
00144     QSopt_dual (QSprob p, int *status),
00145     QSopt_pivotin_col (QSprob p, int ccnt, int *clist),
00146     QSopt_pivotin_row (QSprob p, int rcnt, int *rlist),
00147     QSopt_strongbranch (QSprob p, int ncand, int *candidatelist,
00148         double *xlist, double *down_vals, double *up_vals, int iterations,
00149         double objbound),
00150     QSchange_objsense (QSprob p, int newsense),
00151     QSget_objsense (QSprob p, int *newsense),
00152     QSnew_col (QSprob p, double obj, double lower, double upper,
00153         const char *name),
00154     QSadd_cols (QSprob p, int num, int *cmatcnt, int *cmatbeg, int *cmatind,
00155         double *cmatval, double *obj, double *lower, double *upper,
00156         const char **names),
00157     QSadd_col (QSprob p, int cnt, int *cmatind, double *cmatval, double obj,
00158         double lower, double upper, const char *name),
00159     QSnew_row (QSprob p, double rhs, char sense, const char *name),
00160     QSadd_rows (QSprob p, int num, int *rmatcnt, int *rmatbeg,
00161         int *rmatind, double *rmatval, double *rhs, char *sense,
00162         const char **names),
00163     QSadd_row (QSprob p, int cnt, int *rmatind, double *rmatval, double rhs,
00164         char sense, const char *name),
00165     QSdelete_rows (QSprob p, int num, int *dellist),
00166     QSdelete_row (QSprob p, int rowindex),
00167     QSdelete_setrows (QSprob p, int *flags),
00168     QSdelete_named_row (QSprob p, const char *rowname),
00169     QSdelete_named_rows_list (QSprob p, int num, const char **rownames),
00170     QSdelete_cols (QSprob p, int num, int *dellist),
00171     QSdelete_col (QSprob p, int colindex),
00172     QSdelete_setcols (QSprob p, int *flags),
00173     QSdelete_named_column (QSprob p, const char *colname),
00174     QSdelete_named_columns_list (QSprob p, int num, const char **colnames),
00175     QSchange_senses (QSprob p, int num, int *rowlist, char *sense),
00176     QSchange_sense (QSprob p, int rowindex, char sense),
00177     QSchange_coef (QSprob p, int rowindex, int colindex, double coef),
00178     QSchange_objcoef (QSprob p, int indx, double coef),
00179     QSchange_rhscoef (QSprob p, int indx, double coef),
00180     QSchange_bounds (QSprob p, int num, int *collist, char *lu,
00181         double *bounds),
00182     QSchange_bound (QSprob p, int indx, char lu, double bound),
00183     QSload_basis (QSprob p, QSbas B),
00184     QSread_and_load_basis (QSprob p, const char *filename),
00185     QSload_basis_array (QSprob p, char *cstat, char *rstat),
00186     QSload_basis_and_row_norms_array (QSprob p, char *cstat, char *rstat,
00187         double *rownorms),
00188     QSget_basis_array (QSprob p, char *cstat, char *rstat),
00189     QSget_basis_and_row_norms_array (QSprob p, char *cstat, char *rstat,
00190         double *rownorms),
00191     QSget_binv_row (QSprob p, int indx, double *binvrow),
00192     QSget_tableau_row (QSprob p, int indx, double *tableaurow),
00193     QSget_basis_order (QSprob p, int *basorder),
00194     QSget_status (QSprob p, int *status),
00195     QSget_solution (QSprob p, double *value, double *x, double *pi,
00196         double *slack, double *rc),
00197     QSget_objval (QSprob p, double *value),
00198     QSget_pi_array (QSprob p, double *pi),
00199     QSget_rc_array (QSprob p, double *rc),
00200     QSget_x_array (QSprob p, double *x),
00201     QSget_slack_array (QSprob p, double *slack),
00202     QSget_infeas_array (QSprob p, double *pi),
00203     QSget_colcount (QSprob p),
00204     QSget_rowcount (QSprob p),
00205     QSget_nzcount (QSprob p),
00206     QSget_obj (QSprob p, double *obj),
00207     QSget_rhs (QSprob p, double *rhs),
00208     QSget_rows_list (QSprob p, int num, int *rowlist, int **rowcnt,
00209         int **rowbeg, int **rowind, double **rowval, double **rhs,
00210         char **sense, char ***names),
00211     QSget_rows (QSprob p, int **rowcnt, int **rowbeg, int **rowind,
00212         double **rowval, double **rhs, char **sense, char ***names),
00213     QSget_columns_list (QSprob p, int num, int *collist, int **colcnt,
00214         int **colbeg, int **colind, double **colval, double **obj,
00215         double **lower, double **upper, char ***names),
00216     QSget_columns (QSprob p, int **colcnt, int **colbeg, int **colind,
00217         double **colval, double **obj, double **lower, double **upper,
00218         char ***names),
00219     QSget_rownames (QSprob p, char **rownames),
00220     QSget_colnames (QSprob p, char **colnames),
00221     QSget_bound (QSprob p, int colindex, char lu, double *bound),
00222     QSget_bounds (QSprob p, double *lower, double *upper),
00223     QSget_intflags (QSprob p, int *intflags),
00224     QSget_intcount (QSprob p, int *count),
00225     QSget_column_index (QSprob p, const char *name, int *colindex),
00226     QSget_row_index (QSprob p, const char *name, int *rowindex),
00227     QSget_named_x (QSprob p, const char *colname, double *val),
00228     QSget_named_rc (QSprob p, const char *colname, double *val),
00229     QSget_named_pi (QSprob p, const char *rowname, double *val),
00230     QSget_named_slack (QSprob p, const char *rowname, double *val),
00231     QScompute_row_norms (QSprob p),
00232     QSwrite_prob (QSprob p, const char *filename, const char *filetype),
00233     QSwrite_prob_file (QSprob p, FILE *file, const char *filetype),
00234     QSwrite_basis (QSprob p, QSbas B, const char *filename),
00235     QStest_row_norms (QSprob p),
00236     QSset_param (QSprob p, int whichparam, int newvalue),
00237     QSset_param_double (QSprob p, int whichparam, double newvalue),
00238     QSget_param (QSprob p, int whichparam, int *value),
00239     QSget_param_double (QSprob p, int whichparam, double *value);
00240 
00241 QSLIB_INTERFACE char* QSget_probname (QSprob p); 
00242 QSLIB_INTERFACE char* QSget_objname (QSprob p); 
00243 QSLIB_INTERFACE char* QSversion (void); 
00244 
00245 QSLIB_INTERFACE QSprob
00246    QScreate_prob (const char *name, int objsense),
00247    QSread_prob (const char *filename, const char *filetype),
00248    QSload_prob (const char *probname, int ncols, int nrows,
00249         int *cmatcnt, int *cmatbeg, int *cmatind, double *cmatval,
00250         int objsense, double *obj, double *rhs, char *sense,
00251         double *lower, double *upper, const char **colnames,
00252         const char **rownames),
00253    QScopy_prob (QSprob p, const char *newname);
00254 
00255 QSLIB_INTERFACE QSbas
00256    QSget_basis (QSprob p),
00257    QSread_basis (QSprob p, const char *filename);
00258 
00259 #ifdef  __cplusplus 
00260 }
00261 #endif
00262 
00263 /****************************************************************************
00264  *
00265  * This is the undocumented part of the QSlib interface 
00266  *
00267  ****************************************************************************/
00268 /* 
00269  * functions to facilitate line by line reading from other sources than 
00270  * files from within MPS/LP parsers  
00271  * 
00272  * functions to facilitate the collection of error information instead of 
00273  * having the parsers print messages to stderr
00274  *                              by mps/lp format writers
00275  * 
00276  * a problem's reporter is used by the solver code to provide important 
00277  * feedback/progress information
00278  */
00279 
00280 #ifdef WIN32
00281 typedef struct QSLIB_INTERFACE qsline_reader     *QSline_reader;
00282 typedef struct QSLIB_INTERFACE qsformat_error    *QSformat_error;
00283 typedef struct QSLIB_INTERFACE qserror_collector *QSerror_collector;
00284 typedef struct QSLIB_INTERFACE qserror_memory    *QSerror_memory;
00285 #else 
00286 typedef struct qsline_reader      *QSline_reader;
00287 typedef struct qsformat_error     *QSformat_error;
00288 typedef struct qserror_collector  *QSerror_collector;
00289 typedef struct qserror_memory     *QSerror_memory;
00290 #endif 
00291 
00292 #ifdef  __cplusplus 
00293 extern "C" {
00294 #endif
00295 
00296 /****************************************************************************
00297  * error collection
00298  */
00299 #define QS_DATA_ERROR                   0
00300 #define QS_DATA_WARN                    1
00301 #define QS_MPS_FORMAT_ERROR             2
00302 #define QS_MPS_FORMAT_WARN              3
00303 #define QS_LP_FORMAT_ERROR              4
00304 #define QS_LP_FORMAT_WARN               5
00305 #define QS_INPUT_NERROR        8
00306 
00307 QSLIB_INTERFACE const char* QSformat_error_type_string(int tp); 
00308 
00309 QSLIB_INTERFACE int             QSerror_get_type(QSformat_error error); 
00310 QSLIB_INTERFACE const char* QSerror_get_desc(QSformat_error error); 
00311 QSLIB_INTERFACE int             QSerror_get_line_number(QSformat_error error); 
00312 QSLIB_INTERFACE int             QSerror_get_pos(QSformat_error error); 
00313 QSLIB_INTERFACE const char* QSerror_get_line(QSformat_error error); 
00314 QSLIB_INTERFACE void        QSerror_print(FILE *f, QSformat_error error); 
00315 
00316 QSLIB_INTERFACE 
00317     QSerror_collector QSerror_collector_new(void *fct, void *dest); 
00318 QSLIB_INTERFACE 
00319     QSerror_collector QSerror_memory_collector_new(QSerror_memory mem); 
00320 QSLIB_INTERFACE void 
00321     QSerror_collector_free(QSerror_collector c); 
00322 
00323 /****************************************************************************
00324  * line reader 
00325  */
00326 QSLIB_INTERFACE QSline_reader 
00327     QSline_reader_new(void *fct, void* data_src); 
00328     /* reader->read_line_fct defaults to fgets */
00329 
00330 QSLIB_INTERFACE void
00331     QSline_reader_free(QSline_reader reader); 
00332 
00333 QSLIB_INTERFACE void
00334     QSline_reader_set_error_collector(QSline_reader reader,  
00335                                       QSerror_collector collector); 
00336 
00337 QSLIB_INTERFACE char* 
00338     QSline_reader_get(QSline_reader reader, char *s, int size);
00339 
00340 QSLIB_INTERFACE QSprob 
00341     QSget_prob(QSline_reader reader, 
00342                const char* probname, const char *filetype);
00343     /* the MPS and LP parsers uses the fct from reader 
00344      * to get to next input line */
00345 
00346 
00347 /****************************************************************************
00348  * error memory 
00349  */
00350 QSLIB_INTERFACE QSerror_memory  QSerror_memory_create(char takeErrorLines); 
00351 QSLIB_INTERFACE void            QSerror_memory_free(QSerror_memory mem);
00352 
00353 QSLIB_INTERFACE int            
00354         QSerror_memory_get_nof(QSerror_memory mem, int error_type);
00355 QSLIB_INTERFACE int            
00356         QSerror_memory_get_nerrors(QSerror_memory mem);
00357 
00358 QSLIB_INTERFACE QSformat_error 
00359         QSerror_memory_get_last_error(QSerror_memory mem);
00360 QSLIB_INTERFACE QSformat_error            
00361         QSerror_memory_get_prev_error(QSformat_error e);
00362 
00363 /**************************************************************************** 
00364  * reporter for solver feedback 
00365  */
00366 QSLIB_INTERFACE void QSset_reporter(QSprob prob, int iterskip, void *fct, void *dest); 
00367 
00368 QSLIB_INTERFACE int QSreport_prob (QSprob p, const char *filetype, 
00369                                    QSerror_collector c);
00370 
00371 #ifdef  __cplusplus 
00372 }
00373 #endif
00374 #endif /* __QS_QSOPT_H */


libqsopt
Author(s): Florian Jordan
autogenerated on Thu Jun 6 2019 20:18:16