cb_cinterface.h

Go to the documentation of this file.
00001 
00002 
00003 #ifndef CONICBUNDLE_CB_CINTERFACE_H
00004 #define CONICBUNDLE_CB_CINTERFACE_H
00005 
00006 
00089 
00090 #ifdef __cplusplus
00091 class CB_CSolver;
00094 typedef CB_CSolver* cb_problemp;
00095 #else
00096 
00098 typedef struct CB_CSolver* cb_problemp;
00099 #endif
00100 
00101 #ifdef __cplusplus
00102 extern "C" {
00103 #endif
00104 
00105 
00106 /* *****************************************************************
00107  *                      function evaluation
00108  * ***************************************************************** */
00109 
00204 typedef int (*cb_functionp)( /* input: */
00205                             void *function_key, /* supplied by the user */
00206                             /* on entering the function. May be useful */
00207                             /* if multiple copies of the same function are */
00208                             /* used with parameters */
00209 
00210                             double *arg, /* argument/Lagrange multipliers */
00211 
00212                             double relprec, /* relative precision requirement */
00213                             /* for objective values leading to descent steps */
00214 
00215                             int max_subg, /* at most max_subg */
00216                             /* eps-subgradients and subg_values may be */
00217                             /* returend (but at least one!) */
00218 
00219 
00220                             /* output: */  /*memory provided by caller */
00221 
00222                             double *objective_value,   /* pointer to double */
00223                             /* on input: value gives the threshold for a */
00224                             /* null step; you may stop, if a cutting plane */
00225                             /* yields at least this; */
00226                             /* on output: return an upper bound on the true */
00227                             /* function value if there is no hyperplane  */
00228                             /* cutting above the threshold (must be */
00229                             /* guaranteed within relprec*(abs(objval)+1.)) */
00230 
00231                             int* n_subgrads, /* pointer to int */
00232                             /* must give number of epsilon subgrads returned */
00233 
00234                             double *subg_values,  /* pointer to double array */
00235                             /* for each eps subgradient the value at argument */
00236 
00237                             double *subgradients, /* pointer to double array */
00238                             /* format: s1y1,...,s1ym,s2y1,...,s2ym,... */
00239 
00240                             double *primal /* pointer to array, may be NULL */
00241                             /* if function arises from Lagrangean relaxation */
00242                             /* and a primal approximation is desired then */
00243                             /* set the primal dimension in cb_add_function */
00244                             /* and return the primal solutions corresponding */
00245                             /* to the eps-subgradients in the array pointed */
00246                             /* to by primal */
00247                             /* format p1x1,..,p1xn,p2x1,...,p2xn,... */
00248                             );
00249 
00250 
00251 /* *****************************************************************
00252  *                      subgradient_extension
00253  * ***************************************************************** */
00254 
00305 typedef int (*cb_subgextp) ( /* input: */
00306 
00307                             void *function_key, /* supplied by the user */
00308                             /* on entering the function. May be useful */
00309                             /* if multiple copies of the same function are */
00310                             /* used with parameters */
00311 
00312                             double* generating_primal, /* pointer to array */
00313                             /* may be NULL if no primal supplied */
00314 
00315                             int n_indices,
00316 
00317                             int* variable_indices, /* pointer to array */
00318                             
00319 
00320                             /*output*/     /* (storage provided by caller) */
00321  
00322                             double* new_subgradient_values /* pointer to array */
00323                             );
00324 
00325 
00326 
00327 /* *****************************************************************
00328  *                     cb_construct_problem
00329  * ***************************************************************** */
00330 
00344  cb_problemp  cb_construct_problem(int no_bundle);
00345 
00346   
00347 /* *****************************************************************
00348  *                     destruct_problem
00349  * ***************************************************************** */
00350 
00362   int cb_destruct_problem(cb_problemp *p);
00363 
00364 
00365 /* *****************************************************************
00366  *                        clear
00367  * ***************************************************************** */
00368 
00376   void cb_clear(cb_problemp p);
00377 
00378 
00379 /* *****************************************************************
00380  *                        set_defaults
00381  * ***************************************************************** */
00382 
00390   void cb_set_defaults(cb_problemp p);
00391 
00392 
00393 /* *****************************************************************
00394  *                     cb_init_problem
00395  * ***************************************************************** */
00396 
00434   int cb_init_problem(/* input: */
00435                       cb_problemp p,
00436                       int m, /* dimension of argument/number Lag mult */
00437                       double *lowerb, /* pointer to array, may be NULL */
00438                       double *upperb /* point to array, may be NULL */
00439                     );
00440 
00441 /* *****************************************************************
00442  *                     cb_add_function
00443  * ***************************************************************** */
00444 
00488   int cb_add_function(cb_problemp p,
00489                       void* function_key,
00490                       cb_functionp f,
00491                       cb_subgextp se,
00492                       int primaldim);
00493 
00494 
00495 /* *****************************************************************
00496  *                     set_lower_bound
00497  * ***************************************************************** */
00498 
00520   int cb_set_lower_bound(cb_problemp p,int i, double lower_bound);
00521 
00522 
00523 /* *****************************************************************
00524  *                     set_upper_bound
00525  * ***************************************************************** */
00526 
00549   int cb_set_upper_bound(cb_problemp p,int i, double upper_bound);
00550 
00551 
00552 /* *****************************************************************
00553  *                     append_variables
00554  * ***************************************************************** */
00555 
00597   int cb_append_variables(cb_problemp p,
00598                           int n_append,double* lowerb,double* upperb);
00599 
00600 
00601 /* *****************************************************************
00602  *                     delete_variables
00603  * ***************************************************************** */
00604 
00647   int cb_delete_variables(cb_problemp p,
00648                           int n_del,int* delete_indices,int* map_to_old);
00649 
00650 /* return value:
00651  * 0,  all correct
00652  * >0, failure
00653  */
00654 
00655 
00656 
00657 /* *****************************************************************
00658  *                     reassign_variables
00659  * ***************************************************************** */
00660 
00695   int cb_reassign_variables(cb_problemp p,
00696                             int n_assign,int* assign_new_from_old);
00697 
00698 
00699 /* *****************************************************************
00700  *                     do_descent_step
00701  * ***************************************************************** */
00702 
00735 int cb_do_descent_step(cb_problemp p);
00736 
00737 /* return value:
00738  * 0,  all correct
00739  * >0, errors
00740  */
00741 
00742 /* *****************************************************************
00743  *                     do_maxsteps
00744  * ***************************************************************** */
00745 
00802   int cb_do_maxsteps(cb_problemp p,int maxsteps);
00803 
00804 /* return value:
00805  * 0,  all correct
00806  * >0, errors
00807  */
00808 
00809 /* *****************************************************************
00810  *                     termination_code
00811  * ***************************************************************** */
00812     
00846 int cb_termination_code(cb_problemp p);
00847 
00848 /* *****************************************************************
00849  *                     print_termination_code
00850  * ***************************************************************** */
00851 
00863   int cb_print_termination_code(cb_problemp p);
00864 
00865 /* *****************************************************************
00866  *                     get_objval
00867  * ***************************************************************** */
00868 
00869 
00883 double cb_get_objval(cb_problemp p); 
00884 
00885 /* *****************************************************************
00886  *                     get_center
00887  * ***************************************************************** */
00888 
00909 int cb_get_center(cb_problemp p,double* center); 
00910 
00911 
00912 /* *****************************************************************
00913  *                     get_sgnorm
00914  * ***************************************************************** */
00915 
00926 double cb_get_sgnorm(cb_problemp p); 
00927 
00928 /* *****************************************************************
00929  *                     get_subgradient
00930  * ***************************************************************** */
00931 
00946 int cb_get_subgradient(cb_problemp p,double* subgradient); 
00947 
00948 
00949 /* *****************************************************************
00950  *                     get_candidate_value
00951  * ***************************************************************** */
00952 
00962 double cb_get_candidate_value(cb_problemp p);
00963     
00964 /* *****************************************************************
00965  *                     get_candidate
00966  * ***************************************************************** */
00967 
00985 int cb_get_candidate(cb_problemp p,double* candidate);
00986 
00987 
00988 /* *****************************************************************
00989  *                     set_term_relprec
00990  * ***************************************************************** */
00991 
01009   int cb_set_term_relprec(cb_problemp p,double term_relprec); 
01010 
01011 
01012 /* *****************************************************************
01013  *                     set_new_center_point
01014  * ***************************************************************** */
01015 
01033 int cb_set_new_center_point(cb_problemp p,double* center); 
01034 
01035 
01036 /* *****************************************************************
01037  *                     get_function_status
01038  * ***************************************************************** */
01039 
01054   int cb_get_function_status(cb_problemp p,void* function_key); 
01055 
01056 
01057 /* *****************************************************************
01058  *                     get_approximate_slacks
01059  * ***************************************************************** */
01060 
01077   int cb_get_approximate_slacks(cb_problemp p,double* slacks);
01078 
01079 
01080 /* *****************************************************************
01081  *                     get_approximate_primal
01082  * ***************************************************************** */
01083 
01114 int cb_get_approximate_primal(cb_problemp p,void* function_key,double* primal); 
01115 
01116 
01117 /* *****************************************************************
01118  *                     get_center_primal
01119  * ***************************************************************** */
01120 
01145 int cb_get_center_primal(cb_problemp p,void* function_key,double* primal); 
01146 
01147 
01148 /* *****************************************************************
01149  *                     get_center_candidate
01150  * ***************************************************************** */
01151 
01152 
01153 
01154 
01181 int cb_get_candidate_primal(cb_problemp p,void* function_key,double* primal); 
01182 
01183 
01184 
01185 /* *****************************************************************
01186  *                     set_max_bundlesize
01187  * ***************************************************************** */
01188 
01217   int cb_set_max_bundlesize(cb_problemp p,void* function_key,
01218                             int bundlesize); 
01219 
01220 
01221 /* *****************************************************************
01222  *                     set_max_new_subgradients
01223  * ***************************************************************** */
01224 
01250   int cb_set_max_new_subgradients(cb_problemp p,void* function_key,
01251                                   int max_new_subg); 
01252 
01253 
01254 /* *****************************************************************
01255  *                     get_bundle_parameters
01256  * ***************************************************************** */
01257 
01283   int cb_get_bundle_parameters(cb_problemp p,void* function_key,
01284                                int* max_bundlesize,int* max_new_subgradients);
01285 
01286 
01287 /* *****************************************************************
01288  *                     get_bundle_values
01289  * ***************************************************************** */
01290 
01317   int cb_get_bundle_values(cb_problemp p,void* function_key,
01318                            int* bundlesize,int* new_subgradients);
01319 
01320 
01321  /* *****************************************************************
01322  *                     reinit_function_model
01323  * ***************************************************************** */
01324 
01346   int cb_reinit_function_model(cb_problemp p,void* function_key);
01347                     
01348 
01349 /* *****************************************************************
01350  *                     get_last_weight
01351  * ***************************************************************** */
01352 
01363   double cb_get_last_weight(cb_problemp p); 
01364 
01365 /* *****************************************************************
01366  *                     set_next_weight
01367  * ***************************************************************** */
01368 
01394   int cb_set_next_weight(cb_problemp p,double weight); 
01395 
01396 
01397 /* *****************************************************************
01398  *                     set_min_weight
01399  * ***************************************************************** */
01400 
01419   int cb_set_min_weight(cb_problemp p,double min_weight); 
01420 
01421 
01422 /* *****************************************************************
01423  *                     set_max_weight
01424  * ***************************************************************** */
01425 
01445   int cb_set_max_weight(cb_problemp p,double max_weight); 
01446 
01447 
01448 /* *****************************************************************
01449  *                    get_dim
01450  * ***************************************************************** */
01451 
01456   int cb_get_dim(cb_problemp p);
01457 
01458 
01459 /* *****************************************************************
01460  *                    get_n_functions
01461  * ***************************************************************** */
01462 
01466   int cb_get_n_functions(cb_problemp p);
01467 
01468 
01469 /* *****************************************************************
01470  *                    get_minus_infinity
01471  * ***************************************************************** */
01472 
01477   double cb_get_minus_infinity(void);
01478 
01479 /* *****************************************************************
01480  *                    get_plus_infinity
01481  * ***************************************************************** */
01482 
01487   double cb_get_plus_infinity(void);
01488 
01489 
01490 /* *****************************************************************
01491  *                    clear_fail_counts
01492  * ***************************************************************** */
01493 
01494 
01495 
01504   void cb_clear_fail_counts (cb_problemp p);
01505 
01506 /* *****************************************************************
01507  *                    set_eval_limit
01508  * ***************************************************************** */
01509 
01523   void cb_set_eval_limit(cb_problemp p,int eval_limit);
01524 
01525 /* *****************************************************************
01526  *                    set_inner_update_limit
01527  * ***************************************************************** */
01528 
01542   void cb_set_inner_update_limit(cb_problemp p,int update_limit);
01543  
01544 
01545 
01546 /* *****************************************************************
01547  *                   cb_set_active_bounds_fixing
01548  * ***************************************************************** */
01549 
01576 void cb_set_active_bounds_fixing(cb_problemp p, int allow_fixing );
01577 
01578 /* *****************************************************************
01579  *                   cb_get_active_bounds_indicator
01580  * ***************************************************************** */
01581 
01602   int cb_get_active_bounds_indicator(cb_problemp p,int* indicator);
01603 
01604 /* *****************************************************************
01605  *                     set_print_level
01606  * ***************************************************************** */
01607 
01669   void cb_set_print_level(cb_problemp p,int pril); 
01670 
01671 
01672 
01673 
01674 #ifdef __cplusplus
01675 } /* extern "C" */
01676 #endif
01677 
01680 #endif

Generated on Tue May 3 16:52:53 2011 for ConicBundle by  doxygen 1.5.6