ldbl_qsopt.h

Go to the documentation of this file.
00001 #include "qs_config.h"
00002 #ifdef HAVE_LONG_DOUBLE
00003 #if HAVE_LONG_DOUBLE
00004 /****************************************************************************/
00005 /*                                                                          */
00006 /*  This file is part of QSopt_ex.                                          */
00007 /*                                                                          */
00008 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
00009 /*  and Daniel Espinoza                                                     */
00010 /*                                                                          */
00011 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
00012 /*  copyright in QSopt.                                                     */
00013 /*                                                                          */
00014 /*  This code may be used under the terms of the GNU General Public License */
00015 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
00016 /*                                                                          */
00017 /*  Alternatively, use is granted for research purposes only.               */
00018 /*                                                                          */
00019 /*  It is your choice of which of these two licenses you are operating      */
00020 /*  under.                                                                  */
00021 /*                                                                          */
00022 /*  We make no guarantees about the correctness or usefulness of this code. */
00023 /*                                                                          */
00024 /****************************************************************************/
00025 
00026 /*  $RCSfile: ldbl_qsopt.h,v $ $Revision: 1.3 $ $Date: 2003/11/05 16:57:39 $" */
00027 #ifndef ldbl___QS_QSOPT_H
00028 #define ldbl___QS_QSOPT_H
00029 
00030 #include <stdio.h>
00031 #include "qs_config.h"
00032 
00033 #ifdef WIN32
00034 
00035 #ifdef QSLIB_EXPORTS
00036 #define ldbl_QSLIB_INTERFACE __declspec(dllexport)
00037 #else
00038 #define ldbl_QSLIB_INTERFACE __declspec(dllimport)
00039 #endif
00040 
00041 #else
00042 #define ldbl_QSLIB_INTERFACE extern
00043 #endif
00044 
00045 #ifdef WIN32
00046 typedef struct ldbl_QSLIB_INTERFACE ldbl_qsdata *ldbl_QSprob;
00047 typedef struct ldbl_QSLIB_INTERFACE qsbasis *ldbl_QSbas;
00048 #else
00049 typedef struct ldbl_qsdata *ldbl_QSprob;
00050 typedef struct qsbasis *ldbl_QSbas;
00051 #endif
00052 
00053 /****************************************************************************/
00054 /*                                                                          */
00055 /*                 PARAMETERS TO SPECIFY OBJECTIVE SENSE                    */
00056 /*                                                                          */
00057 /****************************************************************************/
00058 #include "basicdefs.h"
00059 /*
00060 #define QS_LP_PRIMAL_FEASIBLE   11
00061 #define QS_LP_PRIMAL_INFEASIBLE 12
00062 #define QS_LP_PRIMAL_UNBOUNDED  13
00063 #define QS_LP_DUAL_FEASIBLE     14
00064 #define QS_LP_DUAL_INFEASIBLE   15
00065 #define QS_LP_DUAL_UNBOUNDED    16
00066 */
00067 
00068 /****************************************************************************/
00069 /*                                                                          */
00070 /*                      QSopt Library Functions                             */
00071 /*                                                                          */
00072 /****************************************************************************/
00073 #ifdef  __cplusplus
00074 extern "C"
00075 {
00076 #endif
00077 
00078 #ifdef WIN32
00079 /* 
00080  *  in WINDOWS we make 
00081  *     ldbl_solver_main/ldbl_reader_main part of DLL
00082  */
00083 ldbl_QSLIB_INTERFACE int ldbl_solver_main ( int argc, char **argv);
00084 ldbl_QSLIB_INTERFACE int ldbl_reader_main ( int argc, char **argv);
00085 #endif
00086 
00087 ldbl_QSLIB_INTERFACE void ldbl_QSfree ( void *ptr),
00088     ldbl_QSfree_prob ( ldbl_QSprob p),
00089     ldbl_QSfree_basis ( ldbl_QSbas B),
00090     ldbl_QSset_precision ( const unsigned prec),/**< set the ldbl_precision for floating 
00091                                                  point numbers to the given 
00092                                                  number of bits */
00093     ldbl_QSstart ( void),/**< whe we use non native numbers, we need to make 
00094                          some initializations before operating with the
00095                          library */
00096     ldbl_QSend ( void); /**< just to free any internal static data needed by
00097                          the variable ldbl_precision numbers */
00098 
00099 ldbl_QSLIB_INTERFACE int ldbl_QSopt_primal ( ldbl_QSprob p, int *status),
00100     ldbl_QSopt_dual ( ldbl_QSprob p, int *status),
00101     ldbl_QSopt_pivotin_col ( ldbl_QSprob p, int ccnt, int *clist),
00102     ldbl_QSopt_pivotin_row ( ldbl_QSprob p, int rcnt, int *rlist),
00103     ldbl_QSopt_strongbranch ( ldbl_QSprob p, int ncand, int *candidatelist,
00104       long double * xlist, long double * down_vals, long double * up_vals,
00105       int iterations, long double objbound),
00106     ldbl_QSchange_objsense ( ldbl_QSprob p, int newsense),
00107     ldbl_QSget_objsense ( ldbl_QSprob p, int *newsense),
00108     ldbl_QSnew_col ( ldbl_QSprob p,const long double obj,const long double lower,const long double upper,
00109       const char *name),
00110     ldbl_QSadd_cols ( ldbl_QSprob p, int num, int *cmatcnt, int *cmatbeg, int *cmatind,
00111       long double * cmatval, long double * obj, long double * lower,
00112       long double * upper, const char **names),
00113     ldbl_QSadd_col ( ldbl_QSprob p, int cnt, int *cmatind, long double * cmatval,
00114       long double obj, long double lower, long double upper, const char *name),
00115     ldbl_QSnew_row ( ldbl_QSprob p,const long double rhs, int sense, const char *name),
00116     ldbl_QSadd_ranged_rows ( ldbl_QSprob p, int num, int *rmatcnt, int *rmatbeg, 
00117       int *rmatind,const long double * rmatval,const long double * rhs, char *sense,
00118       const long double* range, const char **names),
00119     ldbl_QSadd_ranged_row ( ldbl_QSprob p, int cnt, int *rmatind,const long double * rmatval,
00120       const long double * rhs, int sense,const long double * range, const char *name),
00121     ldbl_QSadd_rows ( ldbl_QSprob p, int num, int *rmatcnt, int *rmatbeg, int *rmatind,
00122       const long double * rmatval,const long double * rhs, char *sense, const char **names),
00123     ldbl_QSadd_row ( ldbl_QSprob p, int cnt, int *rmatind,const long double * rmatval,
00124       const long double * rhs, int sense, const char *name),
00125     ldbl_QSdelete_rows ( ldbl_QSprob p, int num, int *dellist),
00126     ldbl_QSdelete_row ( ldbl_QSprob p, int rowindex),
00127     ldbl_QSdelete_setrows ( ldbl_QSprob p, int *flags),
00128     ldbl_QSdelete_named_row ( ldbl_QSprob p, const char *rowname),
00129     ldbl_QSdelete_named_rows_list ( ldbl_QSprob p, int num, const char **rownames),
00130     ldbl_QSdelete_cols ( ldbl_QSprob p, int num, int *dellist),
00131     ldbl_QSdelete_col ( ldbl_QSprob p, int colindex),
00132     ldbl_QSdelete_setcols ( ldbl_QSprob p, int *flags),
00133     ldbl_QSdelete_named_column ( ldbl_QSprob p, const char *colname),
00134     ldbl_QSdelete_named_columns_list ( ldbl_QSprob p, int num, const char **colnames),
00135     ldbl_QSchange_senses ( ldbl_QSprob p, int num, int *rowlist, char *sense),
00136     ldbl_QSchange_sense ( ldbl_QSprob p, int rowindex, int sense),
00137     ldbl_QSchange_coef ( ldbl_QSprob p, int rowindex, int colindex, long double coef),
00138     ldbl_QSchange_objcoef ( ldbl_QSprob p, int indx, long double coef),
00139     ldbl_QSchange_rhscoef ( ldbl_QSprob p, int indx, long double coef),
00140     ldbl_QSchange_range(ldbl_QSprob p, int rowindex, long double range),
00141     ldbl_QSchange_bounds ( ldbl_QSprob p, int num, int *collist, char *lu, 
00142       const long double * bounds),
00143     ldbl_QSchange_bound ( ldbl_QSprob p, int indx, int lu,const long double bound),
00144     ldbl_QSload_basis ( ldbl_QSprob p, ldbl_QSbas B),
00145     ldbl_QSread_and_load_basis ( ldbl_QSprob p, const char *filename),
00146     ldbl_QSload_basis_array ( ldbl_QSprob p, char *cstat, char *rstat),
00147     ldbl_QSload_basis_and_row_norms_array ( ldbl_QSprob p, char *cstat, char *rstat, 
00148       long double * rownorms),
00149     ldbl_QSget_basis_array ( ldbl_QSprob p, char *cstat, char *rstat),
00150     ldbl_QSget_basis_and_row_norms_array ( ldbl_QSprob p, char *cstat, char *rstat,
00151       long double * rownorms),
00152     ldbl_QSget_binv_row ( ldbl_QSprob p, int indx, long double * binvrow),
00153     ldbl_QSget_tableau_row ( ldbl_QSprob p, int indx, long double * tableaurow),
00154     ldbl_QSget_basis_order ( ldbl_QSprob p, int *basorder), 
00155     ldbl_QSget_coef (ldbl_QSprob p, int rowindex, int colindex, long double*coef),
00156     ldbl_QSget_status ( ldbl_QSprob p, int *status),
00157     ldbl_QSget_solution ( ldbl_QSprob p, long double * value, long double * x,
00158       long double * pi, long double * slack, long double * rc),
00159     ldbl_QSget_objval ( ldbl_QSprob p, long double * value),
00160     ldbl_QSget_pi_array ( ldbl_QSprob p, long double * pi),
00161     ldbl_QSget_rc_array ( ldbl_QSprob p, long double * rc),
00162     ldbl_QSget_x_array ( ldbl_QSprob p, long double * x),
00163     ldbl_QSget_slack_array ( ldbl_QSprob p, long double * slack),
00164     ldbl_QSget_infeas_array ( ldbl_QSprob p, long double * pi),
00165     ldbl_QSget_colcount ( ldbl_QSprob p),
00166     ldbl_QSget_rowcount ( ldbl_QSprob p),
00167     ldbl_QSget_nzcount ( ldbl_QSprob p),
00168     ldbl_QSget_obj_list(ldbl_QSprob p, int num, int*collist, long double*obj),
00169     ldbl_QSget_obj ( ldbl_QSprob p, long double * obj),
00170     ldbl_QSget_rhs ( ldbl_QSprob p, long double * rhs),
00171     ldbl_QSget_ranged_rows_list ( ldbl_QSprob p, int num, int *rowlist, int **rowcnt,
00172       int **rowbeg, int **rowind, long double ** rowval, long double ** rhs,
00173       char **sense, long double **range, char ***names),
00174     ldbl_QSget_ranged_rows ( ldbl_QSprob p, int **rowcnt, int **rowbeg, int **rowind,
00175       long double ** rowval, long double ** rhs, char **sense, 
00176       long double ** range, char ***names),
00177     ldbl_QSget_senses ( ldbl_QSprob p, char*senses),
00178     ldbl_QSget_rows_list ( ldbl_QSprob p, int num, int *rowlist, int **rowcnt,
00179       int **rowbeg, int **rowind, long double ** rowval, long double ** rhs,
00180       char **sense, char ***names),
00181     ldbl_QSget_rows ( ldbl_QSprob p, int **rowcnt, int **rowbeg, int **rowind,
00182       long double ** rowval, long double ** rhs, char **sense, char ***names),
00183     ldbl_QSget_columns_list ( ldbl_QSprob p, int num, int *collist, int **colcnt,
00184       int **colbeg, int **colind, long double ** colval, long double ** obj,
00185       long double ** lower, long double ** upper, char ***names),
00186     ldbl_QSget_columns ( ldbl_QSprob p, int **colcnt, int **colbeg, int **colind,
00187       long double ** colval, long double ** obj, long double ** lower,
00188       long double ** upper, char ***names),
00189     ldbl_QSget_rownames ( ldbl_QSprob p, char **rownames),
00190     ldbl_QSget_colnames ( ldbl_QSprob p, char **colnames),
00191     ldbl_QSget_bound ( ldbl_QSprob p, int colindex, int lu, long double * bound),
00192     ldbl_QSget_bounds ( ldbl_QSprob p, long double * lower, long double * upper),
00193     ldbl_QSget_bounds_list(ldbl_QSprob p, int num, int*collist, long double*lb,
00194       long double*ub),
00195     ldbl_QSget_intflags ( ldbl_QSprob p, int *intflags),
00196     ldbl_QSget_intcount ( ldbl_QSprob p, int *count),
00197     ldbl_QSget_column_index ( ldbl_QSprob p, const char *name, int *colindex),
00198     ldbl_QSget_row_index ( ldbl_QSprob p, const char *name, int *rowindex),
00199     ldbl_QSget_named_x ( ldbl_QSprob p, const char *colname, long double * val),
00200     ldbl_QSget_named_rc ( ldbl_QSprob p, const char *colname, long double * val),
00201     ldbl_QSget_named_pi ( ldbl_QSprob p, const char *rowname, long double * val),
00202     ldbl_QSget_named_slack ( ldbl_QSprob p, const char *rowname, long double * val),
00203     ldbl_QScompute_row_norms ( ldbl_QSprob p),
00204     ldbl_QSwrite_prob ( ldbl_QSprob p, const char *filename, const char *filetype),
00205     ldbl_QSwrite_prob_file ( ldbl_QSprob p, FILE * file, const char *filetype),
00206     ldbl_QSwrite_basis ( ldbl_QSprob p, ldbl_QSbas B, const char *filename),
00207     ldbl_QStest_row_norms ( ldbl_QSprob p),
00208     ldbl_QSget_itcnt(ldbl_QSprob p, int *pI_iter, int *pII_iter, int *dI_iter,
00209       int *dII_iter, int *tot_iter),
00210     ldbl_QSset_param ( ldbl_QSprob p, int whichparam, int newvalue),
00211     ldbl_QSset_param_EGlpNum ( ldbl_QSprob p, int whichparam, long double newvalue),
00212     ldbl_QSget_param ( ldbl_QSprob p, int whichparam, int *value),
00213     ldbl_QSget_param_EGlpNum ( ldbl_QSprob p, int whichparam, long double * value); 
00214 
00215 ldbl_QSLIB_INTERFACE char *ldbl_QSget_probname ( ldbl_QSprob p);
00216 ldbl_QSLIB_INTERFACE char *ldbl_QSget_objname ( ldbl_QSprob p);
00217 ldbl_QSLIB_INTERFACE char *ldbl_QSversion ( void);
00218 
00219 ldbl_QSLIB_INTERFACE ldbl_QSprob ldbl_QScreate_prob ( const char *name, int objsense),
00220     ldbl_QSread_prob ( const char *filename, const char *filetype),
00221     ldbl_QSload_prob ( const char *probname, int ncols, int nrows, int *cmatcnt,
00222       int *cmatbeg, int *cmatind, long double * cmatval, int objsense,
00223       long double * obj, long double * rhs, char *sense, long double * lower,
00224       long double * upper, const char **colnames, const char **rownames),
00225     ldbl_QScopy_prob ( ldbl_QSprob p, const char *newname);
00226 
00227 ldbl_QSLIB_INTERFACE ldbl_QSbas ldbl_QSget_basis ( ldbl_QSprob p),
00228     ldbl_QSread_basis ( ldbl_QSprob p, const char *filename);
00229 
00230 #ifdef  __cplusplus
00231 }
00232 #endif
00233 
00234 /****************************************************************************
00235  *
00236  * This is the undocumented part of the QSlib interface 
00237  *
00238  ****************************************************************************/
00239 /* 
00240  * functions to facilitate line by line reading from other sources than 
00241  * files from within MPS/LP parsers  
00242  * 
00243  * functions to facilitate the collection of error information instead of 
00244  * having the parsers print messages to stderr
00245  *                              by mps/lp format writers
00246  * 
00247  * a problem's reporter is used by the solver code to provide important 
00248  * ldbl_feedback/progress information
00249  */
00250 
00251 #ifdef WIN32
00252 typedef struct ldbl_QSLIB_INTERFACE ldbl_qsline_reader *ldbl_QSline_reader;
00253 typedef struct ldbl_QSLIB_INTERFACE ldbl_qsformat_error *ldbl_QSformat_error;
00254 typedef struct ldbl_QSLIB_INTERFACE ldbl_qserror_collector *ldbl_QSerror_collector;
00255 typedef struct ldbl_QSLIB_INTERFACE ldbl_qserror_memory *ldbl_QSerror_memory;
00256 #else
00257 typedef struct ldbl_qsline_reader *ldbl_QSline_reader;
00258 typedef struct ldbl_qsformat_error *ldbl_QSformat_error;
00259 typedef struct ldbl_qserror_collector *ldbl_QSerror_collector;
00260 typedef struct ldbl_qserror_memory *ldbl_QSerror_memory;
00261 #endif
00262 
00263 #ifdef  __cplusplus
00264 extern "C"
00265 {
00266 #endif
00267   ldbl_QSLIB_INTERFACE const char *ldbl_QSformat_error_type_string (
00268   int tp);
00269 
00270   ldbl_QSLIB_INTERFACE int ldbl_QSerror_get_type (
00271   ldbl_QSformat_error error);
00272   ldbl_QSLIB_INTERFACE const char *ldbl_QSerror_get_desc (
00273   ldbl_QSformat_error error);
00274   ldbl_QSLIB_INTERFACE int ldbl_QSerror_get_line_number (
00275   ldbl_QSformat_error error);
00276   ldbl_QSLIB_INTERFACE int ldbl_QSerror_get_pos (
00277   ldbl_QSformat_error error);
00278   ldbl_QSLIB_INTERFACE const char *ldbl_QSerror_get_line (
00279   ldbl_QSformat_error error);
00280   ldbl_QSLIB_INTERFACE void ldbl_QSerror_print (
00281   FILE * f,
00282   ldbl_QSformat_error error);
00283 
00284   ldbl_QSLIB_INTERFACE ldbl_QSerror_collector ldbl_QSerror_collector_new (
00285   void *fct,
00286   void *dest);
00287   ldbl_QSLIB_INTERFACE ldbl_QSerror_collector ldbl_QSerror_memory_collector_new (
00288   ldbl_QSerror_memory mem);
00289   ldbl_QSLIB_INTERFACE void ldbl_QSerror_collector_free (
00290   ldbl_QSerror_collector c);
00291 
00292 /****************************************************************************
00293  * line reader 
00294  */
00295   ldbl_QSLIB_INTERFACE ldbl_QSline_reader ldbl_QSline_reader_new (
00296   void *fct,
00297   void *data_src);
00298   /* reader->read_line_fct defaults to fgets */
00299 
00300   ldbl_QSLIB_INTERFACE void ldbl_QSline_reader_free (
00301   ldbl_QSline_reader reader);
00302 
00303   ldbl_QSLIB_INTERFACE void ldbl_QSline_reader_set_error_collector (
00304   ldbl_QSline_reader reader,
00305   ldbl_QSerror_collector collector);
00306 
00307   ldbl_QSLIB_INTERFACE char *ldbl_QSline_reader_get (
00308   ldbl_QSline_reader reader,
00309   char *s,
00310   int size);
00311 
00312   ldbl_QSLIB_INTERFACE ldbl_QSprob ldbl_QSget_prob (
00313   ldbl_QSline_reader reader,
00314   const char *probname,
00315   const char *filetype);
00316   /* the MPS and LP parsers uses the fct from reader 
00317    * to get to next input line */
00318 
00319 
00320 /****************************************************************************
00321  * error memory 
00322  */
00323   ldbl_QSLIB_INTERFACE ldbl_QSerror_memory ldbl_QSerror_memory_create (
00324   int takeErrorLines);
00325   ldbl_QSLIB_INTERFACE void ldbl_QSerror_memory_free (
00326   ldbl_QSerror_memory mem);
00327 
00328   ldbl_QSLIB_INTERFACE int ldbl_QSerror_memory_get_nof (
00329   ldbl_QSerror_memory mem,
00330   int error_type);
00331   ldbl_QSLIB_INTERFACE int ldbl_QSerror_memory_get_nerrors (
00332   ldbl_QSerror_memory mem);
00333 
00334   ldbl_QSLIB_INTERFACE ldbl_QSformat_error ldbl_QSerror_memory_get_last_error (
00335   ldbl_QSerror_memory mem);
00336   ldbl_QSLIB_INTERFACE ldbl_QSformat_error ldbl_QSerror_memory_get_prev_error (
00337   ldbl_QSformat_error e);
00338 
00339 /**************************************************************************** 
00340  * reporter for solver ldbl_feedback 
00341  */
00342   ldbl_QSLIB_INTERFACE void ldbl_QSset_reporter (
00343   ldbl_QSprob prob,
00344   int iterskip,
00345   void *fct,
00346   void *dest);
00347 
00348   ldbl_QSLIB_INTERFACE int ldbl_QSreport_prob (
00349   ldbl_QSprob p,
00350   const char *filetype,
00351   ldbl_QSerror_collector c);
00352 
00353 #ifdef  __cplusplus
00354 }
00355 #endif
00356 #endif                          /* ldbl___QS_QSOPT_H */
00357 #endif
00358 #endif

Generated on Thu Mar 29 09:32:31 2012 for QSopt_ex by  doxygen 1.4.7