solver_prototypes.hpp 1.19 KB
Newer Older
Kirill Terekhov's avatar
Fixes  
Kirill Terekhov committed
1

Kirill Terekhov's avatar
Kirill Terekhov committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#ifndef __SOLVER_PROTOTYPES__
#define __SOLVER_PROTOTYPES__

//TODO:
// allow user to provide new RHS or new initial solution

#include "inmost_solver.h"

using namespace INMOST;

class Method
{
public:
	virtual INMOST_DATA_REAL_TYPE & RealParameter(std::string name) = 0;
	virtual INMOST_DATA_ENUM_TYPE & EnumParameter(std::string name) = 0;
	virtual bool Initialize() = 0;
	virtual bool isInitialized() = 0;
	virtual bool Finalize() = 0;
	virtual bool isFinalized() = 0;
Kirill Terekhov's avatar
Kirill Terekhov committed
21 22 23 24
	virtual bool Solve(Sparse::Vector & input, Sparse::Vector & output) = 0;
	virtual bool ReplaceMAT(Sparse::Matrix & A) = 0; //provide matrix
	virtual bool ReplaceRHS(Sparse::Vector & b) = 0; //apply modification such as rescaling or reordering to the new right hand side
	virtual bool ReplaceSOL(Sparse::Vector & x) = 0; //apply modification such as rescaling or reordering to the new solution
Kirill Terekhov's avatar
Kirill Terekhov committed
25 26 27 28 29 30 31 32 33 34
	virtual void Copy(const Method * other) = 0;
	virtual Method * Duplicate() {return NULL;}
	virtual ~Method() {}
};

class IterativeMethod : public Method
{
public:
	virtual INMOST_DATA_ENUM_TYPE GetIterations() = 0;
	virtual INMOST_DATA_REAL_TYPE GetResidual() = 0;
Kirill Terekhov's avatar
Kirill Terekhov committed
35
	virtual std::string GetReason() = 0;
Kirill Terekhov's avatar
Kirill Terekhov committed
36 37 38 39
	virtual ~IterativeMethod() {}
};

#endif