1 /*===========================================================================*/
2 /*                                                                           */
3 /* This file is part of the SYMPHONY Branch, Cut, and Price Callable         */
4 /* Library.                                                                  */
5 /*                                                                           */
6 /* SYMPHONY was jointly developed by Ted Ralphs (tkralphs@lehigh.edu) and    */
7 /* Laci Ladanyi (ladanyi@us.ibm.com).                                        */
8 /*                                                                           */
9 /* (c) Copyright 2004-2006 Ted Ralphs and Lehigh University.                 */
10 /* All Rights Reserved.                                                      */
11 /*                                                                           */
12 /* The authors of this file are Menal Guzelsoy and Ted Ralphs                */
13 /*                                                                           */
14 /* This software is licensed under the Eclipse Public License. Please see    */
15 /* accompanying file for terms.                                              */
16 /*                                                                           */
17 /*===========================================================================*/
18 
19 #include "SymWarmStart.hpp"
20 
21 #include <iostream>
22 
23 #include "symphony.h"
24 
25 //#############################################################################
26 
SymWarmStart(warm_start_desc * ws)27 SymWarmStart::SymWarmStart(warm_start_desc * ws)
28 {
29    warmStart_ = sym_create_copy_warm_start(ws);
30 }
31 
32 /*===========================================================================*/
33 /*===========================================================================*/
34 
SymWarmStart(char * fileName)35 SymWarmStart::SymWarmStart(char * fileName)
36 {
37 
38    warmStart_ = sym_read_warm_start(fileName);
39 }
40 
41 /*===========================================================================*/
42 /*===========================================================================*/
43 
SymWarmStart(const SymWarmStart & symWS)44 SymWarmStart::SymWarmStart(const SymWarmStart & symWS)
45 {
46    warm_start_desc * wsCopy;
47    SymWarmStart * sWS = const_cast<SymWarmStart *>(&symWS);
48    wsCopy = const_cast<warm_start_desc *>(sWS->getCopyOfWarmStartDesc());
49 
50    warmStart_ = wsCopy;
51 }
52 
53 /*===========================================================================*/
54 /*===========================================================================*/
55 
~SymWarmStart()56 SymWarmStart::~SymWarmStart()
57 {
58    sym_delete_warm_start(warmStart_);
59 }
60 
61 /*===========================================================================*/
62 /*===========================================================================*/
63 
clone() const64 CoinWarmStart * SymWarmStart::clone () const
65 {
66    return new SymWarmStart(*this);
67 }
68 
69 /*===========================================================================*/
70 /*===========================================================================*/
71 
getCopyOfWarmStartDesc()72 warm_start_desc * SymWarmStart::getCopyOfWarmStartDesc()
73 {
74 
75    if(warmStart_){
76       return(sym_create_copy_warm_start(warmStart_));
77    }
78    else{
79       std::cout<<"getWarmStart(): No loaded warm start desc. to return!"<<std::endl;
80       return 0;
81    }
82 }
83 
84 /*===========================================================================*/
85 /*===========================================================================*/
86 
writeToFile(char * fileName)87 int SymWarmStart::writeToFile(char * fileName)
88 {
89    return(sym_write_warm_start_desc(warmStart_, fileName));
90 }
91 
92 /*===========================================================================*/
93 /*===========================================================================*/
94