Commit 9fe798c8 authored by Jan Möbius's avatar Jan Möbius

Missing Exports

LinearConstraint.cc added (otherwise, the dll will not contain it as it is not compiled

git-svn-id: http://www.openflipper.org/svnrepo/CoMISo/trunk@77 1355f012-dd97-4b2f-ae87-10fa9f823a57
parent 407019f9
......@@ -15,6 +15,7 @@
//== INCLUDES =================================================================
#include <CoMISo/Config/CoMISoDefines.hh>
#include <vector>
#include <cstddef>
#include <gmm/gmm.h>
......@@ -40,7 +41,7 @@ namespace COMISO {
A more elaborate description follows.
*/
class IPOPTSolver
class COMISODLLEXPORT IPOPTSolver
{
public:
......
//=============================================================================
//
// CLASS NConstraintGmmInterface
//
//=============================================================================
#ifndef COMISO_LINEARCONSTRAINT_CC
#define COMISO_LINEARCONSTRAINT_CC
//== INCLUDES =================================================================
#include <CoMISo/Config/CoMISoDefines.hh>
#include "NConstraintInterface.hh"
#include <gmm/gmm.h>
#include <CoMISo/NSolver/LinearConstraint.hh>
//== FORWARDDECLARATIONS ======================================================
//== NAMESPACES ===============================================================
namespace COMISO {
//== Implementation =========================================================
/// Default constructor
LinearConstraint::LinearConstraint(const ConstraintType _type) : NConstraintInterface(_type)
{}
// linear equation of the form -> coeffs_^T *x + b_=_type= 0
LinearConstraint::LinearConstraint(const SVectorNC& _coeffs, const double _b, const ConstraintType _type) : NConstraintInterface(_type)
{
coeffs_ = _coeffs;
b_ = _b;
}
/// Destructor
LinearConstraint::~LinearConstraint() {}
int LinearConstraint::n_unknowns()
{
return coeffs_.innerSize();
}
LinearConstraint::SVectorNC& LinearConstraint::coeffs()
{
return coeffs_;
}
double& LinearConstraint::b()
{
return b_;
}
double LinearConstraint::eval_constraint ( const double* _x )
{
double v = b_;
SVectorNC::InnerIterator c_it(coeffs_);
for(; c_it; ++c_it)
v += c_it.value()*_x[c_it.index()];
return v;
}
void LinearConstraint::eval_gradient( const double* _x, SVectorNC& _g )
{
_g = coeffs_;
}
void LinearConstraint::eval_hessian ( const double* _x, SMatrixNC& _h )
{
_h.clear();
_h.resize(coeffs_.innerSize(), coeffs_.innerSize());
}
//=============================================================================
} // namespace COMISO
//=============================================================================
#endif // ACG_LINEARCONSTRAINT_HH defined
//=============================================================================
......@@ -11,6 +11,7 @@
//== INCLUDES =================================================================
#include <CoMISo/Config/CoMISoDefines.hh>
#include "NConstraintInterface.hh"
//== FORWARDDECLARATIONS ======================================================
......@@ -29,59 +30,36 @@ namespace COMISO {
A more elaborate description follows.
*/
class LinearConstraint : public NConstraintInterface
class COMISODLLEXPORT LinearConstraint : public NConstraintInterface
{
public:
// use c-arrays as vectors for gmm
typedef gmm::array1D_reference<double*> VectorPT;
typedef NConstraintInterface::SVectorNC SVectorNC;
// different types of constraints
// enum ConstraintType {NC_EQUAL, NC_LESS_EQUAL, NC_GREATER_EQUAL};
/// Default constructor
LinearConstraint(const ConstraintType _type = NC_EQUAL) : NConstraintInterface(_type)
{}
LinearConstraint(const ConstraintType _type = NC_EQUAL);
// linear equation of the form -> coeffs_^T *x + b_=_type= 0
LinearConstraint(const SVectorNC& _coeffs, const double _b, const ConstraintType _type = NC_EQUAL) : NConstraintInterface(_type)
{
coeffs_ = _coeffs;
b_ = _b;
}
LinearConstraint(const SVectorNC& _coeffs, const double _b, const ConstraintType _type = NC_EQUAL);
/// Destructor
~LinearConstraint() {}
~LinearConstraint();
virtual int n_unknowns()
{
return coeffs_.innerSize();
}
virtual int n_unknowns();
SVectorNC& coeffs() { return coeffs_;}
double& b() { return b_;}
SVectorNC& coeffs();
double& b();
virtual double eval_constraint ( const double* _x )
{
double v = b_;
SVectorNC::InnerIterator c_it(coeffs_);
for(; c_it; ++c_it)
v += c_it.value()*_x[c_it.index()];
return v;
}
virtual void eval_gradient( const double* _x, SVectorNC& _g )
{
_g = coeffs_;
}
virtual double eval_constraint ( const double* _x );
virtual void eval_gradient( const double* _x, SVectorNC& _g );
virtual void eval_hessian ( const double* _x, SMatrixNC& _h )
{
_h.clear();
_h.resize(coeffs_.innerSize(), coeffs_.innerSize());
}
virtual void eval_hessian ( const double* _x, SMatrixNC& _h );
// inherited from base
// virtual ConstraintType constraint_type ( ) { return type_; }
......
......@@ -11,6 +11,7 @@
//== INCLUDES =================================================================
#include <CoMISo/Config/CoMISoDefines.hh>
#include <iostream>
#include <gmm/gmm.h>
......@@ -33,7 +34,7 @@ namespace COMISO {
*/
class LinearConstraintHandlerElimination
class COMISODLLEXPORT LinearConstraintHandlerElimination
{
public:
......
......@@ -11,6 +11,7 @@
//== INCLUDES =================================================================
#include <CoMISo/Config/CoMISoDefines.hh>
#include "SuperSparseMatrixT.hh"
#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
#include <Eigen/Sparse>
......@@ -19,7 +20,7 @@
//== NAMESPACES ===============================================================
namespace COMISO {
namespace COMISO {
//== CLASS DEFINITION =========================================================
......@@ -31,7 +32,7 @@ namespace COMISO {
A more elaborate description follows.
*/
class NConstraintInterface
class COMISODLLEXPORT NConstraintInterface
{
public:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment