pycity_scheduling.classes.base.components package

Submodules

pycity_scheduling.classes.base.components.component module

class pycity_scheduling.classes.base.components.component.Component

Bases: object

Base class for all components.

Components contain the specific characteristics of symbols and expressions referenced by equations or inequalities.

Attributes:
symbol

Methods

add_symbol(s)

Add Symbol that references this Component

create(value)

Create a new Component for the specified value.

lb(a, b)

Generate a lower bound for the Component in the specified interval

max(a, b)

Generate a expression representing the maximum value of the Component in the specified interval

mean(a, b)

Generate a mean for the Component in the specified interval.

min(a, b)

Generate an expression representing the minimal value of the Component in the specified interval

register(f)

Register a new child class for the Component 'create' factory

to_exp(a, b)

Generate a sympy expression from this component

ub(a, b)

Generate an upper bound for the Component in the specified interval

descriptive

add_symbol(s: SymbolDefinition)

Add Symbol that references this Component

Parameters:

s (SymbolDefinition) – New Symbol that references this Component

static create(value: Any) Component

Create a new Component for the specified value. Component Class is automatically determined.

Parameters:

value (Any) – Value to create component from

Returns:

Newly created component

Return type:

Component

descriptive()
lb(a: float, b: float) float

Generate a lower bound for the Component in the specified interval

Parameters:
  • a (float) – Interval start for lower bound consideration

  • b (float) – Interval end for lower bound consideration

Returns:

Generated lower bound for the interval

Return type:

lower_bound

lookup = <WeakValueDictionary>
max(a: float, b: float) Expr | float

Generate a expression representing the maximum value of the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated maximum value expression for the interval

Return type:

max_expr

mean(a: float, b: float)

Generate a mean for the Component in the specified interval.

Parameters:
  • a (float) – Interval start for mean consideration

  • b (float) – Interval end for mean consideration

Returns:

Generated mean for the interval

Return type:

mean

min(a: float, b: float) Expr | float

Generate an expression representing the minimal value of the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated minimal value expression for the interval

Return type:

max_expr

classmethod register(f: Type[Component]) Callable

Register a new child class for the Component ‘create’ factory

Parameters:

f (Type[Component]) – New Child Class to register.

Returns:

Wrapper function

Return type:

wrapper_function

registry = [(<function <lambda>>, <class 'pycity_scheduling.classes.base.components.constant.Constant'>), (<function <lambda>>, <class 'pycity_scheduling.classes.base.components.expression_component.Expression'>)]
static_entity_id = 0
property symbol
to_exp(a: float, b: float) Expr | float

Generate a sympy expression from this component

Parameters:
  • a (float) – Interval start for expression

  • b (float) – Interval end for expression

Returns:

generated sympy expression

Return type:

expression

ub(a: float, b: float) float

Generate an upper bound for the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated upper bound for the interval

Return type:

upper_bound

pycity_scheduling.classes.base.components.constant module

class pycity_scheduling.classes.base.components.constant.Constant(value)

Bases: Component

Represents a constant for use in equations and inequalities to offer a unified interface under Component

Parameters:

value – Scalar value to assign to this object as its constant

Methods

lb(a, b)

Generate a lower bound for the Component in the specified interval

max(a, b)

Generate a expression representing the maximum value of the Component in the specified interval

mean(a, b)

Generate a mean for the Component in the specified interval.

min(a, b)

Generate an expression representing the minimal value of the Component in the specified interval

to_exp(a, b)

Generate a sympy expression from this component

ub(a, b)

Generate an upper bound for the Component in the specified interval

lb(a: float, b: float) float

Generate a lower bound for the Component in the specified interval

Parameters:
  • a (float) – Interval start for lower bound consideration

  • b (float) – Interval end for lower bound consideration

Returns:

Generated lower bound for the interval

Return type:

lower_bound

max(a: float, b: float) float

Generate a expression representing the maximum value of the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated maximum value expression for the interval

Return type:

max_expr

mean(a: float, b: float) float

Generate a mean for the Component in the specified interval.

Parameters:
  • a (float) – Interval start for mean consideration

  • b (float) – Interval end for mean consideration

Returns:

Generated mean for the interval

Return type:

mean

min(a: float, b: float) float

Generate an expression representing the minimal value of the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated minimal value expression for the interval

Return type:

max_expr

to_exp(a: float, b: float) float

Generate a sympy expression from this component

Parameters:
  • a (float) – Interval start for expression

  • b (float) – Interval end for expression

Returns:

generated sympy expression

