ActiveComponent

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

class pyomo.core.base.component.ActiveComponent(**kwds)[source]

基础类: Component

一个在模型中激活或停用具有语义意义的组件。

Private class attributes:
_active A boolean that is true if this component will be

用于模型操作

__init__(**kwds)[源代码]

方法

__init__(**kwds)

activate()

将活动属性设置为True

clear_suffix_value(suffix_or_name[, expand])

清除此组件数据的后缀值

cname(*args, **kwds)

已弃用。

construct([data])

用于构建组件的API定义

deactivate()

将活动属性设置为False

display([ostream, verbose, prefix])

get_suffix_value(suffix_or_name[, default])

获取此组件数据的后缀值

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

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

is_component_type()

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

is_constructed()

如果这个类已经被构造,则返回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])

打印组件信息

reconstruct([data])

已移除:reconstruct() 在 Pyomo 6.0 中被移除。

root_block()

返回 self.model()

set_suffix_value(suffix_or_name, value[, expand])

设置此组件数据的后缀值

type()

已弃用。

valid_model_component()

如果这可以用作模型组件,则返回True。

属性

active

返回活动属性

ctype

返回此组件的类类型

local_name

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

name

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

成员文档

activate()[source]

将活动属性设置为True

clear_suffix_value(suffix_or_name, expand=True)

清除此组件数据的后缀值

cname(*args, **kwds)

已弃用。

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

construct(data=None)

用于构建组件的API定义

deactivate()[source]

将活动属性设置为False

get_suffix_value(suffix_or_name, default=None)

获取此组件数据的后缀值

getname(fully_qualified=False, name_buffer=None, relative_to=None)

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

Parameters:
  • fully_qualified (bool) – 从嵌套的块名称生成全名

  • relative_to (Block) – 生成相对于指定块的完全限定名称。

is_component_type()

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

is_constructed()

如果这个类已经被构造,则返回True

is_expression_type(expression_system=None)

如果此数值是一个表达式,则返回 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=None, verbose=False, prefix='')

打印组件信息

reconstruct(data=None)

已移除:reconstruct() 在 Pyomo 6.0 中被移除。

重新构建模型组件是脆弱的,并且不能正确更新在其他组件或上下文中使用的组件实例(这对于Var、Param和Set尤其成问题)。希望重现reconstruct()旧行为的用户,如果愿意操作非公开接口,并且愿意花时间验证他们的模型是否正确执行,可以通过以下方式近似实现reconstruct的旧行为:

component.clear() component._constructed = False component.construct()

root_block()

返回 self.model()

set_suffix_value(suffix_or_name, value, expand=True)

设置此组件数据的后缀值

type()

已弃用。

返回此组件的类类型

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

valid_model_component()

如果这可以用作模型组件,则返回True。

property active

返回活动属性

property ctype

返回此组件的类类型

property local_name

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

property name

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