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
| %% In this scipt we calcualte the maximum and | |
| % average flop counts required with different | |
| % algorithms | |
| clear all; | |
| close all; | |
| clc; | |
| %% Reevaluating the Average gradient and Hessian counts | |
| % LBFGS | |
| AverGrad(1,:)=[84.0426 68.7755 129.750 80.4286... |
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
| %% plot figures | |
| result_data=cell(3,2); | |
| gurobi_ip=cell(3,1); | |
| %prediction hoizon | |
| result_data{1,1}=[8 10 30 45;0.1954 0.2042 0.6179 0.8864;0.0419 0.0590 0.1318 0.2052]'; | |
| result_data{1,2}=[8 10 30 45;1.1501 1.572 3.6162 5.2541;0.1887 0.221 0.4452 0.7612]'; | |
| gurobi_ip{1,1}=[8 10;1.9436 2.7031;2.2394 3.1234]'; | |
| figure(1) |
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
| /* | |
| * Effinet_data_generation.cuh | |
| * Created on: Jul 26, 2015 | |
| * Author: ajay | |
| */ | |
| /* | |
| * This header file has the implementation of the functions that allocate the memory in the | |
| * GPUs. | |
| */ |
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
| clear all | |
| syms a b w l r k Q x; | |
| f1=a^2+4*(w*l+r*k-r*k*x)*(b-a)/((1-x)*Q/x); | |
| f=symfun(0.5*(a+... | |
| (a^2+4*(w*l+r*k-r*k*x)*(b-a)... | |
| /((1-x)*Q/x))^0.5),[a b w l r k Q x]); | |
| g=diff(f,x); | |
| %{ | |
| result |
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
| %% | |
| % This function generates a system with different terminal functions and constraints but | |
| % with same size. The constraint are preconditioned accodingly. | |
| % We solve the method using different methods. First formulated using | |
| % 1) Gurobi-IP 2) Gurobi-AS directly | |
| clear all; | |
| close all; | |
| clear model; | |
| clc; |
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 [ S ] = system_masses(N, options ) | |
| %masses_model function is used to find the dynamic equations of N masses | |
| %system. The no of masses is specified by N and options specify the constraints | |
| %on the system. | |
| % The syntax of the function is | |
| % S=masses_model(N,options) | |
| default_options = struct('M', 1*ones(N,1), 'b', 0.1*ones(N+1,1),... | |
| 'k',1*ones(N+1,1),'xmin',-5*ones(2*N,1), 'xmax', 5*ones(2*N,1), 'umin', ... | |
| -5*ones(N,1),'umax',5*ones(N,1), 'Ts', 0.1); |
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
| %% MPC | |
| clear all | |
| clear classes | |
| clc | |
| % User-defined parameters: | |
| load('dwn_big.mat'); | |
| f0=0.1; | |
| k=3000; |
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 [ Tree details] = Tree_formation( W,ops) | |
| %This function generates the scenario tree. | |
| %The no of scenatios are reduced by forward selection. | |
| %The input is scenario of random variables | |
| %syntax: [Tree]=Tree_formation(W,ops) | |
| %Input: W: The stochastic varible. | |
| % W=[scenarios,no of varibles,future steps] | |
| % The stocastic variable is considered independent | |
| % ops: This contains the option to the tree |
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
| clear all; | |
| close all; | |
| clc; | |
| Nm=10; % Number of masses | |
| T_sampling=0.25; | |
| sys_no_precond=system_generation(Nm,struct('Ts',T_sampling,'xmin', ... | |
| -5*ones(2*Nm,1), 'xmax', 5*ones(2*Nm,1), 'umin', -1*ones(Nm,1),'umax',... | |
| 1*ones(Nm,1))); |