/home/coin/SVN-release/OS-2.4.1/Bcp/src/LP/BCP_lp_convert_OsiWarmStart.cpp

Go to the documentation of this file.
00001 // Copyright (C) 2000, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 
00004 #include "CoinWarmStartDual.hpp"
00005 #include "CoinWarmStartPrimalDual.hpp"
00006 #include "CoinWarmStartBasis.hpp"
00007 
00008 #include "BCP_lp_functions.hpp"
00009 #include "BCP_warmstart_dual.hpp"
00010 #include "BCP_warmstart_primaldual.hpp"
00011 
00012 BCP_warmstart*
00013 BCP_lp_convert_CoinWarmStart(BCP_lp_prob& p, CoinWarmStart*& warmstart)
00014 {
00015   if (warmstart == NULL)
00016     return NULL;
00017 
00018   {
00019     const CoinWarmStartDual* ws =
00020       dynamic_cast<const CoinWarmStartDual*>(warmstart);
00021     if (ws != NULL) {
00022       const int size = ws->size();
00023       const double* dual = ws->dual();
00024       BCP_warmstart* bcp_ws = new BCP_warmstart_dual(dual, dual+size);
00025       delete warmstart;
00026       warmstart = NULL;
00027       return bcp_ws;
00028     }
00029   }
00030 
00031   {
00032     const CoinWarmStartPrimalDual* ws =
00033       dynamic_cast<const CoinWarmStartPrimalDual*>(warmstart);
00034     if (ws != NULL) {
00035       const int psize = ws->primalSize();
00036       const int dsize = ws->dualSize();
00037       const double* primal = ws->primal();
00038       const double* dual = ws->dual();
00039       BCP_warmstart* bcp_ws =
00040           new BCP_warmstart_primaldual(primal, primal+psize, dual, dual+dsize);
00041       delete warmstart;
00042       warmstart = NULL;
00043       return bcp_ws;
00044     }
00045   }
00046 
00047   {
00048     const CoinWarmStartBasis* ws =
00049       dynamic_cast<const CoinWarmStartBasis*>(warmstart);
00050     if (ws != NULL) {
00051       // *FIXME* : want to convert it to BCP_warmstart_basis
00052       delete warmstart;
00053       warmstart = NULL;
00054       return NULL;
00055     }
00056   }
00057 
00058 
00059   return NULL;
00060 }

Generated on Thu Nov 10 03:05:38 2011 by  doxygen 1.4.7