{"id":20013307,"url":"https://github.com/markort147/the-box-problem-api","last_synced_at":"2026-04-12T03:32:00.117Z","repository":{"id":223710762,"uuid":"751570068","full_name":"markort147/the-box-problem-api","owner":"markort147","description":"Java Spring-Boot microservice that resolves a variant of the knapsack problem.","archived":false,"fork":false,"pushed_at":"2024-02-22T21:47:08.000Z","size":202,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-12T15:10:57.966Z","etag":null,"topics":["docker","java","maven","microservice","rest-api","skills-assessment","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markort147.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-01T21:39:04.000Z","updated_at":"2024-06-23T15:40:21.000Z","dependencies_parsed_at":"2024-05-16T06:53:01.715Z","dependency_job_id":null,"html_url":"https://github.com/markort147/the-box-problem-api","commit_stats":null,"previous_names":["markort147/theboxproblem","markort147/the-box-problem-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markort147%2Fthe-box-problem-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markort147%2Fthe-box-problem-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markort147%2Fthe-box-problem-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markort147%2Fthe-box-problem-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markort147","download_url":"https://codeload.github.com/markort147/the-box-problem-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241448291,"owners_count":19964449,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","java","maven","microservice","rest-api","skills-assessment","spring-boot"],"created_at":"2024-11-13T07:36:04.673Z","updated_at":"2025-12-31T01:04:33.834Z","avatar_url":"https://github.com/markort147.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Optimal Item Combination Solution\n\nThis project implements a Spring Boot microservice to determine the optimal combination of items based on weight and value constraints. It is designed for scenarios where maximizing total value within defined weight limits is desired.\n\n## Overview\n\nThe service exposes a REST API that accepts requests with a set of items and a maximum weight limit. It returns the set of items that maximizes total value without exceeding the weight limit\n\n## Getting Started\n\nThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes.\n\n### Cloning the Repository\n\nTo clone the project, run the following command:\n\n  ```bash\n  git clone https://github.com/markort147/theBoxProblem.git\n  ```\n\n### Starting the Application using Maven\n\nTo start the application, navigate to the root directory of the project and run the following command:\n\nOn Linux:\n```bash\n./mvnw spring-boot:run\n```\n\nOn Windows\n```dtd\nmvnw.cmd spring-boot:run\n```\n\nThis will start the Spring Boot application using Maven. The application will be accessible at http://localhost:8080 by default.\n\n### Starting the Application using Docker\n\nAlternatively, you can run the application by building a Docker image.\n\nFor building the image, launch the following command:\n```bash\ndocker build -t theboxproblem .\n```\n\nFor running the application, launch the followign command:\n```bash\ndocker run -p 8080:8080 theboxproblem\n```\n\n## Application Configuration\n\nThe service can be configured through the `application.properties` file. The following parameters can be adjusted:\n\n- `constraint.items.max-number`: Maximum number of items per request (e.g., 15).\n- `constraint.items.max-weight`: Maximum weight per individual item (e.g., 100).\n- `constraint.items.max-price`: Maximum price per individual item (e.g., 100).\n- `constraint.box.max-weight`: Total maximum weight for the box (e.g., 100).\n- `data-format.weight-decimals`: Number of decimal places to use for weight (e.g., 2). \n\n## API Usage\n\nThe API can be accessed via the following endpoint: \n  ```\n  POST /api/best-combination\n  ```\n\n### Request Format\n\nThe API expects a JSON request with the following structure:\n\n```json\n{\n  \"max_weight\": 100,\n  \"items\": [\n    {\n      \"Item ID\": 1,\n      \"Weight\": 20.35,\n      \"Price\": 5\n    },\n    {\n      \"Item ID\": 2,\n      \"Weight\": 25,\n      \"Price\": 15.15\n    }\n    // additional items...\n  ]\n}\n```\n\n- `max_weight`: The maximum weight the box can carry.\n- `items`: A list of items, each with an id, weight, and price. Items can be listed in any order.\n  - `Item ID`: unique ID of the item\n  - `Weight`: weight of the item\n  - `Price`: price of the item\n\n\n### Response Format\n\nThe response will be a JSON object containing the best combination of item IDs:\n\n```json\n{\n  \"items\": [1, 2, ...]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkort147%2Fthe-box-problem-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkort147%2Fthe-box-problem-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkort147%2Fthe-box-problem-api/lists"}