Giter Club home page Giter Club logo

dspsolver.jl's Introduction

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 StochJuMP.jl and MPI.jl packages for Julia. The StochJuMP.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/kibaekkim/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, StochJuMP, MPI; # Load packages

# Initialize MPI
MPI.Init();

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

# StochJuMP.jl model scripts
m = StochasticModel(3);
@defVar(m, 0 <= x[i=1:2] <= 5, Int);
@setObjective(m, Min, -1.5*x[1]-4*x[2]);
@second_stage m s begin
	q = StochasticBlock(m, 1/3);
	@defVal(q, y[j=1:4], Bin);
	@setObjective(q, Min, -16*y[1]+19*y[2]+23*y[3]+28*y[4]);
	@addConstraint(q, 2*y[1]+3*y[2]+4*y[3]+5*y[4]<=xi[1,s]-x[1]);
	@addConstraint(q, 6*y[1]+1*y[2]+3*y[3]+2*y[4]<=xi[2,s]-x[2]);
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();

dspsolver.jl's People

Contributors

kibaekkim avatar ctjandra avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.