mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-04-19 08:55:15 +00:00
* mate -> cxTwoPoints needs at least two elements.
This commit is contained in:
parent
e18201dcb3
commit
c7eb3ec63b
@ -3,7 +3,7 @@ from typing import Any, Optional, Tuple
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from deap import algorithms, base, creator, tools
|
from deap import algorithms, base, creator, tools
|
||||||
from pydantic import BaseModel, Field, model_validator
|
from pydantic import BaseModel, Field, field_validator, model_validator
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
|
|
||||||
from akkudoktoreos.class_akku import EAutoParameters, PVAkku, PVAkkuParameters
|
from akkudoktoreos.class_akku import EAutoParameters, PVAkku, PVAkkuParameters
|
||||||
@ -40,6 +40,14 @@ class OptimizationParameters(BaseModel):
|
|||||||
raise ValueError("Input lists have different lenghts")
|
raise ValueError("Input lists have different lenghts")
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@field_validator("start_solution")
|
||||||
|
def validate_start_solution(
|
||||||
|
cls, start_solution: Optional[list[float]]
|
||||||
|
) -> Optional[list[float]]:
|
||||||
|
if start_solution is not None and len(start_solution) < 2:
|
||||||
|
raise ValueError("Requires at least two values.")
|
||||||
|
return start_solution
|
||||||
|
|
||||||
|
|
||||||
class EAutoResult(BaseModel):
|
class EAutoResult(BaseModel):
|
||||||
"""This object contains information related to the electric vehicle and its charging and discharging behavior."""
|
"""This object contains information related to the electric vehicle and its charging and discharging behavior."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user