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

Last change on this file since 1313 was 1313, checked in by stefan, 4 months ago

merge branch autotools-update

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