-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
113 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,41 @@ | ||
Generalized Assignment Problem | ||
============================== | ||
|
||
Problem Definition | ||
------------------ | ||
|
||
We consider the Generalized Assignment Problem (GAP). | ||
Given a set of :math:`m` agents and :math:`n` jobs, the goal is to assign each job to exactly one agent in such a | ||
way that the total cost is minimized, while respecting the capacity constraints of each agent. | ||
|
||
Each agent :math:`i\in\{1,\dotsc,m\}` has a capacity :math:`C_i`. | ||
Each job :math:`j\in\{1,\dotsc,n\}` has a resource consumption :math:`r_{ij}` and a cost :math:`c_{ij}` when assigned to agent :math:`i`. | ||
|
||
We model the GAP with the following binary linear program: | ||
|
||
.. math:: | ||
\begin{align*} | ||
\min_{x} \ & \sum_{i=1}^m \sum_{j=1}^n c_{ij} x_{ij} \\ | ||
\text{s.t.} & \sum_{j=1}^n r_{ij} x_{ij} \le C_i && i=1,\dotsc,m \\ | ||
& \sum_{i=1}^m x_{ij} = 1 && j=1,\dotsc,n \\ | ||
& x_{ij} \in \{0,1\} && i=1,\dotsc,m, j=1,\dotsc,n. | ||
\end{align*} | ||
Decomposition | ||
------------- | ||
|
||
In this example, we use Dantzig-Wolfe decomposition to break down the problem into a master problem and subproblems. The master problem coordinates the assignment of jobs to agents, while the subproblems handle the capacity constraints for each agent individually. | ||
|
||
1. **Master Problem:** The master problem is responsible for ensuring that each job is assigned to exactly one agent. It maintains the overall objective of minimizing the total cost. | ||
|
||
2. **Subproblems:** Each subproblem corresponds to an agent and ensures that the agent's capacity constraints are respected. The subproblems are solved independently and their solutions are used to update the master problem. | ||
|
||
Implementation with idol | ||
------------------------ | ||
|
||
In this example, we show how to model the Generalized Assignment Problem with idol and how to solve it using a | ||
Dantzig-Wolfe decomposition within a branch-and-bound framework, i.e., a branch-and-price algorithm. | ||
|
||
.. literalinclude:: ../../examples/mixed-integer-optimization/assignment.example.cpp | ||
:language: cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,30 @@ | ||
Knapsack Problem | ||
================ | ||
|
||
Problem Definition | ||
------------------ | ||
|
||
We consider the Knapsack Problem (KP). | ||
Given a set of :math:`n` items, each of which having a weight and a profit, the goal is to | ||
select of subset of items such that the total weight does not exceed a given capacity and the total profit is maximized. | ||
|
||
For each item :math:`j\in\{1,\dotsc,n\}`, we denote its weight by :math:`w_j` and its profit by :math:`p_j`. | ||
The maximum capacity of the knapsack is :math:`C`. | ||
|
||
We model the KP with the following binary linear program: | ||
|
||
.. math:: | ||
\begin{align*} | ||
\max_{x} \ & \sum_{j=1}^n p_j x_j \\ | ||
\text{s.t.} & \sum_{j=1}^n w_j x_j \le C \\ | ||
& x_j \in \{0,1\} && j=1,\dotsc,n. | ||
\end{align*} | ||
Implementation with idol | ||
------------------------ | ||
|
||
In this example, we show how to model the Knapsack Problem with idol and how to solve it using the HiGHS solver. | ||
|
||
.. literalinclude:: ../../examples/mixed-integer-optimization/knapsack.example.cpp | ||
:language: cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters