Skip to content

blegat/GenOpt.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GenOpt.jl

Build Status codecov

Pack groups of similar constraints of sum of similar terms into lightweight generators. This representation can then be used by ExaModels to accelerate the Automatic Differentiation on GPU. See the presentation at JuMP-dev 2025.

License

GenOpt.jl is licensed under the MIT license.

Installation

The package is not registered yet so to install GenOpt using Pkg.add, do:

import Pkg
Pkg.add("https://github.com/blegat/GenOpt.jl")

Use with JuMP

To create a group of constraints, give ParametrizedArray as container keyword:

using GenOpt
@constraint(
    model,
    [i in 1:n],
    x[1, i] == x0[i],
    container = ParametrizedArray,
)

To a grouped sum, use lazy_sum as follows:

@objective(
    model,
    Min,
    lazy_sum(0.5 * R[j] * (u[i, j]^2) for i in 1:N, j in 1:p),
)

To solve it on GPU with ExaModels, use

set_optimizer(model, () -> GenOpt.ExaOptimizer(madnlp, CUDABackend()))
optimize!(model)

About

JuMP extension for constraint and term generators

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages