1 |
|
|
// |
2 |
|
|
// Copyright (c) 2017 CNRS |
3 |
|
|
// |
4 |
|
|
// This file is part of tsid |
5 |
|
|
// tsid is free software: you can redistribute it |
6 |
|
|
// and/or modify it under the terms of the GNU Lesser General Public |
7 |
|
|
// License as published by the Free Software Foundation, either version |
8 |
|
|
// 3 of the License, or (at your option) any later version. |
9 |
|
|
// tsid is distributed in the hope that it will be |
10 |
|
|
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty |
11 |
|
|
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 |
|
|
// General Lesser Public License for more details. You should have |
13 |
|
|
// received a copy of the GNU Lesser General Public License along with |
14 |
|
|
// tsid If not, see |
15 |
|
|
// <http://www.gnu.org/licenses/>. |
16 |
|
|
// |
17 |
|
|
|
18 |
|
|
#include "tsid/solvers/solver-HQP-base.hpp" |
19 |
|
|
|
20 |
|
|
#include <iostream> |
21 |
|
|
|
22 |
|
|
namespace tsid { |
23 |
|
|
namespace solvers { |
24 |
|
|
|
25 |
|
|
std::string const SolverHQPBase::HQP_status_string[] = { |
26 |
|
|
"HQP_STATUS_OPTIMAL", "HQP_STATUS_INFEASIBLE", "HQP_STATUS_UNBOUNDED", |
27 |
|
|
"HQP_STATUS_MAX_ITER_REACHED", "HQP_STATUS_ERROR"}; |
28 |
|
|
|
29 |
|
|
SolverHQPBase::SolverHQPBase(const std::string& name) { |
30 |
|
|
m_name = name; |
31 |
|
|
m_maxIter = 1000; |
32 |
|
|
m_maxTime = 100.0; |
33 |
|
|
m_useWarmStart = true; |
34 |
|
|
} |
35 |
|
|
|
36 |
|
|
bool SolverHQPBase::setMaximumIterations(unsigned int maxIter) { |
37 |
|
|
if (maxIter == 0) return false; |
38 |
|
|
m_maxIter = maxIter; |
39 |
|
|
return true; |
40 |
|
|
} |
41 |
|
|
|
42 |
|
|
bool SolverHQPBase::setMaximumTime(double seconds) { |
43 |
|
|
if (seconds <= 0.0) return false; |
44 |
|
|
m_maxTime = seconds; |
45 |
|
|
return true; |
46 |
|
|
} |
47 |
|
|
|
48 |
|
|
} // namespace solvers |
49 |
|
|
} // namespace tsid |