00001 /* $Id: obbt_supplement.cpp 791 2012-01-24 17:18:52Z pbelotti $ 00002 * 00003 * Name: obbt_supplement.cpp 00004 * Author: Pietro Belotti 00005 * Purpose: Post-OBBT computations that use dual information to infer 00006 * 00007 * This file is licensed under the Eclipse Public License (EPL) 00008 */ 00009 00010 #include "OsiSolverInterface.hpp" 00011 00012 // Use dual information lambda to obtain, from solution to this 00013 // problem, a dual bound to OBBT subproblem (min|max) for every 00014 // other variable. 00015 00016 int obbt_supplement (const OsiSolverInterface *csi, 00017 int index, 00018 int sense) { 00019 00020 return 0; 00021 00022 if (!(csi -> isProvenOptimal ())) 00023 return 0; 00024 00025 int 00026 n = csi -> getNumCols (), 00027 m = csi -> getNumRows (); 00028 00029 // get dual 00030 00031 const double *lambda = csi -> getRowPrice (); 00032 00033 double alpha_i = (sense==1 ? 1. : -1.); 00034 00035 double *beta = new double [m]; 00036 00037 // The problem just solved was either (depending on sense): 00038 // 00039 // LB) min { x_i: Ax>=b, l<=x<=u} 00040 // UB) min { -x_i: Ax>=b, l<=x<=u} 00041 // 00042 // lambda contains the dual variables at the optimal solution, 00043 // i.e., the Lagrangian multipliers of the problems 00044 // 00045 // L_lb (lambda) = min { x_i + lambda^T (b-Ax): l<=x<=u} 00046 // U_lb (lambda) = min {-x_i + lambda^T (b-Ax): l<=x<=u} 00047 // 00048 // Suppose M={1..m} and N={1..n} index the set of rows and columns, 00049 // respectively. Rewrite both problems above by setting alpha_i as 1 00050 // for the LB problem and -1 for the UB problem. 00051 // 00052 // L (i, lambda) = min {alpha_i x_i + sum {h in M} lambda_h (b_h - sum {k in N} a_hk x_k): l <= x <= u} 00053 // = lambda^T b + min {alpha_i x_i - sum {h in M} sum {k in N} lambda_h a_hk x_k: l <= x <= u} 00054 // = lambda^T b + min {alpha_i x_i - sum {k in N} (sum {h in M} lambda_h a_hk) x_k: l <= x <= u} 00055 // = lambda^T b + min {alpha_i x_i - sum {k in N} beta_k x_k: l <= x <= u} 00056 // = lambda^T b + min { sum {k in N} gamma_i_k x_k: l <= x <= u} 00057 // 00058 // = lambda^T b + sum {k in N: gamma_i_k > 0} gamma_i_k l_k + 00059 // sum {k in N: gamma_i_k < 0} gamma_i_k u_k, 00060 // 00061 // where 00062 // 00063 // beta_k = sum {h in M} lambda_h a_hk and 00064 // 00065 // and 00066 // 00067 // gamma_i_k = - beta_i + alpha_i if i==k 00068 // - beta_k otherwise. 00069 // 00070 // Then any dual solution to the i-th LB or UB problems above can be 00071 // used to get a DUAL solution to all other j-th LB/UB problems, for 00072 // j!=i. Just compute L (j,lambda) for all j, for alpha_i in {-1,1}, 00073 // and compare with previous bound. 00074 00075 for (int j=0; j<n; j++) { 00076 00077 } 00078 00079 delete [] beta; 00080 }
1.6.1