solver_prototypes.hpp 1.2 KB
Newer Older
Kirill Terekhov's avatar
Kirill Terekhov committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#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;
	virtual bool Solve(Solver::Vector & input, Solver::Vector & output) = 0;
	virtual bool ReplaceMAT(Solver::Matrix & A) = 0; //provide matrix
	virtual bool ReplaceRHS(Solver::Vector & b) = 0; //apply modification such as rescaling or reordering to the new right hand side
	virtual bool ReplaceSOL(Solver::Vector & x) = 0; //apply modification such as rescaling or reordering to the new solution
	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