组件数据

(类来自 pyomo.core.base.component)

class pyomo.core.base.component.ComponentData(component)[source]

基础类:ComponentBase

这是用于Pyomo建模组件中的组件数据的基类。ComponentData的子类用于索引组件,并且该类假设索引组件是IndexedComponent的子类。请注意,ComponentData实例不存储它们的索引。这使得一些操作显著更昂贵,但这些操作(a)与I/O生成相关,并且(b)可以通过缓存来管理这些成本。

Constructor arguments:

owner 拥有此数据对象的组件

Private class attributes:

_component 指向拥有此数据对象的组件的弱引用 _index 此数据对象的索引

__init__(component)[源代码]

方法

__init__(component)

clear_suffix_value(suffix_or_name[, expand])

设置此组件数据的后缀值

cname(*args, **kwds)

已弃用。

get_suffix_value(suffix_or_name[, default])

获取此组件数据的后缀值

getname([fully_qualified, name_buffer, ...])

返回包含组件名称和索引的字符串

index()

返回此ComponentData实例相对于父组件索引集的索引。

is_component_type()

如果此类是Pyomo组件,则返回True

is_expression_type([expression_system])

如果此数值是一个表达式,则返回 True

is_indexed()

如果此组件已索引,则返回true

is_logical_type()

如果此类是Pyomo布尔对象,则返回True。

is_named_expression_type()

如果此数值是一个命名表达式,则返回 True

is_numeric_type()

如果此类是Pyomo数值对象,则返回True

is_parameter_type()

除非此类是参数对象,否则返回 False

is_reference()

如果此对象是引用,则返回 True。

is_variable_type()

除非此类是变量对象,否则返回 False

model()

返回拥有此数据的组件的模型。

parent_block()

返回拥有此数据的组件的父组件。

parent_component()

返回与此对象关联的组件。

pprint([ostream, verbose, prefix])

打印组件信息

set_suffix_value(suffix_or_name, value[, expand])

设置此组件数据的后缀值

type()

已弃用。

属性

active

返回活动属性

ctype

返回此组件的类类型

local_name

仅在直接父容器的上下文中获取组件名称。

name

获取完全限定的组件名称。

成员文档

clear_suffix_value(suffix_or_name, expand=True)[source]

设置此组件数据的后缀值

cname(*args, **kwds)

已弃用。

自版本5.0起已弃用:cname() 方法已重命名为 getname()。 获取组件名称的首选方法是使用 .name 属性,该属性返回完全限定的组件名称。 .local_name 属性将仅在直接父容器的上下文中返回组件名称。

get_suffix_value(suffix_or_name, default=None)[来源]

获取此组件数据的后缀值

getname(fully_qualified=False, name_buffer=None, relative_to=None)[source]

返回包含组件名称和索引的字符串

index()[source]

返回此ComponentData实例相对于父组件索引集的索引。如果此实例没有父组件,或者由于某些未知原因此实例不属于父组件的索引集,则返回None。

is_component_type()

如果此类是Pyomo组件,则返回True

is_expression_type(expression_system=None)

如果此数值是一个表达式,则返回 True

is_indexed()[source]

如果此组件已索引,则返回true

is_logical_type()

如果此类是Pyomo布尔对象,则返回True。

布尔对象包括常量、变量或逻辑表达式。

is_named_expression_type()

如果此数值是一个命名表达式,则返回 True

is_numeric_type()

如果此类是Pyomo数值对象,则返回True

is_parameter_type()

除非此类是参数对象,否则返回 False

is_reference()

如果此对象是引用,则返回 True。

is_variable_type()

除非此类是变量对象,否则返回 False

model()[source]

返回拥有此数据的组件的模型。

parent_block()[source]

返回拥有此数据的组件的父组件。

parent_component()[source]

返回与此对象关联的组件。

pprint(ostream=None, verbose=False, prefix='')

打印组件信息

请注意,此方法通常只能通过IndexedComponent容器中的ComponentData对象访问。组件,包括未索引的Component派生类以及标量和索引的IndexedComponent派生类,将会看到Component.pprint()

set_suffix_value(suffix_or_name, value, expand=True)[source]

设置此组件数据的后缀值

type()[source]

已弃用。

返回此组件的类类型

自版本5.7起已弃用:Component.type() 方法已被 .ctype 属性取代。

property active

返回活动属性

property ctype

返回此组件的类类型

property local_name

仅在直接父容器的上下文中获取组件名称。

property name

获取完全限定的组件名称。