Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90038319
parabolicprogram.hpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Oct 28, 17:47
Size
4 KB
Mime Type
text/x-c++
Expires
Wed, Oct 30, 17:47 (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
21995957
Attached To
rSPECMICP SpecMiCP / ReactMiCP
parabolicprogram.hpp
View Options
/*-------------------------------------------------------
- Module : reactmicp
- File : common.hpp
- Author : Fabien Georget
Copyright (c) 2014, Fabien Georget <fabieng@princeton.edu>, Princeton University
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Princeton University nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------*/
#ifndef SPECMICP_REACTMICP_PARABOLICPROGRAM_HPP
#define SPECMICP_REACTMICP_PARABOLICPROGRAM_HPP
#include <reactmicp/common.hpp>
namespace
specmicp
{
namespace
reactmicp
{
namespace
solvers
{
//! \brief A abstract base class for a parabolic program
//!
template
<
class
Derived
>
class
ParabolicProgram
{
public
:
//! \brief Return the number of degree of freedoms
ind_t
get_neq
()
{
return
derived
()
->
get_neq
();
}
//! \brief Return the derived class
Derived
&
derived
()
{
return
static_cast
<
Derived
*>
(
*
this
);}
//! \brief Return the residuals
void
get_residuals
(
const
ParabolicVariables
&
variable
,
Vector
&
residual
)
{
return
derived
()
->
get_residuals
(
variable
,
residual
);
}
//! brief Return the jacobian
void
get_jacobian
(
const
ParabolicVariables
&
variable
,
Vector
&
residual
,
SparseMatrix
&
jacobian
)
{
return
derived
()
->
get_jacobian
(
variable
,
residual
,
jacobian
);
}
//! \brief Return the index of the MiCP equations
std
::
vector
<
bool
>&
micp_index
()
{
return
derived
()
->
micp_index
();
}
double
maximum_lambda
(
const
Eigen
::
VectorXd
&
x
,
const
Eigen
::
VectorXd
&
update
);
//! \brief Called at the beginning of an iteration
//!
//! @return A boolean indicating if the system can have converged
//!
//! Return true by default
bool
hook_start_iteration
(
const
ParabolicVariables
&
x
,
double
norm_residual
)
{
return
true
;}
//! \brief Updates the variables
void
update_variables
(
ParabolicVariables
&
x
,
const
Eigen
::
VectorXd
&
predictor
,
const
Eigen
::
VectorXd
&
update
,
double
factor
);
//! \brief Set the predictor
void
set_predictor
(
ParabolicVariables
&
x
,
Eigen
::
VectorXd
&
predictor
,
double
alpha
,
double
dt
);
//! \brief Return the maximum lambda allowed for the linesearch
double
maximum_lambda
(
const
ParabolicVariables
&
x
,
const
Eigen
::
VectorXd
&
update
,
double
alphadt
)
{
return
1.0
;}
};
}
// end namespace solvers
}
// end namespace reactmicp
}
// end namespace specmicp
#endif
// SPECMICP_REACTMICP_PARABOLICPROGRAM_HPP
Event Timeline
Log In to Comment