mirror of
https://review.haiku-os.org/haiku
synced 2025-02-08 14:49:58 +01:00
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
55 lines
1.2 KiB
C++
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. 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
|