Skip to content

Commit

Permalink
Merge pull request #16 from psrenergy/raphasampaio-patch-1
Browse files Browse the repository at this point in the history
README minor changes
  • Loading branch information
raphasampaio authored Nov 26, 2024
2 parents 8a8eced + c2afd74 commit 8a0c27f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@

## Introduction

**LightBenders** is a Julia package that provides a flexible and efficient implementation of the two-stage Benders decomposition method. Designed for solving large-scale optimization problems, **LightBenders** is especially suited for problems where decisions are divided into a main (first-stage) problem and a set of scenario-dependent (second-stage) problems.
LightBenders is a Julia package that provides a flexible and efficient implementation of the two-stage Benders decomposition method. Designed for solving large-scale optimization problems, LightBenders is especially suited for problems where decisions are divided into a main (first-stage) problem and a set of scenario-dependent (second-stage) problems.

With support for both serialized and parallel processing of second-stage scenarios, **LightBenders** allows users to efficiently tackle computationally demanding problems. By leveraging Julia's high-performance capabilities and parallel computing features, the package offers robust performance for solving a wide range of applications, including energy systems, logistics, and supply chain optimization.
With support for both serialized and parallel processing of second-stage scenarios, LightBenders allows users to efficiently tackle computationally demanding problems. By leveraging Julia's high-performance capabilities and parallel computing features, the package offers robust performance for solving a wide range of applications, including energy systems, logistics, and supply chain optimization.

### Key Features
- Generic Implementation: Fully customizable for diverse optimization models.
- Scenario Management: Scenarios are handled either sequentially or in parallel, enabling scalability for large instances.
- User-Friendly Interface: Seamlessly integrates with Julia's optimization ecosystem, such as JuMP.
- Parallel Computing Support: Efficiently utilize multiple cores or distributed systems for solving second-stage problems in parallel.
- Parallel Computing Support: Efficiently utilize multiple cores or distributed systems to solve second-stage problems in parallel.


**LightBenders** is ideal for researchers and practitioners looking to adopt a modular and high-performance approach to Benders decomposition in Julia.
LightBenders is ideal for researchers and practitioners looking to adopt a modular and high-performance approach to Benders decomposition in Julia.

## Getting Started

Expand All @@ -28,6 +27,7 @@ julia> ] add LightBenders
```

### Example: Newsvendor Model

```julia
using LightBenders
using JuMP
Expand All @@ -41,6 +41,7 @@ Base.@kwdef mutable struct Inputs
max_storage::Int
demand::Vector{<:Real}
end

function state_variables_builder(inputs)
model = Model(HiGHS.Optimizer)
set_silent(model)
Expand All @@ -50,13 +51,15 @@ function state_variables_builder(inputs)
LightBenders.set_state(sp, :bought, bought)
return sp
end

function first_stage_builder(sp, inputs)
bought = sp[:bought]

@constraint(sp, bought <= inputs.max_storage)
@objective(sp, Min, bought * inputs.buy_price)
return sp
end

function second_stage_builder(sp, inputs)
bought = sp[:bought]

Expand All @@ -68,6 +71,7 @@ function second_stage_builder(sp, inputs)
@objective(sp, Min, -sold * inputs.sell_price - returned * inputs.return_price)
return sp
end

function second_stage_modifier(sp, inputs, s)
dem = sp[:dem]
JuMP.set_parameter_value(dem, inputs.demand[s])
Expand All @@ -87,6 +91,7 @@ policy_training_options = LightBenders.PolicyTrainingOptions(;
),
cut_strategy = LightBenders.CutStrategy.MultiCut,
)

policy = LightBenders.train(;
state_variables_builder,
first_stage_builder,
Expand All @@ -95,6 +100,7 @@ policy = LightBenders.train(;
inputs = inputs,
policy_training_options,
)

results = LightBenders.simulate(;
state_variables_builder,
first_stage_builder,
Expand Down

0 comments on commit 8a0c27f

Please sign in to comment.