Popularity
3 Stars
Updated Last
12 Months Ago
Started In
June 2015

# DSPsolver

The DSPsolver.jl package provides an interface for using an open-source software package DSP for solving stochastic mixed-integer programming problems from the Julia language. You need to download and install DSP package.

This package requires the StructJuMP.jl and MPI.jl packages for Julia. The StructJuMP.jl package provides a scalable algebraic modeling tool for stochastic programming. The MPI.jl package enables the Julia script to run on a distributed computing system via MPI communication.

## Installation

You can install DSPsolver.jl using the Julia package system.

`Pkg.clone("https://github.com/Argonne-National-Laboratory/DSPsolver.jl");`

## Example

The following example shows a Julia script that uses DSPsolver.jl for solving a two-stage stochastic integer programming problem.

```using DSPsolver, StructJuMP, MPI; # Load packages

# Initialize MPI
MPI.Init();

# random parameter
xi = [[7,7] [11,11] [13,13]];

# StructJuMP.jl model scripts
m = StructuredModel(num_scenarios=3);
@variable(m, 0 <= x[i=1:2] <= 5, Int);
@objective(m, Min, -1.5*x-4*x);
for s = 1:3
q = StructuredModel(parent=m, prob=1/3);
@variable(q, y[j=1:4], Bin);
@objective(q, Min, -16*y+19*y+23*y+28*y);
@constraint(q, 2*y+3*y+4*y+5*y<=xi[1,s]-x);
@constraint(q, 6*y+1*y+3*y+2*y<=xi[2,s]-x);
end

DSPsolver.loadProblem(m);       # Load model m to DSP
DSPsolver.solve(DSP_SOLVER_DD); # Solve problem using dual decomposition

# print out upper/lower bounds
println("Upper Bound: ", DSPsolver.getPrimalBound());
println("Lower Bound: ", DSPsolver.getDualBound());

# Finalize MPI
MPI.Finalize();```