ipopt_solver.h
Go to the documentation of this file.
1 /******************************************************************************
2 Copyright (c) 2017, Alexander W. Winkler, ETH Zurich. All rights reserved.
3 
4 Redistribution and use in source and binary forms, with or without modification,
5 are permitted provided that the following conditions are met:
6  * Redistributions of source code must retain the above copyright notice,
7  this list of conditions and the following disclaimer.
8  * Redistributions in binary form must reproduce the above copyright notice,
9  this list of conditions and the following disclaimer in the documentation
10  and/or other materials provided with the distribution.
11  * Neither the name of ETH ZURICH nor the names of its contributors may be
12  used to endorse or promote products derived from this software without
13  specific prior written permission.
14 
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 DISCLAIMED. IN NO EVENT SHALL ETH ZURICH BE LIABLE FOR ANY DIRECT, INDIRECT,
19 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
22 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
23 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 ******************************************************************************/
26 
27 #ifndef IFOPT_SRC_IFOPT_IPOPT_INCLUDE_IFOPT_IPOPT_H_
28 #define IFOPT_SRC_IFOPT_IPOPT_INCLUDE_IFOPT_IPOPT_H_
29 
30 #include <ifopt/problem.h>
31 #include <ifopt/solver.h>
32 
33 namespace Ipopt {
34 class IpoptApplication;
35 }
36 
37 namespace ifopt {
38 
47 class IpoptSolver : public Solver {
48  public:
49  using Ptr = std::shared_ptr<IpoptSolver>;
50 
51  IpoptSolver(bool rethrow_non_ipopt_exceptions = false);
52  virtual ~IpoptSolver() = default;
53 
57  void Solve(Problem& nlp) override;
58 
62  void SetOption(const std::string& name, const std::string& value);
63  void SetOption(const std::string& name, int value);
64  void SetOption(const std::string& name, double value);
65 
68  double GetTotalWallclockTime();
69 
70  private:
71  std::shared_ptr<Ipopt::IpoptApplication> ipopt_app_;
72 };
73 
74 } /* namespace ifopt */
75 
76 #endif /* IFOPT_SRC_IFOPT_IPOPT_INCLUDE_IFOPT_IPOPT_H_ */
solver.h
ifopt::Solver
Solver interface implemented by IPOPT and SNOPT.
Definition: solver.h:72
ifopt::IpoptSolver::GetTotalWallclockTime
double GetTotalWallclockTime()
Get the total wall clock time for the optimization, including function evaluations.
Definition: ipopt_solver.cc:133
ifopt::IpoptSolver::Solve
void Solve(Problem &nlp) override
Creates an IpoptAdapter and solves the NLP.
Definition: ipopt_solver.cc:90
Ipopt
namespace defined by the Ipopt solver.
Definition: ipopt_adapter.h:42
ifopt::IpoptSolver::SetOption
void SetOption(const std::string &name, const std::string &value)
Definition: ipopt_solver.cc:118
problem.h
ifopt::Problem
A generic optimization problem with variables, costs and constraints.
Definition: problem.h:123
ifopt::IpoptSolver::~IpoptSolver
virtual ~IpoptSolver()=default
ifopt::IpoptSolver
An interface to IPOPT, fully hiding its implementation.
Definition: ipopt_solver.h:47
ifopt
common namespace for all elements in this library.
Definition: bounds.h:33
ifopt::IpoptSolver::ipopt_app_
std::shared_ptr< Ipopt::IpoptApplication > ipopt_app_
Definition: ipopt_solver.h:71
ifopt::Solver::Ptr
std::shared_ptr< Solver > Ptr
Definition: solver.h:74
ifopt::IpoptSolver::IpoptSolver
IpoptSolver(bool rethrow_non_ipopt_exceptions=false)
Definition: ipopt_solver.cc:56


ifopt
Author(s): Alexander W. Winkler
autogenerated on Mon Sep 18 2023 02:14:38