{{ message }}

Instantly share code, notes, and snippets.

# Andrew Powell andrewandrepowell

Last active Oct 4, 2016
Solves a basic linear programming problem with the GPLK ( GNU MathProg ) API. Don't really see too many examples online, so I plan to add a bunch of these.
View gplk_sample_0.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 /* Purpose: Solves the following GNU MathProg program: * var x; var y; s.t. A: x + 2*y <= 14; s.t. B: 3*x - y >= 0; s.t. C: x - y <= 2; maximize z: 3*x + 4*y; * * References:
Last active Nov 14, 2018
Solves the Multicommodity Flow Problem for Concurrent Flow with GNU MathProg.
View gmpl_mcfp_cl.mod
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 # Multicommodity Flow Problem for Directed Networks, ## Optimized for Concurrent Flow set V; # Vertex Set set E, within V cross V; # Edge Set set K; # Commodity Set param s {K}, symbolic in V; # Source Vertex of Commodity param t {K}, symbolic in V; # Sink Vertex of Commodity param d {K}, >= 0; # Demand of Commodity param c, >= 0; # Capacity of Edge
Last active Jul 29, 2020
Solves the Concurrent Flow variant of the Multi-Commodity Flow Problem in MATLAB with linprog.
View mcfp_cf_script.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 %% Solve the Multi-Commodity Flow Problem in MATLAB. % % The goal of this script is to solve the Concurrent-Flow variant of the % Multi-Commodity Flow Problem ( MCFP ) with MATLAB's Linear Programming % ( LP ) tools. % % The documentation generated from this script is a tex file. The PDF can % be generated from the tex, but \usagepackage{amsmath} needs to be added % to the tex file's preamble.
Last active Oct 9, 2016
Solves the Concurrent Flow variant of the Multi-Commodity Flow Problem with GLPK via LEMON interface.
View mcfp_cf_lp_lemon_glpk.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 /* * mcfp_cf_lp_lemon_glpk.cc * LEMON provides a simple interface to known solvers! In * this example the Concurrent Flow variant of the * Multi-Commodity Flow Problem is solved with the glpk * solver. * * The following libraries are needed to run this application: * * lemon
Last active Oct 24, 2016
Solves the Concurrent Flow variant of the Multi-Commodity Flow Problem with an iterative algorithm, which breaks down the problem into Maximum Flow Problems.
View mcfp_cf_itermaxflow_lemon.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 /** * @file mcfp_cf_itermaxflow_lemon.cc * @author Andrew Powell * @date Oct 9, 2016 * * @brief Solves the Concurrent Flow variant of the Multi- * Commodity Flow Problem. * * In this example, the Concurent Flow variant * of the Multi-Commodity Flow Problem is solved with
Last active Oct 13, 2016
Solves a Time Division Multiplexing Concurrent Flow variant of the Multi Commodity Flow Problem in MATLAB.
View matlab_mcfp_cf_tdm_lp.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 %% Solve the Time Division Multiplexing variant of the Multi Commodity Flow Problem in MATLAB. % % The goal of this script is to solve the Multi Commodity Flow Problem % modified for Time Division Multiplexing ( TDM ) as seen in Contention % Free Routing ( CFR ). The Multi Commodity Flow Problem is solved for the % Concurrent Flow variant ( MCFP-CF ) with mixed-integer linear programming % ( MILP ). % % The documentation generated from this script is a tex file. The PDF can % be published from the tex, but \usagepackage{amsmath} needs to be added
Last active Jun 17, 2021
MinGW batch and make files for building GNU Linear Programming Kit glpk-4.60. Remember to change the HOME environmental variable to the directory of MinGW. These files should be located in either "glpk-4.60/w64" or "glpk-4.60/w32".
View Build_GLPK_with_MinGW.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 rem Build GLPK with MinGW rem NOTE: Make sure that HOME variable specifies correct path set HOME="C:\TDM-GCC-64" set PATH=%HOME%\bin;%HOME%\libexec\gcc\x86_64-w64-mingw32\5.1.0;%PATH% copy config_MinGW config.h %HOME%\bin\mingw32-make.exe -f Makefile_MinGW %HOME%\bin\mingw32-make.exe -f Makefile_MinGW check
Last active Sep 19, 2020
Beginnings of Dual Universe scripting. Will become more organized later.
View starting_craft_management.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 -- Item = { -- Create a new Item. new = function(name) name = name or "none" assert(type(name)=="string") return { name = name, ingredients = false, produced = false,