#ifndef __IPMA86SOLVERINTERFACE_HPP__
#define __IPMA86SOLVERINTERFACE_HPP__
#include "IpSparseSymLinearSolverInterface.hpp"
#include "IpMa77SolverInterface.hpp"
#include "IpLibraryLoader.hpp"
#include "IpTypes.h"
extern "C"
{
#ifdef IPOPT_SINGLE
#include "hsl_ma86s.h"
#else
#include "hsl_ma86d.h"
#endif
}
#define IPOPT_DECL_MA86_DEFAULT_CONTROL(x) void (x)( \
struct ma86_control* control \
)
#define IPOPT_DECL_MA86_ANALYSE(x) void (x)( \
const int n, \
const int ptr[], \
const int row[], \
int order[], \
void** keep, \
const struct ma86_control* control, \
struct ma86_info* info \
)
#define IPOPT_DECL_MA86_FACTOR(x) void (x)( \
const int n, \
const int ptr[], \
const int row[], \
const ipnumber val[], \
const int order[], \
void** keep, \
const struct ma86_control* control, \
struct ma86_info* info, \
const ipnumber scale[] \
)
#define IPOPT_DECL_MA86_FACTOR_SOLVE(x) void (x)( \
const int n, \
const int ptr[], \
const int row[], \
const ipnumber val[], \
const int order[], \
void** keep, \
const struct ma86_control* control, \
struct ma86_info* info, \
const int nrhs, \
const int ldx, \
ipnumber xx[], \
const ipnumber scale[] \
)
#define IPOPT_DECL_MA86_SOLVE(x) void (x)( \
const int job, \
const int nrhs, \
const int ldx, \
ipnumber* xx, \
const int order[],\
void** keep, \
const struct ma86_control* control,\
struct ma86_info* info, \
const ipnumber scale[] \
)
#define IPOPT_DECL_MA86_FINALISE(x) void (x)( \
void** keep, \
const struct ma86_control* control \
)
namespace Ipopt
{
class Ma86SolverInterface: public SparseSymLinearSolverInterface
{
private:
enum order_opts
{
ORDER_AUTO,
ORDER_AMD,
ORDER_METIS
};
int ndim_; Number* val_; int numneg_; int* order_; void* keep_; bool pivtol_changed_;
struct ma86_control control_;
Number umax_;
int ordering_;
SmartPtr<LibraryLoader> hslloader;
IPOPT_DECL_MA86_DEFAULT_CONTROL(*ma86_default_control);
IPOPT_DECL_MA86_ANALYSE(*ma86_analyse);
IPOPT_DECL_MA86_FACTOR(*ma86_factor);
IPOPT_DECL_MA86_FACTOR_SOLVE(*ma86_factor_solve);
IPOPT_DECL_MA86_SOLVE(*ma86_solve);
IPOPT_DECL_MA86_FINALISE(*ma86_finalise);
IPOPT_DECL_MC68_DEFAULT_CONTROL(*mc68_default_control);
IPOPT_DECL_MC68_ORDER(*mc68_order);
public:
Ma86SolverInterface(
SmartPtr<LibraryLoader> hslloader_ ) : val_(NULL),
order_(NULL),
keep_(NULL),
pivtol_changed_(false),
hslloader(hslloader_),
ma86_default_control(NULL),
ma86_analyse(NULL),
ma86_factor(NULL),
ma86_factor_solve(NULL),
ma86_solve(NULL),
ma86_finalise(NULL),
mc68_default_control(NULL),
mc68_order(NULL)
{ }
~Ma86SolverInterface();
static void RegisterOptions(
SmartPtr<RegisteredOptions> roptions
);
static void SetFunctions(
IPOPT_DECL_MA86_DEFAULT_CONTROL(*ma86_default_control),
IPOPT_DECL_MA86_ANALYSE(*ma86_analyse),
IPOPT_DECL_MA86_FACTOR(*ma86_factor),
IPOPT_DECL_MA86_FACTOR_SOLVE(*ma86_factor_solve),
IPOPT_DECL_MA86_SOLVE(*ma86_solve),
IPOPT_DECL_MA86_FINALISE(*ma86_finalise),
IPOPT_DECL_MC68_DEFAULT_CONTROL(*mc68_default_control),
IPOPT_DECL_MC68_ORDER(*mc68_order)
);
bool InitializeImpl(
const OptionsList& options,
const std::string& prefix
);
ESymSolverStatus InitializeStructure(
Index dim,
Index nonzeros,
const Index* ia,
const Index* ja
);
Number* GetValuesArrayPtr()
{
return val_;
}
ESymSolverStatus MultiSolve(
bool new_matrix,
const Index* ia,
const Index* ja,
Index nrhs,
Number* rhs_vals,
bool check_NegEVals,
Index numberOfNegEVals
);
Index NumberOfNegEVals() const
{
return numneg_;
}
bool IncreaseQuality();
bool ProvidesInertia() const
{
return true;
}
EMatrixFormat MatrixFormat() const
{
return CSR_Format_1_Offset;
}
bool ProvidesDegeneracyDetection() const
{
return false;
}
ESymSolverStatus DetermineDependentRows(
const Index* ,
const Index* ,
std::list<Index>&
)
{
return SYMSOLVER_FATAL_ERROR;
}
};
}
#endif