17using System.Collections.Generic;
23 return "LinearConstraint";
43 return "" + lb_ +
" <= " + expr_.ToString() +
" <= " + ub_;
48 Dictionary<Variable, double> coefficients =
new Dictionary<Variable, double>();
49 double constant = expr_.
Visit(coefficients);
51 foreach (KeyValuePair<Variable, double> pair
in coefficients)
53 ct.SetCoefficient(pair.Key, pair.Value);
74 this.equality_ = equality;
79 return "" + left_.ToString() +
" == " + right_.ToString();
86 throw new ArgumentException(
"Operator != not supported for LinearExpression");
88 Dictionary<Variable, double> coefficients =
new Dictionary<Variable, double>();
89 double constant = left_.
Visit(coefficients);
90 constant += right_.
DoVisit(coefficients, -1);
92 foreach (KeyValuePair<Variable, double> pair
in coefficients)
94 ct.SetCoefficient(pair.Key, pair.Value);
99 public static implicit
operator bool(
Equality ct)
101 return (
object)ct.left_ == (object)ct.right_ ? ct.equality_ : !ct.equality_;
106 private bool equality_;
115 this.equality_ = equality;
120 return "" + left_.
Name() +
" == " + right_.
Name();
133 return (
object)ct.left_ == (object)ct.right_ ? ct.equality_ : !ct.equality_;
138 private bool equality_;
142public partial class MPConstraintVector : IDisposable,
143 System.Collections.IEnumerable
146 System.Collections.Generic.IList<Constraint>
164 inVal.CopyTo(outVal);