00001 /****************************************************************************** 00002 Copyright (c) 2017, Alexander W. Winkler, ETH Zurich. All rights reserved. 00003 00004 Redistribution and use in source and binary forms, with or without modification, 00005 are permitted provided that the following conditions are met: 00006 * Redistributions of source code must retain the above copyright notice, 00007 this list of conditions and the following disclaimer. 00008 * Redistributions in binary form must reproduce the above copyright notice, 00009 this list of conditions and the following disclaimer in the documentation 00010 and/or other materials provided with the distribution. 00011 * Neither the name of ETH ZURICH nor the names of its contributors may be 00012 used to endorse or promote products derived from this software without 00013 specific prior written permission. 00014 00015 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00016 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00017 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00018 DISCLAIMED. IN NO EVENT SHALL ETH ZURICH BE LIABLE FOR ANY DIRECT, INDIRECT, 00019 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00020 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00021 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00022 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 00023 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 00024 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00025 ******************************************************************************/ 00026 00027 #ifndef IFOPT_SRC_IFOPT_IPOPT_INCLUDE_IFOPT_IPOPT_H_ 00028 #define IFOPT_SRC_IFOPT_IPOPT_INCLUDE_IFOPT_IPOPT_H_ 00029 00030 #include <ifopt/problem.h> 00031 #include <ifopt/solver.h> 00032 00033 00034 namespace Ipopt { 00035 class IpoptApplication; 00036 } 00037 00038 namespace ifopt { 00039 00048 class IpoptSolver : public Solver { 00049 public: 00050 using Ptr = std::shared_ptr<IpoptSolver>; 00051 00052 IpoptSolver(); 00053 virtual ~IpoptSolver() = default; 00054 00058 void Solve(Problem& nlp) override; 00059 00063 void SetOption(const std::string& name, const std::string& value); 00064 void SetOption(const std::string& name, int value); 00065 void SetOption(const std::string& name, double value); 00066 00069 double GetTotalWallclockTime (); 00070 00073 int GetReturnStatus (); 00074 00075 private: 00076 std::shared_ptr<Ipopt::IpoptApplication> ipopt_app_; 00077 int status_; 00078 }; 00079 00080 } /* namespace ifopt */ 00081 00082 #endif /* IFOPT_SRC_IFOPT_IPOPT_INCLUDE_IFOPT_IPOPT_H_ */