Changeset 2099


Ignore:
Timestamp:
Jan 2, 2010 1:00:57 AM (10 years ago)
Author:
wehart
Message:

Removing some tabs.

Add option to allow a Model to be named in its constructor.

Add a Model method to store model data in a SolverResults? object.

Location:
coopr.pyomo/trunk/coopr/pyomo/base
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • coopr.pyomo/trunk/coopr/pyomo/base/PyomoModel.py

    r2064 r2099  
    4242
    4343
    44     def __init__(self):
     44    def __init__(self, name="unknown"):
    4545        """Constructor"""
    4646        Component.__init__(self, ctype=Model)
     
    6464        self._name_conmap={}
    6565        self._name_objmap={}
    66         self.name="unknown"
     66        self.name=name
    6767        self.tmpctr=0
    6868        self._varctr=0
     
    300300           raise ValueError, "Cannot load model with object of type "+str(type(arg))
    301301
     302
     303    def store_info(self, results):
     304        """ Store model information into a SolverResults object """
     305        results.problem.name = self.name
     306        results.problem.number_of_variables = self.statistics.number_of_variables
     307        results.problem.number_of_binary_variables = self.statistics.number_of_binary_variables
     308        results.problem.number_of_integer_variables = self.statistics.number_of_integer_variables
     309        results.problem.number_of_continuous_variables = self.statistics.number_of_continuous_variables
     310        results.problem.number_of_constraints = self.statistics.number_of_constraints
     311        results.problem.number_of_objectives = self.statistics.number_of_objectives
    302312
    303313    def _tuplize(self, data, setobj):
  • coopr.pyomo/trunk/coopr/pyomo/base/constraint.py

    r2050 r2099  
    5454           expression
    5555        """
    56         tkwd = {'ctype':Objective}
     56        tkwd = {'ctype':Objective}
    5757        IndexedComponent.__init__(self, *args, **tkwd)
    5858        tmpname="unknown"
     
    216216           expression
    217217        """
    218         tkwd = {'ctype':Constraint}
     218        tkwd = {'ctype':Constraint}
    219219        IndexedComponent.__init__(self, *args, **tkwd)
    220220        tmpname="unknown"
  • coopr.pyomo/trunk/coopr/pyomo/base/var.py

    r2064 r2099  
    151151    """
    152152    def __init__(self, *args, **kwd):
    153         tkwd = {'ctype':Var}
     153        tkwd = {'ctype':Var}
    154154        IndexedComponent.__init__(self, *args, **tkwd)
    155155        #
Note: See TracChangeset for help on using the changeset viewer.