/home/coin/SVN-release/Bcp-1.2.1/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 void
00050   pack_var_algo(const BCP_var_algo* var, BCP_buffer& buf);
00051   //---------------------------------------------------------------------------
00052   virtual BCP_var_algo*
00053   unpack_var_algo(BCP_buffer& buf);
00054   
00055   //---------------------------------------------------------------------------
00056   virtual OsiSolverInterface *
00057   initialize_solver_interface();
00058   //---------------------------------------------------------------------------
00059   void
00060   modify_lp_parameters(OsiSolverInterface* lp, bool in_strong_branching);
00061   //---------------------------------------------------------------------------
00062   virtual void
00063   initialize_new_search_tree_node(const BCP_vec<BCP_var*>& vars,
00064                                   const BCP_vec<BCP_cut*>& cuts,
00065                                   const BCP_vec<BCP_obj_status>& var_status,
00066                                   const BCP_vec<BCP_obj_status>& cut_status,
00067                                   BCP_vec<int>& var_changed_pos,
00068                                   BCP_vec<double>& var_new_bd,
00069                                   BCP_vec<int>& cut_changed_pos,
00070                                   BCP_vec<double>& cut_new_bd);
00071   //---------------------------------------------------------------------------
00083   virtual double
00084   compute_lower_bound(const double old_lower_bound,
00085                       const BCP_lp_result& lpres,
00086                       const BCP_vec<BCP_var*>& vars,
00087                       const BCP_vec<BCP_cut*>& cuts);
00088   //---------------------------------------------------------------------------
00089   // override default feasiblity testing.
00090   // we want to do heuristics if it's not feasible
00091   virtual BCP_solution*
00092   test_feasibility(const BCP_lp_result& lp_result,
00093                    const BCP_vec<BCP_var*>& vars,
00094                    const BCP_vec<BCP_cut*>& cuts);
00095   //---------------------------------------------------------------------------
00096   // override default feasible solution packing
00097   // since we generate heuristic solutions in test_feasibility, we got to
00098   // pack them here.
00099   virtual void
00100   pack_feasible_solution(BCP_buffer& buf, const BCP_solution* sol);
00101 
00102   //---------------------------------------------------------------------------
00103   // restoring feasibility
00104   // not needed, since the LP formulation is a set packing problem,
00105   // thus it'll always be feasible. BCP will abort if any of them is called.
00106 
00107   //---------------------------------------------------------------------------
00108   // Expand the user generated vars into columns
00109   virtual void
00110   vars_to_cols(const BCP_vec<BCP_cut*>& cuts, // on what to expand
00111                BCP_vec<BCP_var*>& vars,       // what to expand
00112                BCP_vec<BCP_col*>& cols,       // the expanded cols
00113                // things that the user can use for lifting vars if allowed
00114                const BCP_lp_result& lpres,
00115                BCP_object_origin origin, bool allow_multiple);
00116   // This is NOT AN INHERITED FUNCTION, just a shorter form of the previous
00117   void
00118   vars_to_cols(const BCP_vec<BCP_cut*>& cuts,  // on what to expand
00119                BCP_vec<BCP_var*>& vars,        // what to expand
00120                BCP_vec<BCP_col*>& cols);       // the expanded cols
00121    
00122   //---------------------------------------------------------------------------
00123   virtual void
00124   generate_vars_in_lp(const BCP_lp_result& lpres,
00125                       const BCP_vec<BCP_var*>& vars,
00126                       const BCP_vec<BCP_cut*>& cuts,
00127                       const bool before_fathom,
00128                       BCP_vec<BCP_var*>& new_vars,
00129                       BCP_vec<BCP_col*>& new_cols);
00130 
00131   void
00132   generate_vars(const BCP_lp_result& lpres,
00133                 const BCP_vec<BCP_var*>& vars,
00134                 const double rc_bound,
00135                 BCP_vec<BCP_var*>& new_vars);
00136 
00137   //---------------------------------------------------------------------------
00138   virtual void
00139   logical_fixing(const BCP_lp_result& lpres,
00140                  const BCP_vec<BCP_var*>& vars,
00141                  const BCP_vec<BCP_cut*>& cuts,
00142                  const BCP_vec<BCP_obj_status>& var_status,
00143                  const BCP_vec<BCP_obj_status>& cut_status,
00144                  const int var_bound_changes_since_logical_fixing,
00145                  BCP_vec<int>& changed_pos, BCP_vec<double>& new_bd);
00146   //---------------------------------------------------------------------------
00147   virtual BCP_branching_decision
00148   select_branching_candidates(const BCP_lp_result& lpres,
00149                               const BCP_vec<BCP_var*>& vars,
00150                               const BCP_vec<BCP_cut*>& cuts,
00151                               const BCP_lp_var_pool& local_var_pool,
00152                               const BCP_lp_cut_pool& local_cut_pool,
00153                               BCP_vec<BCP_lp_branching_object*>& candidates);
00154 };
00155 
00156 #endif

Generated on Thu Jan 15 03:00:58 2009 for coin-Bcp by  doxygen 1.4.7