This file contains hidden or 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
from django.shortcuts import render, get_list_or_404, redirect | |
from .models import Product | |
from .forms import ProductForm, RawProductForm | |
from django.http import Http404 | |
# Create your views here. | |
''' | |
def product_create_view(request): | |
form = ProductForm(request.POST or None) | |
if form.is_valid(): |
This file contains hidden or 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
# tested on AWS p2.xlarge August 29, 2018 | |
# install CUDA | |
sudo apt-get update && sudo apt-get install wget -y --no-install-recommends | |
CUDA_URL="https://developer.nvidia.com/compute/cuda/9.2/Prod2/local_installers/cuda-repo-ubuntu1604-9-2-local_9.2.148-1_amd64" | |
wget -c ${CUDA_URL} -O cuda.deb | |
sudo dpkg --install cuda.deb | |
sudo apt-key add /var/cuda-repo-9-2-local/7fa2af80.pub | |
sudo apt-get update | |
sudo apt-get install -y cuda |
This file contains hidden or 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
Procedure SARSA(lambda) | |
Initialize Q(s,a) arbitrarily and e(s,a)=0 for all s,a pairs | |
Repeat(per episode): | |
Initialize s,a | |
e(s,a)=0 | |
Repeat(per timestep in each episode): | |
Take action a, observe r,s` | |
Choose a` from s` via epsilon-greedy policy Q | |
error = r+discount*Q(s`,a`)-Q(s,a) | |
any e(s,:)=0 |
This file contains hidden or 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
function [eplus_in_curr, userdata] = RadiantControlFileBaseline(cmd,eplus_out_prev, eplus_in_prev, time, stepNumber, userdata) | |
if strcmp(cmd,'init') | |
addpath('./RL_lib') | |
epsilon1 = 0.7; % Initial value | |
epsilon2 = 0.7; % Initial value | |
epsilon3 = 0.7; % Initial value | |
discount = 0.8; | |
learnRate = 0.99; |
This file contains hidden or 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
function [ err ] = rewardFunc_test( setpointT, actualT, power, constraint) | |
low = constraint(1); | |
high = constraint(2); | |
if (actualT>low & actualT<high) | |
err = -(abs(setpointT - actualT))^2 - power/100; | |
else | |
err = -(abs(setpointT - actualT))^2 -1000- power/100; | |
end | |
end |
This file contains hidden or 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
function [ states, R, Q ] = RL_setup_test( tsps, temps, powers, actions ) | |
states = zeros(length(tsps)*length(temps)*length(powers),3); % State: [tsps, zone temp, zone power consumption] | |
index =1; | |
for j=1:length(tsps) | |
for k = 1:length(temps) | |
for i = 1:length(powers) | |
states(index,:) = [tsps(j), temps(k), powers(i)]; | |
index = index +1; | |
end | |
end |
This file contains hidden or 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
#include <opencv/cv.h> | |
#include <opencv/highgui.h> | |
#include <opencv/ml.h> | |
void doMosaic(IplImage* in, int x, int y, | |
int width, int height, int size); | |
int main (int argc, char **argv) | |
{ | |
int i, c; |