ads2_2022/code/python/models/commands-schema.yaml

181 lines
5.0 KiB
YAML

openapi: 3.0.3
info:
version: 0.2.0
title: Schemata for command instructions
servers:
- url: "."
paths: {}
components:
schemas:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Commands
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Commands:
description: |-
List of commands to test algorithms/datastructures.
type: array
items:
$ref: "#/components/schemas/Command"
default: []
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Command
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Command:
description: |-
Instructions for command to call
type: object
required:
- name
properties:
name:
$ref: '#/components/schemas/EnumAlgorithmNames'
additionalProperties: true
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Algorithm: Tarjan
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CommandTarjan:
description: |-
Instructions for execution of Tarjan-Algorithm
type: object
required:
- name
- nodes
- edges
properties:
name:
$ref: '#/components/schemas/EnumAlgorithmNames'
nodes:
type: array
items:
anyOf:
- type: integer
- type: number
- type: string
edges:
type: array
items:
type: array
minItems: 2
maxItems: 2
items:
anyOf:
- type: integer
- type: number
- type: string
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Algorithm: TSP
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CommandTsp:
description: |-
Instructions for execution of TSP-Algorithm
type: object
required:
- name
- optimise
- dist
properties:
name:
$ref: '#/components/schemas/EnumAlgorithmNames'
dist:
type: array
items:
type: array
items:
type: number
optimise:
$ref: '#/components/schemas/EnumOptimiseMode'
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Algorithm: Hirschberg
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CommandHirschberg:
description: |-
Instructions for execution of Hirschberg-Algorithm
type: object
required:
- name
- word1
- word2
properties:
name:
$ref: '#/components/schemas/EnumAlgorithmNames'
word1:
description: Word that gets placed vertically in algorithm.
type: string
word2:
description: Word that gets placed horizontally in algorithm
type: string
once:
type: boolean
default: false
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Algorithm: Rucksack Branch & Bound
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CommandRucksack:
description: |-
Instructions for execution of Branch & Bound-Algorithm for the Rucksack-Problem
type: object
required:
- algorithm
- max-cost
- costs
- values
properties:
algorithm:
$ref: '#/components/schemas/EnumRucksackAlgorithm'
allow-fractional:
type: boolean
default: false
max-cost:
description: Upper bound for total cost of rucksack.
type: number
minimum: 0
costs:
description: Array of cost for each item (e.g. volume, weight, price, time, etc.).
type: array
items:
type: number
exclusiveMinimum: 0
values:
description: Value extracted from each item (e.g. energy, profit, etc.).
type: array
items:
type: number
items:
description: Optional names of the items (if empty, defaults to 1-based indexes).
type: array
items:
type: string
default: []
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Enum Algorithm Names
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EnumAlgorithmNames:
description: |-
Enumeration of possible algorithm options.
type: string
enum:
- TARJAN
- TSP
- HIRSCHBERG
- RUCKSACK
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Enum Optimise Mode
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EnumOptimiseMode:
description: |-
Enumeration of optimisation modi.
type: string
enum:
- MIN
- MAX
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Enum Rucksack mode for algorithm
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EnumRucksackAlgorithm:
description: |-
Enumeration of mode for Rucksack problem
type: string
enum:
- GREEDY
- BRANCH-AND-BOUND