gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Merge bugfix #430 to branch 1.1
0 2 0
merge 1.1
1 file changed with 12 insertions and 4 deletions:
↑ Collapse diff ↑
Ignore white space 48 line context
... ...
@@ -1583,96 +1583,96 @@
1583 1583

	
1584 1584
  ///\relates LpBase::Expr
1585 1585
  ///
1586 1586
  inline LpBase::Expr operator*(const LpBase::Value &a, const LpBase::Expr &b) {
1587 1587
    LpBase::Expr tmp(b);
1588 1588
    tmp*=a;
1589 1589
    return tmp;
1590 1590
  }
1591 1591
  ///Divide with constant
1592 1592

	
1593 1593
  ///\relates LpBase::Expr
1594 1594
  ///
1595 1595
  inline LpBase::Expr operator/(const LpBase::Expr &a, const LpBase::Value &b) {
1596 1596
    LpBase::Expr tmp(a);
1597 1597
    tmp/=b;
1598 1598
    return tmp;
1599 1599
  }
1600 1600

	
1601 1601
  ///Create constraint
1602 1602

	
1603 1603
  ///\relates LpBase::Constr
1604 1604
  ///
1605 1605
  inline LpBase::Constr operator<=(const LpBase::Expr &e,
1606 1606
                                   const LpBase::Expr &f) {
1607
    return LpBase::Constr(0, f - e, LpBase::INF);
1607
    return LpBase::Constr(0, f - e, LpBase::NaN);
1608 1608
  }
1609 1609

	
1610 1610
  ///Create constraint
1611 1611

	
1612 1612
  ///\relates LpBase::Constr
1613 1613
  ///
1614 1614
  inline LpBase::Constr operator<=(const LpBase::Value &e,
1615 1615
                                   const LpBase::Expr &f) {
1616 1616
    return LpBase::Constr(e, f, LpBase::NaN);
1617 1617
  }
1618 1618

	
1619 1619
  ///Create constraint
1620 1620

	
1621 1621
  ///\relates LpBase::Constr
1622 1622
  ///
1623 1623
  inline LpBase::Constr operator<=(const LpBase::Expr &e,
1624 1624
                                   const LpBase::Value &f) {
1625
    return LpBase::Constr(- LpBase::INF, e, f);
1625
    return LpBase::Constr(LpBase::NaN, e, f);
1626 1626
  }
1627 1627

	
1628 1628
  ///Create constraint
1629 1629

	
1630 1630
  ///\relates LpBase::Constr
1631 1631
  ///
1632 1632
  inline LpBase::Constr operator>=(const LpBase::Expr &e,
1633 1633
                                   const LpBase::Expr &f) {
1634
    return LpBase::Constr(0, e - f, LpBase::INF);
1634
    return LpBase::Constr(0, e - f, LpBase::NaN);
1635 1635
  }
1636 1636

	
1637 1637

	
1638 1638
  ///Create constraint
1639 1639

	
1640 1640
  ///\relates LpBase::Constr
1641 1641
  ///
1642 1642
  inline LpBase::Constr operator>=(const LpBase::Value &e,
1643 1643
                                   const LpBase::Expr &f) {
1644 1644
    return LpBase::Constr(LpBase::NaN, f, e);
1645 1645
  }
1646 1646

	
1647 1647

	
1648 1648
  ///Create constraint
1649 1649

	
1650 1650
  ///\relates LpBase::Constr
1651 1651
  ///
1652 1652
  inline LpBase::Constr operator>=(const LpBase::Expr &e,
1653 1653
                                   const LpBase::Value &f) {
1654
    return LpBase::Constr(f, e, LpBase::INF);
1654
    return LpBase::Constr(f, e, LpBase::NaN);
1655 1655
  }
1656 1656

	
1657 1657
  ///Create constraint
1658 1658

	
1659 1659
  ///\relates LpBase::Constr
1660 1660
  ///
1661 1661
  inline LpBase::Constr operator==(const LpBase::Expr &e,
1662 1662
                                   const LpBase::Value &f) {
1663 1663
    return LpBase::Constr(f, e, f);
1664 1664
  }
1665 1665

	
1666 1666
  ///Create constraint
1667 1667

	
1668 1668
  ///\relates LpBase::Constr
1669 1669
  ///
1670 1670
  inline LpBase::Constr operator==(const LpBase::Expr &e,
1671 1671
                                   const LpBase::Expr &f) {
1672 1672
    return LpBase::Constr(0, f - e, 0);
1673 1673
  }
1674 1674

	
1675 1675
  ///Create constraint
1676 1676

	
1677 1677
  ///\relates LpBase::Constr
1678 1678
  ///
Ignore white space 48 line context
... ...
@@ -145,48 +145,56 @@
145 145
    c = (p1 >= 2.2);
146 146
    c = (p1 >= 2  );
147 147
    c = (2.2>= p2 );
148 148
    c = (2  >= p2 );
149 149

	
150 150
    c = (e  == f  );
151 151
    c = (e  == 2.2);
152 152
    c = (e  == 2  );
153 153
    c = (e  == p1 );
154 154
    c = (2.2== f  );
155 155
    c = (2  == f  );
156 156
    c = (p1 == f  );
157 157
    //c = (p1 == p2 );
158 158
    c = (p1 == 2.2);
159 159
    c = (p1 == 2  );
160 160
    c = (2.2== p2 );
161 161
    c = (2  == p2 );
162 162

	
163 163
    c = ((2 <= e) <= 3);
164 164
    c = ((2 <= p1) <= 3);
165 165

	
166 166
    c = ((2 >= e) >= 3);
167 167
    c = ((2 >= p1) >= 3);
168 168

	
169
    { //Tests for #430
170
      LP::Col v=lp.addCol();
171
      LP::Constr c = v >= -3;
172
      c = c <= 4;
173
      LP::Constr c2;
174
      c2 = -3 <= v <= 4;
175
    }
176

	
169 177
    e[x[3]]=2;
170 178
    e[x[3]]=4;
171 179
    e[x[3]]=1;
172 180
    *e=12;
173 181

	
174 182
    lp.addRow(-LP::INF,e,23);
175 183
    lp.addRow(-LP::INF,3.0*(x[1]+x[2]/2)-x[3],23);
176 184
    lp.addRow(-LP::INF,3.0*(x[1]+x[2]*2-5*x[3]+12-x[4]/3)+2*x[4]-4,23);
177 185

	
178 186
    lp.addRow(x[1]+x[3]<=x[5]-3);
179 187
    lp.addRow((-7<=x[1]+x[3]-12)<=3);
180 188
    lp.addRow(x[1]<=x[5]);
181 189

	
182 190
    std::ostringstream buf;
183 191

	
184 192

	
185 193
    e=((p1+p2)+(p1-0.99*p2));
186 194
    //e.prettyPrint(std::cout);
187 195
    //(e<=2).prettyPrint(std::cout);
188 196
    double tolerance=0.001;
189 197
    e.simplify(tolerance);
190 198
    buf << "Coeff. of p2 should be 0.01";
191 199
    check(e[p2]>0, buf.str());
192 200

	
0 comments (0 inline)