Changeset 3544
 Timestamp:
 01/26/11 21:24:02 (4 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

coopr.pyomo/trunk/coopr/pyomo/base/var.py
r3537 r3544 465 465 # 466 466 if self.bounds is not None: 467 # bounds are specified via a tuple 467 468 468 if type(self.bounds) is tuple: 469 for key in self._varval: 470 (lb, ub) = self.bounds 471 self._varval[key].setlb(lb) 472 self._varval[key].setub(ub) 469 470 # bounds are specified via a tuple  same lower and upper bounds for all var values! 471 472 (lb, ub) = self.bounds 473 474 # do some simple validation that the bounds are actually finite  otherwise, set them to None. 475 if (lb is not None) and (not pyutilib.math.is_finite(lb)): 476 lb = None 477 if (ub is not None) and (not pyutilib.math.is_finite(ub)): 478 ub = None 479 480 for key,varval in self._varval.iteritems(): 481 varval.setlb(lb) 482 varval.setub(ub) 483 473 484 else: 485 474 486 # bounds are specified via a function 487 475 488 for key in self._varval: 476 489 if isinstance(key,tuple): … … 485 498 self._varval[key].setlb(lb) 486 499 self._varval[key].setub(ub) 487 for key in self._varval: 488 if self._varval[key].lb is not None and \ 489 not pyutilib.math.is_finite(self._varval[key].lb()): 490 self._varval[key].setlb(None) 491 if self._varval[key].ub is not None and \ 492 not pyutilib.math.is_finite(self._varval[key].ub()): 493 self._varval[key].setub(None) 500 501 for key in self._varval: 502 if self._varval[key].lb is not None and not pyutilib.math.is_finite(self._varval[key].lb()): 503 self._varval[key].setlb(None) 504 if self._varval[key].ub is not None and not pyutilib.math.is_finite(self._varval[key].ub()): 505 self._varval[key].setub(None) 494 506 # 495 507 # Iterate through all variables, and tighten the bounds based on
Note: See TracChangeset
for help on using the changeset viewer.