/home/coin/SVN-release/Bcp-1.2.3/Applications/Mkc/include/MKC_lp.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2000, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 #ifndef _MKC_LP_H
00004 #define _MKC_LP_H
00005 
00006 #include <cfloat>
00007 
00008 #include "BCP_parameters.hpp"
00009 #include "BCP_lp_user.hpp"
00010 
00011 #include "MKC_lp_param.hpp"
00012 #include "MKC_knapsack.hpp"
00013 #include "MKC_var.hpp"
00014 
00015 //#############################################################################
00016 
00017 class MKC_lp : public BCP_lp_user {
00018 public:
00019   BCP_parameter_set<MKC_lp_par> par;
00020   double* objhist;
00021   MKC_knapsack_set kss;
00022 
00023   MKC_knapsack_fixing* ks_fixings;
00024   BCP_vec<MKC_var*>* enumerated_ks;
00025   BCP_vec<MKC_var*> input_vars;
00026 
00027   BCP_vec<BCP_var*> generated_vars;
00028 
00029   double best_lb_in_root;
00030   double start_time;
00031 
00032 public:
00033   MKC_lp() :
00034     objhist(0), ks_fixings(0), enumerated_ks(0), best_lb_in_root(-DBL_MAX) {}
00035   ~MKC_lp() {
00036     for (int i = 0; i < kss.ks_num; ++i) {
00037       purge_ptr_vector(enumerated_ks[i]);
00038     }
00039     delete[] enumerated_ks;
00040     delete[] ks_fixings;
00041     delete[] objhist;
00042     purge_ptr_vector(input_vars);
00043   }
00044   //###########################################################################
00045   // unpack the initial info for the appropriate process
00046   virtual void
00047   unpack_module_data(BCP_buffer& buf);
00048   //---------------------------------------------------------------------------
00049   virtual OsiSolverInterface *
00050   initialize_solver_interface();
00051   //---------------------------------------------------------------------------
00052   void
00053   modify_lp_parameters(OsiSolverInterface* lp, const int changeType,
00054                        bool in_strong_branching);
00055   //---------------------------------------------------------------------------
00056   virtual void
00057   initialize_new_search_tree_node(const BCP_vec<BCP_var*>& vars,
00058                                   const BCP_vec<BCP_cut*>& cuts,
00059                                   const BCP_vec<BCP_obj_status>& var_status,
00060                                   const BCP_vec<BCP_obj_status>& cut_status,
00061                                   BCP_vec<int>& var_changed_pos,
00062                                   BCP_vec<double>& var_new_bd,
00063                                   BCP_vec<int>& cut_changed_pos,
00064                                   BCP_vec<double>& cut_new_bd);
00065   //---------------------------------------------------------------------------
00077   virtual double
00078   compute_lower_bound(const double old_lower_bound,
00079                       const BCP_lp_result& lpres,
00080                       const BCP_vec<BCP_var*>& vars,
00081                       const BCP_vec<BCP_cut*>& cuts);
00082   //---------------------------------------------------------------------------
00083   // override default feasiblity testing.
00084   // we want to do heuristics if it's not feasible
00085   virtual BCP_solution*
00086   test_feasibility(const BCP_lp_result& lp_result,
00087                    const BCP_vec<BCP_var*>& vars,
00088                    const BCP_vec<BCP_cut*>& cuts);
00089   //---------------------------------------------------------------------------
00090   // override default feasible solution packing
00091   // since we generate heuristic solutions in test_feasibility, we got to
00092   // pack them here.
00093   virtual void
00094   pack_feasible_solution(BCP_buffer& buf, const BCP_solution* sol);
00095 
00096   //---------------------------------------------------------------------------
00097   // restoring feasibility
00098   // not needed, since the LP formulation is a set packing problem,
00099   // thus it'll always be feasible. BCP will abort if any of them is called.
00100 
00101   //---------------------------------------------------------------------------
00102   // Expand the user generated vars into columns
00103   virtual void
00104   vars_to_cols(const BCP_vec<BCP_cut*>& cuts, // on what to expand
00105                BCP_vec<BCP_var*>& vars,       // what to expand
00106                BCP_vec<BCP_col*>& cols,       // the expanded cols
00107                // things that the user can use for lifting vars if allowed
00108                const BCP_lp_result& lpres,
00109                BCP_object_origin origin, bool allow_multiple);
00110   // This is NOT AN INHERITED FUNCTION, just a shorter form of the previous
00111   void
00112   vars_to_cols(const BCP_vec<BCP_cut*>& cuts,  // on what to expand
00113                BCP_vec<BCP_var*>& vars,        // what to expand
00114                BCP_vec<BCP_col*>& cols);       // the expanded cols
00115    
00116   //---------------------------------------------------------------------------
00117   virtual void
00118   generate_vars_in_lp(const BCP_lp_result& lpres,
00119                       const BCP_vec<BCP_var*>& vars,
00120                       const BCP_vec<BCP_cut*>& cuts,
00121                       const bool before_fathom,
00122                       BCP_vec<BCP_var*>& new_vars,
00123                       BCP_vec<BCP_col*>& new_cols);
00124 
00125   void
00126   generate_vars(const BCP_lp_result& lpres,
00127                 const BCP_vec<BCP_var*>& vars,
00128                 const double rc_bound,
00129                 BCP_vec<BCP_var*>& new_vars);
00130 
00131   //---------------------------------------------------------------------------
00132   virtual void
00133   logical_fixing(const BCP_lp_result& lpres,
00134                  const BCP_vec<BCP_var*>& vars,
00135                  const BCP_vec<BCP_cut*>& cuts,
00136                  const BCP_vec<BCP_obj_status>& var_status,
00137                  const BCP_vec<BCP_obj_status>& cut_status,
00138                  const int var_bound_changes_since_logical_fixing,
00139                  BCP_vec<int>& changed_pos, BCP_vec<double>& new_bd);
00140   //---------------------------------------------------------------------------
00141   virtual BCP_branching_decision
00142   select_branching_candidates(const BCP_lp_result& lpres,
00143                               const BCP_vec<BCP_var*>& vars,
00144                               const BCP_vec<BCP_cut*>& cuts,
00145                               const BCP_lp_var_pool& local_var_pool,
00146                               const BCP_lp_cut_pool& local_cut_pool,
00147                               BCP_vec<BCP_lp_branching_object*>& candidates,
00148                               bool force_branch = false);
00149 };
00150 
00151 #endif

Generated on Thu Oct 8 03:12:36 2009 for coin-Bcp by  doxygen 1.4.7