2 * Copyright 2007-2008, Christof Lutteroth, lutteroth@cs.auckland.ac.nz
3 * Copyright 2007-2008, James Kim, jkim202@ec.auckland.ac.nz
4 * Distributed under the terms of the MIT License.
9 #include <ObjectList.h>
11 #include <SupportDefs.h>
13 #include "LinearProgrammingTypes.h"
18 namespace LinearProgramming
{
23 * Hard linear constraint, i.e. one that must be satisfied.
24 * May render a specification infeasible.
29 /*! Creates a soft copy of the constraint which is not connected
30 to the solver. Variables are not copied or cloned but the soft copy
31 has its own summand list with summands. */
32 Constraint(Constraint
* constraint
);
36 SummandList
* LeftSide();
38 bool SetLeftSide(SummandList
* summands
,
39 bool deleteOldSummands
);
41 bool SetLeftSide(double coeff1
, Variable
* var1
);
42 bool SetLeftSide(double coeff1
, Variable
* var1
,
43 double coeff2
, Variable
* var2
);
44 bool SetLeftSide(double coeff1
, Variable
* var1
,
45 double coeff2
, Variable
* var2
,
46 double coeff3
, Variable
* var3
);
47 bool SetLeftSide(double coeff1
, Variable
* var1
,
48 double coeff2
, Variable
* var2
,
49 double coeff3
, Variable
* var3
,
50 double coeff4
, Variable
* var4
);
53 void SetOp(OperatorType value
);
54 double RightSide() const;
55 void SetRightSide(double value
);
56 double PenaltyNeg() const;
57 void SetPenaltyNeg(double value
);
58 double PenaltyPos() const;
59 void SetPenaltyPos(double value
);
62 void SetLabel(const char* label
);
67 BString
ToString() const;
73 Constraint(LinearSpec
* ls
,
74 SummandList
* summands
, OperatorType op
,
76 double penaltyNeg
= -1,
77 double penaltyPos
= -1);
81 SummandList
* fLeftSide
;
90 friend class LinearSpec
;
94 typedef BObjectList
<Constraint
> ConstraintList
;
97 } // namespace LinearProgramming
99 using LinearProgramming::Constraint
;
100 using LinearProgramming::ConstraintList
;
102 #endif // CONSTRAINT_H