Beispiel #1
0
 def __init__(self, component):
     _BlockData.__init__(self, component)
     self.indicator_var = AutoLinkedBooleanVar()
     self.binary_indicator_var = AutoLinkedBinaryVar(self.indicator_var)
     self.indicator_var.associate_binary_var(self.binary_indicator_var)
     # pointer to transformation block if this disjunct has been
     # transformed. None indicates it hasn't been transformed.
     self._transformation_block = None
Beispiel #2
0
 def __init__(self, component):
     _BlockData.__init__(self, component)
     self._persistent_solvers = ComponentSet()
     self._allow_changes = False
     self._relaxation_side = RelaxationSide.BOTH
     self._oa_points = list()  # List of ComponentMap. Each entry in the list specifies a point at which an outer
                               # approximation cut should be built for convex/concave constraints.
     self._saved_oa_points = list()
     self._cuts = None
     self._use_linear_relaxation = True
     self.large_eval_tol = math.inf
Beispiel #3
0
 def __init__(self, component):
     if not mpi4py_available:
         raise ImportError('BendersCutGenerator requires mpi4py.')
     if not numpy_available:
         raise ImportError('BendersCutGenerator requires numpy.')
     _BlockData.__init__(self, component)
     self.num_subproblems_by_rank = np.zeros(MPI.COMM_WORLD.Get_size())
     self.subproblems = list()
     self.complicating_vars_maps = list()
     self.master_vars = list()
     self.master_vars_indices = pe.ComponentMap()
     self.master_etas = list()
     self.cuts = None
     self.subproblem_solvers = list()
     self.tol = None
     self.all_master_etas = list()
Beispiel #4
0
    def __init__(self, *args, **kwargs):
        """
        Initialize the object.  Anything inheriting from process base
        should impliment a build() function that create the Pyomo
        variables, constriants, and whatever.

        Args:
        ------
        delay_construct: A model that inherits this can call the build
            function at the end of the constructor (or not).  The
            delay_construct argument provides a standard way to override
            the automatic call to build and manually do it later. The
            purpose of delaying the call to build is to do some more
            model setup before constructing the Pyomo problem. False by
            default
        solver: the solver to be used in solving the this Pyomo Block
            by default is ipopt.  The solver and solver settings can
            be changed at anytime.
        """
        # Pop arguments that are used here and not to be passed on
        # to the Pyomo Block constructor.
        kwargs.setdefault('name', 'Unnamed_Unit_Model')
        self.delay_construct = kwargs.pop("delay_construct", False)
        self.unit_type = kwargs.pop('type', ['General'])
        self.unit_name = kwargs.pop('name')
        self.parent_unit = Wrapper(kwargs.pop('parent'))

        self._idx = kwargs.pop('idx', None)
        self._comps = set(kwargs.pop('comps', []))

        self._init_methods = {}
        self.link_map = {}
        self.units = Bunch()
        self.graph = nx.DiGraph()
        self._built = False
        _BlockData.__init__(self, *args)
        #super(ProcessBase, self).__init__(self, *args)
        if self.parent_component().__class__.__name__.startswith("_Indexed"):
            #if its a simple block this gets called from Simple* init.  need
            #Block init in between __init__ and __init2__
            self._suppress_ctypes = self.parent_component()._suppress_ctypes
            self.__init2__()
        self._reg_initialize('default',
                             func=self.default_init,
                             doc='Do nothing')
Beispiel #5
0
 def __init__(self, component):
     if not mpi4py_available:
         raise ImportError('BendersCutGenerator requires mpi4py.')
     if not numpy_available:
         raise ImportError('BendersCutGenerator requires numpy.')
     _BlockData.__init__(self, component)
     
     self.num_subproblems_by_rank = 0 #np.zeros(self.comm.Get_size())
     self.subproblems = list()
     self.complicating_vars_maps = list()
     self.master_vars = list()
     self.master_vars_indices = pe.ComponentMap()
     self.master_etas = list()
     self.cuts = None
     self.subproblem_solvers = list()
     self.tol = None
     self.all_master_etas = list()
     self._subproblem_ndx_map = dict()  # map from ndx in self.subproblems (local) to the global subproblem ndx
Beispiel #6
0
 def __init__(self, component):
     _BlockData.__init__(self, component)
     self.indicator_var = Var(within=Binary)
     # pointer to transformation block if this disjunct has been
     # transformed. None indicates it hasn't been transformed.
     self._transformation_block = None
Beispiel #7
0
 def __init__(self, component):
     _BlockData.__init__(self, component)
     self._persistent_solvers = ComponentSet()
     self._allow_changes = False
     self._relaxation_side = RelaxationSide.BOTH
Beispiel #8
0
 def __init__(self, component):
     _BlockData.__init__(self, component)
     self._M = None
     self.indicator_var = Var(within=Binary)
Beispiel #9
0
 def __init__(self, owner):
     _BlockData.__init__(self, owner)
     self._M = None
     self.indicator_var = Var(within=Binary)
Beispiel #10
0
 def __init__(self, owner):
     _BlockData.__init__(self, owner)
     self._M = None
     self.indicator_var = Var(within=Binary)
Beispiel #11
0
 def __init__(self, component):
     _BlockData.__init__(self, component)
     self.indicator_var = Var(within=Binary)