diff --git a/.github/workflows/dockerhub.yml b/.github/workflows/dockerhub.yml index c3433f0..51dcd88 100644 --- a/.github/workflows/dockerhub.yml +++ b/.github/workflows/dockerhub.yml @@ -25,18 +25,18 @@ jobs: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - name: Build and push latest of objective function service + - name: Build and push latest of objective evaluation service if: ${{ steps.vars.outputs.tag == 'main' }} uses: docker/build-push-action@v2 with: context: . push: true - tags: planqk/objective-function-service:latest + tags: planqk/objective-evaluation-service:latest - - name: Build and push version of objective function service + - name: Build and push version of objective evaluation service if: ${{ steps.vars.outputs.tag != 'main' }} uses: docker/build-push-action@v2 with: context: . push: true - tags: planqk/objective-function-service:${{ steps.vars.outputs.tag }} + tags: planqk/objective-evaluation-service:${{ steps.vars.outputs.tag }} diff --git a/README.md b/README.md index b886f78..a88a12b 100644 Binary files a/README.md and b/README.md differ diff --git a/app/controller/objectiveFns/objective_controller.py b/app/controller/objectiveFns/objective_controller.py index f27e993..496c0b1 100644 --- a/app/controller/objectiveFns/objective_controller.py +++ b/app/controller/objectiveFns/objective_controller.py @@ -3,10 +3,10 @@ from app.services import objective_service from app.model.objective_response import ObjectiveResponseSchema from app.model.objective_request import ( - TSPObjectiveFunctionRequest, - TSPObjectiveFunctionRequestSchema, - MaxCutObjectiveFunctionRequest, - MaxCutObjectiveFunctionRequestSchema, + TSPObjectiveEvaluationRequest, + TSPObjectiveEvaluationRequestSchema, + MaxCutObjectiveEvaluationRequest, + MaxCutObjectiveEvaluationRequestSchema, ) @@ -20,7 +20,7 @@ @blp.route("/tsp", methods=["POST"]) @blp.arguments( - TSPObjectiveFunctionRequestSchema, + TSPObjectiveEvaluationRequestSchema, example=dict( adj_matrix=[[0, 1, 1, 0], [1, 0, 1, 1], [1, 1, 0, 1], [0, 1, 1, 0]], counts={"1" * 16: 100, "0" * 16: 100}, @@ -29,17 +29,17 @@ ), ) @blp.response(200, ObjectiveResponseSchema) -def tsp(json: TSPObjectiveFunctionRequest): +def tsp(json: TSPObjectiveEvaluationRequest): print(json) if json: return objective_service.generate_tsp_objective_response( - TSPObjectiveFunctionRequest(**json) + TSPObjectiveEvaluationRequest(**json) ) @blp.route("/max-cut", methods=["POST"]) @blp.arguments( - MaxCutObjectiveFunctionRequestSchema, + MaxCutObjectiveEvaluationRequestSchema, example={ "adj_matrix": [ [0, 3, 3, 6, 9, 1], @@ -61,9 +61,9 @@ def tsp(json: TSPObjectiveFunctionRequest): }, ) @blp.response(200, ObjectiveResponseSchema) -def max_cut(json: MaxCutObjectiveFunctionRequest): +def max_cut(json: MaxCutObjectiveEvaluationRequest): print(json) if json: return objective_service.generate_max_cut_objective_response( - MaxCutObjectiveFunctionRequest(**json) + MaxCutObjectiveEvaluationRequest(**json) ) diff --git a/app/model/objective_request.py b/app/model/objective_request.py index 0239919..4c3d441 100644 --- a/app/model/objective_request.py +++ b/app/model/objective_request.py @@ -3,7 +3,7 @@ import numpy as np -class TSPObjectiveFunctionRequest: +class TSPObjectiveEvaluationRequest: def __init__( self, adj_matrix, counts, objFun, objFun_hyperparameters={}, visualization=False ): @@ -14,7 +14,7 @@ def __init__( self.objFun_hyperparameters = objFun_hyperparameters -class TSPObjectiveFunctionRequestSchema(ma.Schema): +class TSPObjectiveEvaluationRequestSchema(ma.Schema): adj_matrix = ma.fields.List(ma.fields.List(ma.fields.Float()), required=True) counts = ma.fields.Dict( keys=ma.fields.Str(), values=ma.fields.Float(), required=True @@ -24,7 +24,7 @@ class TSPObjectiveFunctionRequestSchema(ma.Schema): objFun_hyperparameters = ma.fields.Dict(keys=ma.fields.Str(), required=False) -class MaxCutObjectiveFunctionRequest: +class MaxCutObjectiveEvaluationRequest: def __init__( self, adj_matrix, counts, objFun, objFun_hyperparameters={}, visualization=False ): @@ -35,7 +35,7 @@ def __init__( self.objFun_hyperparameters = objFun_hyperparameters -class MaxCutObjectiveFunctionRequestSchema(ma.Schema): +class MaxCutObjectiveEvaluationRequestSchema(ma.Schema): adj_matrix = ma.fields.List(ma.fields.List(ma.fields.Float())) counts = ma.fields.Dict(keys=ma.fields.Str(), values=ma.fields.Float()) objFun = ma.fields.Str() diff --git a/app/model/objective_response.py b/app/model/objective_response.py index b2f7030..c0d2bdd 100644 --- a/app/model/objective_response.py +++ b/app/model/objective_response.py @@ -1,6 +1,6 @@ from datetime import datetime import marshmallow as ma -from .objective_request import TSPObjectiveFunctionRequestSchema +from .objective_request import TSPObjectiveEvaluationRequestSchema class ObjectiveResponse: @@ -24,5 +24,5 @@ def to_json(self): class ObjectiveResponseSchema(ma.Schema): objective_value = ma.fields.Float() visualization = ma.fields.String() - input = ma.fields.Nested(TSPObjectiveFunctionRequestSchema) + input = ma.fields.Nested(TSPObjectiveEvaluationRequestSchema) timestamp = ma.fields.String() diff --git a/app/services/objective_service.py b/app/services/objective_service.py index 3db89a0..948b82c 100644 --- a/app/services/objective_service.py +++ b/app/services/objective_service.py @@ -1,6 +1,6 @@ from app.model.objective_request import ( - TSPObjectiveFunctionRequest, - MaxCutObjectiveFunctionRequest, + TSPObjectiveEvaluationRequest, + MaxCutObjectiveEvaluationRequest, ) from app.model.objective_response import ObjectiveResponse from app.services.objectiveFunctions import F_CVaR, F_EE, F_Gibbs @@ -8,7 +8,7 @@ from app.constants import * -def generate_tsp_objective_response(input: TSPObjectiveFunctionRequest): +def generate_tsp_objective_response(input: TSPObjectiveEvaluationRequest): objective_function = getObjectiveFunction( input.objFun, TSP, **input.objFun_hyperparameters ) @@ -25,7 +25,7 @@ def generate_tsp_objective_response(input: TSPObjectiveFunctionRequest): return ObjectiveResponse(objective_value, graphic, input) -def generate_max_cut_objective_response(input: MaxCutObjectiveFunctionRequest): +def generate_max_cut_objective_response(input: MaxCutObjectiveEvaluationRequest): objective_function = getObjectiveFunction( input.objFun, MAX_CUT, **input.objFun_hyperparameters )