change tif/tcc targets to be more variable

This commit is contained in:
Josh Burman 2021-09-08 11:25:55 -04:00
parent 8ac5d5efdb
commit 4a8952fae3
4 changed files with 11 additions and 14 deletions

View File

@ -30,5 +30,10 @@ async def ready():
@app.post('/solve/') @app.post('/solve/')
async def solve(solve_request: SolveRequest): async def solve(solve_request: SolveRequest):
response = SolveResponse(response_id=randint(100,5000), forms=[Form(items=solve_request.items)]) response = SolveResponse(
response_id=randint(100,5000),
forms=[Form(
items=[item.id for item in solve_request.items]
)]
)
return response return response

View File

@ -4,4 +4,4 @@ from typing import List
from models.item import Item from models.item import Item
class Form(BaseModel): class Form(BaseModel):
items: List[Item] items: List[int]

View File

@ -1,12 +1,12 @@
from pydantic import BaseModel from pydantic import BaseModel
from typing import Dict from typing import Dict, List
from models.targets import Targets from models.target import Target
class ObjectiveFunction(BaseModel): class ObjectiveFunction(BaseModel):
# minimizing tif/tcc target value is only option currently # minimizing tif/tcc target value is only option currently
# as we add more we can build this out to be more dynamic # as we add more we can build this out to be more dynamic
# likely with models representing each objective function type # likely with models representing each objective function type
tif_targets: Targets tif_targets: List[Target]
tcc_targets: Targets tcc_targets: List[Target]
weight: Dict = {'tif': 1, 'tcc': 1} weight: Dict = {'tif': 1, 'tcc': 1}

View File

@ -1,8 +0,0 @@
from pydantic import BaseModel
class Targets(BaseModel):
n_2_5: int
n_1_5: int
n_0_5: int
p_0_5: int
p_1: int