Return type:

expression

ub(a: float, b: float) float

Generate an upper bound for the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated upper bound for the interval

Return type:

upper_bound

pycity_scheduling.classes.base.components.control_var module

class pycity_scheduling.classes.base.components.control_var.ControlVar(t: TimeSampler, replacement_func=None, interpolation='zero')

Bases: Component

Component that represents a control action vector over time that can be influenced by the optimization

Parameters:
  • t (TimeSampler) – TimeSampler used to determine horizons and the control sampling

  • replacement_func – Function to determine variable values with in case the variable was not created for the optimization

  • interpolation

    zero if the control variable should not change in between samples linear if the control variable changes linearly between samples and is continuous piecewise-linear if the control variable changes linearly between samples and doesn’t have to be continuous

    Defaults to zero.

Attributes:
sub_symbols

Methods

lb(a, b)

Generate a lower bound for the Component in the specified interval

max(a, b)

Generate a expression representing the maximum value of the Component in the specified interval

mean(a, b)

Generate a mean for the Component in the specified interval.

min(a, b)

Generate an expression representing the minimal value of the Component in the specified interval

to_exp(a, b)

Generate a sympy expression from this component

ub(a, b)

Generate an upper bound for the Component in the specified interval

get_var

set_schedule

set_var

update_schedule

get_var(s: Symbol)
Parameters:

s (Symbol) –

lb(a: float, b: float) float

Generate a lower bound for the Component in the specified interval

Parameters:
  • a (float) – Interval start for lower bound consideration

  • b (float) – Interval end for lower bound consideration

Returns:

Generated lower bound for the interval

Return type:

lower_bound

max(a: float, b: float) Expr

Generate a expression representing the maximum value of the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated maximum value expression for the interval

Return type:

max_expr

mean(a: float, b: float) Expr

Generate a mean for the Component in the specified interval.

Parameters:
  • a (float) – Interval start for mean consideration

  • b (float) – Interval end for mean consideration

Returns:

Generated mean for the interval

Return type:

mean

min(a: float, b: float) Expr

Generate an expression representing the minimal value of the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated minimal value expression for the interval

Return type:

max_expr

set_schedule(schedule)
set_var(v)
property sub_symbols
to_exp(a: float, b: float) Expr

Generate a sympy expression from this component

Parameters:
  • a (float) – Interval start for expression

  • b (float) – Interval end for expression

Returns:

generated sympy expression

Return type:

expression

ub(a: float, b: float) float

Generate an upper bound for the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated upper bound for the interval

Return type:

upper_bound

update_schedule(schedule)

pycity_scheduling.classes.base.components.design_var module

class pycity_scheduling.classes.base.components.design_var.DesignVar(value)

Bases: Component

Component that represents a design decision that can be influenced by the optimization

Methods

lb(a, b)

Generate a lower bound for the Component in the specified interval

max(a, b)

Generate a expression representing the maximum value of the Component in the specified interval

mean(a, b)

Generate a mean for the Component in the specified interval.

min(a, b)

Generate an expression representing the minimal value of the Component in the specified interval

to_exp(a, b)

Generate a sympy expression from this component

ub(a, b)

Generate an upper bound for the Component in the specified interval

set_var

lb(a: float, b: float) float

Generate a lower bound for the Component in the specified interval

Parameters:
  • a (float) – Interval start for lower bound consideration

  • b (float) – Interval end for lower bound consideration

Returns:

Generated lower bound for the interval

Return type:

lower_bound

max(a: float, b: float) Expr

Generate a expression representing the maximum value of the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated maximum value expression for the interval

Return type:

max_expr

mean(a: float, b: float) Expr

Generate a mean for the Component in the specified interval.

Parameters:
  • a (float) – Interval start for mean consideration

  • b (float) – Interval end for mean consideration

Returns:

Generated mean for the interval

Return type:

mean

min(a: float, b: float) Expr

Generate an expression representing the minimal value of the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated minimal value expression for the interval

Return type:

max_expr

set_var(v)
to_exp(a: float, b: float) Expr

Generate a sympy expression from this component

Parameters:
  • a (float) – Interval start for expression

  • b (float) – Interval end for expression

Returns:

generated sympy expression

Return type:

expression

ub(a: float, b: float) float

Generate an upper bound for the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated upper bound for the interval

Return type:

upper_bound

pycity_scheduling.classes.base.components.expression_component module

class pycity_scheduling.classes.base.components.expression_component.Expression(value, used_rels=[])

Bases: Component

Methods

lb(a, b)

