haiku/headers/libs/linprog/Summand.h
Clemens Zeidler 7583db5a1e Add an alternative solver to lp_solve. The solver based on Ingo's active set solver but is able to handle arbitrary hard and soft constraints. The advantage to lp_solve is that the active set solver can optimize variable in respect to a quadratic objective function. This makes it possible to minimise the quadratic derivation to a desired value e.g. \Sum_i(x_i - x_{i,pref})^2 -> min.
The solver part has been refactored in this way that both solver can be used with the same layout specifications. The active set solver is default now; the performance is not as good as lp_solve, though.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40285 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-01-25 04:59:40 +00:00

47 lines
886 B
C++

/*
* Copyright 2007-2008, Christof Lutteroth, lutteroth@cs.auckland.ac.nz
* Copyright 2007-2008, James Kim, jkim202@ec.auckland.ac.nz
* Distributed under the terms of the MIT License.
*/
#ifndef SUMMAND_H
#define SUMMAND_H
#include <ObjectList.h>
namespace LinearProgramming {
class LinearSpec;
class Variable;
/**
* A summand of a linear term.
*/
class Summand {
public:
Summand(double coeff, Variable* var);
~Summand();
double Coeff();
void SetCoeff(double coeff);
Variable* Var();
void SetVar(Variable* var);
int32 VariableIndex();
private:
double fCoeff;
Variable* fVar;
bool fUsedInPenaltyFunction; //not set yet
};
typedef BObjectList<Summand> SummandList;
} // namespace LinearProgramming
using LinearProgramming::Summand;
using LinearProgramming::SummandList;
#endif // OBJ_FUNCTION_SUMMAND_H