114 |
114 |
115 ///The floating point type used by the solver |
115 ///The floating point type used by the solver |
116 typedef double Value; |
116 typedef double Value; |
117 ///The infinity constant |
117 ///The infinity constant |
118 static const Value INF; |
118 static const Value INF; |
|
119 ///The not a number constant |
|
120 static const Value NaN; |
119 |
121 |
120 ///Refer to a column of the LP. |
122 ///Refer to a column of the LP. |
121 |
123 |
122 ///This type is used to refer to a column of the LP. |
124 ///This type is used to refer to a column of the LP. |
123 /// |
125 /// |
316 &indices[0],&values[0]); |
320 &indices[0],&values[0]); |
317 _setRowLowerBound(rows.floatingId(r.id),l-e.constComp()); |
321 _setRowLowerBound(rows.floatingId(r.id),l-e.constComp()); |
318 _setRowUpperBound(rows.floatingId(r.id),u-e.constComp()); |
322 _setRowUpperBound(rows.floatingId(r.id),u-e.constComp()); |
319 } |
323 } |
320 |
324 |
|
325 ///Set a row (i.e a constaint) of the LP |
|
326 |
|
327 ///\param r is the row to be modified |
|
328 ///\param c is a linear expression (see \ref Constr) |
|
329 ///\bug This is a temportary function. The interface will change to |
|
330 ///a better one. |
|
331 void setRow(Row r, const Constr &c) { |
|
332 Value lb= c.lb==NaN?-INF:lb; |
|
333 Value ub= c.ub==NaN?INF:lb; |
|
334 setRow(r,lb,c.expr,ub); |
|
335 } |
|
336 |
321 ///Add a new row (i.e a new constaint) to the LP |
337 ///Add a new row (i.e a new constaint) to the LP |
322 |
338 |
323 ///\param l is the lower bound (-\ref INF means no bound) |
339 ///\param l is the lower bound (-\ref INF means no bound) |
324 ///\param e is a linear expression (see \ref Expr) |
340 ///\param e is a linear expression (see \ref Expr) |
325 ///\param u is the upper bound (\ref INF means no bound) |
341 ///\param u is the upper bound (\ref INF means no bound) |
330 Row r=addRow(); |
346 Row r=addRow(); |
331 setRow(r,l,e,u); |
347 setRow(r,l,e,u); |
332 return r; |
348 return r; |
333 } |
349 } |
334 |
350 |
|
351 ///Add a new row (i.e a new constaint) to the LP |
|
352 |
|
353 ///\param c is a linear expression (see \ref Constr) |
|
354 ///\return The created row. |
|
355 ///\bug This is a temportary function. The interface will change to |
|
356 ///a better one. |
|
357 Row addRow(const Constr &c) { |
|
358 Row r=addRow(); |
|
359 setRow(r,c); |
|
360 return r; |
|
361 } |
|
362 |
335 /// Set the lower bound of a column (i.e a variable) |
363 /// Set the lower bound of a column (i.e a variable) |
336 |
364 |
337 /// The upper bound of a variable (column) have to be given by an |
365 /// The upper bound of a variable (column) have to be given by an |
338 /// extended number of type Value, i.e. a finite number of type |
366 /// extended number of type Value, i.e. a finite number of type |
339 /// Value or -\ref INF. |
367 /// Value or -\ref INF. |