#include <opt.h>
Inheritance diagram for Solver:
Public Member Functions | |
Solver (int n, Pointer< ostream > out_solver_p_=out_out_p, Pointer< ostream > out_solver_log_p_=out_log_p) | |
Constructor for the dimension. | |
virtual | ~Solver () |
Virtual Destructor. | |
int | dim () const |
Gives the dimension. | |
double | opt_val () |
Gives the optimal value. | |
double | time () |
Gives the time, needed to solve the problem. | |
int | iter () |
Gives the number of iterations, needed to solve the problem. | |
virtual int | solve ()=0 |
Solves the problem. | |
virtual int | solve (dvector &x) |
Solves the problem for a starting point. | |
virtual void | print (ostream &out) const |
Print's some information about the problem. | |
Public Attributes | |
Pointer< ostream > | out_solver_p |
A Pointer to an ostream to print solver-relevant information to. | |
Pointer< ostream > | out_solver_log_p |
A Pointer to an ostream to print solver-relevant logging-information to. | |
double | tol |
A tolerance value. | |
int | iter_max |
The maximal number of iterations. | |
dvector | sol_point |
The solution point. | |
Protected Attributes | |
int | dim_ |
The number of variables. | |
double | time_ |
The time, needed to find the solution. | |
double | opt_val_ |
The optimal value. | |
int | iter_ |
The number of iterations. | |
Friends | |
ostream & | operator<< (ostream &out, const Solver &a) |
Output-Operator. |
You need to implement the following method:
Definition at line 20 of file opt.h.
Solver::Solver | ( | int | n, | |
Pointer< ostream > | out_solver_p_ = out_out_p , |
|||
Pointer< ostream > | out_solver_log_p_ = out_log_p | |||
) | [inline] |
Constructor for the dimension.
Sets sol_point to zero, time_ and tol to -1, iter_max to INF, optimal and no_sol to false.
virtual Solver::~Solver | ( | ) | [inline, virtual] |
int Solver::dim | ( | ) | const [inline] |
Gives the dimension.
Definition at line 104 of file opt.h.
References dim_.
Referenced by DualSolver::DualSolver(), and print().
double Solver::opt_val | ( | ) | [inline] |
double Solver::time | ( | ) | [inline] |
int Solver::iter | ( | ) | [inline] |
virtual int Solver::solve | ( | ) | [pure virtual] |
Solves the problem.
Abstract.
Implemented in MinlpBCP, gamsLocOpt, IpOpt, LagHeu, LinearRelaxSolver, MinlpOpt, LPSolver, BoxLocOpt, SimpleEquationSolver, SubGradOpt, and Random.
Referenced by solve().
virtual int Solver::solve | ( | dvector & | x | ) | [inline, virtual] |
Solves the problem for a starting point.
Sets sol_point to x. Calls solve().
x | The dvector to start the solver with. |
Reimplemented in MinlpBCP, gamsLocOpt, IpOpt, LPSolver, BoxLocOpt, SimpleEquationSolver, SubGradOpt, and Random.
virtual void Solver::print | ( | ostream & | out | ) | const [inline, virtual] |
ostream& operator<< | ( | ostream & | out, | |
const Solver & | a | |||
) | [friend] |
int Solver::dim_ [protected] |
double Solver::time_ [protected] |
double Solver::opt_val_ [protected] |
The optimal value.
Definition at line 44 of file opt.h.
Referenced by opt_val(), RelaxationSolver::set_upper_bound(), and BoxLocOpt::solve().
int Solver::iter_ [protected] |
Pointer<ostream> Solver::out_solver_p |
Pointer<ostream> Solver::out_solver_log_p |
double Solver::tol |
A tolerance value.
Definition at line 75 of file opt.h.
Referenced by LinearRelaxSolverGeneral::LinearRelaxSolverGeneral(), print(), SimpleEquationSolver::SimpleEquationSolver(), and SubGradOpt::SubGradOpt().
int Solver::iter_max |
The maximal number of iterations.
Definition at line 80 of file opt.h.
Referenced by Random::Random(), BoxLocOpt::set_box(), SimpleEquationSolver::SimpleEquationSolver(), BoxLocOpt::solve(), and SubGradOpt::SubGradOpt().
The solution point.
Definition at line 84 of file opt.h.
Referenced by Random::solve(), SubGradOpt::solve(), BoxLocOpt::solve(), and solve().