Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CoMISo
CoMISo
Commits
c19fd197
Commit
c19fd197
authored
Dec 15, 2017
by
David Bommes
Browse files
added FiniteElementLogBarrier
parent
49e4334c
Changes
3
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
c19fd197
...
...
@@ -508,6 +508,9 @@ if (COMISO_BUILD_EXAMPLES )
if
(
EXISTS
"
${
CMAKE_SOURCE_DIR
}
/Examples/small_AQP/CMakeLists.txt"
)
add_subdirectory
(
Examples/small_AQP
)
endif
()
if
(
EXISTS
"
${
CMAKE_SOURCE_DIR
}
/Examples/finite_element_integrability_problem/CMakeLists.txt"
)
add_subdirectory
(
Examples/finite_element_integrability_problem
)
endif
()
endif
(
COMISO_BUILD_EXAMPLES
)
...
...
NSolver/FiniteElementLogBarrier.hh
0 → 100644
View file @
c19fd197
//=============================================================================
//
// CLASS FiniteElementLogBarrier
//
//=============================================================================
#ifndef COMISO_FINITEELEMENTLOGBARRIER_HH
#define COMISO_FINITEELEMENTLOGBARRIER_HH
//== INCLUDES =================================================================
#include
<CoMISo/Config/CoMISoDefines.hh>
#include
"NProblemInterface.hh"
//== FORWARDDECLARATIONS ======================================================
//== NAMESPACES ===============================================================
namespace
COMISO
{
//== CLASS DEFINITION =========================================================
/** \class FiniteElementLogBarrierLowerBound
Implements function of the type f(x) = -c1*log(x-c0) with constants (c0,c1)
A more elaborate description follows.
*/
class
FiniteElementLogBarrierLowerBound
{
public:
// define dimensions
const
static
int
NV
=
1
;
const
static
int
NC
=
2
;
typedef
Eigen
::
Matrix
<
size_t
,
NV
,
1
>
VecI
;
typedef
Eigen
::
Matrix
<
double
,
NV
,
1
>
VecV
;
typedef
Eigen
::
Matrix
<
double
,
NC
,
1
>
VecC
;
typedef
Eigen
::
Triplet
<
double
>
Triplet
;
inline
double
eval_f
(
const
VecV
&
_x
,
const
VecC
&
_c
)
const
{
return
-
_c
[
1
]
*
std
::
log
(
_x
[
0
]
-
_c
[
0
]);
}
inline
void
eval_gradient
(
const
VecV
&
_x
,
const
VecC
&
_c
,
VecV
&
_g
)
const
{
_g
[
0
]
=
-
_c
[
1
]
/
(
_x
[
0
]
-
_c
[
0
]);
}
inline
void
eval_hessian
(
const
VecV
&
_x
,
const
VecC
&
_c
,
std
::
vector
<
Triplet
>&
_triplets
)
const
{
_triplets
.
clear
();
_triplets
.
push_back
(
Triplet
(
0
,
0
,
_c
[
1
]
/
std
::
pow
(
_x
[
0
]
-
_c
[
0
],
2
)));
}
inline
double
max_feasible_step
(
const
VecV
&
_x
,
const
VecV
&
_v
,
const
VecC
&
_c
)
{
if
(
_v
[
0
]
>=
0.0
)
return
DBL_MAX
;
else
return
0.999
*
(
_c
[
0
]
-
_x
[
0
])
/
_v
[
0
];
}
};
/** \class FiniteElementLogBarrierUpperBound
Implements function of the type f(x) = -c1*log(c0-x) with constants (c0,c1)
A more elaborate description follows.
*/
class
FiniteElementLogBarrierUpperBound
{
public:
// define dimensions
const
static
int
NV
=
1
;
const
static
int
NC
=
2
;
typedef
Eigen
::
Matrix
<
size_t
,
NV
,
1
>
VecI
;
typedef
Eigen
::
Matrix
<
double
,
NV
,
1
>
VecV
;
typedef
Eigen
::
Matrix
<
double
,
NC
,
1
>
VecC
;
typedef
Eigen
::
Triplet
<
double
>
Triplet
;
inline
double
eval_f
(
const
VecV
&
_x
,
const
VecC
&
_c
)
const
{
return
-
_c
[
1
]
*
std
::
log
(
_c
[
0
]
-
_x
[
0
]);
}
inline
void
eval_gradient
(
const
VecV
&
_x
,
const
VecC
&
_c
,
VecV
&
_g
)
const
{
_g
[
0
]
=
_c
[
1
]
/
(
_c
[
0
]
-
_x
[
0
]);
}
inline
void
eval_hessian
(
const
VecV
&
_x
,
const
VecC
&
_c
,
std
::
vector
<
Triplet
>&
_triplets
)
const
{
_triplets
.
clear
();
_triplets
.
push_back
(
Triplet
(
0
,
0
,
_c
[
1
]
/
std
::
pow
(
_c
[
0
]
-
_x
[
0
],
2
)));
}
inline
double
max_feasible_step
(
const
VecV
&
_x
,
const
VecV
&
_v
,
const
VecC
&
_c
)
{
if
(
_v
[
0
]
<=
0.0
)
return
DBL_MAX
;
else
return
0.999
*
(
_c
[
0
]
-
_x
[
0
])
/
_v
[
0
];
}
};
//=============================================================================
}
// namespace COMISO
//=============================================================================
#endif // COMISO_FINITEELEMENTLOGBARRIER_HH defined
//=============================================================================
NSolver/IPOPTSolver.hh
View file @
c19fd197
...
...
@@ -104,6 +104,8 @@ public:
// access the ipopt-application (for setting parameters etc.)
// examples: app().Options()->SetIntegerValue("max_iter", 100);
// app().Options()->SetStringValue("derivative_test", "second-order");
// app().Options()->SetStringValue("hessian_approximation", "limited-memory");
Ipopt
::
IpoptApplication
&
app
()
{
return
(
*
app_
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment