/home/coin/SVN-release/Bcp-1.2.2/Applications/Csp/include/CSP_lp.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2005, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 #ifndef _CSP_LP_H
00004 #define _CSP_LP_H
00005 
00006 #include <cfloat>
00007 #include <map>
00008 #include <vector>
00009 
00010 #include <OsiClpSolverInterface.hpp>
00011 
00012 #include "BCP_parameters.hpp"
00013 #include "BCP_lp_user.hpp"
00014 
00015 #include "CSP_lp_param.hpp"
00016 #include "CSP_var.hpp"
00017 #include "CSP_colgen.hpp"
00018 
00019 class CSP_lp : public BCP_lp_user {
00020   // private data
00021 private:
00022   // this is where we store the 
00023   // columns generated in the compute_lower_bound method
00024   // for use elsewhere in our application. 
00025    std::vector<PATTERN*> improving_patterns_;
00026 
00027   // public data
00028 public:
00029    BCP_parameter_set<CSP_lp_par> par;
00030 
00031   // pointer to the static problem information
00032   // there's only one LP module, so no need to declare this "static"
00033   CSPROBLEM* csproblem;
00034 
00035   CSP_colgen* colgen;
00036 
00037   // public methods
00038 public:
00039   // constructor
00040   CSP_lp() : csproblem(0), colgen(0) {}
00041 
00042   // destructor
00043   ~CSP_lp() {
00044     std::for_each(improving_patterns_.begin(),
00045                   improving_patterns_.end(), DELETEOBJECT());
00046     delete csproblem;
00047     delete colgen;
00048   }
00049 
00050    //==========================================================================
00056   // inherited methods
00057    virtual void
00058    unpack_module_data(BCP_buffer & buf);
00059 
00060    //==========================================================================
00071    virtual OsiSolverInterface *
00072    initialize_solver_interface();
00073 
00074    //==========================================================================
00092    virtual void
00093    initialize_new_search_tree_node(const BCP_vec<BCP_var*>& vars,
00094                                    const BCP_vec<BCP_cut*>& cuts,
00095                                    const BCP_vec<BCP_obj_status>& var_status,
00096                                    const BCP_vec<BCP_obj_status>& cut_status,
00097                                    BCP_vec<int>& var_changed_pos,
00098                                    BCP_vec<double>& var_new_bd,
00099                                    BCP_vec<int>& cut_changed_pos,
00100                                    BCP_vec<double>& cut_new_bd);
00101 
00102   //==========================================================================
00109    virtual void
00110    modify_lp_parameters(OsiSolverInterface* lp, const int changeType,
00111                         bool in_strong_branching);
00112 
00113    //==========================================================================
00125    virtual double
00126    compute_lower_bound(const double old_lower_bound,
00127                        const BCP_lp_result& lpres,
00128                        const BCP_vec<BCP_var*>& vars,
00129                        const BCP_vec<BCP_cut*>& cuts);
00130    //==========================================================================
00131 
00150    // *LL* : sufficient to test binary-ness 
00151 #if 0
00152    virtual BCP_solution*
00153    test_feasibility(const BCP_lp_result& lpres,
00154                     const BCP_vec<BCP_var*>& vars,
00155                     const BCP_vec<BCP_cut*>& cuts);
00156 #endif
00157    //==========================================================================
00162   virtual BCP_solution*
00163   generate_heuristic_solution(const BCP_lp_result& lpres,
00164                               const BCP_vec<BCP_var*>& vars,
00165                               const BCP_vec<BCP_cut*>& cuts);
00166   
00167    //==========================================================================
00174    // get one dual ray from the solver, and try to generate columns that cut
00175    // off the  dual ray. 
00176    virtual void
00177    restore_feasibility(const BCP_lp_result& lpres,
00178                        const std::vector<double*> dual_rays,
00179                        const BCP_vec<BCP_var*>& vars,
00180                        const BCP_vec<BCP_cut*>& cuts,
00181                        BCP_vec<BCP_var*>& vars_to_add,
00182                        BCP_vec<BCP_col*>& cols_to_add);
00183 
00184    //==========================================================================
00205    virtual void
00206    vars_to_cols(const BCP_vec<BCP_cut*>& cuts, // on what to expand
00207                 BCP_vec<BCP_var*>& vars,       // what to expand
00208                 BCP_vec<BCP_col*>& cols,       // the expanded cols
00209                 // things that the user can use for lifting vars if allowed
00210                 const BCP_lp_result& lpres,
00211                 BCP_object_origin origin, bool allow_multiple);
00212 
00213    void
00214    vars_to_cols(BCP_vec<BCP_var*>& vars,
00215                 BCP_vec<BCP_col*>& cols);
00216 
00217    //==========================================================================
00231    // *LL* : for now we don't have cuts, so the default is fine.
00232 #if 0
00233    virtual void
00234    generate_cuts_in_lp(const BCP_lp_result& lpres,
00235                        const BCP_vec<BCP_var*>& vars,
00236                        const BCP_vec<BCP_cut*>& cuts,
00237                        BCP_vec<BCP_cut*>& new_cuts,
00238                        BCP_vec<BCP_row*>& new_rows);
00239 #endif
00240 
00241    //==========================================================================
00258    virtual void
00259    generate_vars_in_lp(const BCP_lp_result& lpres,
00260                        const BCP_vec<BCP_var*>& vars,
00261                        const BCP_vec<BCP_cut*>& cuts,
00262                        const bool before_fathom,
00263                        BCP_vec<BCP_var*>& new_vars,
00264                        BCP_vec<BCP_col*>& new_cols);
00265 
00266    //==========================================================================
00274    // *LL* : for now we don't have cuts, so the default is fine.
00275 #if 0
00276    virtual BCP_object_compare_result
00277    compare_cuts(const BCP_cut* c0, const BCP_cut* c1);
00278 #endif
00279 
00280    //==========================================================================
00289    // *LL* : We just assume that every generated var is different, so default
00290    // *LL* : is fine. The worst that can happen is a minimal performance
00291    // *LL* : penalty.
00292 #if 0
00293    virtual BCP_object_compare_result
00294    compare_vars(const BCP_var* v0, const BCP_var* v1);
00295 #endif
00296 
00297    //==========================================================================
00313    // *LL* : This is not a must, but would be nice to add setpacking matrix
00314    // *LL* : reduction techniques eventually. For now use the default.
00315 #if 0
00316    virtual void
00317    logical_fixing(const BCP_lp_result& lpres,
00318                   const BCP_vec<BCP_var*>& vars,
00319                   const BCP_vec<BCP_cut*>& cuts,
00320                   const BCP_vec<BCP_obj_status>& var_status,
00321                   const BCP_vec<BCP_obj_status>& cut_status,
00322                   const int var_bound_changes_since_logical_fixing,
00323                   BCP_vec<int>& changed_pos, BCP_vec<double>& new_bd);
00324 #endif
00325 
00326    //==========================================================================
00329    virtual BCP_branching_decision
00330    select_branching_candidates(const BCP_lp_result& lpres,
00331                                const BCP_vec<BCP_var*>& vars,
00332                                const BCP_vec<BCP_cut*>& cuts,
00333                                const BCP_lp_var_pool& local_var_pool,
00334                                const BCP_lp_cut_pool& local_cut_pool,
00335                                BCP_vec<BCP_lp_branching_object*>& cands,
00336                                bool force_branch = false);
00337    BCP_lp_branching_object*
00338    branch_on_half(const BCP_lp_result& lpres,
00339                   const BCP_vec<BCP_var*>& vars);
00340 
00341    //==========================================================================
00355    // *LL* : Use default for now
00356    // *LL* : Later we can play with integrality based branching
00357 #if 0
00358    virtual BCP_branching_object_relation
00359    compare_branching_candidates(BCP_presolved_lp_brobj* new_solved,
00360                                 BCP_presolved_lp_brobj* old_solved);
00361 #endif
00362 
00363    //==========================================================================
00383    virtual void
00384    set_actions_for_children(BCP_presolved_lp_brobj* best);
00385       
00386    //==========================================================================
00404    // *LL* : Used only when branching on dynamically generated cuts is
00405    // *LL* : allowed, but we don't generate cuts...
00406 #if 0
00407    virtual void
00408    purge_slack_pool(const BCP_vec<BCP_cut*>& slack_pool,
00409                     BCP_vec<int>& to_be_purged);
00410 #endif
00411 
00412    //==========================================================================
00413 
00414 };
00415 #endif

Generated on Tue Jun 16 03:03:00 2009 for coin-Bcp by  doxygen 1.4.7