Ipopt Documentation  
 
Loading...
Searching...
No Matches
IpAugSystemSolver.hpp
Go to the documentation of this file.
1// Copyright (C) 2004, 2006 International Business Machines and others.
2// All Rights Reserved.
3// This code is published under the Eclipse Public License.
4//
5// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
6
7#ifndef __IP_AUGSYSTEMSOLVER_HPP__
8#define __IP_AUGSYSTEMSOLVER_HPP__
9
10#include "IpSymMatrix.hpp"
11#include "IpSymLinearSolver.hpp"
12#include "IpAlgStrategy.hpp"
13
14namespace Ipopt
15{
16DECLARE_STD_EXCEPTION(FATAL_ERROR_IN_LINEAR_SOLVER);
17
37{
38public:
41
46 { }
48
50 virtual bool InitializeImpl(
51 const OptionsList& options,
52 const std::string& prefix
53 ) = 0;
54
64 const SymMatrix* W,
65 Number W_factor,
66 const Vector* D_x,
67 Number delta_x,
68 const Vector* D_s,
69 Number delta_s,
70 const Matrix* J_c,
71 const Vector* D_c,
72 Number delta_c,
73 const Matrix* J_d,
74 const Vector* D_d,
75 Number delta_d,
76 const Vector& rhs_x,
77 const Vector& rhs_s,
78 const Vector& rhs_c,
79 const Vector& rhs_d,
80 Vector& sol_x,
81 Vector& sol_s,
82 Vector& sol_c,
83 Vector& sol_d,
84 bool check_NegEVals,
85 Index numberOfNegEVals
86 )
87 {
88 std::vector<SmartPtr<const Vector> > rhs_xV(1);
89 rhs_xV[0] = &rhs_x;
90 std::vector<SmartPtr<const Vector> > rhs_sV(1);
91 rhs_sV[0] = &rhs_s;
92 std::vector<SmartPtr<const Vector> > rhs_cV(1);
93 rhs_cV[0] = &rhs_c;
94 std::vector<SmartPtr<const Vector> > rhs_dV(1);
95 rhs_dV[0] = &rhs_d;
96 std::vector<SmartPtr<Vector> > sol_xV(1);
97 sol_xV[0] = &sol_x;
98 std::vector<SmartPtr<Vector> > sol_sV(1);
99 sol_sV[0] = &sol_s;
100 std::vector<SmartPtr<Vector> > sol_cV(1);
101 sol_cV[0] = &sol_c;
102 std::vector<SmartPtr<Vector> > sol_dV(1);
103 sol_dV[0] = &sol_d;
104 return MultiSolve(W, W_factor, D_x, delta_x, D_s, delta_s, J_c, D_c, delta_c, J_d, D_d, delta_d, rhs_xV, rhs_sV,
105 rhs_cV, rhs_dV, sol_xV, sol_sV, sol_cV, sol_dV, check_NegEVals, numberOfNegEVals);
106 }
107
114 const SymMatrix* W,
115 Number W_factor,
116 const Vector* D_x,
117 Number delta_x,
118 const Vector* D_s,
119 Number delta_s,
120 const Matrix* J_c,
121 const Vector* D_c,
122 Number delta_c,
123 const Matrix* J_d,
124 const Vector* D_d,
125 Number delta_d,
126 std::vector<SmartPtr<const Vector> >& rhs_xV,
127 std::vector<SmartPtr<const Vector> >& rhs_sV,
128 std::vector<SmartPtr<const Vector> >& rhs_cV,
129 std::vector<SmartPtr<const Vector> >& rhs_dV,
130 std::vector<SmartPtr<Vector> >& sol_xV,
131 std::vector<SmartPtr<Vector> >& sol_sV,
132 std::vector<SmartPtr<Vector> >& sol_cV,
133 std::vector<SmartPtr<Vector> >& sol_dV,
134 bool check_NegEVals,
135 Index numberOfNegEVals
136 )
137 {
138 // Solve for one right hand side after the other
139 Index nrhs = (Index) rhs_xV.size();
140 DBG_ASSERT(nrhs > 0);
141 DBG_ASSERT(nrhs == (Index)rhs_sV.size());
142 DBG_ASSERT(nrhs == (Index)rhs_cV.size());
143 DBG_ASSERT(nrhs == (Index)rhs_dV.size());
144 DBG_ASSERT(nrhs == (Index)sol_xV.size());
145 DBG_ASSERT(nrhs == (Index)sol_sV.size());
146 DBG_ASSERT(nrhs == (Index)sol_cV.size());
147 DBG_ASSERT(nrhs == (Index)sol_dV.size());
148
150 for( Index i = 0; i < nrhs; i++ )
151 {
152 retval = Solve(W, W_factor, D_x, delta_x, D_s, delta_s, J_c, D_c, delta_c, J_d, D_d, delta_d, *rhs_xV[i],
153 *rhs_sV[i], *rhs_cV[i], *rhs_dV[i], *sol_xV[i], *sol_sV[i], *sol_cV[i], *sol_dV[i], check_NegEVals,
154 numberOfNegEVals);
155 if( retval != SYMSOLVER_SUCCESS )
156 {
157 break;
158 }
159 }
160 return retval;
161 }
162
169 virtual Index NumberOfNegEVals() const = 0;
170
175 virtual bool ProvidesInertia() const = 0;
176
184 virtual bool IncreaseQuality() = 0;
185
186private:
197
199 const AugSystemSolver&
200 );
201
204 const AugSystemSolver&
205 );
207
208};
209
210} // namespace Ipopt
211
212#endif
#define DBG_ASSERT(test)
Definition IpDebug.hpp:27
#define DECLARE_STD_EXCEPTION(__except_type)
IPOPT_DEPRECATED typedef int Index
Type for all indices.
This is the base class for all algorithm strategy objects.
Base class for Solver for the augmented system.
virtual Index NumberOfNegEVals() const =0
Number of negative eigenvalues detected during last solve.
virtual ESymSolverStatus MultiSolve(const SymMatrix *W, Number W_factor, const Vector *D_x, Number delta_x, const Vector *D_s, Number delta_s, const Matrix *J_c, const Vector *D_c, Number delta_c, const Matrix *J_d, const Vector *D_d, Number delta_d, std::vector< SmartPtr< const Vector > > &rhs_xV, std::vector< SmartPtr< const Vector > > &rhs_sV, std::vector< SmartPtr< const Vector > > &rhs_cV, std::vector< SmartPtr< const Vector > > &rhs_dV, std::vector< SmartPtr< Vector > > &sol_xV, std::vector< SmartPtr< Vector > > &sol_sV, std::vector< SmartPtr< Vector > > &sol_cV, std::vector< SmartPtr< Vector > > &sol_dV, bool check_NegEVals, Index numberOfNegEVals)
Like Solve, but for multiple right hand sides.
virtual ~AugSystemSolver()
Destructor.
AugSystemSolver(const AugSystemSolver &)
Copy Constructor.
AugSystemSolver()
Default constructor.
virtual bool IncreaseQuality()=0
Request to increase quality of solution for next solve.
virtual bool InitializeImpl(const OptionsList &options, const std::string &prefix)=0
overloaded from AlgorithmStrategyObject
virtual bool ProvidesInertia() const =0
Query whether inertia is computed by linear solver.
virtual ESymSolverStatus Solve(const SymMatrix *W, Number W_factor, const Vector *D_x, Number delta_x, const Vector *D_s, Number delta_s, const Matrix *J_c, const Vector *D_c, Number delta_c, const Matrix *J_d, const Vector *D_d, Number delta_d, const Vector &rhs_x, const Vector &rhs_s, const Vector &rhs_c, const Vector &rhs_d, Vector &sol_x, Vector &sol_s, Vector &sol_c, Vector &sol_d, bool check_NegEVals, Index numberOfNegEVals)
Set up the augmented system and solve it for a given right hand side.
void operator=(const AugSystemSolver &)
Default Assignment Operator.
Matrix Base Class.
Definition IpMatrix.hpp:28
This class stores a list of user set options.
Template class for Smart Pointers.
This is the base class for all derived symmetric matrix types.
Vector Base Class.
Definition IpVector.hpp:48
#define IPOPTLIB_EXPORT
This file contains a base class for all exceptions and a set of macros to help with exceptions.
ESymSolverStatus
Enum to report outcome of a linear solve.
@ SYMSOLVER_SUCCESS
Successful solve.
ipindex Index
Type of all indices of vectors, matrices etc.
Definition IpTypes.hpp:20
ipnumber Number
Type of all numbers.
Definition IpTypes.hpp:17