#ifndef CONSTRAINT_H
#define CONSTRAINT_H
#include <ObjectList.h>
#include <String.h>
#include <SupportDefs.h>
#include "LinearProgrammingTypes.h"
#include "Summand.h"
#include "Variable.h"
namespace LinearProgramming {
class LinearSpec;
class Constraint {
public:
Constraint();
Constraint(Constraint* constraint);
int32 Index() const;
SummandList* LeftSide();
bool SetLeftSide(SummandList* summands,
bool deleteOldSummands);
bool SetLeftSide(double coeff1, Variable* var1);
bool SetLeftSide(double coeff1, Variable* var1,
double coeff2, Variable* var2);
bool SetLeftSide(double coeff1, Variable* var1,
double coeff2, Variable* var2,
double coeff3, Variable* var3);
bool SetLeftSide(double coeff1, Variable* var1,
double coeff2, Variable* var2,
double coeff3, Variable* var3,
double coeff4, Variable* var4);
OperatorType Op();
void SetOp(OperatorType value);
double RightSide() const;
void SetRightSide(double value);
double PenaltyNeg() const;
void SetPenaltyNeg(double value);
double PenaltyPos() const;
void SetPenaltyPos(double value);
const char* Label();
void SetLabel(const char* label);
bool IsValid();
void Invalidate();
BString ToString() const;
void PrintToStream();
~Constraint();
protected:
Constraint(LinearSpec* ls,
SummandList* summands, OperatorType op,
double rightSide,
double penaltyNeg = -1,
double penaltyPos = -1);
private:
LinearSpec* fLS;
SummandList* fLeftSide;
OperatorType fOp;
double fRightSide;
double fPenaltyNeg;
double fPenaltyPos;
BString fLabel;
public:
friend class LinearSpec;
};
typedef BObjectList<Constraint> ConstraintList;
}
using LinearProgramming::Constraint;
using LinearProgramming::ConstraintList;
#endif