2
Cassowary.net: an incremental constraint solver for .NET
3
(http://lumumba.uhasselt.be/jo/projects/cassowary.net/)
5
Copyright (C) 2005 Jo Vermeulen (jo.vermeulen@uhasselt.be)
7
This program is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Lesser General Public License
9
as published by the Free Software Foundation; either version 2.1
10
of the License, or (at your option) any later version.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU Lesser General Public License for more details.
17
You should have received a copy of the GNU Lesser General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
public class ClLinearInequality : ClLinearConstraint
28
public ClLinearInequality(ClLinearExpression cle,
30
double weight) : base(cle, strength, weight)
33
public ClLinearInequality(ClLinearExpression cle,
34
ClStrength strength) : base(cle, strength)
37
public ClLinearInequality(ClLinearExpression cle) : base(cle)
40
public ClLinearInequality(ClVariable clv1,
44
double weight) : base(new ClLinearExpression(clv2), strength, weight)
45
/* throws ExClInternalError */
50
_expression.MultiplyMe(-1.0);
51
_expression.AddVariable(clv1);
54
_expression.AddVariable(clv1, -1.0);
58
throw new ExClInternalError("Invalid operator in ClLinearInequality constructor");
62
public ClLinearInequality(ClVariable clv1,
65
ClStrength strength) : this(clv1, op_enum, clv2, strength, 1.0)
66
/* throws ExClInternalError */
69
public ClLinearInequality(ClVariable clv1,
71
ClVariable clv2) : this(clv1, op_enum, clv2, ClStrength.Required, 1.0)
72
/* throws ExClInternalError */
75
public ClLinearInequality(ClVariable clv,
79
double weight) : base(new ClLinearExpression(val), strength, weight)
80
/* throws ExClInternalError */
85
_expression.MultiplyMe(-1.0);
86
_expression.AddVariable(clv);
89
_expression.AddVariable(clv, -1.0);
93
throw new ExClInternalError("Invalid operator in ClLinearInequality constructor");
97
public ClLinearInequality(ClVariable clv,
100
ClStrength strength) : this(clv, op_enum, val, strength, 1.0)
101
/* throws ExClInternalError */
104
public ClLinearInequality(ClVariable clv,
106
double val) : this(clv, op_enum, val, ClStrength.Required, 1.0)
107
/* throws ExClInternalError */
110
public ClLinearInequality(ClLinearExpression cle1,
112
ClLinearExpression cle2,
114
double weight) : base((ClLinearExpression) cle2.Clone(), strength, weight)
115
/* throws ExClInternalError */
120
_expression.MultiplyMe(-1.0);
121
_expression.AddExpression(cle1);
124
_expression.AddExpression(cle1, -1.0);
128
throw new ExClInternalError("Invalid operator in ClLinearInequality constructor");
132
public ClLinearInequality(ClLinearExpression cle1,
134
ClLinearExpression cle2,
135
ClStrength strength) : this(cle1, op_enum, cle2, strength, 1.0)
136
/* throws ExClInternalError */
139
public ClLinearInequality(ClLinearExpression cle1,
141
ClLinearExpression cle2) : this(cle1, op_enum, cle2, ClStrength.Required, 1.0)
142
/* throws ExClInternalError */
145
public ClLinearInequality(ClAbstractVariable clv,
147
ClLinearExpression cle,
149
double weight) : base((ClLinearExpression) cle.Clone(), strength, weight)
150
/* throws ExClInternalError */
155
_expression.MultiplyMe(-1.0);
156
_expression.AddVariable(clv);
159
_expression.AddVariable(clv, -1.0);
163
throw new ExClInternalError("Invalid operator in ClLinearInequality constructor");
167
public ClLinearInequality(ClAbstractVariable clv,
169
ClLinearExpression cle,
170
ClStrength strength) : this(clv, op_enum, cle, strength, 1.0)
171
/* throws ExClInternalError */
174
public ClLinearInequality(ClAbstractVariable clv,
176
ClLinearExpression cle) : this(clv, op_enum, cle, ClStrength.Required, 1.0)
177
/* throws ExClInternalError */
180
public ClLinearInequality(ClLinearExpression cle,
182
ClAbstractVariable clv,
184
double weight) : base((ClLinearExpression) cle.Clone(), strength, weight)
185
/* throws ExClInternalError */
190
_expression.MultiplyMe(-1.0);
191
_expression.AddVariable(clv);
194
_expression.AddVariable(clv, -1.0);
198
throw new ExClInternalError("Invalid operator in ClLinearInequality constructor");
202
public ClLinearInequality(ClLinearExpression cle,
204
ClAbstractVariable clv,
205
ClStrength strength) : this(cle, op_enum, clv, strength, 1.0)
206
/* throws ExClInternalError */
209
public ClLinearInequality(ClLinearExpression cle,
211
ClAbstractVariable clv) : this(cle, op_enum, clv, ClStrength.Required, 1.0)
212
/* throws ExClInternalError */
215
public sealed override bool IsInequality
220
public sealed override string ToString()
222
return base.ToString() + " >= 0)";