Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99861297
micpsolver_structs.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, Jan 27, 00:33
Size
4 KB
Mime Type
text/x-c
Expires
Wed, Jan 29, 00:33 (2 d)
Engine
blob
Format
Raw Data
Handle
23838334
Attached To
rSPECMICP SpecMiCP / ReactMiCP
micpsolver_structs.hpp
View Options
/*-------------------------------------------------------
- Module : micpsolver
- File : micpsolver_structs.hpp
- Author : Fabien Georget
Copyright (c) 2014, Fabien Georget, Princeton University
---------------------------------------------------------*/
#ifndef SPECMICP_MICPSOLVER_MICPSOLVERSTRUCTS_HPP
#define SPECMICP_MICPSOLVER_MICPSOLVERSTRUCTS_HPP
//! \file micpsolver_structs.hpp structures and enum used by the micpsolver
// this file exists to reduce the header dependancy
#include <float.h>
namespace
specmicp
{
namespace
micpsolver
{
//! \brief Options for the MiCPSolver
struct
MiCPSolverOptions
{
int
max_iter
;
//!< Maximum number of iterations allowed
// tolerances
double
fvectol
;
//!< Tolerance for minimization of residuals
double
steptol
;
//!< Tolerance for minimization of error
// misc ...
double
condition_limit
;
//!< Condition number limit
double
penalization_factor
;
//!< Penalization factor for the penalized Fisher-Burmeister function
double
maxstep
;
//!< the maximum step allowed
int
maxiter_maxstep
;
//!< the maximum number of step of length maxstep allowed
double
factor_descent_condition
;
//!< > 0
double
power_descent_condition
;
//!< > 2
bool
use_crashing
;
//! Use a crashing step to improve the starting guess
double
coeff_accept_newton_step
;
//! Accept the newton step without line search if merit(x+d)<coeff*merit(x^k)
bool
use_scaling
;
//! Use scaling to improve convergence
double
factor_gradient_search_direction
;
//! factor which multiply the gradient in the search direction system
double
projection_min_variable
;
//! threshold under which a mineral is considered to be 0
//! \brief Constructor - also defines the default value used by the algorithm
MiCPSolverOptions
()
:
max_iter
(
100
),
fvectol
(
1e-8
),
steptol
(
1e-10
),
condition_limit
(
1e6
),
penalization_factor
(
0.8
),
maxstep
(
100
),
maxiter_maxstep
(
5
),
factor_descent_condition
(
1e-4
),
power_descent_condition
(
2
),
use_crashing
(
false
),
coeff_accept_newton_step
(
0.95
),
use_scaling
(
true
),
factor_gradient_search_direction
(
5.0
),
projection_min_variable
(
DBL_EPSILON
)
{}
};
//! \brief Return code of the MiCP solver
//!
//! A positive return code means that the algorithm converged (but maybe to a stationnary points)
//! A negative return code means that something wrong happened and was detected
enum
class
MiCPSolverReturnCode
{
LolItsNotSupposedToHappen
=
-
10
,
//!< bummer..
MaxStepTakenTooManyTimes
=
-
4
,
//!< Propably detect a divergence
FailedToSolveLinearSystem
=
-
3
,
//!< Problem in the decomposition... shouldn't be raised, use of the gradient step
MaxIterations
=
-
2
,
//!< Algorithm has reached the maximum number of iterations
StationnaryPoint
=
-
1
,
//!< Algorithm is tuck in a stationnary point of the merit function
NotConvergedYet
=
0
,
//!< Keep going...
Success
=
1
,
//!< Test success (well be careful of stationnary points)
ResidualMinimized
=
2
,
//!< The residual is minimized (i.e. close to zero)
ErrorMinimized
=
3
//!< The error is minimized, may indicate a stationary point
};
//! \brief This structure contains counter to check/query the performance of the algorithm
//!
//! It should be updated after each operations, not at the end
struct
MiCPPerformance
{
int
nb_call_residuals
;
//! Number of calls of the residual
int
nb_call_jacobian
;
//! Number of calls of the jacobian
int
nb_factorization
;
//! Number of factorization performed (may be > number of iterations)
int
nb_gradient_step
;
//! Number of gradient steps (too many gradient steps indicate a bad starting guess)
int
nb_crashing_iterations
;
//! Number of crashing iterations
int
nb_iterations
;
//! Number of iterations
MiCPSolverReturnCode
return_code
;
//! Return code
MiCPPerformance
()
:
nb_call_residuals
(
0
),
nb_call_jacobian
(
0
),
nb_factorization
(
0
),
nb_gradient_step
(
0
),
nb_crashing_iterations
(
0
),
nb_iterations
(
0
),
return_code
(
MiCPSolverReturnCode
::
NotConvergedYet
)
{}
};
}
// end namespace micpsolver
}
// end namespace specmicp
#endif
//SPECMICP_MICPSOLVER_MICPSOLVERSTRUCTS_HPP
Event Timeline
Log In to Comment