{"id":25811310,"url":"https://github.com/quantum-software-development/optimization-simulation-modelin-linearprogramming","last_synced_at":"2025-02-28T00:38:28.147Z","repository":{"id":278377262,"uuid":"935420221","full_name":"Quantum-Software-Development/Optimization-Simulation-Modelin-LinearProgramming","owner":"Quantum-Software-Development","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-22T21:14:55.000Z","size":3311,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-22T21:27:12.463Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"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/Quantum-Software-Development.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":"FUNDING.yml","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},"funding":{"github":"Quantum-Software-Developmen","Custom":"https://github.com/sponsors/Quantum-Software-Development/card"}},"created_at":"2025-02-19T12:17:47.000Z","updated_at":"2025-02-22T21:14:57.000Z","dependencies_parsed_at":"2025-02-22T21:37:16.060Z","dependency_job_id":null,"html_url":"https://github.com/Quantum-Software-Development/Optimization-Simulation-Modelin-LinearProgramming","commit_stats":null,"previous_names":["quantum-software-development/optimization-and-simulation","quantum-software-development/optimization-simulation-modelin-linearprogramming"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantum-Software-Development%2FOptimization-Simulation-Modelin-LinearProgramming","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantum-Software-Development%2FOptimization-Simulation-Modelin-LinearProgramming/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantum-Software-Development%2FOptimization-Simulation-Modelin-LinearProgramming/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantum-Software-Development%2FOptimization-Simulation-Modelin-LinearProgramming/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Quantum-Software-Development","download_url":"https://codeload.github.com/Quantum-Software-Development/Optimization-Simulation-Modelin-LinearProgramming/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241079536,"owners_count":19906070,"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":[],"created_at":"2025-02-28T00:38:27.585Z","updated_at":"2025-02-28T00:38:28.130Z","avatar_url":"https://github.com/Quantum-Software-Development.png","language":null,"readme":"\n\u003cbr\u003e\n\n#  \u003cp align=\"center\"\u003e  Integrated Mathematics Project\n###  \u003cp align=\"center\"\u003e  [Optimization / Simulation / Modelin / Linear Programming / Simplex Algorithm / Matrix / Mathematics]()\n\n\n\u003cbr\u003e\n\n\u003c!--### \u003cp align=\"center\"\u003e  \u003cimg src=\"https://github.githubassets.com/images/icons/emoji/octocat.png\" width=\"46\"\u003e  --\u003e\n### \u003cp align=\"center\"\u003e [![Sponsor Quantum Software Development](https://img.shields.io/badge/Sponsor-Quantum%20Software%20Development-brightgreen?logo=GitHub)](https://github.com/sponsors/Quantum-Software-Development)\n\n\u003cbr\u003e\n\n\n### This Repo is focused on mathematical concepts, taught during the third semester of the Data Science and Artificial Intelligence bachelor's program at PUC-SP in 2022, under the instruction of Professor [Daniel Rodrigues da Silva](https://www.linkedin.com/in/daniel-rodrigues-048654a5/)\n\n\n\u003cbr\u003e\u003cbr\u003e\n\n## [Introduction to optimization problems and their basic properties]():\n\nConstrained and unconstrained optimization. Linear Programming: formulation, geometric solution, simplex method, and duality. Network flow models: Transportation, Assignment, Shortest Path, and Maximum Flow problems. Integer programming. Multiobjective programming. Monte Carlo and discrete event simulation.\n\n\nOptimization and simulation are two key areas in Operations Research, used for problem-solving and decision-making, but they approach these tasks differently[4][5]. Simulation creates a virtual model to analyze a system's behavior under various conditions, allowing for experimentation by varying parameters[1]. Optimization, on the other hand, employs mathematical algorithms to identify the best configuration of these parameters, aiming to maximize or minimize a specific objective, such as reducing costs or increasing efficiency[1][2].\n\n**Sim-Opt (Simulation-Optimization)**\nSim-opt combines simulation and optimization techniques to provide a comprehensive and dynamic understanding of a system[1]. This approach integrates real-world uncertainties with the search for ideal solutions[1]. By simulating the impact of each parameter and comparing it to an ideal scenario, sim-opt helps identify the factors that most influence a system's performance, leading to more strategic decisions[1].\n\n[**Benefits of Sim-Opt**]()\n*   **Analyzing uncertain scenarios:** Sim-opt evaluates the impact of unpredictable events and helps plan strategies to manage risks[1].\n*   **Optimizing processes:** It identifies bottlenecks and opportunities for improvement and defines the best practices for various situations[1].\n*   **Making informed decisions:** Sim-opt bases decisions on data and simulations, reducing uncertainty and the risk of errors[1].\n\n[**How to Implement Optimization in Simulation Models**]()\n\n1.  **Define decision variables:** Identify the variables that affect the simulation model's outputs and will be tested by the optimization algorithm[3].\n2.  **Define variable types and limits:** Determine whether each decision variable is real or integer and set lower and upper limits. The optimization algorithm will search for solutions within these limits[3].\n3.  **Define the objective function:** Establish a function to evaluate the solutions tested by the algorithm. This function can be designed to minimize, maximize, or use both types of variables, depending on the study's objectives[3].\n4.  **Select population size:** Choose the number of solutions for the evolutionary algorithm. The population size affects the reliability and time required for the search. Also, define other parameters such as the required precision, significance level, and number of replications[3].\n5.  **Analyze solutions:** After the search, analyze the solutions found. Compare all solutions based on the objective function to identify the best and other competitive solutions[3].\n\nThe key difference between sim-opt and other analytical tools is its ability to model the complexity and dynamics of real-world systems, including data uncertainty and variability[1]. This allows for the creation of more robust and adaptable plans[1].\n\n\u003cbr\u003e\n\n## [Optimization Problem]()\n\n### An optimization problem can be represented using the `optidef` package. For example:\n\n$$\n\\begin{aligned}\n    \u0026\\min_{x} f(x) \\\\\n    \u0026\\text{subject to } x \\geq 0\n\\end{aligned}\n$$\n\n\n```latex\n\\begin{aligned}\n    \u0026\\min_{x} f(x) \\\\\n    \u0026\\text{subject to } x \\geq 0\n\\end{aligned}\n```\n\n\u003cbr\u003e\n\n\n## [Simplex Algorithm]()\n\nThe simplex algorithm is used to solve linear problems. Although there isn't a specific command for it, we can describe it in text or use tables to show the steps of the algorithm.\n\n### [Matrix]()\n\nA matrix can be created using the `amsmath` package:\n\n$$\nA =\n\\begin{bmatrix}\na_{11} \u0026 a_{12} \\\\\na_{21} \u0026 a_{22}\n\\end{bmatrix}\n$$\n\n```latex\nA =\n\\begin{bmatrix}\na_{11} \u0026 a_{12} \\\\\na_{21} \u0026 a_{22}\n\\end{bmatrix}\n```\n\n\u003cbr\u003e\n\n### [Simulation]()\n\nSimulation generally involves complex mathematical models that can be described using differential or integral equations.\n\n$$\ny(t) = A e^{kt}\n$$\n\n```latex\ny(t) = A e^{kt}\n```\n\u003cbr\u003e\n\n#### This equation represents a simple solution to an ordinary differential equation.\n\n\u003cbr\u003e\n\n## [Modeling - Writing Mathematical Models]()\n\n\n### Example 1: [Maximizing Profit for a Chocolate Manufacturer]()\n\nA chocolate manufacturer has a stock of chocolates, consisting of 130 kg with cherry filling and 170 kg with mint filling. He decides to sell the stock in the form of two different assorted packages. One package contains a mix with half the weight in cherry chocolates and half in mint chocolates and sells for R$ 20.00 per kg. The other package contains a mix of one-third cherry chocolates and two-thirds mint chocolates and sells for R$ 12.50 per kg. How many kilograms of each mix should the seller prepare to maximize his sales profit?\n\n### [Solution]():\n\n###  Objective Function\n\n#### [Maximize]():\n\n$$\nZ = 20x_1 + 12.5x_2\n$$\n\n\n#### [Subject to Constraints]():\n\n$$\n\\begin{cases}\n    \\frac{x_1}{2} + \\frac{x_2}{3} \\leq 130 \\\\\n    \\frac{x_1}{2} + \\frac{2x_2}{3} \\leq 170 \\\\\n    x_1 \\geq 0, \\quad x_2 \\geq 0\n\\end{cases}\n$$\n\n\n### Solution Steps\n\n1. Express the cherry chocolate constraint:\n   \n   $$\\frac{x_1}{2} + \\frac{x_2}{3} \\leq 130$$\n   \n2. Express the mint chocolate constraint:\n   \n   $$\\frac{x_1}{2} + \\frac{2x_2}{3} \\leq 170$$\n   \n Solve the system using the **Simplex Method** or an optimization tool.\n\n\u003cbr\u003e\n\n### Optimal Solution:\n\n#### [Solving the system yields]():\n\n$$\n(x_1, x_2) = (180, 120)\n$$\n\n#### [Maximum Profit Calculation]()\n\n$$\nZ = 20(180) + 12.5(120)\n$$\n\n$$\nZ = 3600 + 1500 = 5100\n$$\n\n\u003cbr\u003e\n\nThus, the maximum profit achievable is [**R$ 5,100**]().\n\n\n\n\n\n\n\u003c!--\nLet:\n- **A** be the mix with half cherry and half mint chocolates, and let **x₁** be the number of kilograms prepared of this mix.\n- **B** be the mix with one-third cherry and two-thirds mint chocolates, and let **x₂** be the number of kilograms prepared of this mix.\n\n### Decision Variables:\n- \\( x_1 \\) is the quantity (in kg) of mix A prepared.\n- \\( x_2 \\) is the quantity (in kg) of mix B prepared.\n\n### Objective Function:\nMix A is sold for R$ 20 per kg, and mix B is sold for R$ 12.50 per kg. Therefore, the objective function to be maximized is:\n\n$Z = 20x_1 + 12.5x_2\\$\n\n### Constraints:\nEach kilogram of mix A contains half a kilogram of cherry chocolates, and each kilogram of mix B contains one-third of a kilogram of cherry chocolates. Therefore, the total amount of cherry chocolates used is:\n\n$\\frac{x_1}{2} + \\frac{x_2}{3} \\leq 130\\$\n\nEach kilogram of mix A contains half a kilogram of mint chocolates, and each kilogram of mix B contains two-thirds of a kilogram of mint chocolates. Therefore, the total amount of mint chocolates used is:\n\n$\\frac{x_1}{2} + \\frac{2x_2}{3} \\leq 170\\$\n\nAdditionally, we have the non-negativity constraints:\n\n$x_1 \\geq 0, \\quad x_2 \\geq 0\\$\n\n### Mathematically Modeled Problem:\n\n$\\text{Maximize } Z = 20x_1 + 12.5x_2\\$\n\nSubject to:\n\n$\\frac{x_1}{2} + \\frac{x_2}{3} \\leq 130\\$\n\n$\\frac{x_1}{2} + \\frac{2x_2}{3} \\leq 170\\$\n\n$x_1 \\geq 0, \\quad x_2 \\geq 0\\$\n--\u003e\n\n\n\u003cbr\u003e\n\n\n\n\n\n\n\n\n\n\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n## [Contribute]()\n\nContributions are welcome! If you want to add more examples, correct errors, or improve the documentation, please submit a pull request. Let's learn and grow together on the journey of integral calculus.\n\n### [How to Contribute]()\n\nAny contributions are highly appreciated.  You can contribute in two ways:\n\n   1. Create an issue and tell us your idea 💡. Make sure that you use the new idea label in this case;\n\n   2. Fork the project and submit a full requesto with your new idea. Before doing that, please make sure that you read and follow the [Contributions Guide](https://github.com/Mindful-AI-Assistants/.github/blob/9e7e98f98af07a1d6c4bdeb349e1a9db04f8ed0e/CONTRIBUTIBNG.md). ⊹★🔭๋࣭\n\n\n### [Main Contributors]() \n\n- [Fabiana 🚀 Campanari](https://github.com/FabianaCampanari) \n\n\u003cbr\u003e\n\n## [Sources]()\n\n[1] Simulação-otimização: como combiná-las na tomada de decisões e ... https://logweb.com.br/simulacao-otimizacao-como-combina-las-na-tomada-de-decisoes-e-na-resolucao-de-problemas-na-logistica-e-supply-chain/\n\n[2] O que é otimização? - VirtualCAE https://virtualcae.com.br/2022/11/25/o-que-e-otimizacao/\n\n[3] [PDF] otimização em modelos de simulação: um estudo http://www.din.uem.br/sbpo/sbpo2011/pdf/87592.\n\n[4] SIMULAÇÃO-OTIMIZAÇÃO: PORQUE E COMO COMBINÁ-LAS? https://www.podesenvolvimento.org.br/podesenvolvimento/article/view/623\n\n[5] [PDF] TUTORIAL CONVIDADO SIMULAÇÃO-OTIMIZAÇÃO: PORQUE E ... https://revistapodes.emnuvens.com.br/podesenvolvimento/article/download/623/412/4420\n\n[6] [PDF] Modelos de Otimização e Simulação - DCA https://www.dca.fee.unicamp.br/~gomide/courses/EA044/transp/EA_044_ModelosOtimizacaoSimulacao.pdf\n\n[7] Simulação e Otimização de processos: planejamento eficiente https://paragon.com.br/simulacao-e-otimizacao-de-processos-planejamento-eficiente/\n\n[8] Modelagem de Simulação vs Otimização: Como Escolher - LinkedIn https://www.linkedin.com/advice/0/how-do-you-choose-between-simulation-modeling?lang=pt\n\n\n\n#\n\n###### \u003cp align=\"center\"\u003e Copyright 2025 Quantum Software Development. Code released under the [MIT License license.](https://github.com/Quantum-Software-Development/Math/blob/3bf8270ca09d3848f2bf22f9ac89368e52a2fb66/LICENSE)\n","funding_links":["https://github.com/sponsors/Quantum-Software-Developmen","https://github.com/sponsors/Quantum-Software-Development/card","https://github.com/sponsors/Quantum-Software-Development"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquantum-software-development%2Foptimization-simulation-modelin-linearprogramming","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquantum-software-development%2Foptimization-simulation-modelin-linearprogramming","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquantum-software-development%2Foptimization-simulation-modelin-linearprogramming/lists"}