haiku/headers/libs/linprog/SoftConstraint.h
Ingo Weinhold a101e99aad Added libalm.so and its dependency liblinprog.so. libalm.so provides a
BLayout implementation (BALMLayout) using the Auckland Layout Model
(ALM). The original ALM was implemented by Christof Lutteroth, the
Haiku/C++ version by James Kim.
The code needs some review, but the test programs seem to work fine.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23889 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-06 10:51:44 +00:00

55 lines
1.2 KiB
C++

#ifndef SOFT_CONSTRAINT_H
#define SOFT_CONSTRAINT_H
#include "Constraint.h"
#include <List.h>
namespace LinearProgramming {
class LinearSpec;
class ObjFunctionSummand;
class Variable;
/**
* Soft constraint, i.e.&nbsp;one that does not necessarily have to be satisfied.
* Use this instead of hard constraints to avoid over-constrained specifications.
*/
class SoftConstraint : public Constraint {
public:
void ChangeLeftSide(BList* coeffs, BList* vars);
OperatorType Op();
void SetOp(OperatorType value);
double PenaltyNeg();
void SetPenaltyNeg(double value);
double PenaltyPos();
void SetPenaltyPos(double value);
//~ string ToString();
Variable* DNeg() const;
Variable* DPos() const;
~SoftConstraint();
protected:
SoftConstraint(LinearSpec* ls, BList* coeffs, BList* vars,
OperatorType op, double rightSide,
double penaltyNeg, double penaltyPos);
private:
Variable* fDNeg;
Variable* fDPos;
ObjFunctionSummand* fDNegSummand;
ObjFunctionSummand* fDPosSummand;
public:
friend class LinearSpec;
};
} // namespace LinearProgramming
using LinearProgramming::SoftConstraint;
#endif // SOFT_CONSTRAINT_H