How to use DSP¶
There are two ways to use algorithms in DSP
:
- Executable binary file
runDsp
- Callable C functions in shared library
libDsp.so
(orlibDsp.dylib
for Mac)
Building the DSP source files creates an executable file ./bin/runDsp
and a shared library file ./lib/libDsp.*
.
Executable file¶
The executable file ./bin/runDsp
can be run as a command-line tool with the following arguments:
Argument | Description |
---|---|
--algo |
A required argument for the choice of algorithms from one of the following:
|
--wassnorm |
Wasserstein distance norm (>= 1.0). This argument should be used with --wasseps argument when --algo drbd or --algo drdd . |
--wasseps |
Wasserstein distance limit (>= 0.0). This argument should be used with --wassnorm argument when --algo drbd or --algo drdd . |
--smps |
SMPS file name without extensions. For example, if your SMPS files are ../test/farmer.cor , ../test/farmer.sto , and ../test/farmer.tim , this value should be ../test/farmer |
--mps |
MPS file name. This argument should be used with --dec argument. |
--dec |
DEC file name. This argument should be used with --mps argument. |
--quad |
Quadratic file name without extension. The Quadratic file should extend the parsed SMPS file and its suffix needs to be .txt in the current version. For example, if your Quadratic file is ../test/farmer.txt , this value should be ../test/farmer . |
--soln |
An optional argument for solution file prefix. For example, For example, if --soln mysoln is given, runDsp will write the following solution files:
|
--param |
An optional paramater for parameter file name (see Parameters section) |
Your first example!
This examples solves the two-stage stochastic mixed-integer linear program (MILP) of farmer
example by using the (parallel) dual decomposition.
1 |
|
1 |
|
Attention
Of course, Parallel Run
is available only if you build DSP
with MPI library.
More examples¶
Here we give some examples for running DSP
with the executable file.
The examples are given with --algo dd
(i.e., using the dual decomposition), but can be easily modified to use the other algorithms (e.g., bd
, dw
) with argument --algo
.
Example: Wasserstein DRO
This example solves the distributionall robust optimization (DRO) of farmer
example, where the Wasserstein ambiguity set is of order 2
with the size 0.1
.
1 2 3 4 5 6 |
|
1 2 3 4 5 6 |
|
Example: Stochastic MIQCP
This examples solves the two-stage stochastic mixed-integer quadratically constrained program (MIQCP) of farmer
example.
The quadratic constraints are defined in ../example/farmer.txt
.
1 2 3 4 5 |
|
1 2 3 4 5 |
|
Info
As a special case, the stochastic mixed-integer linear program can be set by omitting argument --quad
.
Example: Generic structured program
This example solves a generic block-angular structure problem written in files noswot.mps
and noswot.dec
.
1 2 3 4 5 |
|
1 2 3 4 5 |
|
Shared library¶
The shared library provides access to C API functions. The library needs to be placed in the searchable path. For example,
1 |
|
1 |
|
Using the library can be useful to interface with other (high-level) langauges such as Julia. We strongly recomment to check our Julia interface DSPopt.jl.