File: optimizer_asco.m

package info (click to toggle)
openems 0.0.35%2Bgit20190103.6a75e98%2Bdfsg.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 8,424 kB
  • sloc: cpp: 40,407; python: 2,028; yacc: 580; makefile: 458; lex: 350; sh: 176; ruby: 19
file content (36 lines) | stat: -rw-r--r-- 998 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
%
% asco optimizer example -- optimize the turn number of a coil
%
% You need asco from http://asco.sf.net
% This is the main script.
%  - optimizer_simfun.m starts the simulator with a parameter set from
%    asco
%
% The goal is evaluated inside optimizer_simfun() to get as close to 2 uH.

% clear
clear
close all
clc

% setup the parameters
params = [];
params(end+1).name  = 'turns';
params(end).range   = [1 30];
params(end).value   = 4;
params(end).step    = 1;
params(end).active  = 1; % this parameter is to be optimized

% setup the simulation function
folder = fileparts( mfilename('fullpath') );
options.simfun = [folder '/optimizer_simfun.m'];

% additional options
% options.octave_exe = 'octave'; % must be newer than 3.2.4 (3.3.54 works)
options.clean = 1;

% start the optimization
[params_opt,result] = optimize( 'opttmp', params, options, 'asco' );

% display best value
disp( ['ASCO found the optimum turn number: ' num2str(params_opt(1).value) '  result: ' num2str(result)] );