Generate a lower bound for the Component in the specified interval

max(a, b)

Generate a expression representing the maximum value of the Component in the specified interval

mean(a, b)

Generate a mean for the Component in the specified interval.

min(a, b)

Generate an expression representing the minimal value of the Component in the specified interval

to_exp(a, b)

Generate a sympy expression from this component

ub(a, b)

Generate an upper bound for the Component in the specified interval

lb(a: float, b: float) float

Generate a lower bound for the Component in the specified interval

Parameters:
  • a (float) – Interval start for lower bound consideration

  • b (float) – Interval end for lower bound consideration

Returns:

Generated lower bound for the interval

Return type:

lower_bound

max(a: float, b: float) Expr

Generate a expression representing the maximum value of the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated maximum value expression for the interval

Return type:

max_expr

mean(a: float, b: float) Expr

Generate a mean for the Component in the specified interval.

Parameters:
  • a (float) – Interval start for mean consideration

  • b (float) – Interval end for mean consideration

Returns:

Generated mean for the interval

Return type:

mean

min(a: float, b: float) Expr

Generate an expression representing the minimal value of the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated minimal value expression for the interval

Return type:

max_expr

to_exp(a: float, b: float) Expr

Generate a sympy expression from this component

Parameters:
  • a (float) – Interval start for expression

  • b (float) – Interval end for expression

Returns:

generated sympy expression

Return type:

expression

ub(a: float, b: float) float

Generate an upper bound for the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated upper bound for the interval

Return type:

upper_bound

pycity_scheduling.classes.base.components.signal module

class pycity_scheduling.classes.base.components.signal.Signal(t: Timer, series: Series, interpolator, valid_period=(None, None))

Bases: Component

Methods

__call__(t)

Call self as a function.

lb(a, b)

Generate a lower bound for the Component in the specified interval

max(a, b)

Generate a expression representing the maximum value of the Component in the specified interval

mean(a, b)

Generate a mean for the Component in the specified interval.

min(a, b)

Generate an expression representing the minimal value of the Component in the specified interval

to_exp(a, b)

Generate a sympy expression from this component

ub(a, b)

Generate an upper bound for the Component in the specified interval

derivative

integrate

points

Parameters:
  • t (Timer) –

  • series (Series) –

derivative()
integrate(a, b)
lb(a: float, b: float) float

Generate a lower bound for the Component in the specified interval

Parameters:
  • a (float) – Interval start for lower bound consideration

  • b (float) – Interval end for lower bound consideration

Returns:

Generated lower bound for the interval

Return type:

lower_bound

max(a: float, b: float) float

Generate a expression representing the maximum value of the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated maximum value expression for the interval

Return type:

max_expr

mean(a: float, b: float) float

Generate a mean for the Component in the specified interval.

Parameters:
  • a (float) – Interval start for mean consideration

  • b (float) – Interval end for mean consideration

Returns:

Generated mean for the interval

Return type:

mean

min(a: float, b: float) float

Generate an expression representing the minimal value of the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated minimal value expression for the interval

Return type:

max_expr

points()
to_exp(a: float, b: float) Expr

Generate a sympy expression from this component

Parameters:
  • a (float) – Interval start for expression

  • b (float) – Interval end for expression

Returns:

generated sympy expression

Return type:

expression

ub(a: float, b: float) float

Generate an upper bound for the Component in the specified interval

Parameters:
  • a (float) – Interval start for upper bound consideration

  • b (float) – Interval end for upper bound consideration

Returns:

Generated upper bound for the interval

Return type:

upper_bound

pycity_scheduling.classes.base.components.signal.make_interp_spline(t: Timer, series: Series, k=3, bc_type=None, valid_period=(None, None))
Parameters:
  • t (Timer) –

  • series (Series) –

pycity_scheduling.classes.base.components.signal.make_monotonic_signal(t: Timer, series: Series, valid_period=(None, None))
Parameters:
  • t (Timer) –

  • series (Series) –

pycity_scheduling.classes.base.components.signal.make_periodic_signal(t: Timer, series: Series, k=2, valid_period=(None, None))
Parameters:
  • t (Timer) –

  • series (Series) –

pycity_scheduling.classes.base.components.signal.make_power_signal(t: Timer, series: Series, valid_period=(None, None))
Parameters:
  • t (Timer) –

  • series (Series) –

pycity_scheduling.classes.base.components.signal.make_step_signal(t: Timer, series: Series, valid_period=(None, None))
Parameters:
  • t (Timer) –

  • series (Series) –

Module contents