00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "CoinTime.hpp"
00012
00013 #include "CouenneFeasPump.hpp"
00014 #include "CouenneFPpool.hpp"
00015 #include "CouenneProblem.hpp"
00016 #include "CouenneExprVar.hpp"
00017
00018 #include "cons_rowcuts.h"
00019
00020 #ifdef COIN_HAS_SCIP
00021 #include "scip/scip.h"
00022 #endif
00023
00024 using namespace Couenne;
00025
00027 double CouenneFeasPump::findSolution (const double *nSol, double* &iSol, int niter, int* nsuciter) {
00028
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 double obj;
00058
00060
00061 if (0) {
00062 static int nSolves = 0;
00063 char name [40];
00064 sprintf (name, "fp_milp_%d", nSolves++);
00065 milp_ -> writeLp (name);
00066 }
00067
00068 #ifdef COIN_HAS_SCIP
00069
00070 if (useSCIP_ && problem_ -> nIntVars () > 0) {
00071
00072 SCIP_RETCODE retcode = ScipSolve (nSol, iSol, niter, nsuciter, obj);
00073
00074 if (retcode != SCIP_OKAY) {
00075
00076 printf ("Couenne Feasibility Pump: SCIP did not return a feasible solution\n");
00077 obj = COIN_DBL_MAX;
00078 }
00079 } else
00080
00081 #endif
00082 {
00083
00084 milp_ -> messageHandler () -> setLogLevel (0);
00085
00086 if (problem_ -> nIntVars () > 0) milp_ -> branchAndBound ();
00087 else milp_ -> initialSolve ();
00088
00089 if (!iSol)
00090 iSol = new CouNumber [problem_ -> nVars ()];
00091
00092 if (milp_ -> getColSolution ())
00093 CoinCopyN (milp_ -> getColSolution (), problem_ -> nVars (), iSol);
00094 else {
00095
00096 if (iSol)
00097 delete [] iSol;
00098 iSol = NULL;
00099 }
00100
00101 obj = milp_ -> getObjValue ();
00102 }
00103
00104 return obj;
00105 }
00106
00108 void CouenneFeasPump::init_MILP () {}