summaryrefslogtreecommitdiff
path: root/newstructure/thirdparty/linux/include/coin/BonAmplInterface.hpp
blob: 055004c183008a4bbc04ea451017caff5895f3eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// (C) Copyright International Business Machines Corporation and
// Carnegie Mellon University 2004, 2007
//
// All Rights Reserved.
// This code is published under the Eclipse Public License.
//
// Authors :
// Pierre Bonami, Carnegie Mellon University,
// Andreas Waechter, International Business Machines Corporation
//
// Date : 12/01/2004

#ifndef BonminAmplInterface_H
#define BonminAmplInterface_H
#include "BonOsiTMINLPInterface.hpp"
#include "BonAmplTMINLP.hpp"

class BM_lp;
namespace Bonmin
{
  /** Class for providing an Osi interface to Ipopt with an ampl nl file as input. */
  class AmplInterface: public OsiTMINLPInterface
  {
  public:
    /** Default constructor */
    /** Default constructor only available for Bonmin's friends and child classes.*/
    AmplInterface();
    /**@name Methods to input a problem */
    //@{
    virtual void readAmplNlFile(char **& argv, Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions,
        Ipopt::SmartPtr<Ipopt::OptionsList> options,
        Ipopt::SmartPtr<Ipopt::Journalist> journalist,
        std::string* nl_file_content  = NULL);
    //@}
    /** Copy constructor */
    AmplInterface(const AmplInterface &other);
    /// Clone
    virtual OsiSolverInterface * clone(bool CopyData = true);

    /// Destructor
    virtual ~AmplInterface();


    /** Fast access to AmplTMINLP */
    const AmplTMINLP * amplModel() const
    {
      return GetRawPtr(amplTminlp_);
    }
    /** To set some application specific defaults. */
    virtual void setAppDefaultOptions(Ipopt::SmartPtr<Ipopt::OptionsList> Options);

  protected:
    /** Read variables and row names in .col and .row files.*/
    void readNames() ;

    /** TMINLP problem (the original problem usually an AmplTMINLP).*/
    Ipopt::SmartPtr<Bonmin::AmplTMINLP> amplTminlp_;

  private:
    /** Write the ampl solution file or write a bonmin one?*/
    int writeAmplSolFile_;
  };
}
#endif