source: trunk/Couenne/src/main/BonCouenneInfo.hpp @ 487

Last change on this file since 487 was 487, checked in by pbelotti, 9 years ago

adopting new build system in trunk

  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1/* $Id: BonCouenneInfo.hpp 487 2011-01-10 16:18:44Z pbelotti $ */
2// (C) Copyright International Business Machines Corporation 2008
3// All Rights Reserved.
4// This code is published under the Common Public License.
5//
6// Authors :
7// Andreas Waechter, International Business Machines Corporation
8//
9// Date : 02/10/2008
10
11#ifndef BonCouenneInfos_H
12#define BonCouenneInfos_H
13
14#include "BonBabInfos.hpp"
15#include "BonCbc.hpp"
16#include "IpSmartPtr.hpp"
17#include <list>
18
19namespace Couenne {
20
21  /** Bonmin class for passing info between components of branch-and-cuts.*/
22  class CouenneInfo : public Bonmin::BabInfo
23  {
24  public:
25    /** Class for storing an Nlp Solution */
26    class NlpSolution: public Ipopt::ReferencedObject
27    {
28    public:
29      // meaningful constructor
30      NlpSolution(int n, const double* sol, double objval);
31
32      // destructor
33      ~NlpSolution();
34
35      /** @name Accessor methods */
36      //@{
37      const double* solution() const
38      {
39        return sol_;
40      }
41      double objVal() const
42      {
43        return objVal_;
44      }
45      int nVars() const
46      {
47        return n_;
48      }
49      //@}
50
51    private:
52      //@{
53      NlpSolution();
54      NlpSolution(const NlpSolution&);
55      void operator=(const NlpSolution&);
56      //@}
57      /** number of variables */
58      int n_;
59      /** values of the stored solution */
60      double* sol_;
61      /** objective function of stored solution */
62      double objVal_;
63    };
64
65    /** Default constructor.*/
66    CouenneInfo(int type);
67
68    /** Constructor from OsiBabSolver.*/
69    CouenneInfo(const OsiBabSolver &other);
70
71    /** Copy constructor.*/
72    CouenneInfo(const CouenneInfo &other);
73
74    /** Destructor.*/
75    virtual ~CouenneInfo();
76
77    /** Virtual copy constructor.*/
78    virtual OsiAuxInfo * clone() const;
79
80    /** List of all stored NLP solutions */
81    const std::list<Ipopt::SmartPtr<const NlpSolution> >& NlpSolutions() const {
82      return nlpSols_;
83    }
84
85    /** Add a new NLP solution */
86    void addSolution(Ipopt::SmartPtr<const NlpSolution> newSol)
87    {
88      nlpSols_.push_back(newSol);
89    }
90
91    protected:
92    std::list<Ipopt::SmartPtr<const NlpSolution> > nlpSols_;
93  };
94}
95
96#endif
Note: See TracBrowser for help on using the repository browser.