Skip to content

Instantly share code, notes, and snippets.

View joaquimg's full-sized avatar

Joaquim Dias Garcia joaquimg

View GitHub Profile
@joaquimg
joaquimg / multiple_lower_level_in_bileveljump.jl
Created April 27, 2022 05:37
Multiple lower level example
using JuMP, BilevelJuMP
model = BilevelModel()
NLL = 3 # number of lower level (LL) models
GLL = [4, 5, 6] # generators in each lower level
@variable(Upper(model), 0 <= q[i in 1:NLL] <= 100)
# arbitrary upper constraint
@joaquimg
joaquimg / moiqp3qtb3.mps
Created February 28, 2022 17:13
binary expansions mps files moiqp3qtbX for X in 3:8 (larger less numerically robust)
NAME
OBJSENSE MIN
ROWS
N OBJ
L c1_2
L c2_2
L c3_2
L c4_2
L c5_2
L c6_2
#=
(soi) pkg> st
Status `~/soi/Project.toml`
[0a46da34] CSDP v0.5.0 #bl/moiv0.9 (https://github.com/JuliaOpt/CSDP.jl.git)
[b8f27783] MathOptInterface v0.9.0 #master (https://github.com/JuliaOpt/MathOptInterface.jl.git)
[f0680fed] SemidefiniteOptInterface v0.6.0 #bl/moiv0.9 (https://github.com/JuliaOpt/SemidefiniteOptInterface.jl.git)
=#
using LinearAlgebra
using MathOptInterface
using JuMP
using GLPK
using ParameterJuMP
using TimerOutputs
#=
add parameters
=#
function add_parameters(model, N)
x = Parameters(model, 4.0*ones(N))
Main
CplexSolver
cpx_setparam
cpx_setlogfile
cpx_getprobtype
Constraints
cpx_chgbds
using Xpress
Solver = Xpress

using BenchmarkTools

BenchmarkTools.DEFAULT_PARAMETERS.samples = 100

const nvars = 1000
const ncons = 1000
using Xpress
Solver = Xpress

using BenchmarkTools

BenchmarkTools.DEFAULT_PARAMETERS.samples = 100

m1 = Solver.Model()
function add1000vars1(m)
@joaquimg
joaquimg / ex.jl
Created July 2, 2017 01:16
JuMP query example
using JuMP
m = Model()
# Variables section
@variable(m, x[1:10] >= 0)
@variable(m, y[1:10] >= 0)
@variable(m, z >= 0)
# Constraints section
@joaquimg
joaquimg / problem.jl
Last active August 4, 2016 19:31
Julia JuMP example for cutting planes
using JuMP
using Gurobi
# define type to hold cutting planes info
# ---------------------------------------
type cuts
RHS::Vector{Vector{Float64}}
Coeff::Vector{Vector{Float64}}
n::Int