使用pymoo实现遗传算法
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
from .database import *
|
||||
from .s0_base import *
|
||||
|
||||
|
||||
def get_scheme_schema(name: str) -> dict[str, dict[Any, Any]]:
|
||||
return { 'id' : {'type': 'str' , 'optional': False , 'readonly': True },
|
||||
'name' : {'type': 'str' , 'optional': False , 'readonly': False},
|
||||
'type' : {'type': 'str' , 'optional': False , 'readonly': False},
|
||||
"create_time": {'type': 'str' , 'optional': False , 'readonly': True },
|
||||
"start_time" : {'type': 'str' , 'optional': False , 'readonly': True },
|
||||
"detail" : {'type': 'str' , 'optional': False , 'readonly': True } }
|
||||
|
||||
return {
|
||||
"id": {"type": "str", "optional": False, "readonly": True},
|
||||
"name": {"type": "str", "optional": False, "readonly": False},
|
||||
"type": {"type": "str", "optional": False, "readonly": False},
|
||||
"create_time": {"type": "str", "optional": False, "readonly": True},
|
||||
"start_time": {"type": "str", "optional": False, "readonly": True},
|
||||
"detail": {"type": "str", "optional": False, "readonly": True},
|
||||
}
|
||||
|
||||
|
||||
def get_scheme(name: str, schema_name: str) -> dict[Any, Any]:
|
||||
t = try_read(name, f"select * from scheme_list where scheme_name = '{schema_name}'")
|
||||
@@ -16,15 +19,15 @@ def get_scheme(name: str, schema_name: str) -> dict[Any, Any]:
|
||||
return {}
|
||||
|
||||
d = {}
|
||||
d['id'] = str(t['scheme_id'])
|
||||
d['name'] = str(t['scheme_name'])
|
||||
d['type'] = str(t['scheme_type'])
|
||||
d['create_time'] = str(t['create_time'])
|
||||
d['start_time'] = str(t['start_time'])
|
||||
d['detail'] = str(t['detail'])
|
||||
d["id"] = str(t["scheme_id"])
|
||||
d["name"] = str(t["scheme_name"])
|
||||
d["type"] = str(t["scheme_type"])
|
||||
d["create_time"] = str(t["create_time"])
|
||||
d["start_time"] = str(t["start_time"])
|
||||
d["detail"] = str(t["detail"])
|
||||
|
||||
return d
|
||||
|
||||
|
||||
def get_all_schemes(name: str) -> list[dict[Any, Any]]:
|
||||
return read_all(name, "select * from scheme_list")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user