Skip to content

Instantly share code, notes, and snippets.

@bart6114
bart6114 / CG.py
Created January 14, 2014 07:57
Column generation with pulp-or (Python)
import random ## to generate the items
from pulp import * ## import pulp-or functions
class MasterProblem:
def __init__(self, maxValue, itemLengths, itemDemands, initialPatterns, problemname):
self.maxValue=maxValue
self.itemLengths=itemLengths
clientid income age loan LTI default10yr
1 66155.9250950813 59.0170150669292 8106.53213128514 0.122536751162261 0
2 34415.1539658196 48.1171531048603 6564.74501767738 0.190751580661163 0
3 57317.1700630337 63.108049491886 8020.95329638647 0.139939799671993 0
4 42709.5342008397 45.7519723521546 6103.6422601407 0.142910532141104 0
5 66952.6888453402 18.5843359269202 8770.09923520439 0.130989499995485 1
6 24904.0641402826 57.4716071025468 15.4985984378272 0.000622332096099854 0
7 48430.3596126847 26.8091324190609 5722.58198121271 0.118161046644673 0
8 24500.1419843175 32.8975483207032 2971.00330971188 0.121264738449827 1
9 40654.8925372772 55.4968525394797 4755.8252798016 0.116980392346159 0
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bart6114
bart6114 / bpnn.py
Created December 13, 2014 19:34
adjusted bpnn.py
# Back-Propagation Neural Networks
#
# Written in Python. See http://www.python.org/
# Placed in the public domain.
# Neil Schemenauer <nas@arctrix.com>
# Adapted for instructional purposes by Bart Smeets <bartsmeets86@gmail.com>
import math
import random
library(R6)
library(simmer)
BatchGate <- R6Class("BatchGate",
public = list(
queue_length = 0,
opens_at_length = NA,
open = FALSE,
allowed_to_pass = 0,
initialize = function(opens_at_length){
library(lpSolveAPI)
#used for result visualization
library(ggplot2)
library(reshape)
library(gridExtra)
#define the datasets
train<-data.frame(wagon=c('w1','w2','w3'), weightcapacity=c(10,8,12), spacecapacity=c(5000,4000,8000))
{
"env": {
"resources": {
"nurse": {
"capacity": 1
},
"doctor": {
"capacity": 1
}
},
{
"env": {
"resources": {
"nurse": {
"capacity": 1
},
"doctor": {
"capacity": 1
}
},
Evolution hospital beds, resources and consumption
========================================================
```{r setup, echo=FALSE, message=FALSE, warning=FALSE}
imgur_insecure<-function (file, key = "75ace4c8e871b86")
{
if (!is.character(key))
stop("The Imgur API Key must be a character string!")
res = RCurl::postForm("https://api.imgur.com/3/image.xml",
image = RCurl::fileUpload(file), .opts = RCurl::curlOptions(httpheader = c(Authorization = paste("Client-ID",
key)),ssl.verifypeer = FALSE))
@bart6114
bart6114 / OECDcareresources.csv
Created January 19, 2014 12:44
Evolution hospital beds, resources and consumption
Variable Unit Country Year Value Flags
Total hospital beds Number Australia 1960 99191
Total hospital beds Number Australia 1961 99670
Total hospital beds Number Australia 1962 100413
Total hospital beds Number Australia 1963 102109
Total hospital beds Number Australia 1964 102618
Total hospital beds Number Australia 1965 103580
Total hospital beds Number Australia 1966 103636
Total hospital beds Number Australia 1967 104262
Total hospital beds Number Australia 1968 103397