... | ... |
@@ -117,113 +117,113 @@ |
117 | 117 |
(f+12)+(12+f)+(p1+f)+(f+p1)+(f+g)+ |
118 | 118 |
(f-12)+(12-f)+(p1-f)+(f-p1)+(f-g)+ |
119 | 119 |
2.2*f+f*2.2+f/2.2+ |
120 | 120 |
2*f+f*2+f/2+ |
121 | 121 |
2.2*p1+p1*2.2+p1/2.2+ |
122 | 122 |
2*p1+p1*2+p1/2 |
123 | 123 |
); |
124 | 124 |
|
125 | 125 |
|
126 | 126 |
c = (e <= f ); |
127 | 127 |
c = (e <= 2.2); |
128 | 128 |
c = (e <= 2 ); |
129 | 129 |
c = (e <= p1 ); |
130 | 130 |
c = (2.2<= f ); |
131 | 131 |
c = (2 <= f ); |
132 | 132 |
c = (p1 <= f ); |
133 | 133 |
c = (p1 <= p2 ); |
134 | 134 |
c = (p1 <= 2.2); |
135 | 135 |
c = (p1 <= 2 ); |
136 | 136 |
c = (2.2<= p2 ); |
137 | 137 |
c = (2 <= p2 ); |
138 | 138 |
|
139 | 139 |
c = (e >= f ); |
140 | 140 |
c = (e >= 2.2); |
141 | 141 |
c = (e >= 2 ); |
142 | 142 |
c = (e >= p1 ); |
143 | 143 |
c = (2.2>= f ); |
144 | 144 |
c = (2 >= f ); |
145 | 145 |
c = (p1 >= f ); |
146 | 146 |
c = (p1 >= p2 ); |
147 | 147 |
c = (p1 >= 2.2); |
148 | 148 |
c = (p1 >= 2 ); |
149 | 149 |
c = (2.2>= p2 ); |
150 | 150 |
c = (2 >= p2 ); |
151 | 151 |
|
152 | 152 |
c = (e == f ); |
153 | 153 |
c = (e == 2.2); |
154 | 154 |
c = (e == 2 ); |
155 | 155 |
c = (e == p1 ); |
156 | 156 |
c = (2.2== f ); |
157 | 157 |
c = (2 == f ); |
158 | 158 |
c = (p1 == f ); |
159 | 159 |
//c = (p1 == p2 ); |
160 | 160 |
c = (p1 == 2.2); |
161 | 161 |
c = (p1 == 2 ); |
162 | 162 |
c = (2.2== p2 ); |
163 | 163 |
c = (2 == p2 ); |
164 | 164 |
|
165 |
c = (2 <= e <= 3); |
|
166 |
c = (2 <= p1<= 3); |
|
165 |
c = ((2 <= e) <= 3); |
|
166 |
c = ((2 <= p1) <= 3); |
|
167 | 167 |
|
168 |
c = (2 >= e >= 3); |
|
169 |
c = (2 >= p1>= 3); |
|
168 |
c = ((2 >= e) >= 3); |
|
169 |
c = ((2 >= p1) >= 3); |
|
170 | 170 |
|
171 | 171 |
e[x[3]]=2; |
172 | 172 |
e[x[3]]=4; |
173 | 173 |
e[x[3]]=1; |
174 | 174 |
*e=12; |
175 | 175 |
|
176 | 176 |
lp.addRow(-LP::INF,e,23); |
177 | 177 |
lp.addRow(-LP::INF,3.0*(x[1]+x[2]/2)-x[3],23); |
178 | 178 |
lp.addRow(-LP::INF,3.0*(x[1]+x[2]*2-5*x[3]+12-x[4]/3)+2*x[4]-4,23); |
179 | 179 |
|
180 | 180 |
lp.addRow(x[1]+x[3]<=x[5]-3); |
181 |
lp.addRow(-7<=x[1]+x[3]-12<=3); |
|
181 |
lp.addRow((-7<=x[1]+x[3]-12)<=3); |
|
182 | 182 |
lp.addRow(x[1]<=x[5]); |
183 | 183 |
|
184 | 184 |
std::ostringstream buf; |
185 | 185 |
|
186 | 186 |
|
187 | 187 |
e=((p1+p2)+(p1-0.99*p2)); |
188 | 188 |
//e.prettyPrint(std::cout); |
189 | 189 |
//(e<=2).prettyPrint(std::cout); |
190 | 190 |
double tolerance=0.001; |
191 | 191 |
e.simplify(tolerance); |
192 | 192 |
buf << "Coeff. of p2 should be 0.01"; |
193 | 193 |
check(e[p2]>0, buf.str()); |
194 | 194 |
|
195 | 195 |
tolerance=0.02; |
196 | 196 |
e.simplify(tolerance); |
197 | 197 |
buf << "Coeff. of p2 should be 0"; |
198 | 198 |
check(const_cast<const LpSolver::Expr&>(e)[p2]==0, buf.str()); |
199 | 199 |
|
200 | 200 |
|
201 | 201 |
} |
202 | 202 |
|
203 | 203 |
{ |
204 | 204 |
LP::DualExpr e,f,g; |
205 | 205 |
LP::Row p1 = INVALID, p2 = INVALID, p3 = INVALID, |
206 | 206 |
p4 = INVALID, p5 = INVALID; |
207 | 207 |
|
208 | 208 |
e[p1]=2; |
209 | 209 |
e[p1]+=2; |
210 | 210 |
e[p1]-=2; |
211 | 211 |
|
212 | 212 |
e=p1; |
213 | 213 |
e=f; |
214 | 214 |
|
215 | 215 |
e+=p1; |
216 | 216 |
e+=f; |
217 | 217 |
|
218 | 218 |
e-=p1; |
219 | 219 |
e-=f; |
220 | 220 |
|
221 | 221 |
e*=2; |
222 | 222 |
e*=2.2; |
223 | 223 |
e/=2; |
224 | 224 |
e/=2.2; |
225 | 225 |
|
226 | 226 |
e=((p1+p2)+(p1-p2)+ |
227 | 227 |
(p1+f)+(f+p1)+(f+g)+ |
228 | 228 |
(p1-f)+(f-p1)+(f-g)+ |
229 | 229 |
2.2*f+f*2.2+f/2.2+ |
0 comments (0 inline)