/home/coin/SVN-release/OS-2.4.0/Couenne/src/cut/sdpcuts/OsiXxxSolverInterface.hpp

Go to the documentation of this file.
00001 /* $Id: OsiXxxSolverInterface.hpp 508 2011-02-15 21:52:44Z pbelotti $
00002  *
00003  * Name:    OsiXxxSolverInterface.hpp
00004  * Author:  Andrea Qualizza
00005  * Purpose: 
00006  *
00007  * This file is licensed under the Eclipse Public License (EPL)
00008  */
00009 
00010 #ifndef OSIXXXSOLVERINTERFACE_HPP
00011 #define OSIXXXSOLVERINTERFACE_HPP
00012 
00013 #ifdef COIN_HAS_CPX
00014 #include "cplex.h"
00015 #include "OsiCpxSolverInterface.hpp"
00016 
00017 class OsiXxxSolverInterface: public OsiCpxSolverInterface {
00018 public:
00019         
00020         void myResolve() {
00021                 int status;
00022 
00023                 CPXsetintparam( getEnvironmentPtr(), CPX_PARAM_SIMDISPLAY, 0 );
00024                 if ( (status = CPXdualopt( getEnvironmentPtr(), getLpPtr (FREECACHED_RESULTS))))
00025                         printf("ERROR WITH myResolve returncode=%d\n",status);
00026         }
00027 
00028         double myGetObjVal() {
00029                 int status;
00030                 double objval=0.0;
00031                 if ((status = CPXgetobjval( getEnvironmentPtr(), getLpPtr (FREECACHED_RESULTS), &objval )))
00032                         printf("ERROR WITH myGetObjVal returncode=%d\n",status);
00033                 return objval;
00034         }
00035 
00036         void myWriteMps(const char *name) {
00037                 int status;
00038                 if ((status = CPXwriteprob (getEnvironmentPtr(), getLpPtr (FREECACHED_RESULTS), name, NULL)))
00039                         printf("ERROR WITH myWriteMps returncode=%d\n",status);
00040                 
00041         }
00042         
00043         // NOTE: only modifies cplex problem data NOT OsiSolverInterface cache !
00044         void XxxModifyCoefficient(int row,int col,double value) {
00045                 if (CPXchgcoef( getEnvironmentPtr (), getLpPtr (KEEPCACHED_RESULTS), row, col, value)) 
00046                         printf("ERROR WITH XxxModifyCoefficient\n");
00047         }
00048 
00049         void XxxInitialSolveBaropt() {
00050                 CPXCENVptr env = getEnvironmentPtr();
00051                 CPXLPptr lp = getLpPtr(KEEPCACHED_RESULTS);     
00052                 CPXhybbaropt(env,lp,CPX_ALG_NONE);
00053         }
00054         
00055         void XxxResolveBaropt() {
00056                 CPXCENVptr env = getEnvironmentPtr();
00057                 CPXLPptr lp = getLpPtr(KEEPCACHED_RESULTS);
00058                 CPXhybbaropt(env,lp,CPX_ALG_NONE);
00059         }
00060 };
00061 
00062 
00063 #else
00064 
00065 #include "OsiClpSolverInterface.hpp"
00066 class OsiXxxSolverInterface: public OsiClpSolverInterface {
00067 public:
00068         void XxxModifyCoefficient(int row,int col,double value) {
00069                 modifyCoefficient (row,col,value,false);
00070         }
00071 };
00072 
00073 #endif
00074 
00075 #endif
00076 

Generated on Thu Sep 22 03:05:57 2011 by  doxygen 1.4.7