Update app.py
Browse files
app.py
CHANGED
|
@@ -253,7 +253,7 @@ In our renewable energy model, the **objective function** is to minimize the tot
|
|
| 253 |
st.latex(r"""
|
| 254 |
\text{Minimize } \quad \sum_{r, g} \text{Cost}_{g} \times \text{Capacity}_{r, g} + \text{Battery Cost} \times \text{Battery Capacity}
|
| 255 |
""")
|
| 256 |
-
st.
|
| 257 |
where:
|
| 258 |
- $r$ represents the region (in this case, a single region),
|
| 259 |
- $g$ represents the generation technology (solar, onshore wind, offshore wind, river),
|
|
@@ -268,39 +268,43 @@ st.markdown("""
|
|
| 268 |
Typically, optimization models produce a **single optimal solution** that minimizes the cost under a given set of constraints. However, in many real-world applications, there are **multiple near-optimal solutions** that achieve similar costs but vary in other characteristics. This diversity is valuable because:
|
| 269 |
- **Flexibility**: Different solutions might be preferable depending on policy objectives, geographic constraints, or social preferences.
|
| 270 |
- **Robustness**: Exploring near-optimal solutions reveals which elements (e.g., specific technologies or infrastructure investments) are consistently essential, regardless of slight variations in cost.
|
|
|
|
| 271 |
MGA addresses this need by generating **alternative solutions** that are close to the optimal cost but differ in technological composition.
|
| 272 |
""")
|
| 273 |
|
| 274 |
st.write("## How MGA Works: Adding a Cost Constraint")
|
| 275 |
-
st.
|
| 276 |
To generate alternatives, MGA introduces a **cost tolerance** parameter $\epsilon$, which represents the acceptable increase in total cost relative to the optimal solution. The cost constraint for alternative solutions is expressed as:
|
| 277 |
""")
|
| 278 |
st.latex(r"""
|
| 279 |
\text{Total Cost} \leq (1 + \epsilon) \times \text{Optimal Cost}
|
| 280 |
""")
|
| 281 |
-
st.
|
| 282 |
where:
|
| 283 |
-
- $\epsilon$ is the cost deviation percentage (e.g., if $\epsilon = 0.05
|
| 284 |
- $\text{Optimal Cost}$ is the minimum cost obtained from the initial optimization.
|
|
|
|
| 285 |
This constraint allows for flexibility in cost, enabling the exploration of solutions that are **near-optimal** but differ in terms of installed capacities for each technology.
|
| 286 |
""")
|
| 287 |
|
| 288 |
st.markdown("""
|
| 289 |
### MGA Process in This Application
|
| 290 |
-
1. **Initial Optimization**: First, we solve for the optimal solution to obtain the minimal total cost, referred to as $\text{Optimal Cost}
|
| 291 |
2. **Setting the Cost Threshold**: We introduce a range of $\epsilon$ values (0%, 5%, 10%, etc.) to explore how alternative solutions differ as we allow for higher costs.
|
| 292 |
3. **Minimizing and Maximizing Capacities**: For each selected technology (e.g., solar, wind, hydro), we attempt to:
|
| 293 |
- **Minimize the installed capacity** within the allowed cost threshold, identifying configurations with the lowest feasible capacity for that technology.
|
| 294 |
- **Maximize the installed capacity** under the same conditions, exploring configurations with higher reliance on that technology.
|
|
|
|
| 295 |
These steps generate a set of **alternative solutions** that are close in cost but vary significantly in their reliance on each technology, revealing **flexibility** and **trade-offs** in the renewable energy system configuration.
|
| 296 |
""")
|
| 297 |
|
| 298 |
st.write("## Interpreting the Cost Threshold (\\( \\epsilon \\))")
|
| 299 |
st.markdown("""
|
| 300 |
The cost threshold parameter \\( \\epsilon \\) is crucial in MGA, as it determines the range within which we consider solutions to be "near-optimal." For example:
|
| 301 |
-
- **\\( \\epsilon = 0
|
| 302 |
-
- **\\( \\epsilon = 5
|
| 303 |
-
- **\\( \\epsilon = 10
|
|
|
|
| 304 |
By exploring a range of \\( \\epsilon \\) values, we can see how the system configuration changes as we relax the cost constraint, offering a broader view of feasible solutions.
|
| 305 |
""")
|
| 306 |
|
|
@@ -308,9 +312,11 @@ st.markdown("""
|
|
| 308 |
## Visualization of Results
|
| 309 |
- **Cost Breakdown**: The total cost of each solution, broken down by technology, helps us see the contribution of each technology to the total cost.
|
| 310 |
- **Capacity Ranges**: For each technology, we plot the minimum and maximum capacities across different \\( \\epsilon \\) values, showing the flexibility in system design as cost thresholds change.
|
|
|
|
| 311 |
This visualization provides insights into:
|
| 312 |
- Which technologies are essential (appear consistently in solutions across all \\( \\epsilon \\) values),
|
| 313 |
- Which technologies offer flexibility (capacities vary widely as \\( \\epsilon \\) increases),
|
| 314 |
- The cost impact of relying more or less on specific technologies.
|
|
|
|
| 315 |
Through MGA, we can make more **informed decisions** about the renewable energy mix and identify robust, flexible strategies that align with broader goals beyond cost minimization.
|
| 316 |
""")
|
|
|
|
| 253 |
st.latex(r"""
|
| 254 |
\text{Minimize } \quad \sum_{r, g} \text{Cost}_{g} \times \text{Capacity}_{r, g} + \text{Battery Cost} \times \text{Battery Capacity}
|
| 255 |
""")
|
| 256 |
+
st.markdown("""
|
| 257 |
where:
|
| 258 |
- $r$ represents the region (in this case, a single region),
|
| 259 |
- $g$ represents the generation technology (solar, onshore wind, offshore wind, river),
|
|
|
|
| 268 |
Typically, optimization models produce a **single optimal solution** that minimizes the cost under a given set of constraints. However, in many real-world applications, there are **multiple near-optimal solutions** that achieve similar costs but vary in other characteristics. This diversity is valuable because:
|
| 269 |
- **Flexibility**: Different solutions might be preferable depending on policy objectives, geographic constraints, or social preferences.
|
| 270 |
- **Robustness**: Exploring near-optimal solutions reveals which elements (e.g., specific technologies or infrastructure investments) are consistently essential, regardless of slight variations in cost.
|
| 271 |
+
|
| 272 |
MGA addresses this need by generating **alternative solutions** that are close to the optimal cost but differ in technological composition.
|
| 273 |
""")
|
| 274 |
|
| 275 |
st.write("## How MGA Works: Adding a Cost Constraint")
|
| 276 |
+
st.markdown("""
|
| 277 |
To generate alternatives, MGA introduces a **cost tolerance** parameter $\epsilon$, which represents the acceptable increase in total cost relative to the optimal solution. The cost constraint for alternative solutions is expressed as:
|
| 278 |
""")
|
| 279 |
st.latex(r"""
|
| 280 |
\text{Total Cost} \leq (1 + \epsilon) \times \text{Optimal Cost}
|
| 281 |
""")
|
| 282 |
+
st.markdown("""
|
| 283 |
where:
|
| 284 |
+
- $\epsilon$ is the cost deviation percentage (e.g., if $\epsilon = 0.05$, then the solution can be up to 5% more expensive than the optimal cost),
|
| 285 |
- $\text{Optimal Cost}$ is the minimum cost obtained from the initial optimization.
|
| 286 |
+
|
| 287 |
This constraint allows for flexibility in cost, enabling the exploration of solutions that are **near-optimal** but differ in terms of installed capacities for each technology.
|
| 288 |
""")
|
| 289 |
|
| 290 |
st.markdown("""
|
| 291 |
### MGA Process in This Application
|
| 292 |
+
1. **Initial Optimization**: First, we solve for the optimal solution to obtain the minimal total cost, referred to as $\text{Optimal Cost}$.
|
| 293 |
2. **Setting the Cost Threshold**: We introduce a range of $\epsilon$ values (0%, 5%, 10%, etc.) to explore how alternative solutions differ as we allow for higher costs.
|
| 294 |
3. **Minimizing and Maximizing Capacities**: For each selected technology (e.g., solar, wind, hydro), we attempt to:
|
| 295 |
- **Minimize the installed capacity** within the allowed cost threshold, identifying configurations with the lowest feasible capacity for that technology.
|
| 296 |
- **Maximize the installed capacity** under the same conditions, exploring configurations with higher reliance on that technology.
|
| 297 |
+
|
| 298 |
These steps generate a set of **alternative solutions** that are close in cost but vary significantly in their reliance on each technology, revealing **flexibility** and **trade-offs** in the renewable energy system configuration.
|
| 299 |
""")
|
| 300 |
|
| 301 |
st.write("## Interpreting the Cost Threshold (\\( \\epsilon \\))")
|
| 302 |
st.markdown("""
|
| 303 |
The cost threshold parameter \\( \\epsilon \\) is crucial in MGA, as it determines the range within which we consider solutions to be "near-optimal." For example:
|
| 304 |
+
- **\\( \\epsilon = 0\\%**: Only the exact optimal solution is considered.
|
| 305 |
+
- **\\( \\epsilon = 5\\%**: Solutions within 5% of the optimal cost are considered acceptable, allowing for slightly more flexibility in technology choice.
|
| 306 |
+
- **\\( \\epsilon = 10\\%**: Solutions within 10% of the optimal cost are allowed, providing even greater flexibility.
|
| 307 |
+
|
| 308 |
By exploring a range of \\( \\epsilon \\) values, we can see how the system configuration changes as we relax the cost constraint, offering a broader view of feasible solutions.
|
| 309 |
""")
|
| 310 |
|
|
|
|
| 312 |
## Visualization of Results
|
| 313 |
- **Cost Breakdown**: The total cost of each solution, broken down by technology, helps us see the contribution of each technology to the total cost.
|
| 314 |
- **Capacity Ranges**: For each technology, we plot the minimum and maximum capacities across different \\( \\epsilon \\) values, showing the flexibility in system design as cost thresholds change.
|
| 315 |
+
|
| 316 |
This visualization provides insights into:
|
| 317 |
- Which technologies are essential (appear consistently in solutions across all \\( \\epsilon \\) values),
|
| 318 |
- Which technologies offer flexibility (capacities vary widely as \\( \\epsilon \\) increases),
|
| 319 |
- The cost impact of relying more or less on specific technologies.
|
| 320 |
+
|
| 321 |
Through MGA, we can make more **informed decisions** about the renewable energy mix and identify robust, flexible strategies that align with broader goals beyond cost minimization.
|
| 322 |
""")
|