├── tex ├── biblio │ └── bib.bib ├── extras │ ├── anhang.tex │ ├── header.tex │ ├── danksagung.tex │ ├── titelseite.tex │ ├── eidesstattliche.tex │ └── verzeichnisse.tex ├── Bachelor-Thesis.pdf ├── Bachelor-Thesis.tex ├── images │ ├── exp-func.png │ ├── himmelblau.png │ ├── rosenbrock.png │ ├── tuberlin-logo.jpg │ ├── bazaraa-shetty.png │ ├── beispiel-unrestr-opt-prob.table │ ├── ssn_results.table │ └── sqp_results.table ├── chapters │ ├── sqp │ │ ├── sqp.tex │ │ ├── einfuehrung.tex │ │ ├── formulierung.tex │ │ ├── lagrange_newton_sqp.tex │ │ ├── nullraum_verfahren.tex │ │ └── aktive_mengen_methode_fuer_quadr_prob.tex │ ├── ssn │ │ ├── ssn.tex │ │ ├── grundlagen.tex │ │ ├── formulierung.tex │ │ └── active_set_strategie.tex │ ├── fazit │ │ └── fazit.tex │ ├── vergleich │ │ ├── ergebnis.tex │ │ ├── vergleich.tex │ │ ├── testprobleme_v.tex │ │ ├── opt_strg_problem.tex │ │ └── ergebnisse_genauigkeit.tex │ ├── einleitung │ │ └── einleitung.tex │ └── grundlagen │ │ ├── grundlagen.tex │ │ ├── allg_opt_prob.tex │ │ ├── opt_prob_ohne_restr.tex │ │ ├── opt_prob_mit_lin_gl_nebenbed.tex │ │ ├── opt_prob_mit_nichtlin_restr.tex │ │ └── opt_prob_mit_lin_ungl_nebenbed.tex ├── .gitignore └── README.markdown ├── .gitignore ├── test ├── problem_v_exp │ ├── grad_func_for_problem_v_exp.m │ ├── func_for_problem_v_exp.m │ ├── hess_func_for_problem_v_exp.m │ ├── test_problem_v_exp.m │ ├── test_problem_v_exp_with_fmincon_too.m │ └── test_problem_v_exp_100_times.m ├── problem_v_exp_1 │ ├── grad_func_for_problem_v_exp_1.m │ ├── hess_func_for_problem_v_exp_1.m │ ├── func_for_problem_v_exp_1.m │ ├── test_problem_v_exp_1.m │ ├── test_problem_v_exp_1_with_fmincon_too.m │ └── test_problem_v_exp_1_100_times.m ├── problem_v_norm │ ├── grad_func_for_problem_v_norm.m │ ├── hess_func_for_problem_v_norm.m │ ├── func_for_problem_v_norm.m │ ├── test_problem_v_norm.m │ ├── test_problem_v_norm_with_fmincon_too.m │ └── test_problem_v_norm_100_times.m ├── problem_v_norm_1 │ ├── grad_func_for_problem_v_norm_1.m │ ├── hess_func_for_problem_v_norm_1.m │ ├── func_for_problem_v_norm_1.m │ ├── test_problem_v_norm_1.m │ ├── test_problem_v_norm_1_with_fmincon_too.m │ └── test_problem_v_norm_1_100_times.m ├── problem_v_beale │ ├── hess_func_for_problem_v_beale.m │ ├── grad_func_for_problem_v_beale.m │ ├── func_for_problem_v_beale.m │ ├── test_problem_v_beale.m │ ├── test_problem_v_beale_with_fmincon_too.m │ └── test_problem_v_beale_100_times.m ├── extras │ ├── opt_ctrl_prob │ │ ├── opt_ctrl_prob_constr_r.m │ │ ├── opt_ctrl_prob_func_H.m │ │ ├── opt_ctrl_prob_constr_G.m │ │ ├── opt_ctrl_prob_func_q.m │ │ ├── opt_ctrl_prob_constr_A.m │ │ ├── opt_ctrl_prob_constr_b.m │ │ └── opt_ctrl_prob_constr_x0.m │ ├── approx_gradient.m │ ├── example_func_1.m │ ├── approx_hessian.m │ ├── plot3dim.m │ └── function_value_in_iteration_points.m ├── problem_A_simple_example │ ├── grad_func_for_problem_A_simple_example.m │ ├── hess_func_for_problem_A_simple_example.m │ ├── func_for_problem_A_simple_example.m │ ├── test_problem_A_simple_example.m │ └── test_problem_A_simple_example_with_fmincon_too.m ├── problem_v_beale_1 │ ├── grad_func_for_problem_v_beale_1.m │ ├── hess_func_for_problem_v_beale_1.m │ ├── func_for_problem_v_beale_1.m │ ├── test_problem_v_beale_1.m │ ├── test_problem_v_beale_1_with_fmincon_too.m │ └── test_problem_v_beale_1_100_times.m ├── problem_v_colville │ ├── grad_func_for_problem_v_colville.m │ ├── hess_func_for_problem_v_colville.m │ ├── func_for_problem_v_colville.m │ ├── test_problem_v_colville.m │ ├── test_problem_v_colville_with_fmincon_too.m │ └── test_problem_v_colville_100_times.m ├── problem_v_colville_1 │ ├── hess_func_for_problem_v_colville_1.m │ ├── grad_func_for_problem_v_colville_1.m │ ├── func_for_problem_v_colville_1.m │ ├── test_problem_v_colville_1.m │ └── test_problem_v_colville_1_with_fmincon_too.m ├── problem_v_rosenbrock │ ├── grad_func_for_problem_v_rosenbrock.m │ ├── hess_func_for_problem_v_rosenbrock.m │ ├── func_for_problem_v_rosenbrock.m │ ├── test_problem_v_rosenbrock.m │ └── test_problem_v_rosenbrock_with_fmincon_too.m ├── problem_Gv_betts_hs21 │ ├── hess_func_for_problem_Gv_betts_hs21.m │ ├── grad_func_for_problem_Gv_betts_hs21.m │ ├── func_for_problem_Gv_betts_hs21.m │ ├── test_problem_Gv_betts_hs21.m │ └── test_problem_Gv_betts_hs21_with_fmincon_too.m ├── problem_v_rosenbrock_1 │ ├── grad_func_for_problem_v_rosenbrock_1.m │ ├── hess_func_for_problem_v_rosenbrock_1.m │ ├── func_for_problem_v_rosenbrock_1.m │ ├── test_problem_v_rosenbrock_1.m │ └── test_problem_v_rosenbrock_1_with_fmincon_too.m ├── problem_v_bazaraa_shetty │ ├── grad_func_for_problem_v_bazaraa_shetty.m │ ├── hess_func_for_problem_v_bazaraa_shetty.m │ ├── func_for_problem_v_bazaraa_shetty.m │ ├── test_problem_v_bazaraa_shetty.m │ └── test_problem_v_bazaraa_shetty_with_fmincon_too.m ├── problem_Gv_beale_hs35 │ ├── hess_func_for_problem_Gv_beale_hs35.m │ ├── grad_func_for_problem_Gv_beale_hs35.m │ ├── func_for_problem_Gv_beale_hs35.m │ ├── test_problem_Gv_beale_hs35.m │ └── test_problem_Gv_beale_hs35_with_fmincon_too.m ├── problem_v_bazaraa_shetty_1 │ ├── hess_func_for_problem_v_bazaraa_shetty_1.m │ ├── grad_func_for_problem_v_bazaraa_shetty_1.m │ ├── func_for_problem_v_bazaraa_shetty_1.m │ ├── test_problem_v_bazaraa_shetty_1.m │ └── test_problem_v_bazaraa_shetty_1_with_fmincon_too.m ├── problem_Gv_example_16_4_nocedal_wright │ ├── grad_func_for_problem_Gv_example_16_4_nocedal_wright.m │ ├── hess_func_for_problem_Gv_example_16_4_nocedal_wright.m │ ├── func_for_problem_Gv_example_16_4_nocedal_wright.m │ ├── test_problem_Gv_example_16_4_nocedal_wright.m │ └── test_problem_Gv_example_16_4_nocedal_wright_with_fmincon_too.m ├── problem_A_huang_aggerwal_hs28 │ ├── hess_func_for_problem_A_huang_aggerwal_hs28.m │ ├── grad_func_for_problem_A_huang_aggerwal_hs28.m │ ├── func_for_problem_A_huang_aggerwal_hs28.m │ ├── test_problem_A_huang_aggerwal_hs28.m │ └── test_problem_A_huang_aggerwal_hs28_with_fmincon_too.m ├── problem_A_huang_aggerwal_hs49 │ ├── grad_func_for_problem_A_huang_aggerwal_hs49.m │ ├── hess_func_for_problem_A_huang_aggerwal_hs49.m │ ├── func_for_problem_A_huang_aggerwal_hs49.m │ ├── test_problem_A_huang_aggerwal_hs49.m │ └── test_problem_A_huang_aggerwal_hs49_with_fmincon_too.m ├── problem_A_huang_aggerwal_hs50 │ ├── grad_func_for_problem_A_huang_aggerwal_hs50.m │ ├── hess_func_for_problem_A_huang_aggerwal_hs50.m │ ├── func_for_problem_A_huang_aggerwal_hs50.m │ ├── test_problem_A_huang_aggerwal_hs50.m │ └── test_problem_A_huang_aggerwal_hs50_with_fmincon_too.m ├── problem_v_himmelblau │ ├── hess_func_for_problem_v_himmelblau.m │ ├── grad_func_for_problem_v_himmelblau.m │ ├── func_for_problem_v_himmelblau.m │ ├── test_problem_v_himmelblau.m │ └── test_problem_v_himmelblau_with_fmincon_too.m ├── problem_AG_opt_ctrl │ ├── hess_func_for_problem_AG_opt_ctrl.m │ ├── grad_func_for_problem_AG_opt_ctrl.m │ ├── func_for_problem_AG_opt_ctrl.m │ ├── test_problem_AG_opt_ctrl.m │ ├── test_problem_AG_opt_ctrl_with_fmincon_too.m │ └── test_problem_AG_opt_ctrl_100_times.m ├── problem_G_example_with_diamond_area │ ├── hess_func_for_problem_G_example_with_diamond_area.m │ ├── grad_func_for_problem_G_example_with_diamond_area.m │ ├── func_for_problem_G_example_with_diamond_area.m │ ├── test_problem_G_example_with_diamond_area.m │ └── test_problem_G_example_with_diamond_area_with_fmincon_too.m ├── problem_v_himmelblau_1 │ ├── hess_func_for_problem_v_himmelblau_1.m │ ├── grad_func_for_problem_v_himmelblau_1.m │ ├── func_for_problem_v_himmelblau_1.m │ ├── test_problem_v_himmelblau_1.m │ └── test_problem_v_himmelblau_1_with_fmincon_too.m ├── problem_A_miele_hs52 │ ├── hess_func_for_problem_A_miele_hs52.m │ ├── grad_func_for_problem_A_miele_hs52.m │ ├── func_for_problem_A_miele_hs52.m │ ├── test_problem_A_miele_hs52.m │ ├── test_problem_A_miele_hs52_with_fmincon_too.m │ └── test_problem_A_miele_hs52_100_times.m ├── problem_A_example_16_2_nocedal_wright │ ├── hess_func_for_problem_A_example_16_2_nocedal_wright.m │ ├── grad_func_for_problem_A_example_16_2_nocedal_wright.m │ ├── func_for_problem_A_example_16_2_nocedal_wright.m │ ├── test_problem_A_example_16_2_nocedal_wright.m │ └── test_problem_A_example_16_2_nocedal_wright_with_fmincon_too.m ├── problem_G_example_13_2_antoniou_lu │ ├── hess_func_for_problem_G_example_13_2_antoniou_lu.m │ ├── grad_func_for_problem_G_example_13_2_antoniou_lu.m │ ├── func_for_problem_G_example_13_2_antoniou_lu.m │ ├── test_problem_G_example_13_2_antoniou_lu.m │ └── test_problem_G_example_13_2_antoniou_lu_with_fmincon_too.m ├── problem_Av_betts_miele_hs53 │ ├── hess_func_for_problem_Av_betts_miele_hs53.m │ ├── grad_func_for_problem_Av_betts_miele_hs53.m │ ├── func_for_problem_Av_betts_miele_hs53.m │ ├── test_problem_Av_betts_miele_hs53.m │ └── test_problem_Av_betts_miele_hs53_with_fmincon_too.m ├── problem_Gv_murtagh_sargent_hs76 │ ├── hess_func_for_problem_Gv_murtagh_sargent_hs76.m │ ├── grad_func_for_problem_Gv_murtagh_sargent_hs76.m │ ├── func_for_problem_Gv_murtagh_sargent_hs76.m │ ├── test_problem_Gv_murtagh_sargent_hs76.m │ └── test_problem_Gv_murtagh_sargent_hs76_with_fmincon_too.m ├── problem_A_huang_aggerwal_hs51 │ ├── hess_func_for_problem_A_huang_aggerwal_hs51.m │ ├── grad_func_for_problem_A_huang_aggerwal_hs51.m │ ├── func_for_problem_A_huang_aggerwal_hs51.m │ ├── test_problem_A_huang_aggerwal_hs51.m │ └── test_problem_A_huang_aggerwal_hs51_with_fmincon_too.m ├── problem_v_lin_regression │ ├── grad_func_for_problem_v_lin_regression.m │ ├── hess_func_for_problem_v_lin_regression.m │ ├── func_for_problem_v_lin_regression.m │ ├── test_problem_v_lin_regression.m │ └── test_problem_v_lin_regression_with_fmincon_too.m ├── problem_A_huang_aggerwal_miele_hs48 │ ├── hess_func_for_problem_A_huang_aggerwal_miele_hs48.m │ ├── grad_func_for_problem_A_huang_aggerwal_miele_hs48.m │ ├── func_for_problem_A_huang_aggerwal_miele_hs48.m │ ├── test_problem_A_huang_aggerwal_miele_hs48.m │ └── test_problem_A_huang_aggerwal_miele_hs48_with_fmincon_too.m ├── problem_v_quad_regression │ ├── grad_func_for_problem_v_quad_regression.m │ ├── hess_func_for_problem_v_quad_regression.m │ ├── func_for_problem_v_quad_regression.m │ ├── test_problem_v_quad_regression.m │ └── test_problem_v_quad_regression_with_fmincon_too.m ├── problem_v_dixon │ ├── grad_func_for_problem_v_dixon.m │ ├── hess_func_for_problem_v_dixon.m │ ├── func_for_problem_v_dixon.m │ ├── test_problem_v_dixon.m │ ├── test_problem_v_dixon_with_fmincon_too.m │ └── test_problem_v_dixon_100_times.m ├── problem_v_dixon_1 │ ├── grad_func_for_problem_v_dixon_1.m │ ├── hess_func_for_problem_v_dixon_1.m │ ├── func_for_problem_v_dixon_1.m │ ├── test_problem_v_dixon_1.m │ ├── test_problem_v_dixon_1_with_fmincon_too.m │ └── test_problem_v_dixon_1_100_times.m ├── problem_v_nichtlin_regression │ ├── grad_func_for_problem_v_nichtlin_regression.m │ ├── func_for_problem_v_nichtlin_regression.m │ ├── hess_func_for_problem_v_nichtlin_regression.m │ ├── test_problem_v_nichtlin_regression.m │ └── test_problem_v_nichtlin_regression_with_fmincon_too.m └── test-populator │ └── src │ └── data │ ├── test_problem.tpl │ ├── test_problem_with_fmincon_too.tpl │ └── test_problem_100_times.tpl ├── test.config ├── README.markdown └── semismooth_newton.m /tex/biblio/bib.bib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/biblio/bib.bib -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # no Thumbs.db file (created by Windows) 2 | Thumbs.db 3 | 4 | # no *~ file (created by XEmacs) 5 | *~ -------------------------------------------------------------------------------- /tex/extras/anhang.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/extras/anhang.tex -------------------------------------------------------------------------------- /tex/extras/header.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/extras/header.tex -------------------------------------------------------------------------------- /tex/Bachelor-Thesis.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/Bachelor-Thesis.pdf -------------------------------------------------------------------------------- /tex/Bachelor-Thesis.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/Bachelor-Thesis.tex -------------------------------------------------------------------------------- /tex/images/exp-func.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/images/exp-func.png -------------------------------------------------------------------------------- /tex/chapters/sqp/sqp.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/sqp/sqp.tex -------------------------------------------------------------------------------- /tex/chapters/ssn/ssn.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/ssn/ssn.tex -------------------------------------------------------------------------------- /tex/extras/danksagung.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/extras/danksagung.tex -------------------------------------------------------------------------------- /tex/extras/titelseite.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/extras/titelseite.tex -------------------------------------------------------------------------------- /tex/images/himmelblau.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/images/himmelblau.png -------------------------------------------------------------------------------- /tex/images/rosenbrock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/images/rosenbrock.png -------------------------------------------------------------------------------- /test/problem_v_exp/grad_func_for_problem_v_exp.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_exp(x) 2 | g = 2*exp(norm(x)^2)*x; 3 | end -------------------------------------------------------------------------------- /tex/chapters/fazit/fazit.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/fazit/fazit.tex -------------------------------------------------------------------------------- /tex/images/tuberlin-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/images/tuberlin-logo.jpg -------------------------------------------------------------------------------- /tex/chapters/ssn/grundlagen.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/ssn/grundlagen.tex -------------------------------------------------------------------------------- /tex/extras/eidesstattliche.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/extras/eidesstattliche.tex -------------------------------------------------------------------------------- /tex/images/bazaraa-shetty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/images/bazaraa-shetty.png -------------------------------------------------------------------------------- /test/problem_v_exp_1/grad_func_for_problem_v_exp_1.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_exp_1(x) 2 | g = 2*exp(norm(x)^2)*x; 3 | end -------------------------------------------------------------------------------- /tex/chapters/sqp/einfuehrung.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/sqp/einfuehrung.tex -------------------------------------------------------------------------------- /tex/chapters/sqp/formulierung.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/sqp/formulierung.tex -------------------------------------------------------------------------------- /tex/chapters/ssn/formulierung.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/ssn/formulierung.tex -------------------------------------------------------------------------------- /test/problem_v_norm/grad_func_for_problem_v_norm.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_norm(x) 2 | xd = [4; 7]; 3 | g = 2*(x-xd); 4 | end -------------------------------------------------------------------------------- /tex/chapters/vergleich/ergebnis.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/vergleich/ergebnis.tex -------------------------------------------------------------------------------- /tex/chapters/vergleich/vergleich.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/vergleich/vergleich.tex -------------------------------------------------------------------------------- /test/problem_v_norm/hess_func_for_problem_v_norm.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_norm(x) 2 | xd = [4; 7]; 3 | H = 2*eye(length(x)); 4 | end -------------------------------------------------------------------------------- /test/problem_v_norm_1/grad_func_for_problem_v_norm_1.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_norm_1(x) 2 | xd = [4; 2; 7]; 3 | g = 2*(x-xd); 4 | end -------------------------------------------------------------------------------- /tex/chapters/einleitung/einleitung.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/einleitung/einleitung.tex -------------------------------------------------------------------------------- /tex/chapters/grundlagen/grundlagen.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/grundlagen/grundlagen.tex -------------------------------------------------------------------------------- /tex/chapters/grundlagen/allg_opt_prob.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/grundlagen/allg_opt_prob.tex -------------------------------------------------------------------------------- /tex/chapters/sqp/lagrange_newton_sqp.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/sqp/lagrange_newton_sqp.tex -------------------------------------------------------------------------------- /tex/chapters/sqp/nullraum_verfahren.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/sqp/nullraum_verfahren.tex -------------------------------------------------------------------------------- /tex/chapters/ssn/active_set_strategie.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/ssn/active_set_strategie.tex -------------------------------------------------------------------------------- /tex/chapters/vergleich/testprobleme_v.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/vergleich/testprobleme_v.tex -------------------------------------------------------------------------------- /test/problem_v_norm_1/hess_func_for_problem_v_norm_1.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_norm_1(x) 2 | xd = [4; 2; 7]; 3 | H = 2*eye(length(x)); 4 | end -------------------------------------------------------------------------------- /tex/chapters/vergleich/opt_strg_problem.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/vergleich/opt_strg_problem.tex -------------------------------------------------------------------------------- /tex/images/beispiel-unrestr-opt-prob.table: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/images/beispiel-unrestr-opt-prob.table -------------------------------------------------------------------------------- /test/problem_v_beale/hess_func_for_problem_v_beale.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_beale(x) 2 | H = approx_hessian('func_for_problem_v_beale',x,0.00001); 3 | end -------------------------------------------------------------------------------- /tex/chapters/grundlagen/opt_prob_ohne_restr.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/grundlagen/opt_prob_ohne_restr.tex -------------------------------------------------------------------------------- /test/extras/opt_ctrl_prob/opt_ctrl_prob_constr_r.m: -------------------------------------------------------------------------------- 1 | function r = opt_ctrl_prob_constr_r (eta, N) 2 | r = zeros(3*N,1); 3 | for k=1:N 4 | r(3*k,1) = eta; 5 | end 6 | end -------------------------------------------------------------------------------- /test/problem_v_beale/grad_func_for_problem_v_beale.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_beale(x) 2 | g = approx_gradient('func_for_problem_v_beale',x,0.00001); 3 | end -------------------------------------------------------------------------------- /tex/chapters/vergleich/ergebnisse_genauigkeit.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/vergleich/ergebnisse_genauigkeit.tex -------------------------------------------------------------------------------- /test/problem_A_simple_example/grad_func_for_problem_A_simple_example.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_A_simple_example(x) 2 | xd = [0; 0; 0; 0; 0]; 3 | g = 2*(x-xd); 4 | end -------------------------------------------------------------------------------- /test/problem_v_beale_1/grad_func_for_problem_v_beale_1.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_beale_1(x) 2 | g = approx_gradient('func_for_problem_v_beale_1',x,0.00001); 3 | end -------------------------------------------------------------------------------- /test/problem_v_beale_1/hess_func_for_problem_v_beale_1.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_beale_1(x) 2 | H = approx_hessian('func_for_problem_v_beale_1',x,0.00001); 3 | end -------------------------------------------------------------------------------- /tex/extras/verzeichnisse.tex: -------------------------------------------------------------------------------- 1 | % Inhaltsverzeichnis 2 | \tableofcontents 3 | 4 | % Abbildungsverzeichnis 5 | %\listoffigures 6 | 7 | % Tabellenverzeichnis 8 | %\listoftables 9 | -------------------------------------------------------------------------------- /test/problem_v_colville/grad_func_for_problem_v_colville.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_colville(x) 2 | g = approx_gradient('func_for_problem_v_colville',x,0.00001); 3 | end -------------------------------------------------------------------------------- /test/problem_v_colville/hess_func_for_problem_v_colville.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_colville(x) 2 | H = approx_hessian('func_for_problem_v_colville',x,0.00001); 3 | end -------------------------------------------------------------------------------- /tex/chapters/grundlagen/opt_prob_mit_lin_gl_nebenbed.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/grundlagen/opt_prob_mit_lin_gl_nebenbed.tex -------------------------------------------------------------------------------- /tex/chapters/grundlagen/opt_prob_mit_nichtlin_restr.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/grundlagen/opt_prob_mit_nichtlin_restr.tex -------------------------------------------------------------------------------- /test/problem_A_simple_example/hess_func_for_problem_A_simple_example.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_A_simple_example(x) 2 | xd = [0; 0; 0; 0; 0]; 3 | H = 2*eye(length(x)); 4 | end -------------------------------------------------------------------------------- /test/problem_v_colville_1/hess_func_for_problem_v_colville_1.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_colville_1(x) 2 | H = approx_hessian('func_for_problem_v_colville_1',x,0.00001); 3 | end -------------------------------------------------------------------------------- /test/problem_v_rosenbrock/grad_func_for_problem_v_rosenbrock.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_rosenbrock(x) 2 | g = [-400*x(1)*(x(2)-x(1)^2)-2*(1-x(1)); 200*(x(2)-x(1)^2)]; 3 | end -------------------------------------------------------------------------------- /tex/chapters/grundlagen/opt_prob_mit_lin_ungl_nebenbed.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/grundlagen/opt_prob_mit_lin_ungl_nebenbed.tex -------------------------------------------------------------------------------- /tex/chapters/sqp/aktive_mengen_methode_fuer_quadr_prob.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viqizevic/SQP-vs.-Semismooth-Newton/HEAD/tex/chapters/sqp/aktive_mengen_methode_fuer_quadr_prob.tex -------------------------------------------------------------------------------- /test/problem_Gv_betts_hs21/hess_func_for_problem_Gv_betts_hs21.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_Gv_betts_hs21(x) 2 | Q = 2*[0.01 0; 0 1]; 3 | q = [0; 0]; 4 | c = -100; 5 | H = Q; 6 | end -------------------------------------------------------------------------------- /test/problem_v_colville_1/grad_func_for_problem_v_colville_1.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_colville_1(x) 2 | g = approx_gradient('func_for_problem_v_colville_1',x,0.00001); 3 | end -------------------------------------------------------------------------------- /test/problem_v_rosenbrock_1/grad_func_for_problem_v_rosenbrock_1.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_rosenbrock_1(x) 2 | g = [-400*x(1)*(x(2)-x(1)^2)-2*(1-x(1)); 200*(x(2)-x(1)^2)]; 3 | end -------------------------------------------------------------------------------- /test/extras/opt_ctrl_prob/opt_ctrl_prob_func_H.m: -------------------------------------------------------------------------------- 1 | function H = opt_ctrl_prob_func_H (rho_u, T, N) 2 | tao = T/N; 3 | H = zeros(2*N); 4 | for k=1:N 5 | H(2*k-1,2*k-1) = tao*rho_u; 6 | end 7 | end -------------------------------------------------------------------------------- /test/problem_Gv_betts_hs21/grad_func_for_problem_Gv_betts_hs21.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_Gv_betts_hs21(x) 2 | Q = 2*[0.01 0; 0 1]; 3 | q = [0; 0]; 4 | c = -100; 5 | g = Q*x + q; 6 | end -------------------------------------------------------------------------------- /test/problem_v_bazaraa_shetty/grad_func_for_problem_v_bazaraa_shetty.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_bazaraa_shetty(x) 2 | g = [ 4*(x(1)-2)^3+2*x(1)-4*x(2); 3 | -4*x(1)+8*x(2) ]; 4 | end -------------------------------------------------------------------------------- /test/problem_v_bazaraa_shetty/hess_func_for_problem_v_bazaraa_shetty.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_bazaraa_shetty(x) 2 | H = [ 12*(x(1)-2)^2+2 -4; 3 | -4 8 ]; 4 | end -------------------------------------------------------------------------------- /tex/.gitignore: -------------------------------------------------------------------------------- 1 | # no .project and .texlipse file (created by teXlipse) 2 | .project 3 | .texlipse 4 | 5 | # ignore all files in the tmp/ directory 6 | tmp/ 7 | 8 | # no .synctex.gz file 9 | *.synctex.gz -------------------------------------------------------------------------------- /test/problem_Gv_beale_hs35/hess_func_for_problem_Gv_beale_hs35.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_Gv_beale_hs35(x) 2 | Q = 2*[2 1 1; 1 2 0; 1 0 1]; 3 | q = [-8; -6; -4]; 4 | c = 9; 5 | H = Q; 6 | end -------------------------------------------------------------------------------- /test/problem_v_bazaraa_shetty_1/hess_func_for_problem_v_bazaraa_shetty_1.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_bazaraa_shetty_1(x) 2 | H = [ 12*(x(1)-2)^2+2 -4; 3 | -4 8 ]; 4 | end -------------------------------------------------------------------------------- /test/problem_Gv_beale_hs35/grad_func_for_problem_Gv_beale_hs35.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_Gv_beale_hs35(x) 2 | Q = 2*[2 1 1; 1 2 0; 1 0 1]; 3 | q = [-8; -6; -4]; 4 | c = 9; 5 | g = Q*x + q; 6 | end -------------------------------------------------------------------------------- /test/problem_Gv_example_16_4_nocedal_wright/grad_func_for_problem_Gv_example_16_4_nocedal_wright.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_Gv_example_16_4_nocedal_wright(x) 2 | xd = [1; 2.5]; 3 | g = 2*(x-xd); 4 | end -------------------------------------------------------------------------------- /test/problem_v_bazaraa_shetty_1/grad_func_for_problem_v_bazaraa_shetty_1.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_bazaraa_shetty_1(x) 2 | g = [ 4*(x(1)-2)^3+2*x(1)-4*x(2); 3 | -4*x(1)+8*x(2) ]; 4 | end -------------------------------------------------------------------------------- /test/problem_v_rosenbrock/hess_func_for_problem_v_rosenbrock.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_rosenbrock(x) 2 | H = [ 1200*x(1)^2-400*x(2)+2 -400*x(1); 3 | -400*x(1) 200 ]; 4 | end -------------------------------------------------------------------------------- /test/extras/opt_ctrl_prob/opt_ctrl_prob_constr_G.m: -------------------------------------------------------------------------------- 1 | function G = opt_ctrl_prob_constr_G (N) 2 | G = zeros(3*N,2*N); 3 | for k=1:N 4 | G(3*k-2,2*k-1) = -1; 5 | G(3*k-1,2*k) = -1; 6 | G(3*k,2*k) = 1; 7 | end 8 | end -------------------------------------------------------------------------------- /test/extras/opt_ctrl_prob/opt_ctrl_prob_func_q.m: -------------------------------------------------------------------------------- 1 | function q = opt_ctrl_prob_func_q (rho_z,s,T,N) 2 | tao = T/N; 3 | q = zeros(2*N,1); 4 | for k=1:N-1 5 | q(2*k) = tao*rho_z; 6 | end 7 | q(2*N) = tao*rho_z - s; 8 | end -------------------------------------------------------------------------------- /test/problem_Gv_example_16_4_nocedal_wright/hess_func_for_problem_Gv_example_16_4_nocedal_wright.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_Gv_example_16_4_nocedal_wright(x) 2 | xd = [1; 2.5]; 3 | H = 2*eye(length(x)); 4 | end -------------------------------------------------------------------------------- /test/problem_v_rosenbrock_1/hess_func_for_problem_v_rosenbrock_1.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_rosenbrock_1(x) 2 | H = [ 1200*x(1)^2-400*x(2)+2 -400*x(1); 3 | -400*x(1) 200 ]; 4 | end -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs28/hess_func_for_problem_A_huang_aggerwal_hs28.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_A_huang_aggerwal_hs28(x) 2 | Q = 2*[1 1 0; 1 2 1; 0 1 1]; 3 | q = [0; 0; 0]; 4 | c = 0; 5 | H = Q; 6 | end -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs49/grad_func_for_problem_A_huang_aggerwal_hs49.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_A_huang_aggerwal_hs49(x) 2 | g = approx_gradient('func_for_problem_A_huang_aggerwal_hs49',x,0.00001); 3 | end -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs49/hess_func_for_problem_A_huang_aggerwal_hs49.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_A_huang_aggerwal_hs49(x) 2 | H = approx_hessian('func_for_problem_A_huang_aggerwal_hs49',x,0.00001); 3 | end -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs50/grad_func_for_problem_A_huang_aggerwal_hs50.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_A_huang_aggerwal_hs50(x) 2 | g = approx_gradient('func_for_problem_A_huang_aggerwal_hs50',x,0.00001); 3 | end -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs50/hess_func_for_problem_A_huang_aggerwal_hs50.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_A_huang_aggerwal_hs50(x) 2 | H = approx_hessian('func_for_problem_A_huang_aggerwal_hs50',x,0.00001); 3 | end -------------------------------------------------------------------------------- /test/problem_v_himmelblau/hess_func_for_problem_v_himmelblau.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_himmelblau(x) 2 | H = [ 12*x(1)^2+4*x(2)-42 4*(x(1)+x(2)); 3 | 4*(x(1)+x(2)) 4*x(1)+12*x(2)^2-26 ]; 4 | end -------------------------------------------------------------------------------- /test/problem_AG_opt_ctrl/hess_func_for_problem_AG_opt_ctrl.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_AG_opt_ctrl(x) 2 | Q = opt_ctrl_prob_func_H(0.2,12,100); 3 | q = opt_ctrl_prob_func_q(0.1,1.5,12,100); 4 | c = 0; 5 | H = Q; 6 | end -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs28/grad_func_for_problem_A_huang_aggerwal_hs28.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_A_huang_aggerwal_hs28(x) 2 | Q = 2*[1 1 0; 1 2 1; 0 1 1]; 3 | q = [0; 0; 0]; 4 | c = 0; 5 | g = Q*x + q; 6 | end -------------------------------------------------------------------------------- /test/problem_G_example_with_diamond_area/hess_func_for_problem_G_example_with_diamond_area.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_G_example_with_diamond_area(x) 2 | Q = [2 0; 0 2]; 3 | q = [-4; -4]; 4 | c = 0; 5 | H = Q; 6 | end -------------------------------------------------------------------------------- /test/problem_v_himmelblau/grad_func_for_problem_v_himmelblau.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_himmelblau(x) 2 | g = [ 4*x(1)*(x(1)^2+x(2)-11) + 2*(x(1)+x(2)^2-7); 3 | 2*(x(1)^2+x(2)-11) + 4*x(2)*(x(1)+x(2)^2-7) ]; 4 | end -------------------------------------------------------------------------------- /test/problem_v_himmelblau_1/hess_func_for_problem_v_himmelblau_1.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_himmelblau_1(x) 2 | H = [ 12*x(1)^2+4*x(2)-42 4*(x(1)+x(2)); 3 | 4*(x(1)+x(2)) 4*x(1)+12*x(2)^2-26 ]; 4 | end -------------------------------------------------------------------------------- /test/problem_AG_opt_ctrl/grad_func_for_problem_AG_opt_ctrl.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_AG_opt_ctrl(x) 2 | Q = opt_ctrl_prob_func_H(0.2,12,100); 3 | q = opt_ctrl_prob_func_q(0.1,1.5,12,100); 4 | c = 0; 5 | g = Q*x + q; 6 | end -------------------------------------------------------------------------------- /test/problem_G_example_with_diamond_area/grad_func_for_problem_G_example_with_diamond_area.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_G_example_with_diamond_area(x) 2 | Q = [2 0; 0 2]; 3 | q = [-4; -4]; 4 | c = 0; 5 | g = Q*x + q; 6 | end -------------------------------------------------------------------------------- /test/problem_v_himmelblau_1/grad_func_for_problem_v_himmelblau_1.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_himmelblau_1(x) 2 | g = [ 4*x(1)*(x(1)^2+x(2)-11) + 2*(x(1)+x(2)^2-7); 3 | 2*(x(1)^2+x(2)-11) + 4*x(2)*(x(1)+x(2)^2-7) ]; 4 | end -------------------------------------------------------------------------------- /test/problem_v_exp/func_for_problem_v_exp.m: -------------------------------------------------------------------------------- 1 | %problem_v_exp 2 | %(Exponent-Funktion) 3 | %\min_{x\in\R^2}\ e^{\|x\|^2} 4 | %\nb -10 \leq x_i & \leq 10,\ i = 1,2 \\ 5 | % 6 | function y = func_for_problem_v_exp(x) 7 | y = exp(norm(x)^2); 8 | end -------------------------------------------------------------------------------- /test/problem_A_miele_hs52/hess_func_for_problem_A_miele_hs52.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_A_miele_hs52(x) 2 | Q = 2*[16 -4 0 0 0; -4 2 1 0 0; 0 1 1 0 0; 0 0 0 1 0; 0 0 0 0 1]; 3 | q = [0; -4; -4; -2; -2]; 4 | c = 6; 5 | H = Q; 6 | end -------------------------------------------------------------------------------- /test/problem_A_example_16_2_nocedal_wright/hess_func_for_problem_A_example_16_2_nocedal_wright.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_A_example_16_2_nocedal_wright(x) 2 | Q = [6 2 1; 2 5 2; 1 2 4]; 3 | q = [-8; -3; -3]; 4 | c = 0; 5 | H = Q; 6 | end -------------------------------------------------------------------------------- /test/problem_A_miele_hs52/grad_func_for_problem_A_miele_hs52.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_A_miele_hs52(x) 2 | Q = 2*[16 -4 0 0 0; -4 2 1 0 0; 0 1 1 0 0; 0 0 0 1 0; 0 0 0 0 1]; 3 | q = [0; -4; -4; -2; -2]; 4 | c = 6; 5 | g = Q*x + q; 6 | end -------------------------------------------------------------------------------- /test/problem_v_norm/func_for_problem_v_norm.m: -------------------------------------------------------------------------------- 1 | %problem_v_norm 2 | %\min_{x\in\R^2}\ (x_1 - 4)^2 + (x_2 - 7)^2 3 | %\nb -10 \leq x_i & \leq 10,\ i = 1,2 \\ 4 | % 5 | function y = func_for_problem_v_norm(x) 6 | xd = [4; 7]; 7 | y = norm(x-xd)^2; 8 | end -------------------------------------------------------------------------------- /test/problem_A_example_16_2_nocedal_wright/grad_func_for_problem_A_example_16_2_nocedal_wright.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_A_example_16_2_nocedal_wright(x) 2 | Q = [6 2 1; 2 5 2; 1 2 4]; 3 | q = [-8; -3; -3]; 4 | c = 0; 5 | g = Q*x + q; 6 | end -------------------------------------------------------------------------------- /test/problem_G_example_13_2_antoniou_lu/hess_func_for_problem_G_example_13_2_antoniou_lu.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_G_example_13_2_antoniou_lu(x) 2 | Q = 2*[1 0 -1 0; 0 1 0 -1; -1 0 1 0; 0 -1 0 1]; 3 | q = [0; 0; 0; 0]; 4 | c = 0; 5 | H = Q; 6 | end -------------------------------------------------------------------------------- /test/problem_Av_betts_miele_hs53/hess_func_for_problem_Av_betts_miele_hs53.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_Av_betts_miele_hs53(x) 2 | Q = 2*[1 -1 0 0 0; -1 2 1 0 0; 0 1 1 0 0; 0 0 0 1 0; 0 0 0 0 1]; 3 | q = [0; -4; -4; -2; -2]; 4 | c = 6; 5 | H = Q; 6 | end -------------------------------------------------------------------------------- /test/problem_G_example_13_2_antoniou_lu/grad_func_for_problem_G_example_13_2_antoniou_lu.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_G_example_13_2_antoniou_lu(x) 2 | Q = 2*[1 0 -1 0; 0 1 0 -1; -1 0 1 0; 0 -1 0 1]; 3 | q = [0; 0; 0; 0]; 4 | c = 0; 5 | g = Q*x + q; 6 | end -------------------------------------------------------------------------------- /test/problem_Gv_murtagh_sargent_hs76/hess_func_for_problem_Gv_murtagh_sargent_hs76.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_Gv_murtagh_sargent_hs76(x) 2 | Q = 2*[1 0 -0.5 0; 0 0.5 0 0; -0.5 0 1 0.5; 0 0 0.5 0.5]; 3 | q = [-1; -3; 1; -1]; 4 | c = 0; 5 | H = Q; 6 | end -------------------------------------------------------------------------------- /test/problem_AG_opt_ctrl/func_for_problem_AG_opt_ctrl.m: -------------------------------------------------------------------------------- 1 | %problem_AG_opt_ctrl 2 | % 3 | function y = func_for_problem_AG_opt_ctrl(x) 4 | Q = opt_ctrl_prob_func_H(0.2,12,100); 5 | q = opt_ctrl_prob_func_q(0.1,1.5,12,100); 6 | c = 0; 7 | y = 0.5*x'*Q*x + q'*x + c; 8 | end -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs51/hess_func_for_problem_A_huang_aggerwal_hs51.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_A_huang_aggerwal_hs51(x) 2 | Q = 2*[1 -1 0 0 0; -1 2 1 0 0; 0 1 1 0 0; 0 0 0 1 0; 0 0 0 0 1]; 3 | q = [0; -4; -4; -2; -2]; 4 | c = 6; 5 | H = Q; 6 | end -------------------------------------------------------------------------------- /test/problem_Av_betts_miele_hs53/grad_func_for_problem_Av_betts_miele_hs53.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_Av_betts_miele_hs53(x) 2 | Q = 2*[1 -1 0 0 0; -1 2 1 0 0; 0 1 1 0 0; 0 0 0 1 0; 0 0 0 0 1]; 3 | q = [0; -4; -4; -2; -2]; 4 | c = 6; 5 | g = Q*x + q; 6 | end -------------------------------------------------------------------------------- /test/problem_Gv_murtagh_sargent_hs76/grad_func_for_problem_Gv_murtagh_sargent_hs76.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_Gv_murtagh_sargent_hs76(x) 2 | Q = 2*[1 0 -0.5 0; 0 0.5 0 0; -0.5 0 1 0.5; 0 0 0.5 0.5]; 3 | q = [-1; -3; 1; -1]; 4 | c = 0; 5 | g = Q*x + q; 6 | end -------------------------------------------------------------------------------- /test/problem_v_exp/hess_func_for_problem_v_exp.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_exp(x) 2 | n = length(x); 3 | efx = exp(norm(x)^2); 4 | H = 2*efx*eye(n); 5 | for k=1:n 6 | for l=1:n 7 | H(k,l) = H(k,l) + 4*efx*x(k)*x(l); 8 | end 9 | end 10 | end -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs51/grad_func_for_problem_A_huang_aggerwal_hs51.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_A_huang_aggerwal_hs51(x) 2 | Q = 2*[1 -1 0 0 0; -1 2 1 0 0; 0 1 1 0 0; 0 0 0 1 0; 0 0 0 0 1]; 3 | q = [0; -4; -4; -2; -2]; 4 | c = 6; 5 | g = Q*x + q; 6 | end -------------------------------------------------------------------------------- /test/problem_v_exp_1/hess_func_for_problem_v_exp_1.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_exp_1(x) 2 | n = length(x); 3 | efx = exp(norm(x)^2); 4 | H = 2*efx*eye(n); 5 | for k=1:n 6 | for l=1:n 7 | H(k,l) = H(k,l) + 4*efx*x(k)*x(l); 8 | end 9 | end 10 | end -------------------------------------------------------------------------------- /test/problem_v_norm_1/func_for_problem_v_norm_1.m: -------------------------------------------------------------------------------- 1 | %problem_v_norm_1 2 | %\min_{x\in\R^3}\ (x_1 - 4)^2 + (x_2 - 2)^2 + (x_3 - 7)^2 3 | %\nb 5 \leq x_i & \leq 10,\ i = 1,2,3 \\ 4 | % 5 | function y = func_for_problem_v_norm_1(x) 6 | xd = [4; 2; 7]; 7 | y = norm(x-xd)^2; 8 | end -------------------------------------------------------------------------------- /test/extras/opt_ctrl_prob/opt_ctrl_prob_constr_A.m: -------------------------------------------------------------------------------- 1 | function A = opt_ctrl_prob_constr_A (T, N) 2 | tao = T/N; 3 | A = zeros(N,2*N); 4 | A(1,1) = -tao; 5 | A(1,2) = 1; 6 | for k=2:N 7 | A(k,2*k-2) = -1; 8 | A(k,2*k-1) = -tao; 9 | A(k,2*k) = 1; 10 | end 11 | end -------------------------------------------------------------------------------- /test/problem_v_lin_regression/grad_func_for_problem_v_lin_regression.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_lin_regression(x) 2 | xi = [1:1:10]'; 3 | eta = [-0.5; -2; -3; -3; -2.5; -2; -1; 1; 3; 5.5]; 4 | g = approx_gradient('func_for_problem_v_lin_regression',x,0.00001); 5 | end -------------------------------------------------------------------------------- /test/problem_v_lin_regression/hess_func_for_problem_v_lin_regression.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_lin_regression(x) 2 | xi = [1:1:10]'; 3 | eta = [-0.5; -2; -3; -3; -2.5; -2; -1; 1; 3; 5.5]; 4 | H = approx_hessian('func_for_problem_v_lin_regression',x,0.00001); 5 | end -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_miele_hs48/hess_func_for_problem_A_huang_aggerwal_miele_hs48.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_A_huang_aggerwal_miele_hs48(x) 2 | Q = 2*[1 0 0 0 0; 0 1 -1 0 0; 0 -1 1 0 0; 0 0 0 1 -1; 0 0 0 -1 1]; 3 | q = [-2; 0; 0; 0; 0]; 4 | c = 1; 5 | H = Q; 6 | end -------------------------------------------------------------------------------- /test/problem_v_quad_regression/grad_func_for_problem_v_quad_regression.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_quad_regression(x) 2 | xi = [1:1:10]'; 3 | eta = [-0.5; -2; -3; -3; -2.5; -2; -1; 1; 3; 5.5]; 4 | g = approx_gradient('func_for_problem_v_quad_regression',x,0.00001); 5 | end -------------------------------------------------------------------------------- /test/problem_v_quad_regression/hess_func_for_problem_v_quad_regression.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_quad_regression(x) 2 | xi = [1:1:10]'; 3 | eta = [-0.5; -2; -3; -3; -2.5; -2; -1; 1; 3; 5.5]; 4 | H = approx_hessian('func_for_problem_v_quad_regression',x,0.00001); 5 | end -------------------------------------------------------------------------------- /test/extras/approx_gradient.m: -------------------------------------------------------------------------------- 1 | function gradf = approx_gradient(f,x,epsi) 2 | n = length(x); 3 | gradf = zeros(n,1); 4 | for k=1:n 5 | ek = zeros(n,1); 6 | ek(k) = 1; 7 | gradf(k) = ( feval(f,x+epsi*ek) - feval(f,x-epsi*ek) ) / (2*epsi); 8 | end 9 | end -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_miele_hs48/grad_func_for_problem_A_huang_aggerwal_miele_hs48.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_A_huang_aggerwal_miele_hs48(x) 2 | Q = 2*[1 0 0 0 0; 0 1 -1 0 0; 0 -1 1 0 0; 0 0 0 1 -1; 0 0 0 -1 1]; 3 | q = [-2; 0; 0; 0; 0]; 4 | c = 1; 5 | g = Q*x + q; 6 | end -------------------------------------------------------------------------------- /test/problem_v_dixon/grad_func_for_problem_v_dixon.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_dixon(x) 2 | n = 10; 3 | g(1,1) = -2*(1-x(1)) + 4*x(1)*(x(1)^2-x(2)); 4 | for k=2:(n-1) 5 | g(k,1) = -2*(x(k-1)^2-x(k)) + 4*x(k)*(x(k)^2-x(k+1)); 6 | end 7 | g(n,1) = -2*(x(n-1)^2-x(n)) - 2*(1-x(n)); 8 | end -------------------------------------------------------------------------------- /test/problem_v_dixon_1/grad_func_for_problem_v_dixon_1.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_dixon_1(x) 2 | n = 10; 3 | g(1,1) = -2*(1-x(1)) + 4*x(1)*(x(1)^2-x(2)); 4 | for k=2:(n-1) 5 | g(k,1) = -2*(x(k-1)^2-x(k)) + 4*x(k)*(x(k)^2-x(k+1)); 6 | end 7 | g(n,1) = -2*(x(n-1)^2-x(n)) - 2*(1-x(n)); 8 | end -------------------------------------------------------------------------------- /test/problem_v_exp_1/func_for_problem_v_exp_1.m: -------------------------------------------------------------------------------- 1 | %problem_v_exp_1 2 | %(Exponent-Funktion) 3 | %\min_{x\in\R^3}\ e^{\|x\|^2} 4 | %\nb 0.5 \leq x_1 & \leq 10 \\ 5 | %1 \leq x_2 & \leq 10 \\ 6 | %1 \leq x_3 & \leq 10 \\ 7 | % 8 | function y = func_for_problem_v_exp_1(x) 9 | y = exp(norm(x)^2); 10 | end -------------------------------------------------------------------------------- /test/extras/opt_ctrl_prob/opt_ctrl_prob_constr_b.m: -------------------------------------------------------------------------------- 1 | function b = opt_ctrl_prob_constr_b (z0, T, N) 2 | tao = T/N; 3 | b = zeros(N,1); 4 | b(1) = z0-tao*func_r(0); 5 | for k=2:N 6 | b(k) = -tao*func_r(tao*(k-1)); 7 | end 8 | end 9 | 10 | function obj = func_r(x) 11 | obj = 10 + 5*sin(x); 12 | end 13 | -------------------------------------------------------------------------------- /test/problem_v_rosenbrock_1/func_for_problem_v_rosenbrock_1.m: -------------------------------------------------------------------------------- 1 | %problem_v_rosenbrock_1 2 | %(Rosenbrock-Funktion) 3 | %\min_{x\in\R^2}\ 100 (x_2-x_1^2)^2+(1-x_1)^2 4 | %\nb -10 \leq x_1 & \leq 10 \\ 5 | %1.5 \leq x_2 & \leq 10 \\ 6 | % 7 | function y = func_for_problem_v_rosenbrock_1(x) 8 | y = 100*(x(2)-x(1)^2)^2+(1-x(1))^2; 9 | end -------------------------------------------------------------------------------- /test/problem_v_bazaraa_shetty_1/func_for_problem_v_bazaraa_shetty_1.m: -------------------------------------------------------------------------------- 1 | %problem_v_bazaraa_shetty_1 2 | %(Bazaraa-Shetty-Funktion) 3 | %\min_{x\in\R^2}\ (x_1-2)^4+(x_1-2 x_2)^2 4 | %\nb 4 \leq x_1 & \leq 10 \\ 5 | %-10 \leq x_2 & \leq 10 \\ 6 | % 7 | function y = func_for_problem_v_bazaraa_shetty_1(x) 8 | y = (x(1)-2)^4+(x(1)-2*x(2))^2; 9 | end -------------------------------------------------------------------------------- /test/problem_v_himmelblau_1/func_for_problem_v_himmelblau_1.m: -------------------------------------------------------------------------------- 1 | %problem_v_himmelblau_1 2 | %(Himmelblau-Funktion) 3 | %\min_{x\in\R^2}\ (x_1^2+x_2-11)^2 + (x_1+x_2^2-7)^2 4 | %\nb -10 \leq x_1 & \leq 10 \\ 5 | %5 \leq x_2 & \leq 10 \\ 6 | % 7 | function y = func_for_problem_v_himmelblau_1(x) 8 | y = (x(1)^2+x(2)-11)^2 + (x(1)+x(2)^2-7)^2; 9 | end -------------------------------------------------------------------------------- /test/problem_v_rosenbrock/func_for_problem_v_rosenbrock.m: -------------------------------------------------------------------------------- 1 | %problem_v_rosenbrock 2 | %(Rosenbrock-Funktion, vgl. Beispiel 1.4.1 in \cite[S.~14]{alt}) 3 | %\min_{x\in\R^2}\ 100 (x_2-x_1^2)^2+(1-x_1)^2 4 | %\nb -10 \leq x_i & \leq 10,\ i = 1,2 \\ 5 | % 6 | function y = func_for_problem_v_rosenbrock(x) 7 | y = 100*(x(2)-x(1)^2)^2+(1-x(1))^2; 8 | end -------------------------------------------------------------------------------- /test/problem_v_bazaraa_shetty/func_for_problem_v_bazaraa_shetty.m: -------------------------------------------------------------------------------- 1 | %problem_v_bazaraa_shetty 2 | %(Bazaraa-Shetty-Funktion, vgl. Beispiel 1.4.3 in \cite[S.~15~f.]{alt}) 3 | %\min_{x\in\R^2}\ (x_1-2)^4+(x_1-2 x_2)^2 4 | %\nb -10 \leq x_i & \leq 10,\ i = 1,2 \\ 5 | % 6 | function y = func_for_problem_v_bazaraa_shetty(x) 7 | y = (x(1)-2)^4+(x(1)-2*x(2))^2; 8 | end -------------------------------------------------------------------------------- /test/problem_v_himmelblau/func_for_problem_v_himmelblau.m: -------------------------------------------------------------------------------- 1 | %problem_v_himmelblau 2 | %(Himmelblau-Funktion, vgl. Beispiel 1.4.2 in \cite[S.~14~f.]{alt}) 3 | %\min_{x\in\R^2}\ (x_1^2+x_2-11)^2 + (x_1+x_2^2-7)^2 4 | %\nb -10 \leq x_i & \leq 10,\ i = 1,2 \\ 5 | % 6 | function y = func_for_problem_v_himmelblau(x) 7 | y = (x(1)^2+x(2)-11)^2 + (x(1)+x(2)^2-7)^2; 8 | end -------------------------------------------------------------------------------- /test/extras/example_func_1.m: -------------------------------------------------------------------------------- 1 | % A function as an example for the thesis. 2 | % Based on an example in [Alt11]. 3 | % See file tex/images/beispiel-unrestr-opt-prob.table 4 | % for more information. 5 | % 6 | function y = example_func_1(x) 7 | n = length(x); 8 | y = zeros(n,1); 9 | for k=1:n 10 | y(k) = (2*x(k)-2)^2*(3*x(k)+3)^2 + 10*x(k); 11 | end 12 | end -------------------------------------------------------------------------------- /test/extras/opt_ctrl_prob/opt_ctrl_prob_constr_x0.m: -------------------------------------------------------------------------------- 1 | function x0 = opt_ctrl_prob_constr_x0 (z0, T, N) 2 | tao = T/N; 3 | x0 = zeros(2*N,1); 4 | z = 5; 5 | x0(1) = func_r(0)-(z-z0)/tao; 6 | x0(2) = z; 7 | for k=2:N 8 | x0(2*k-1) = func_r(tao*(k-1)); 9 | x0(2*k) = z; 10 | end 11 | end 12 | 13 | function obj = func_r(x) 14 | obj = 10 + 5*sin(x); 15 | end 16 | -------------------------------------------------------------------------------- /test/problem_v_beale_1/func_for_problem_v_beale_1.m: -------------------------------------------------------------------------------- 1 | %problem_v_beale_1 2 | %(Beale-Funktion) 3 | %\min_{x\in\R^2}\ (1.5-x_1 (1-x_2))^2+(2.25-x_1 (1-x_2^2))^2+(2.625-x_1 (1-x_2^3))^2 4 | %\nb 3 \leq x_1 & \leq 10 \\ 5 | %-10 \leq x_2 & \leq 10 \\ 6 | % 7 | function y = func_for_problem_v_beale_1(x) 8 | y = (1.5-x(1)*(1-x(2)))^2+(2.25-x(1)*(1-x(2)^2))^2+(2.625-x(1)*(1-x(2)^3))^2; 9 | end -------------------------------------------------------------------------------- /test/problem_v_beale/func_for_problem_v_beale.m: -------------------------------------------------------------------------------- 1 | %problem_v_beale 2 | %(Beale-Funktion, vgl. Aufgabe 2.2 in \cite[S.~39]{alt}) 3 | %\min_{x\in\R^2}\ (1.5-x_1 (1-x_2))^2+(2.25-x_1 (1-x_2^2))^2+(2.625-x_1 (1-x_2^3))^2 4 | %\nb -10 \leq x_i & \leq 10,\ i = 1,2 \\ 5 | % 6 | function y = func_for_problem_v_beale(x) 7 | y = (1.5-x(1)*(1-x(2)))^2+(2.25-x(1)*(1-x(2)^2))^2+(2.625-x(1)*(1-x(2)^3))^2; 8 | end -------------------------------------------------------------------------------- /test/problem_v_dixon/hess_func_for_problem_v_dixon.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_dixon(x) 2 | n = 10; 3 | for k=1:n 4 | for l=1:n 5 | H(k,l) = 0; 6 | if (l == k-1) 7 | H(k,l) = -4*x(k-1); 8 | end 9 | if (l == k) 10 | H(k,l) = 2+12*x(k)^2; 11 | end 12 | if (l == k+1) 13 | H(k,l) = -4*x(k); 14 | end 15 | end 16 | end 17 | H(n,n) = 4; 18 | end -------------------------------------------------------------------------------- /test/problem_A_simple_example/func_for_problem_A_simple_example.m: -------------------------------------------------------------------------------- 1 | %problem_A_simple_example 2 | %(Vgl. Beispiel~\ref{example:opt_prob_mit_lin_gl_nebenbed} auf Seite~\pageref{example:opt_prob_mit_lin_gl_nebenbed}) 3 | %\min_{x\in\R^5}\ \| x \|^2 4 | %\nb x_1 + x_2 + x_3 + x_4 + x_5 & = 1 \\ 5 | % 6 | function y = func_for_problem_A_simple_example(x) 7 | xd = [0; 0; 0; 0; 0]; 8 | y = norm(x-xd)^2; 9 | end -------------------------------------------------------------------------------- /test/problem_v_dixon_1/hess_func_for_problem_v_dixon_1.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_dixon_1(x) 2 | n = 10; 3 | for k=1:n 4 | for l=1:n 5 | H(k,l) = 0; 6 | if (l == k-1) 7 | H(k,l) = -4*x(k-1); 8 | end 9 | if (l == k) 10 | H(k,l) = 2+12*x(k)^2; 11 | end 12 | if (l == k+1) 13 | H(k,l) = -4*x(k); 14 | end 15 | end 16 | end 17 | H(n,n) = 4; 18 | end -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs28/func_for_problem_A_huang_aggerwal_hs28.m: -------------------------------------------------------------------------------- 1 | %problem_A_huang_aggerwal_hs28 2 | %(Vgl. Problem 28 in \cite[S.~51]{hock}) 3 | %\min_{x\in\R^3}\ (x_1 + x_2)^2 + (x_2 + x_3)^2 4 | %\nb x_1 + 2 x_2 + 3 x_3 & = 1 \\ 5 | % 6 | function y = func_for_problem_A_huang_aggerwal_hs28(x) 7 | Q = 2*[1 1 0; 1 2 1; 0 1 1]; 8 | q = [0; 0; 0]; 9 | c = 0; 10 | y = 0.5*x'*Q*x + q'*x + c; 11 | end -------------------------------------------------------------------------------- /test/problem_v_dixon_1/func_for_problem_v_dixon_1.m: -------------------------------------------------------------------------------- 1 | %problem_v_dixon_1 2 | %(Dixon-Funktion) 3 | %\min_{x\in\R^{10}}\ (1-x_1)^2 + \sum_{k=1}^{9} (x_k^2-x_{k+1})^2 + (1-x_{10})^2 4 | %\nb 2 \leq x_i & \leq 10,\ i = 1,\ldots,10 \\ 5 | % 6 | function y = func_for_problem_v_dixon_1(x) 7 | n = 10; 8 | y = (1-x(1))^2; 9 | for k=1:(n-1) 10 | y = y + (x(k)^2-x(k+1))^2; 11 | end 12 | y = y + (1-x(n))^2; 13 | end -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs49/func_for_problem_A_huang_aggerwal_hs49.m: -------------------------------------------------------------------------------- 1 | %problem_A_huang_aggerwal_hs49 2 | %(Vgl. Problem 49 in \cite[S.~72]{hock}) 3 | %\min_{x\in\R^5}\ (x_1-x_2)^2 + (x_3-1)^2 + (x_4-1)^2 + (x_5-1)^6 4 | %\nb x_1 + x_2 + x_3 + 4 x_4 & = 7 \\ 5 | %x_3 + 5 x_5 & = 6 \\ 6 | % 7 | function y = func_for_problem_A_huang_aggerwal_hs49(x) 8 | y = (x(1)-x(2))^2 + (x(3)-1)^2 + (x(4)-1)^2 + (x(5)-1)^6; 9 | end -------------------------------------------------------------------------------- /test/problem_Gv_betts_hs21/func_for_problem_Gv_betts_hs21.m: -------------------------------------------------------------------------------- 1 | %problem_Gv_betts_hs21 2 | %(Vgl. Problem 21 in \cite[S.~44]{hock}) 3 | %\min_{x\in\R^2}\ 0.01 x_1^2 + x_2^2 - 100 4 | %\nb -10 x_1 + x_2 & \leq -10 \\ 5 | %2 \leq x_1 & \leq 50 \\ 6 | %-50 \leq x_2 & \leq 50 \\ 7 | % 8 | function y = func_for_problem_Gv_betts_hs21(x) 9 | Q = 2*[0.01 0; 0 1]; 10 | q = [0; 0]; 11 | c = -100; 12 | y = 0.5*x'*Q*x + q'*x + c; 13 | end -------------------------------------------------------------------------------- /test/problem_v_dixon/func_for_problem_v_dixon.m: -------------------------------------------------------------------------------- 1 | %problem_v_dixon 2 | %(Dixon-Funktion, vgl. Beispiel 1.4.5 in \cite[S.~16]{alt}) 3 | %\min_{x\in\R^{10}}\ (1-x_1)^2 + \sum_{k=1}^{9} (x_k^2-x_{k+1})^2 + (1-x_{10})^2 4 | %\nb -10 \leq x_i & \leq 10,\ i = 1,\ldots,10 \\ 5 | % 6 | function y = func_for_problem_v_dixon(x) 7 | n = 10; 8 | y = (1-x(1))^2; 9 | for k=1:(n-1) 10 | y = y + (x(k)^2-x(k+1))^2; 11 | end 12 | y = y + (1-x(n))^2; 13 | end -------------------------------------------------------------------------------- /test/problem_v_colville/func_for_problem_v_colville.m: -------------------------------------------------------------------------------- 1 | %problem_v_colville 2 | %\min_{x\in\R^4}\ 100 (x_2-x_1^2)^2 + (1-x_1)^2 + 90 (x_4-x_3^2)^2 + (1-x_3)^2 + 10.1 ((x_2-1)^2 + (x_4-1)^2) + 19.8 (x_2-1) (x_4-1) 3 | %\nb -10 \leq x_i & \leq 10,\ i = 1,\ldots,4 \\ 4 | % 5 | function y = func_for_problem_v_colville(x) 6 | y = 100*(x(2)-x(1)^2)^2 + (1-x(1))^2 + 90*(x(4)-x(3)^2)^2 + (1-x(3))^2 + 10.1*((x(2)-1)^2 + (x(4)-1)^2) + 19.8*(x(2)-1)*(x(4)-1); 7 | end -------------------------------------------------------------------------------- /test/problem_G_example_with_diamond_area/func_for_problem_G_example_with_diamond_area.m: -------------------------------------------------------------------------------- 1 | %problem_G_example_with_diamond_area 2 | %\min_{x\in\R^2}\ x_1^2 + x_2^2 - 4 x_1 - 4 x_2 3 | %\nb 2 x_1 + x_2 & \leq 2 \\ 4 | %x_1 - x_2 & \leq 1 \\ 5 | %-x_1 - x_2 & \leq 1 \\ 6 | %-2 x_1 + x_2 & \leq 2 \\ 7 | % 8 | function y = func_for_problem_G_example_with_diamond_area(x) 9 | Q = [2 0; 0 2]; 10 | q = [-4; -4]; 11 | c = 0; 12 | y = 0.5*x'*Q*x + q'*x + c; 13 | end -------------------------------------------------------------------------------- /test/problem_Gv_beale_hs35/func_for_problem_Gv_beale_hs35.m: -------------------------------------------------------------------------------- 1 | %problem_Gv_beale_hs35 2 | %(Vgl. Problem 35 in \cite[S.~58]{hock}) 3 | %\min_{x\in\R^3}\ 2 x_1^2 + 2 x_1 x_2 + 2 x_1 x_3 + 2 x_2^2 + x_3^2 - 8 x_1 - 6 x_2 - 4 x_3 + 9 4 | %\nb x_1 + x_2 + 2 x_3 & \leq 3 \\ 5 | %0 & \leq x_i,\ i = 1,2,3 \\ 6 | % 7 | function y = func_for_problem_Gv_beale_hs35(x) 8 | Q = 2*[2 1 1; 1 2 0; 1 0 1]; 9 | q = [-8; -6; -4]; 10 | c = 9; 11 | y = 0.5*x'*Q*x + q'*x + c; 12 | end -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs50/func_for_problem_A_huang_aggerwal_hs50.m: -------------------------------------------------------------------------------- 1 | %problem_A_huang_aggerwal_hs50 2 | %(Vgl. Problem 50 in \cite[S.~73]{hock}) 3 | %\min_{x\in\R^5}\ (x_1-x_2)^2 + (x_2-x_3)^2 + (x_3-x_4)^4 + (x_4-x_5)^2 4 | %\nb x_1 + 2 x_2 + 3 x_3 & = 6 \\ 5 | %x_2 + 2 x_3 + 3 x_4 & = 6 \\ 6 | %x_3 + 2 x_4 + 3 x_5 & = 6 \\ 7 | % 8 | function y = func_for_problem_A_huang_aggerwal_hs50(x) 9 | y = (x(1)-x(2))^2 + (x(2)-x(3))^2 + (x(3)-x(4))^4 + (x(4)-x(5))^2; 10 | end -------------------------------------------------------------------------------- /test/problem_v_nichtlin_regression/grad_func_for_problem_v_nichtlin_regression.m: -------------------------------------------------------------------------------- 1 | function g = grad_func_for_problem_v_nichtlin_regression(x) 2 | xi = [1:1:10]'; 3 | eta = [1; 1.1; 1.2; 1.35; 1.55; 1.75; 2.5; 3; 3.7; 4.5]; 4 | m = length(xi); 5 | g = zeros(2,1); 6 | for k=1:m 7 | g(1) = g(1) + 2*exp(xi(k)*x(2)) * ( x(1)*exp(xi(k)*x(2)) - eta(k) ); 8 | end 9 | for k=1:m 10 | g(2) = g(2) + 2*xi(k)*x(1)*exp(xi(k)*x(2)) * ( x(1)*exp(xi(k)*x(2)) - eta(k) ); 11 | end 12 | end -------------------------------------------------------------------------------- /test/problem_A_miele_hs52/func_for_problem_A_miele_hs52.m: -------------------------------------------------------------------------------- 1 | %problem_A_miele_hs52 2 | %(Vgl. Problem 52 in \cite[S.~75]{hock}) 3 | %\min_{x\in\R^5}\ (4 x_1 - x_2)^2 + (x_2 + x_3 - 2)^2 + (x_4 - 1)^2 + (x_5 - 1)^2 4 | %\nb x_1 + 3 x_2 & = 0 \\ 5 | %x_3 + x_4 - 2 x_5 & = 0 \\ 6 | %x_2 - x_5 & = 0 \\ 7 | % 8 | function y = func_for_problem_A_miele_hs52(x) 9 | Q = 2*[16 -4 0 0 0; -4 2 1 0 0; 0 1 1 0 0; 0 0 0 1 0; 0 0 0 0 1]; 10 | q = [0; -4; -4; -2; -2]; 11 | c = 6; 12 | y = 0.5*x'*Q*x + q'*x + c; 13 | end -------------------------------------------------------------------------------- /test/problem_A_example_16_2_nocedal_wright/func_for_problem_A_example_16_2_nocedal_wright.m: -------------------------------------------------------------------------------- 1 | %problem_A_example_16_2_nocedal_wright 2 | %(Vgl. Beispiel 16.2 in \cite[S.~452]{nocedal}) 3 | %\min_{x\in\R^3}\ 3 x_1^2 + 2 x_1 x_2 + x_1 x_3 + 2.5 x_2^2 + 2 x_2 x_3 + 2 x_3^2 - 8 x_1 - 3 x_2 - 3 x_3 4 | %\nb x_1 + x_3 & = 3 \\ 5 | %x_2 + x_3 & = 0 \\ 6 | % 7 | function y = func_for_problem_A_example_16_2_nocedal_wright(x) 8 | Q = [6 2 1; 2 5 2; 1 2 4]; 9 | q = [-8; -3; -3]; 10 | c = 0; 11 | y = 0.5*x'*Q*x + q'*x + c; 12 | end -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs51/func_for_problem_A_huang_aggerwal_hs51.m: -------------------------------------------------------------------------------- 1 | %problem_A_huang_aggerwal_hs51 2 | %(Vgl. Problem 51 in \cite[S.~74]{hock}) 3 | %\min_{x\in\R^5}\ (x_1 - x_2)^2 + (x_2 + x_3 - 2)^2 + (x_4 - 1)^2 + (x_5 - 1)^2 4 | %\nb x_1 + 3 x_2 & = 4 \\ 5 | %x_3 + x_4 - 2 x_5 & = 0 \\ 6 | %x_2 - x_5 & = 0 \\ 7 | % 8 | function y = func_for_problem_A_huang_aggerwal_hs51(x) 9 | Q = 2*[1 -1 0 0 0; -1 2 1 0 0; 0 1 1 0 0; 0 0 0 1 0; 0 0 0 0 1]; 10 | q = [0; -4; -4; -2; -2]; 11 | c = 6; 12 | y = 0.5*x'*Q*x + q'*x + c; 13 | end -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_miele_hs48/func_for_problem_A_huang_aggerwal_miele_hs48.m: -------------------------------------------------------------------------------- 1 | %problem_A_huang_aggerwal_miele_hs48 2 | %(Vgl. Problem 48 in \cite[S.~71]{hock}) 3 | %\min_{x\in\R^5}\ (x_1 - 1)^2 + (x_2 - x_3)^2 + (x_4 - x_5)^2 4 | %\nb x_1 + x_2 + x_3 + x_4 + x_5 & = 5 \\ 5 | %x_3 - 2 x_4 - 2 x_5 & = -3 \\ 6 | % 7 | function y = func_for_problem_A_huang_aggerwal_miele_hs48(x) 8 | Q = 2*[1 0 0 0 0; 0 1 -1 0 0; 0 -1 1 0 0; 0 0 0 1 -1; 0 0 0 -1 1]; 9 | q = [-2; 0; 0; 0; 0]; 10 | c = 1; 11 | y = 0.5*x'*Q*x + q'*x + c; 12 | end -------------------------------------------------------------------------------- /test/problem_v_colville_1/func_for_problem_v_colville_1.m: -------------------------------------------------------------------------------- 1 | %problem_v_colville_1 2 | %\min_{x\in\R^4}\ 100 (x_2-x_1^2)^2 + (1-x_1)^2 + 90 (x_4-x_3^2)^2 + (1-x_3)^2 + 10.1 ((x_2-1)^2 + (x_4-1)^2) + 19.8 (x_2-1) (x_4-1) 3 | %\nb 2 \leq x_1 & \leq 10 \\ 4 | %-10 \leq x_2 & \leq 10 \\ 5 | %-10 \leq x_3 & \leq 10 \\ 6 | %-10 \leq x_4 & \leq 10 \\ 7 | % 8 | function y = func_for_problem_v_colville_1(x) 9 | y = 100*(x(2)-x(1)^2)^2 + (1-x(1))^2 + 90*(x(4)-x(3)^2)^2 + (1-x(3))^2 + 10.1*((x(2)-1)^2 + (x(4)-1)^2) + 19.8*(x(2)-1)*(x(4)-1); 10 | end -------------------------------------------------------------------------------- /test/problem_Gv_example_16_4_nocedal_wright/func_for_problem_Gv_example_16_4_nocedal_wright.m: -------------------------------------------------------------------------------- 1 | %problem_Gv_example_16_4_nocedal_wright 2 | %(Vgl. Beispiel~\ref{example:opt_prob_mit_lin_ungl_nebenbed} auf Seite~\pageref{example:opt_prob_mit_lin_ungl_nebenbed}) 3 | %\min_{x\in\R^2}\ (x_1 - 1)^2 + (x_2 - 2.5)^2 4 | %\nb -x_1 + 2 x_2 & \leq 2 \\ 5 | %x_1 + 2 x_2 & \leq 6 \\ 6 | %x_1 - 2 x_2 & \leq 2 \\ 7 | %0 & \leq x_i,\ i = 1,2 \\ 8 | % 9 | function y = func_for_problem_Gv_example_16_4_nocedal_wright(x) 10 | xd = [1; 2.5]; 11 | y = norm(x-xd)^2; 12 | end -------------------------------------------------------------------------------- /test/problem_v_nichtlin_regression/func_for_problem_v_nichtlin_regression.m: -------------------------------------------------------------------------------- 1 | %problem_v_nichtlin_regression 2 | %\min_{x\in\R^2}\ f(x) %TODO write f(x) 3 | %% y = 0; 4 | %% for k=1:m 5 | %% y = y + ( x(1)*exp(xi(k)*x(2)) - eta(k) )^2; 6 | %% end 7 | %\nb -10 \leq x_i & \leq 10,\ i = 1,2 \\ 8 | % 9 | function y = func_for_problem_v_nichtlin_regression(x) 10 | xi = [1:1:10]'; 11 | eta = [1; 1.1; 1.2; 1.35; 1.55; 1.75; 2.5; 3; 3.7; 4.5]; 12 | m = length(xi); 13 | y = 0; 14 | for k=1:m 15 | y = y + ( x(1)*exp(xi(k)*x(2)) - eta(k) )^2; 16 | end 17 | end -------------------------------------------------------------------------------- /test/extras/approx_hessian.m: -------------------------------------------------------------------------------- 1 | function hessf = approx_hessian(f,x,epsi) 2 | n = length(x); 3 | hessf = zeros(n,n); 4 | for k=1:n 5 | ek = zeros(n,1); 6 | ek(k) = 1; 7 | for j=1:k 8 | ej = zeros(n,1); 9 | ej(j) = 1; 10 | hessf(k,j) = ( feval(f,x+epsi*ek+epsi*ej) - feval(f,x+epsi*ek) - feval(f,x+epsi*ej) + feval(f,x) ) / (epsi^2); 11 | if k == j 12 | hessf(k,k) = hessf(k,k)/2; 13 | end 14 | end 15 | end 16 | hessf = hessf + hessf'; 17 | end -------------------------------------------------------------------------------- /test/problem_Av_betts_miele_hs53/func_for_problem_Av_betts_miele_hs53.m: -------------------------------------------------------------------------------- 1 | %problem_Av_betts_miele_hs53 2 | %(Vgl. Problem 53 in \cite[S.~76]{hock}) 3 | %\min_{x\in\R^5}\ (x_1 - x_2)^2 + (x_2 + x_3 - 2)^2 + (x_4 - 1)^2 + (x_5 - 1)^2 4 | %\nb x_1 + 3 x_2 & = 0 \\ 5 | %x_3 + x_4 - 2 x_5 & = 0 \\ 6 | %x_2 - x_5 & = 0 \\ 7 | %-10 \leq x_i & \leq 10,\ i = 1,\ldots,5 \\ 8 | % 9 | function y = func_for_problem_Av_betts_miele_hs53(x) 10 | Q = 2*[1 -1 0 0 0; -1 2 1 0 0; 0 1 1 0 0; 0 0 0 1 0; 0 0 0 0 1]; 11 | q = [0; -4; -4; -2; -2]; 12 | c = 6; 13 | y = 0.5*x'*Q*x + q'*x + c; 14 | end -------------------------------------------------------------------------------- /test/problem_v_quad_regression/func_for_problem_v_quad_regression.m: -------------------------------------------------------------------------------- 1 | %problem_v_quad_regression 2 | %\min_{x\in\R^3}\ f(x) %TODO write f(x) 3 | %% y = 0; 4 | %% m = length(xi); 5 | %% for k=1:m 6 | %% y = y + ( x(1)*(xi(k) - x(2))^2 + x(3) - eta(k) )^2; 7 | %% end 8 | %\nb -10 \leq x_i & \leq 20,\ i = 1,2,3 \\ 9 | % 10 | function y = func_for_problem_v_quad_regression(x) 11 | xi = [1:1:10]'; 12 | eta = [-0.5; -2; -3; -3; -2.5; -2; -1; 1; 3; 5.5]; 13 | y = 0; 14 | m = length(xi); 15 | for k=1:m 16 | y = y + ( x(1)*(xi(k) - x(2))^2 + x(3) - eta(k) )^2; 17 | end 18 | end -------------------------------------------------------------------------------- /test/problem_v_nichtlin_regression/hess_func_for_problem_v_nichtlin_regression.m: -------------------------------------------------------------------------------- 1 | function H = hess_func_for_problem_v_nichtlin_regression(x) 2 | xi = [1:1:10]'; 3 | eta = [1; 1.1; 1.2; 1.35; 1.55; 1.75; 2.5; 3; 3.7; 4.5]; 4 | m = length(xi); 5 | H = zeros(2,2); 6 | for k=1:m 7 | H(1,1) = H(1,1) + 2*exp(2*xi(k)*x(2)); 8 | end 9 | for k=1:m 10 | H(1,2) = H(1,2) + 4*xi(k)*x(1)*exp(2*xi(k)*x(2)) - 2*xi(k)*eta(k)*exp(xi(k)*x(2)); 11 | end 12 | H(2,1) = H(1,2); 13 | for k=1:m 14 | H(2,2) = H(2,2) + 4*xi(k)^2*x(1)^2*exp(2*xi(k)*x(2)) - 2*xi(k)^2*eta(k)*x(1)*exp(xi(k)*x(2)); 15 | end 16 | end -------------------------------------------------------------------------------- /test/problem_Gv_murtagh_sargent_hs76/func_for_problem_Gv_murtagh_sargent_hs76.m: -------------------------------------------------------------------------------- 1 | %problem_Gv_murtagh_sargent_hs76 2 | %(Vgl. Problem 76 in \cite[S.~96]{hock}) 3 | %\min_{x\in\R^4}\ x_1^2 + 0.5 x_2^2 + x_3^2 + 0.5 x_4^2 - x_1 x_3 + x_3 x_4 - x_1 - 3 x_2 + x_3 - x_4 4 | %\nb x_1 + 2 x_2 + x_3 + x_4 & \leq 5 \\ 5 | %3 x_1 + x_2 + 2 x_3 - x_4 & \leq 4 \\ 6 | %-x_2 - 4 x_3 & \leq -1.5 \\ 7 | %0 & \leq x_i,\ i = 1,\ldots,4 \\ 8 | % 9 | function y = func_for_problem_Gv_murtagh_sargent_hs76(x) 10 | Q = 2*[1 0 -0.5 0; 0 0.5 0 0; -0.5 0 1 0.5; 0 0 0.5 0.5]; 11 | q = [-1; -3; 1; -1]; 12 | c = 0; 13 | y = 0.5*x'*Q*x + q'*x + c; 14 | end -------------------------------------------------------------------------------- /test/problem_v_lin_regression/func_for_problem_v_lin_regression.m: -------------------------------------------------------------------------------- 1 | %problem_v_lin_regression 2 | %Lineare Regression (Vgl. Beispiel~\ref{example:lineare_regression}) 3 | %\min_{x\in\R^2}\ f(x) %TODO write f(x) 4 | %% y = 0; 5 | %% m = length(xi); 6 | %% for k=1:m 7 | %% y = y + ( x(1)*xi(k) + x(2) - eta(k) )^2; 8 | %% end 9 | %\nb -10 \leq x_i & \leq 10,\ i = 1,2 \\ 10 | % 11 | function y = func_for_problem_v_lin_regression(x) 12 | xi = [1:1:10]'; 13 | eta = [-0.5; -2; -3; -3; -2.5; -2; -1; 1; 3; 5.5]; 14 | y = 0; 15 | m = length(xi); 16 | for k=1:m 17 | y = y + ( x(1)*xi(k) + x(2) - eta(k) )^2; 18 | end 19 | end -------------------------------------------------------------------------------- /test/problem_G_example_13_2_antoniou_lu/func_for_problem_G_example_13_2_antoniou_lu.m: -------------------------------------------------------------------------------- 1 | %problem_G_example_13_2_antoniou_lu 2 | %(Vgl. Beispiel~\ref{example:abstand_zw_dreiecken_problem} auf Seite~\pageref{example:abstand_zw_dreiecken_problem}) 3 | %\min_{x\in\R^4}\ (x_1 - x_3)^2 + (x_2 - x_4)^2 4 | %\nb -x_1 & \leq 0 \\ 5 | %-x_2 & \leq 0 \\ 6 | %x_1 + 2 x_2 & \leq 2 \\ 7 | %-x_4 & \leq -2 \\ 8 | %-x_3 - x_4 & \leq -3 \\ 9 | %x_3 + 2 x_4 & \leq 6 \\ 10 | % 11 | function y = func_for_problem_G_example_13_2_antoniou_lu(x) 12 | Q = 2*[1 0 -1 0; 0 1 0 -1; -1 0 1 0; 0 -1 0 1]; 13 | q = [0; 0; 0; 0]; 14 | c = 0; 15 | y = 0.5*x'*Q*x + q'*x + c; 16 | end -------------------------------------------------------------------------------- /test/extras/plot3dim.m: -------------------------------------------------------------------------------- 1 | % plot3dim(f,x1,x2,gapx,y1,y2,gapy) 2 | % - the function f should be a scalarfunction f:R^2->R 3 | % - x1,x2 real numbers with x1 < x2 4 | % - gapx a real number with gapx << (x2-x1) 5 | % - y1,y2 real numbers with y1 < y2 6 | % - gapy a real number with gapy << (y2-y1) 7 | % the plot will be made considering all points (x,y): 8 | % x in {x1, x1+gapx, x1+2*gapx, ... , x2}, 9 | % y in {y1, y1+gapy, y1+2*gapy, ... , y2} 10 | % 11 | function plot3dim(f,x1,x2,gapx,y1,y2,gapy) 12 | vx = x1:gapx:x2; 13 | vy = y1:gapy:y2; 14 | [x,y] = meshgrid(vx,vy); 15 | [m,n] = size(x); 16 | z = zeros(m,n); 17 | for k=1:m 18 | for l=1:n 19 | v = [x(k,l); y(k,l)]; 20 | z(k,l) = feval(f,v); 21 | end 22 | end 23 | surfc(x,y,z); 24 | end -------------------------------------------------------------------------------- /test/extras/function_value_in_iteration_points.m: -------------------------------------------------------------------------------- 1 | function function_value_in_iteration_points() 2 | %testproblem = 'test_problem_v_beale_1'; 3 | %func = 'func_for_problem_v_beale_1'; 4 | testproblem = 'test_problem_v_dixon'; 5 | func = 'func_for_problem_v_dixon'; 6 | [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = feval(testproblem,2); 7 | V = X_ssn; 8 | W = X_sqp; 9 | [m,n] = size(V); 10 | [p,n] = size(W); 11 | r = max(m,p); 12 | s = min(m,p); 13 | for i=1:r 14 | if i <= s 15 | U(i,1) = feval(func,V(i,:)'); 16 | U(i,2) = feval(func,W(i,:)'); 17 | else 18 | if m == r 19 | U(i,1) = feval(func,V(i,:)'); 20 | U(i,2) = 1.23456789; 21 | else 22 | U(i,1) = 1.23456789; 23 | U(i,2) = feval(func,W(i,:)'); 24 | end 25 | end 26 | end 27 | U 28 | end -------------------------------------------------------------------------------- /tex/README.markdown: -------------------------------------------------------------------------------- 1 | # Bachelor Thesis: SQP vs. Semismooth-Newton 2 | 3 | The title of the bachelor thesis in German is: 4 | **Vergleich zwischen halgblattem Newton-Verfahren und SQP-Verfahren** 5 | (in English: Comparison between Semismooth Newton Method and SQP Method) 6 | 7 | This directory contains all LaTeX files for the bachelor thesis. 8 | 9 | * Main tex file: `Bachelor-Thesis.tex` 10 | 11 | * `chapters` contains all files for each chapters in the thesis. 12 | 13 | * `extras` contains files defining the header, the appendix, etc. 14 | 15 | * `biblio` contains the bibliography data. 16 | 17 | * `images` contains all images and files needed for the plot. 18 | 19 | The writing project in LaTeX was maintained using [TeXlipse][]. 20 | 21 | [texlipse]: http://texlipse.sourceforge.net "TeXlipse" -------------------------------------------------------------------------------- /tex/images/ssn_results.table: -------------------------------------------------------------------------------- 1 | 1 1 # problem_v_norm 2 | 2 4 # problem_v_rosenbrock 3 | 3 5 # problem_v_himmelblau 4 | 4 9 # problem_v_bazaraa_shetty 5 | 5 20 # problem_v_beale 6 | 6 36 # problem_v_exp 7 | 7 172 # problem_v_colville 8 | 8 148 # problem_v_dixon 9 | 9 3 # problem_v_norm_1 10 | 10 6 # problem_v_rosenbrock_1 11 | 11 6 # problem_v_himmelblau_1 12 | 12 4 # problem_v_bazaraa_shetty_1 13 | 13 22 # problem_v_beale_1 14 | 14 50 # problem_v_exp_1 15 | 15 70 # problem_v_colville_1 16 | 16 42 # problem_v_dixon_1 17 | 17 15 # problem_v_lin_regression 18 | 18 142 # problem_v_quad_regression 19 | 19 75 # problem_v_nichtlin_regression 20 | 20 1 # problem_A_example_16_2_nocedal_wright 21 | 21 1 # problem_A_simple_example 22 | 22 1 # problem_A_huang_aggerwal_hs28 23 | 23 1 # problem_A_huang_aggerwal_miele_hs48 24 | 24 1 # problem_A_huang_aggerwal_hs51 25 | 25 1 # problem_A_miele_hs52 26 | 26 2 # problem_Av_betts_miele_hs53 27 | 27 20 # problem_A_huang_aggerwal_hs49 28 | 28 65 # problem_A_huang_aggerwal_hs50 29 | 29 2 # problem_G_example_with_diamond_area 30 | 30 2 # problem_Gv_example_16_4_nocedal_wright 31 | 31 3 # problem_G_example_13_2_antoniou_lu 32 | 32 3 # problem_Gv_betts_hs21 33 | 33 2 # problem_Gv_beale_hs35 34 | 34 4 # problem_Gv_murtagh_sargent_hs76 -------------------------------------------------------------------------------- /tex/images/sqp_results.table: -------------------------------------------------------------------------------- 1 | 1 2 # problem_v_norm 2 | 2 7 # problem_v_rosenbrock 3 | 3 9 # problem_v_himmelblau 4 | 4 36 # problem_v_bazaraa_shetty 5 | 5 25 # problem_v_beale 6 | 6 65 # problem_v_exp 7 | 7 195 # problem_v_colville 8 | 8 211 # problem_v_dixon 9 | 9 6 # problem_v_norm_1 10 | 10 13 # problem_v_rosenbrock_1 11 | 11 21 # problem_v_himmelblau_1 12 | 12 5 # problem_v_bazaraa_shetty_1 13 | 13 21 # problem_v_beale_1 14 | 14 91 # problem_v_exp_1 15 | 15 86 # problem_v_colville_1 16 | 16 98 # problem_v_dixon_1 17 | 17 18 # problem_v_lin_regression 18 | 18 152 # problem_v_quad_regression 19 | 19 87 # problem_v_nichtlin_regression 20 | 20 2 # problem_A_example_16_2_nocedal_wright 21 | 21 2 # problem_A_simple_example 22 | 22 2 # problem_A_huang_aggerwal_hs28 23 | 23 2 # problem_A_huang_aggerwal_miele_hs48 24 | 24 2 # problem_A_huang_aggerwal_hs51 25 | 25 2 # problem_A_miele_hs52 26 | 26 4 # problem_Av_betts_miele_hs53 27 | 27 22 # problem_A_huang_aggerwal_hs49 28 | 28 74 # problem_A_huang_aggerwal_hs50 29 | 29 6 # problem_G_example_with_diamond_area 30 | 30 6 # problem_Gv_example_16_4_nocedal_wright 31 | 31 10 # problem_G_example_13_2_antoniou_lu 32 | 32 4 # problem_Gv_betts_hs21 33 | 33 4 # problem_Gv_beale_hs35 34 | 34 8 # problem_Gv_murtagh_sargent_hs76 -------------------------------------------------------------------------------- /test/problem_v_exp/test_problem_v_exp.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_exp(show) 2 | u = [-10; -10]; 3 | v = [10; 10]; 4 | x0 = [5; 4]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_exp','grad_func_for_problem_v_exp','hess_func_for_problem_v_exp',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_exp','grad_func_for_problem_v_exp','hess_func_for_problem_v_exp',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_norm/test_problem_v_norm.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_norm(show) 2 | u = [-10; -10]; 3 | v = [10; 10]; 4 | x0 = [8; 9]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_norm','grad_func_for_problem_v_norm','hess_func_for_problem_v_norm',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_norm','grad_func_for_problem_v_norm','hess_func_for_problem_v_norm',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/test-populator/src/data/test_problem.tpl: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_{var_problem_name}(show) 2 | u = {var_u}; 3 | v = {var_v}; 4 | x0 = {var_x0}; 5 | tol = {var_tol}; 6 | itmax = {var_itmax}; 7 | A = {var_A}; 8 | b = {var_b}; 9 | G = {var_G}; 10 | r = {var_r}; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('{var_function_name}','{var_grad_function_name}','{var_hess_function_name}',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('{var_function_name}','{var_grad_function_name}','{var_hess_function_name}',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end -------------------------------------------------------------------------------- /test/problem_v_beale/test_problem_v_beale.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_beale(show) 2 | u = [-10; -10]; 3 | v = [10; 10]; 4 | x0 = [5; 0]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_beale','grad_func_for_problem_v_beale','hess_func_for_problem_v_beale',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_beale','grad_func_for_problem_v_beale','hess_func_for_problem_v_beale',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_exp_1/test_problem_v_exp_1.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_exp_1(show) 2 | u = [0.5; 1; 1]; 3 | v = [10; 10; 10]; 4 | x0 = [5; 2; 4]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_exp_1','grad_func_for_problem_v_exp_1','hess_func_for_problem_v_exp_1',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_exp_1','grad_func_for_problem_v_exp_1','hess_func_for_problem_v_exp_1',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_beale_1/test_problem_v_beale_1.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_beale_1(show) 2 | u = [3; -10]; 3 | v = [10; 10]; 4 | x0 = [5; 0]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_beale_1','grad_func_for_problem_v_beale_1','hess_func_for_problem_v_beale_1',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_beale_1','grad_func_for_problem_v_beale_1','hess_func_for_problem_v_beale_1',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_norm_1/test_problem_v_norm_1.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_norm_1(show) 2 | u = [5; 5; 5]; 3 | v = [10; 10; 10]; 4 | x0 = [7; 10; 9]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_norm_1','grad_func_for_problem_v_norm_1','hess_func_for_problem_v_norm_1',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_norm_1','grad_func_for_problem_v_norm_1','hess_func_for_problem_v_norm_1',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_himmelblau/test_problem_v_himmelblau.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_himmelblau(show) 2 | u = [-10; -10]; 3 | v = [10; 10]; 4 | x0 = [5; 5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_himmelblau','grad_func_for_problem_v_himmelblau','hess_func_for_problem_v_himmelblau',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_himmelblau','grad_func_for_problem_v_himmelblau','hess_func_for_problem_v_himmelblau',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_rosenbrock/test_problem_v_rosenbrock.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_rosenbrock(show) 2 | u = [-10; -10]; 3 | v = [10; 10]; 4 | x0 = [-1; 2]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_rosenbrock','grad_func_for_problem_v_rosenbrock','hess_func_for_problem_v_rosenbrock',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_rosenbrock','grad_func_for_problem_v_rosenbrock','hess_func_for_problem_v_rosenbrock',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_colville/test_problem_v_colville.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_colville(show) 2 | u = [-10; -10; -10; -10]; 3 | v = [10; 10; 10; 10]; 4 | x0 = [3; -1; -3; -1]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_colville','grad_func_for_problem_v_colville','hess_func_for_problem_v_colville',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_colville','grad_func_for_problem_v_colville','hess_func_for_problem_v_colville',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_Gv_beale_hs35/test_problem_Gv_beale_hs35.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_Gv_beale_hs35(show) 2 | u = [0; 0; 0]; 3 | v = []; 4 | x0 = [1.5; 0.5; 0.5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = [1 1 2]; 10 | r = [3]; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_Gv_beale_hs35','grad_func_for_problem_Gv_beale_hs35','hess_func_for_problem_Gv_beale_hs35',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_Gv_beale_hs35','grad_func_for_problem_Gv_beale_hs35','hess_func_for_problem_Gv_beale_hs35',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_Gv_betts_hs21/test_problem_Gv_betts_hs21.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_Gv_betts_hs21(show) 2 | u = [2; -50]; 3 | v = [50; 50]; 4 | x0 = [10; -10]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = [-10 1]; 10 | r = [-10]; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_Gv_betts_hs21','grad_func_for_problem_Gv_betts_hs21','hess_func_for_problem_Gv_betts_hs21',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_Gv_betts_hs21','grad_func_for_problem_Gv_betts_hs21','hess_func_for_problem_Gv_betts_hs21',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_himmelblau_1/test_problem_v_himmelblau_1.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_himmelblau_1(show) 2 | u = [-10; 5]; 3 | v = [10; 10]; 4 | x0 = [10; 10]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_himmelblau_1','grad_func_for_problem_v_himmelblau_1','hess_func_for_problem_v_himmelblau_1',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_himmelblau_1','grad_func_for_problem_v_himmelblau_1','hess_func_for_problem_v_himmelblau_1',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_rosenbrock_1/test_problem_v_rosenbrock_1.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_rosenbrock_1(show) 2 | u = [-10; 1.5]; 3 | v = [10; 10]; 4 | x0 = [2; 3]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_rosenbrock_1','grad_func_for_problem_v_rosenbrock_1','hess_func_for_problem_v_rosenbrock_1',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_rosenbrock_1','grad_func_for_problem_v_rosenbrock_1','hess_func_for_problem_v_rosenbrock_1',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_colville_1/test_problem_v_colville_1.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_colville_1(show) 2 | u = [2; -10; -10; -10]; 3 | v = [10; 10; 10; 10]; 4 | x0 = [3; -1; -3; -1]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_colville_1','grad_func_for_problem_v_colville_1','hess_func_for_problem_v_colville_1',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_colville_1','grad_func_for_problem_v_colville_1','hess_func_for_problem_v_colville_1',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test.config: -------------------------------------------------------------------------------- 1 | # Relative path from the eclipse project in workspace to the "test" directory. 2 | # The Matlab files created for the test will be placed in this directory. 3 | path_to_test_dir = SQP-vs.-Semismooth-Newton/test/ 4 | 5 | # If Octave is used instead of Matlab. 6 | use_octave = true 7 | 8 | # Relative path from "test" directory to the directory "data". 9 | path_to_data_dir = test-populator/src/data/ 10 | 11 | # XML files defining the functions and the problems. 12 | functions_xml_file_0 = functions.xml 13 | problems_xml_file_0 = problems_v.xml 14 | problems_xml_file_1 = problems_A.xml 15 | problems_xml_file_2 = problems_G.xml 16 | 17 | # Tell to use approximate differentiation for all test functions. 18 | # If set to false, only approximate if differentiation not available. 19 | use_approx_diff = false 20 | 21 | # Template files name for the test. 22 | # The word "problem" will be replaced with the problem name. 23 | # The numbers at the end of the variable names are to be kept in the right order. 24 | test_template_file_name_0 = test_problem 25 | test_template_file_name_1 = test_problem_100_times 26 | test_template_file_name_2 = test_problem_with_fmincon_too 27 | test_template_file_name_3 = test_problem_with_sqp_octave_too 28 | 29 | # The extension of the template file (i.e. the file type is ".tpl"). 30 | template_file_extension = .tpl 31 | 32 | # The prefix for the name of the main test files. 33 | # The main test file calls all test problems. 34 | prefix_for_main_test_file = test_all 35 | 36 | # The name of the file, where the result saved 37 | result_file = test.result -------------------------------------------------------------------------------- /test/problem_v_bazaraa_shetty/test_problem_v_bazaraa_shetty.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_bazaraa_shetty(show) 2 | u = [-10; -10]; 3 | v = [10; 10]; 4 | x0 = [5; 5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_bazaraa_shetty','grad_func_for_problem_v_bazaraa_shetty','hess_func_for_problem_v_bazaraa_shetty',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_bazaraa_shetty','grad_func_for_problem_v_bazaraa_shetty','hess_func_for_problem_v_bazaraa_shetty',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_A_miele_hs52/test_problem_A_miele_hs52.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_A_miele_hs52(show) 2 | u = []; 3 | v = []; 4 | x0 = [-1.5; 0.5; 2; -1; 0.5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 3 0 0 0; 0 0 1 1 -2; 0 1 0 0 -1]; 8 | b = [0; 0; 0]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_A_miele_hs52','grad_func_for_problem_A_miele_hs52','hess_func_for_problem_A_miele_hs52',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_A_miele_hs52','grad_func_for_problem_A_miele_hs52','hess_func_for_problem_A_miele_hs52',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_lin_regression/test_problem_v_lin_regression.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_lin_regression(show) 2 | u = [-10; -10]; 3 | v = [10; 10]; 4 | x0 = [-10; 10]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_lin_regression','grad_func_for_problem_v_lin_regression','hess_func_for_problem_v_lin_regression',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_lin_regression','grad_func_for_problem_v_lin_regression','hess_func_for_problem_v_lin_regression',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_A_simple_example/test_problem_A_simple_example.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_A_simple_example(show) 2 | u = []; 3 | v = []; 4 | x0 = [5; -1; -1; -1; -1]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 1 1 1 1]; 8 | b = [1]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_A_simple_example','grad_func_for_problem_A_simple_example','hess_func_for_problem_A_simple_example',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_A_simple_example','grad_func_for_problem_A_simple_example','hess_func_for_problem_A_simple_example',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_bazaraa_shetty_1/test_problem_v_bazaraa_shetty_1.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_bazaraa_shetty_1(show) 2 | u = [4; -10]; 3 | v = [10; 10]; 4 | x0 = [7; 5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_bazaraa_shetty_1','grad_func_for_problem_v_bazaraa_shetty_1','hess_func_for_problem_v_bazaraa_shetty_1',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_bazaraa_shetty_1','grad_func_for_problem_v_bazaraa_shetty_1','hess_func_for_problem_v_bazaraa_shetty_1',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_quad_regression/test_problem_v_quad_regression.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_quad_regression(show) 2 | u = [-10; -10; -10]; 3 | v = [20; 20; 20]; 4 | x0 = [1; 3; -4]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_quad_regression','grad_func_for_problem_v_quad_regression','hess_func_for_problem_v_quad_regression',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_quad_regression','grad_func_for_problem_v_quad_regression','hess_func_for_problem_v_quad_regression',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_dixon/test_problem_v_dixon.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_dixon(show) 2 | u = [-10; -10; -10; -10; -10; -10; -10; -10; -10; -10]; 3 | v = [10; 10; 10; 10; 10; 10; 10; 10; 10; 10]; 4 | x0 = [10; 10; 10; 10; 10; 10; 10; 10; 10; 10]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_dixon','grad_func_for_problem_v_dixon','hess_func_for_problem_v_dixon',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_dixon','grad_func_for_problem_v_dixon','hess_func_for_problem_v_dixon',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_dixon_1/test_problem_v_dixon_1.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_dixon_1(show) 2 | u = [2; 2; 2; 2; 2; 2; 2; 2; 2; 2]; 3 | v = [10; 10; 10; 10; 10; 10; 10; 10; 10; 10]; 4 | x0 = [10; 10; 10; 10; 10; 10; 10; 10; 10; 10]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_dixon_1','grad_func_for_problem_v_dixon_1','hess_func_for_problem_v_dixon_1',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_dixon_1','grad_func_for_problem_v_dixon_1','hess_func_for_problem_v_dixon_1',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs28/test_problem_A_huang_aggerwal_hs28.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_A_huang_aggerwal_hs28(show) 2 | u = []; 3 | v = []; 4 | x0 = [-4; 1; 1]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 2 3]; 8 | b = [1]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_A_huang_aggerwal_hs28','grad_func_for_problem_A_huang_aggerwal_hs28','hess_func_for_problem_A_huang_aggerwal_hs28',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_A_huang_aggerwal_hs28','grad_func_for_problem_A_huang_aggerwal_hs28','hess_func_for_problem_A_huang_aggerwal_hs28',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_nichtlin_regression/test_problem_v_nichtlin_regression.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_v_nichtlin_regression(show) 2 | u = [-10; -10]; 3 | v = [10; 10]; 4 | x0 = [0.2; 0.5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_v_nichtlin_regression','grad_func_for_problem_v_nichtlin_regression','hess_func_for_problem_v_nichtlin_regression',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_v_nichtlin_regression','grad_func_for_problem_v_nichtlin_regression','hess_func_for_problem_v_nichtlin_regression',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs49/test_problem_A_huang_aggerwal_hs49.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_A_huang_aggerwal_hs49(show) 2 | u = []; 3 | v = []; 4 | x0 = [10; 7; 2; -3; 0.8]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 1 1 4 0; 0 0 1 0 5]; 8 | b = [7; 6]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_A_huang_aggerwal_hs49','grad_func_for_problem_A_huang_aggerwal_hs49','hess_func_for_problem_A_huang_aggerwal_hs49',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_A_huang_aggerwal_hs49','grad_func_for_problem_A_huang_aggerwal_hs49','hess_func_for_problem_A_huang_aggerwal_hs49',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_exp/test_problem_v_exp_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_exp_with_fmincon_too() 2 | u = [-10; -10]; 3 | v = [10; 10]; 4 | x0 = [5; 4]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_exp','grad_func_for_problem_v_exp','hess_func_for_problem_v_exp',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_exp','grad_func_for_problem_v_exp','hess_func_for_problem_v_exp',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_exp',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_AG_opt_ctrl/test_problem_AG_opt_ctrl.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_AG_opt_ctrl(show) 2 | u = []; 3 | v = []; 4 | x0 = opt_ctrl_prob_constr_x0(5,12,100); 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = opt_ctrl_prob_constr_A(12,100); 8 | b = opt_ctrl_prob_constr_b(5,12,100); 9 | G = opt_ctrl_prob_constr_G(100); 10 | r = opt_ctrl_prob_constr_r(6,100); 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_AG_opt_ctrl','grad_func_for_problem_AG_opt_ctrl','hess_func_for_problem_AG_opt_ctrl',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_AG_opt_ctrl','grad_func_for_problem_AG_opt_ctrl','hess_func_for_problem_AG_opt_ctrl',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs50/test_problem_A_huang_aggerwal_hs50.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_A_huang_aggerwal_hs50(show) 2 | u = []; 3 | v = []; 4 | x0 = [35; -31; 11; 5; -5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 2 3 0 0; 0 1 2 3 0; 0 0 1 2 3]; 8 | b = [6; 6; 6]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_A_huang_aggerwal_hs50','grad_func_for_problem_A_huang_aggerwal_hs50','hess_func_for_problem_A_huang_aggerwal_hs50',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_A_huang_aggerwal_hs50','grad_func_for_problem_A_huang_aggerwal_hs50','hess_func_for_problem_A_huang_aggerwal_hs50',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs51/test_problem_A_huang_aggerwal_hs51.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_A_huang_aggerwal_hs51(show) 2 | u = []; 3 | v = []; 4 | x0 = [2.5; 0.5; 2; -1; 0.5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 3 0 0 0; 0 0 1 1 -2; 0 1 0 0 -1]; 8 | b = [4; 0; 0]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_A_huang_aggerwal_hs51','grad_func_for_problem_A_huang_aggerwal_hs51','hess_func_for_problem_A_huang_aggerwal_hs51',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_A_huang_aggerwal_hs51','grad_func_for_problem_A_huang_aggerwal_hs51','hess_func_for_problem_A_huang_aggerwal_hs51',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_norm/test_problem_v_norm_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_norm_with_fmincon_too() 2 | u = [-10; -10]; 3 | v = [10; 10]; 4 | x0 = [8; 9]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_norm','grad_func_for_problem_v_norm','hess_func_for_problem_v_norm',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_norm','grad_func_for_problem_v_norm','hess_func_for_problem_v_norm',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_norm',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/test-populator/src/data/test_problem_with_fmincon_too.tpl: -------------------------------------------------------------------------------- 1 | function test_{var_problem_name}_with_fmincon_too() 2 | u = {var_u}; 3 | v = {var_v}; 4 | x0 = {var_x0}; 5 | tol = {var_tol}; 6 | itmax = {var_itmax}; 7 | A = {var_A}; 8 | b = {var_b}; 9 | G = {var_G}; 10 | r = {var_r}; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('{var_function_name}','{var_grad_function_name}','{var_hess_function_name}',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('{var_function_name}','{var_grad_function_name}','{var_hess_function_name}',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('{var_function_name}',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end -------------------------------------------------------------------------------- /test/problem_v_beale/test_problem_v_beale_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_beale_with_fmincon_too() 2 | u = [-10; -10]; 3 | v = [10; 10]; 4 | x0 = [5; 0]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_beale','grad_func_for_problem_v_beale','hess_func_for_problem_v_beale',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_beale','grad_func_for_problem_v_beale','hess_func_for_problem_v_beale',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_beale',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_v_exp_1/test_problem_v_exp_1_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_exp_1_with_fmincon_too() 2 | u = [0.5; 1; 1]; 3 | v = [10; 10; 10]; 4 | x0 = [5; 2; 4]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_exp_1','grad_func_for_problem_v_exp_1','hess_func_for_problem_v_exp_1',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_exp_1','grad_func_for_problem_v_exp_1','hess_func_for_problem_v_exp_1',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_exp_1',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_Av_betts_miele_hs53/test_problem_Av_betts_miele_hs53.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_Av_betts_miele_hs53(show) 2 | u = [-10; -10; -10; -10; -10]; 3 | v = [10; 10; 10; 10; 10]; 4 | x0 = [-1.5; 0.5; 2; -1; 0.5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 3 0 0 0; 0 0 1 1 -2; 0 1 0 0 -1]; 8 | b = [0; 0; 0]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_Av_betts_miele_hs53','grad_func_for_problem_Av_betts_miele_hs53','hess_func_for_problem_Av_betts_miele_hs53',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_Av_betts_miele_hs53','grad_func_for_problem_Av_betts_miele_hs53','hess_func_for_problem_Av_betts_miele_hs53',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_beale_1/test_problem_v_beale_1_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_beale_1_with_fmincon_too() 2 | u = [3; -10]; 3 | v = [10; 10]; 4 | x0 = [5; 0]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_beale_1','grad_func_for_problem_v_beale_1','hess_func_for_problem_v_beale_1',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_beale_1','grad_func_for_problem_v_beale_1','hess_func_for_problem_v_beale_1',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_beale_1',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_v_norm_1/test_problem_v_norm_1_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_norm_1_with_fmincon_too() 2 | u = [5; 5; 5]; 3 | v = [10; 10; 10]; 4 | x0 = [7; 10; 9]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_norm_1','grad_func_for_problem_v_norm_1','hess_func_for_problem_v_norm_1',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_norm_1','grad_func_for_problem_v_norm_1','hess_func_for_problem_v_norm_1',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_norm_1',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_Gv_murtagh_sargent_hs76/test_problem_Gv_murtagh_sargent_hs76.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_Gv_murtagh_sargent_hs76(show) 2 | u = [0; 0; 0; 0]; 3 | v = []; 4 | x0 = [0.25; 1.5; 0.25; 0.5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = [1 2 1 1; 3 1 2 -1; 0 -1 -4 0]; 10 | r = [5; 4; -1.5]; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_Gv_murtagh_sargent_hs76','grad_func_for_problem_Gv_murtagh_sargent_hs76','hess_func_for_problem_Gv_murtagh_sargent_hs76',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_Gv_murtagh_sargent_hs76','grad_func_for_problem_Gv_murtagh_sargent_hs76','hess_func_for_problem_Gv_murtagh_sargent_hs76',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_G_example_with_diamond_area/test_problem_G_example_with_diamond_area.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_G_example_with_diamond_area(show) 2 | u = []; 3 | v = []; 4 | x0 = [-1; 0]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = [2 1; 1 -1; -1 -1; -2 1]; 10 | r = [2; 1; 1; 2]; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_G_example_with_diamond_area','grad_func_for_problem_G_example_with_diamond_area','hess_func_for_problem_G_example_with_diamond_area',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_G_example_with_diamond_area','grad_func_for_problem_G_example_with_diamond_area','hess_func_for_problem_G_example_with_diamond_area',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_A_example_16_2_nocedal_wright/test_problem_A_example_16_2_nocedal_wright.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_A_example_16_2_nocedal_wright(show) 2 | u = []; 3 | v = []; 4 | x0 = [5; 2; -2]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 0 1; 0 1 1]; 8 | b = [3; 0]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_A_example_16_2_nocedal_wright','grad_func_for_problem_A_example_16_2_nocedal_wright','hess_func_for_problem_A_example_16_2_nocedal_wright',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_A_example_16_2_nocedal_wright','grad_func_for_problem_A_example_16_2_nocedal_wright','hess_func_for_problem_A_example_16_2_nocedal_wright',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_miele_hs48/test_problem_A_huang_aggerwal_miele_hs48.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_A_huang_aggerwal_miele_hs48(show) 2 | u = []; 3 | v = []; 4 | x0 = [3; 5; -3; 2; -2]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 1 1 1 1; 0 0 1 -2 -2]; 8 | b = [5; -3]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_A_huang_aggerwal_miele_hs48','grad_func_for_problem_A_huang_aggerwal_miele_hs48','hess_func_for_problem_A_huang_aggerwal_miele_hs48',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_A_huang_aggerwal_miele_hs48','grad_func_for_problem_A_huang_aggerwal_miele_hs48','hess_func_for_problem_A_huang_aggerwal_miele_hs48',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_Gv_example_16_4_nocedal_wright/test_problem_Gv_example_16_4_nocedal_wright.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_Gv_example_16_4_nocedal_wright(show) 2 | u = [0; 0]; 3 | v = []; 4 | x0 = [2; 0]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = [-1 2; 1 2; 1 -2]; 10 | r = [2; 6; 2]; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_Gv_example_16_4_nocedal_wright','grad_func_for_problem_Gv_example_16_4_nocedal_wright','hess_func_for_problem_Gv_example_16_4_nocedal_wright',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_Gv_example_16_4_nocedal_wright','grad_func_for_problem_Gv_example_16_4_nocedal_wright','hess_func_for_problem_Gv_example_16_4_nocedal_wright',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_v_himmelblau/test_problem_v_himmelblau_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_himmelblau_with_fmincon_too() 2 | u = [-10; -10]; 3 | v = [10; 10]; 4 | x0 = [5; 5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_himmelblau','grad_func_for_problem_v_himmelblau','hess_func_for_problem_v_himmelblau',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_himmelblau','grad_func_for_problem_v_himmelblau','hess_func_for_problem_v_himmelblau',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_himmelblau',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_v_rosenbrock/test_problem_v_rosenbrock_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_rosenbrock_with_fmincon_too() 2 | u = [-10; -10]; 3 | v = [10; 10]; 4 | x0 = [-1; 2]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_rosenbrock','grad_func_for_problem_v_rosenbrock','hess_func_for_problem_v_rosenbrock',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_rosenbrock','grad_func_for_problem_v_rosenbrock','hess_func_for_problem_v_rosenbrock',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_rosenbrock',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_v_colville/test_problem_v_colville_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_colville_with_fmincon_too() 2 | u = [-10; -10; -10; -10]; 3 | v = [10; 10; 10; 10]; 4 | x0 = [3; -1; -3; -1]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_colville','grad_func_for_problem_v_colville','hess_func_for_problem_v_colville',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_colville','grad_func_for_problem_v_colville','hess_func_for_problem_v_colville',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_colville',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_G_example_13_2_antoniou_lu/test_problem_G_example_13_2_antoniou_lu.m: -------------------------------------------------------------------------------- 1 | function [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp,X_ssn,X_sqp] = test_problem_G_example_13_2_antoniou_lu(show) 2 | u = []; 3 | v = []; 4 | x0 = [0; 1; 2; 2]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = [-1 0 0 0; 0 -1 0 0; 1 2 0 0; 0 0 0 -1; 0 0 -1 -1; 0 0 1 2]; 10 | r = [0; 0; 2; -2; -3; 6]; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn,X_ssn] = semismooth_newton('func_for_problem_G_example_13_2_antoniou_lu','grad_func_for_problem_G_example_13_2_antoniou_lu','hess_func_for_problem_G_example_13_2_antoniou_lu',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp,X_sqp] = seq_quad_prog('func_for_problem_G_example_13_2_antoniou_lu','grad_func_for_problem_G_example_13_2_antoniou_lu','hess_func_for_problem_G_example_13_2_antoniou_lu',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | if ( nargin == 0 ) 28 | show = 1; 29 | end 30 | if ( show == 1 ) 31 | x0 = sprintf('%.3f ',x0); 32 | str0 = ['x0 = [ ', x0, ']']; 33 | disp(str0); 34 | disp(str1); 35 | disp(str2); 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/problem_Gv_beale_hs35/test_problem_Gv_beale_hs35_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_Gv_beale_hs35_with_fmincon_too() 2 | u = [0; 0; 0]; 3 | v = []; 4 | x0 = [1.5; 0.5; 0.5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = [1 1 2]; 10 | r = [3]; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_Gv_beale_hs35','grad_func_for_problem_Gv_beale_hs35','hess_func_for_problem_Gv_beale_hs35',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_Gv_beale_hs35','grad_func_for_problem_Gv_beale_hs35','hess_func_for_problem_Gv_beale_hs35',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_Gv_beale_hs35',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_Gv_betts_hs21/test_problem_Gv_betts_hs21_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_Gv_betts_hs21_with_fmincon_too() 2 | u = [2; -50]; 3 | v = [50; 50]; 4 | x0 = [10; -10]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = [-10 1]; 10 | r = [-10]; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_Gv_betts_hs21','grad_func_for_problem_Gv_betts_hs21','hess_func_for_problem_Gv_betts_hs21',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_Gv_betts_hs21','grad_func_for_problem_Gv_betts_hs21','hess_func_for_problem_Gv_betts_hs21',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_Gv_betts_hs21',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_v_himmelblau_1/test_problem_v_himmelblau_1_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_himmelblau_1_with_fmincon_too() 2 | u = [-10; 5]; 3 | v = [10; 10]; 4 | x0 = [10; 10]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_himmelblau_1','grad_func_for_problem_v_himmelblau_1','hess_func_for_problem_v_himmelblau_1',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_himmelblau_1','grad_func_for_problem_v_himmelblau_1','hess_func_for_problem_v_himmelblau_1',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_himmelblau_1',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_v_rosenbrock_1/test_problem_v_rosenbrock_1_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_rosenbrock_1_with_fmincon_too() 2 | u = [-10; 1.5]; 3 | v = [10; 10]; 4 | x0 = [2; 3]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_rosenbrock_1','grad_func_for_problem_v_rosenbrock_1','hess_func_for_problem_v_rosenbrock_1',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_rosenbrock_1','grad_func_for_problem_v_rosenbrock_1','hess_func_for_problem_v_rosenbrock_1',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_rosenbrock_1',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_v_colville_1/test_problem_v_colville_1_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_colville_1_with_fmincon_too() 2 | u = [2; -10; -10; -10]; 3 | v = [10; 10; 10; 10]; 4 | x0 = [3; -1; -3; -1]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_colville_1','grad_func_for_problem_v_colville_1','hess_func_for_problem_v_colville_1',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_colville_1','grad_func_for_problem_v_colville_1','hess_func_for_problem_v_colville_1',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_colville_1',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_A_miele_hs52/test_problem_A_miele_hs52_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_A_miele_hs52_with_fmincon_too() 2 | u = []; 3 | v = []; 4 | x0 = [-1.5; 0.5; 2; -1; 0.5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 3 0 0 0; 0 0 1 1 -2; 0 1 0 0 -1]; 8 | b = [0; 0; 0]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_A_miele_hs52','grad_func_for_problem_A_miele_hs52','hess_func_for_problem_A_miele_hs52',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_A_miele_hs52','grad_func_for_problem_A_miele_hs52','hess_func_for_problem_A_miele_hs52',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_A_miele_hs52',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_v_bazaraa_shetty/test_problem_v_bazaraa_shetty_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_bazaraa_shetty_with_fmincon_too() 2 | u = [-10; -10]; 3 | v = [10; 10]; 4 | x0 = [5; 5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_bazaraa_shetty','grad_func_for_problem_v_bazaraa_shetty','hess_func_for_problem_v_bazaraa_shetty',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_bazaraa_shetty','grad_func_for_problem_v_bazaraa_shetty','hess_func_for_problem_v_bazaraa_shetty',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_bazaraa_shetty',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_v_lin_regression/test_problem_v_lin_regression_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_lin_regression_with_fmincon_too() 2 | u = [-10; -10]; 3 | v = [10; 10]; 4 | x0 = [-10; 10]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_lin_regression','grad_func_for_problem_v_lin_regression','hess_func_for_problem_v_lin_regression',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_lin_regression','grad_func_for_problem_v_lin_regression','hess_func_for_problem_v_lin_regression',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_lin_regression',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_A_simple_example/test_problem_A_simple_example_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_A_simple_example_with_fmincon_too() 2 | u = []; 3 | v = []; 4 | x0 = [5; -1; -1; -1; -1]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 1 1 1 1]; 8 | b = [1]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_A_simple_example','grad_func_for_problem_A_simple_example','hess_func_for_problem_A_simple_example',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_A_simple_example','grad_func_for_problem_A_simple_example','hess_func_for_problem_A_simple_example',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_A_simple_example',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_v_bazaraa_shetty_1/test_problem_v_bazaraa_shetty_1_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_bazaraa_shetty_1_with_fmincon_too() 2 | u = [4; -10]; 3 | v = [10; 10]; 4 | x0 = [7; 5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_bazaraa_shetty_1','grad_func_for_problem_v_bazaraa_shetty_1','hess_func_for_problem_v_bazaraa_shetty_1',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_bazaraa_shetty_1','grad_func_for_problem_v_bazaraa_shetty_1','hess_func_for_problem_v_bazaraa_shetty_1',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_bazaraa_shetty_1',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_v_dixon/test_problem_v_dixon_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_dixon_with_fmincon_too() 2 | u = [-10; -10; -10; -10; -10; -10; -10; -10; -10; -10]; 3 | v = [10; 10; 10; 10; 10; 10; 10; 10; 10; 10]; 4 | x0 = [10; 10; 10; 10; 10; 10; 10; 10; 10; 10]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_dixon','grad_func_for_problem_v_dixon','hess_func_for_problem_v_dixon',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_dixon','grad_func_for_problem_v_dixon','hess_func_for_problem_v_dixon',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_dixon',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_v_dixon_1/test_problem_v_dixon_1_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_dixon_1_with_fmincon_too() 2 | u = [2; 2; 2; 2; 2; 2; 2; 2; 2; 2]; 3 | v = [10; 10; 10; 10; 10; 10; 10; 10; 10; 10]; 4 | x0 = [10; 10; 10; 10; 10; 10; 10; 10; 10; 10]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_dixon_1','grad_func_for_problem_v_dixon_1','hess_func_for_problem_v_dixon_1',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_dixon_1','grad_func_for_problem_v_dixon_1','hess_func_for_problem_v_dixon_1',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_dixon_1',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_v_quad_regression/test_problem_v_quad_regression_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_quad_regression_with_fmincon_too() 2 | u = [-10; -10; -10]; 3 | v = [20; 20; 20]; 4 | x0 = [1; 3; -4]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_quad_regression','grad_func_for_problem_v_quad_regression','hess_func_for_problem_v_quad_regression',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_quad_regression','grad_func_for_problem_v_quad_regression','hess_func_for_problem_v_quad_regression',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_quad_regression',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs28/test_problem_A_huang_aggerwal_hs28_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_A_huang_aggerwal_hs28_with_fmincon_too() 2 | u = []; 3 | v = []; 4 | x0 = [-4; 1; 1]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 2 3]; 8 | b = [1]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_A_huang_aggerwal_hs28','grad_func_for_problem_A_huang_aggerwal_hs28','hess_func_for_problem_A_huang_aggerwal_hs28',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_A_huang_aggerwal_hs28','grad_func_for_problem_A_huang_aggerwal_hs28','hess_func_for_problem_A_huang_aggerwal_hs28',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_A_huang_aggerwal_hs28',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_v_nichtlin_regression/test_problem_v_nichtlin_regression_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_nichtlin_regression_with_fmincon_too() 2 | u = [-10; -10]; 3 | v = [10; 10]; 4 | x0 = [0.2; 0.5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_v_nichtlin_regression','grad_func_for_problem_v_nichtlin_regression','hess_func_for_problem_v_nichtlin_regression',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_v_nichtlin_regression','grad_func_for_problem_v_nichtlin_regression','hess_func_for_problem_v_nichtlin_regression',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_v_nichtlin_regression',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_AG_opt_ctrl/test_problem_AG_opt_ctrl_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_AG_opt_ctrl_with_fmincon_too() 2 | u = []; 3 | v = []; 4 | x0 = opt_ctrl_prob_constr_x0(5,12,100); 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = opt_ctrl_prob_constr_A(12,100); 8 | b = opt_ctrl_prob_constr_b(5,12,100); 9 | G = opt_ctrl_prob_constr_G(100); 10 | r = opt_ctrl_prob_constr_r(6,100); 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_AG_opt_ctrl','grad_func_for_problem_AG_opt_ctrl','hess_func_for_problem_AG_opt_ctrl',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_AG_opt_ctrl','grad_func_for_problem_AG_opt_ctrl','hess_func_for_problem_AG_opt_ctrl',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_AG_opt_ctrl',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs49/test_problem_A_huang_aggerwal_hs49_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_A_huang_aggerwal_hs49_with_fmincon_too() 2 | u = []; 3 | v = []; 4 | x0 = [10; 7; 2; -3; 0.8]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 1 1 4 0; 0 0 1 0 5]; 8 | b = [7; 6]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_A_huang_aggerwal_hs49','grad_func_for_problem_A_huang_aggerwal_hs49','hess_func_for_problem_A_huang_aggerwal_hs49',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_A_huang_aggerwal_hs49','grad_func_for_problem_A_huang_aggerwal_hs49','hess_func_for_problem_A_huang_aggerwal_hs49',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_A_huang_aggerwal_hs49',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs50/test_problem_A_huang_aggerwal_hs50_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_A_huang_aggerwal_hs50_with_fmincon_too() 2 | u = []; 3 | v = []; 4 | x0 = [35; -31; 11; 5; -5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 2 3 0 0; 0 1 2 3 0; 0 0 1 2 3]; 8 | b = [6; 6; 6]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_A_huang_aggerwal_hs50','grad_func_for_problem_A_huang_aggerwal_hs50','hess_func_for_problem_A_huang_aggerwal_hs50',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_A_huang_aggerwal_hs50','grad_func_for_problem_A_huang_aggerwal_hs50','hess_func_for_problem_A_huang_aggerwal_hs50',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_A_huang_aggerwal_hs50',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_hs51/test_problem_A_huang_aggerwal_hs51_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_A_huang_aggerwal_hs51_with_fmincon_too() 2 | u = []; 3 | v = []; 4 | x0 = [2.5; 0.5; 2; -1; 0.5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 3 0 0 0; 0 0 1 1 -2; 0 1 0 0 -1]; 8 | b = [4; 0; 0]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_A_huang_aggerwal_hs51','grad_func_for_problem_A_huang_aggerwal_hs51','hess_func_for_problem_A_huang_aggerwal_hs51',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_A_huang_aggerwal_hs51','grad_func_for_problem_A_huang_aggerwal_hs51','hess_func_for_problem_A_huang_aggerwal_hs51',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_A_huang_aggerwal_hs51',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | # SQP vs. Semismooth-Newton 2 | 3 | This is a project using [MATLAB][] 4 | to make a comparison between two methods of the nonlinear optimization: 5 | **Sequential Quadratic Programming** and **Semismooth Newton**. 6 | 7 | --- 8 | 9 | ## Directories tree 10 | 11 | |-- SQP-vs.-Semismooth-Newton 12 | |-- tex 13 | |-- test 14 | |-- problem_... 15 | |-- ... 16 | |-- problem_... 17 | |-- extras 18 | |-- test-populator 19 | |-- src 20 | |-- data 21 | |-- main 22 | 23 | The main directory **SQP-vs.-Semismooth-Newton** contains 24 | two subdirectories, three Matlab files, one config file and this README file. 25 | 26 | The three Matlab files are: 27 | 28 | 1. `seq_quad_prog.m` (The implementation of SQP method) 29 | 30 | 2. `semismooth_newton.m` (The implementation of Semismooth Newton method) 31 | 32 | 3. `active_set_strategy.m` (The implementation of Active Set Strategy) 33 | 34 | The two subdirectories are: 35 | 36 | * Directory **tex** contains the LaTeX files for the bachelor thesis. 37 | 38 | * Directory **test** contains MATLAB and Java files for the test. 39 | 40 | * The MATLAB files in this directory with the prefix `test_all` can be used to run all the test files. 41 | 42 | * Each test problem as MATLAB test file can be found in the different subdirectories. 43 | Every test problem get his own directory. 44 | 45 | * The directory **test_populator** contains source code in Java 46 | to create all the MATLAB test files. 47 | 48 | * The directory **extras** here contains other MATLAB files needed for the test 49 | or for the results interpretation. 50 | 51 | --- 52 | 53 | [matlab]: http://de.wikipedia.org/wiki/MATLAB "MATLAB" 54 | -------------------------------------------------------------------------------- /test/problem_Av_betts_miele_hs53/test_problem_Av_betts_miele_hs53_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_Av_betts_miele_hs53_with_fmincon_too() 2 | u = [-10; -10; -10; -10; -10]; 3 | v = [10; 10; 10; 10; 10]; 4 | x0 = [-1.5; 0.5; 2; -1; 0.5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 3 0 0 0; 0 0 1 1 -2; 0 1 0 0 -1]; 8 | b = [0; 0; 0]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_Av_betts_miele_hs53','grad_func_for_problem_Av_betts_miele_hs53','hess_func_for_problem_Av_betts_miele_hs53',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_Av_betts_miele_hs53','grad_func_for_problem_Av_betts_miele_hs53','hess_func_for_problem_Av_betts_miele_hs53',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_Av_betts_miele_hs53',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_Gv_murtagh_sargent_hs76/test_problem_Gv_murtagh_sargent_hs76_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_Gv_murtagh_sargent_hs76_with_fmincon_too() 2 | u = [0; 0; 0; 0]; 3 | v = []; 4 | x0 = [0.25; 1.5; 0.25; 0.5]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = [1 2 1 1; 3 1 2 -1; 0 -1 -4 0]; 10 | r = [5; 4; -1.5]; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_Gv_murtagh_sargent_hs76','grad_func_for_problem_Gv_murtagh_sargent_hs76','hess_func_for_problem_Gv_murtagh_sargent_hs76',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_Gv_murtagh_sargent_hs76','grad_func_for_problem_Gv_murtagh_sargent_hs76','hess_func_for_problem_Gv_murtagh_sargent_hs76',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_Gv_murtagh_sargent_hs76',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_G_example_with_diamond_area/test_problem_G_example_with_diamond_area_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_G_example_with_diamond_area_with_fmincon_too() 2 | u = []; 3 | v = []; 4 | x0 = [-1; 0]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = [2 1; 1 -1; -1 -1; -2 1]; 10 | r = [2; 1; 1; 2]; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_G_example_with_diamond_area','grad_func_for_problem_G_example_with_diamond_area','hess_func_for_problem_G_example_with_diamond_area',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_G_example_with_diamond_area','grad_func_for_problem_G_example_with_diamond_area','hess_func_for_problem_G_example_with_diamond_area',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_G_example_with_diamond_area',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_A_example_16_2_nocedal_wright/test_problem_A_example_16_2_nocedal_wright_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_A_example_16_2_nocedal_wright_with_fmincon_too() 2 | u = []; 3 | v = []; 4 | x0 = [5; 2; -2]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 0 1; 0 1 1]; 8 | b = [3; 0]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_A_example_16_2_nocedal_wright','grad_func_for_problem_A_example_16_2_nocedal_wright','hess_func_for_problem_A_example_16_2_nocedal_wright',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_A_example_16_2_nocedal_wright','grad_func_for_problem_A_example_16_2_nocedal_wright','hess_func_for_problem_A_example_16_2_nocedal_wright',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_A_example_16_2_nocedal_wright',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_A_huang_aggerwal_miele_hs48/test_problem_A_huang_aggerwal_miele_hs48_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_A_huang_aggerwal_miele_hs48_with_fmincon_too() 2 | u = []; 3 | v = []; 4 | x0 = [3; 5; -3; 2; -2]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = [1 1 1 1 1; 0 0 1 -2 -2]; 8 | b = [5; -3]; 9 | G = []; 10 | r = []; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_A_huang_aggerwal_miele_hs48','grad_func_for_problem_A_huang_aggerwal_miele_hs48','hess_func_for_problem_A_huang_aggerwal_miele_hs48',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_A_huang_aggerwal_miele_hs48','grad_func_for_problem_A_huang_aggerwal_miele_hs48','hess_func_for_problem_A_huang_aggerwal_miele_hs48',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_A_huang_aggerwal_miele_hs48',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_Gv_example_16_4_nocedal_wright/test_problem_Gv_example_16_4_nocedal_wright_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_Gv_example_16_4_nocedal_wright_with_fmincon_too() 2 | u = [0; 0]; 3 | v = []; 4 | x0 = [2; 0]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = [-1 2; 1 2; 1 -2]; 10 | r = [2; 6; 2]; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_Gv_example_16_4_nocedal_wright','grad_func_for_problem_Gv_example_16_4_nocedal_wright','hess_func_for_problem_Gv_example_16_4_nocedal_wright',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_Gv_example_16_4_nocedal_wright','grad_func_for_problem_Gv_example_16_4_nocedal_wright','hess_func_for_problem_Gv_example_16_4_nocedal_wright',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_Gv_example_16_4_nocedal_wright',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_G_example_13_2_antoniou_lu/test_problem_G_example_13_2_antoniou_lu_with_fmincon_too.m: -------------------------------------------------------------------------------- 1 | function test_problem_G_example_13_2_antoniou_lu_with_fmincon_too() 2 | u = []; 3 | v = []; 4 | x0 = [0; 1; 2; 2]; 5 | tol = 0.00001; 6 | itmax = 100; 7 | A = []; 8 | b = []; 9 | G = [-1 0 0 0; 0 -1 0 0; 1 2 0 0; 0 0 0 -1; 0 0 -1 -1; 0 0 1 2]; 10 | r = [0; 0; 2; -2; -3; 6]; 11 | G = [ G; -eye(length(u)); eye(length(v)) ]; 12 | r = [ r; -u; v ]; 13 | tic; 14 | [x_ssn,fval_ssn,it_ssn] = semismooth_newton('func_for_problem_G_example_13_2_antoniou_lu','grad_func_for_problem_G_example_13_2_antoniou_lu','hess_func_for_problem_G_example_13_2_antoniou_lu',A,b,G,r,x0,itmax,tol); 15 | t_ssn = toc; 16 | x1 = sprintf('%.3f ',x_ssn); 17 | f1 = sprintf('f(x_ssn) = %.3f',fval_ssn); 18 | t1 = sprintf('solved in %.2f ms.',t_ssn*1000); 19 | str1 = ['x_ssn = [ ', x1, '], ', f1, ', it = ', num2str(it_ssn), ', ', t1]; 20 | tic; 21 | [x_sqp,fval_sqp,it_sqp] = seq_quad_prog('func_for_problem_G_example_13_2_antoniou_lu','grad_func_for_problem_G_example_13_2_antoniou_lu','hess_func_for_problem_G_example_13_2_antoniou_lu',A,b,G,r,x0,itmax,tol); 22 | t_sqp = toc; 23 | x2 = sprintf('%.3f ',x_sqp); 24 | f2 = sprintf('f(x_sqp) = %.3f',fval_sqp); 25 | t2 = sprintf('solved in %.2f ms.',t_sqp*1000); 26 | str2 = ['x_sqp = [ ', x2, '], ', f2, ', it = ', num2str(it_sqp), ', ', t2]; 27 | options = optimset('Algorithm','active-set','Display','off'); 28 | tic; 29 | [x_fmc,fval_fmc,exitflag,output] = fmincon('func_for_problem_G_example_13_2_antoniou_lu',x0,G,r,A,b,[],[],[],options); 30 | t_fmc = toc; 31 | x3 = sprintf('%.3f ',x_fmc); 32 | f3 = sprintf('f(x_fmc) = %.3f',fval_fmc); 33 | t3 = sprintf('solved in %.2f ms.',t_fmc*1000); 34 | str3 = ['x_fmc = [ ', x3, '], ', f3, ', ', t3]; 35 | x0 = sprintf('%.3f ',x0); 36 | str0 = ['x0 = [ ', x0, ']']; 37 | disp(str0); 38 | disp(str1); 39 | disp(str2); 40 | disp(str3); 41 | end 42 | -------------------------------------------------------------------------------- /test/problem_v_exp/test_problem_v_exp_100_times.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_exp_100_times(show) 2 | t1_total = 0; 3 | t2_total = 0; 4 | t_max = 2.5; 5 | t1_min = t_max; 6 | t2_min = t_max; 7 | t1_max = 0; 8 | t2_max = 0; 9 | it1_total = 0; 10 | it2_total = 0; 11 | total = 100; 12 | k = 1; 13 | k_total = 0; 14 | while k<=total 15 | k_total = k_total+1; 16 | [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp] = test_problem_v_exp(0); 17 | if (norm(x_ssn-x_sqp) > 0.1) 18 | disp('Different solutions..'); 19 | break; 20 | end 21 | if (t_ssn > t_max || t_sqp > t_max) 22 | break; 23 | end 24 | if (t_ssn == 0 || t_sqp == 0) 25 | continue; 26 | end 27 | k = k+1; 28 | t1_total = t1_total + t_ssn; 29 | t2_total = t2_total + t_sqp; 30 | if (t1_min > t_ssn) 31 | t1_min = t_ssn; 32 | end 33 | if (t2_min > t_sqp) 34 | t2_min = t_sqp; 35 | end 36 | if (t1_max < t_ssn) 37 | t1_max = t_ssn; 38 | end 39 | if (t2_max < t_sqp) 40 | t2_max = t_sqp; 41 | end 42 | it1_total = it1_total + it_ssn; 43 | it2_total = it2_total + it_sqp; 44 | end 45 | t1_total = t1_total/total; 46 | t2_total = t2_total/total; 47 | it1_total = it1_total/total; 48 | it2_total = it2_total/total; 49 | if ( nargin == 0 ) 50 | show = 1; 51 | end 52 | if ( (show == 1) && (k == total+1) ) 53 | x1 = sprintf('%.3f ',x_ssn); 54 | t1 = sprintf('solved in %.2f ms',t1_total*1000); 55 | t1min = sprintf(' (%.2f -',t1_min*1000); 56 | t1max = sprintf(' %.2f).',t1_max*1000); 57 | str1 = ['x_ssn = [ ', x1, '], it = ', num2str(it1_total), ', ', t1, t1min, t1max]; 58 | x2 = sprintf('%.3f ',x_sqp); 59 | t2 = sprintf('solved in %.2f ms',t2_total*1000); 60 | t2min = sprintf(' (%.2f -',t2_min*1000); 61 | t2max = sprintf(' %.2f).',t2_max*1000); 62 | str2 = ['x_sqp = [ ', x2, '], it = ', num2str(it2_total), ', ', t2, t2min, t2max]; 63 | disp(str1); 64 | disp(str2); 65 | if (k_total ~= 100) 66 | disp(['[', num2str(k_total), ']']); 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /test/problem_v_norm/test_problem_v_norm_100_times.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_norm_100_times(show) 2 | t1_total = 0; 3 | t2_total = 0; 4 | t_max = 2.5; 5 | t1_min = t_max; 6 | t2_min = t_max; 7 | t1_max = 0; 8 | t2_max = 0; 9 | it1_total = 0; 10 | it2_total = 0; 11 | total = 100; 12 | k = 1; 13 | k_total = 0; 14 | while k<=total 15 | k_total = k_total+1; 16 | [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp] = test_problem_v_norm(0); 17 | if (norm(x_ssn-x_sqp) > 0.1) 18 | disp('Different solutions..'); 19 | break; 20 | end 21 | if (t_ssn > t_max || t_sqp > t_max) 22 | break; 23 | end 24 | if (t_ssn == 0 || t_sqp == 0) 25 | continue; 26 | end 27 | k = k+1; 28 | t1_total = t1_total + t_ssn; 29 | t2_total = t2_total + t_sqp; 30 | if (t1_min > t_ssn) 31 | t1_min = t_ssn; 32 | end 33 | if (t2_min > t_sqp) 34 | t2_min = t_sqp; 35 | end 36 | if (t1_max < t_ssn) 37 | t1_max = t_ssn; 38 | end 39 | if (t2_max < t_sqp) 40 | t2_max = t_sqp; 41 | end 42 | it1_total = it1_total + it_ssn; 43 | it2_total = it2_total + it_sqp; 44 | end 45 | t1_total = t1_total/total; 46 | t2_total = t2_total/total; 47 | it1_total = it1_total/total; 48 | it2_total = it2_total/total; 49 | if ( nargin == 0 ) 50 | show = 1; 51 | end 52 | if ( (show == 1) && (k == total+1) ) 53 | x1 = sprintf('%.3f ',x_ssn); 54 | t1 = sprintf('solved in %.2f ms',t1_total*1000); 55 | t1min = sprintf(' (%.2f -',t1_min*1000); 56 | t1max = sprintf(' %.2f).',t1_max*1000); 57 | str1 = ['x_ssn = [ ', x1, '], it = ', num2str(it1_total), ', ', t1, t1min, t1max]; 58 | x2 = sprintf('%.3f ',x_sqp); 59 | t2 = sprintf('solved in %.2f ms',t2_total*1000); 60 | t2min = sprintf(' (%.2f -',t2_min*1000); 61 | t2max = sprintf(' %.2f).',t2_max*1000); 62 | str2 = ['x_sqp = [ ', x2, '], it = ', num2str(it2_total), ', ', t2, t2min, t2max]; 63 | disp(str1); 64 | disp(str2); 65 | if (k_total ~= 100) 66 | disp(['[', num2str(k_total), ']']); 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /test/problem_v_beale/test_problem_v_beale_100_times.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_beale_100_times(show) 2 | t1_total = 0; 3 | t2_total = 0; 4 | t_max = 2.5; 5 | t1_min = t_max; 6 | t2_min = t_max; 7 | t1_max = 0; 8 | t2_max = 0; 9 | it1_total = 0; 10 | it2_total = 0; 11 | total = 100; 12 | k = 1; 13 | k_total = 0; 14 | while k<=total 15 | k_total = k_total+1; 16 | [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp] = test_problem_v_beale(0); 17 | if (norm(x_ssn-x_sqp) > 0.1) 18 | disp('Different solutions..'); 19 | break; 20 | end 21 | if (t_ssn > t_max || t_sqp > t_max) 22 | break; 23 | end 24 | if (t_ssn == 0 || t_sqp == 0) 25 | continue; 26 | end 27 | k = k+1; 28 | t1_total = t1_total + t_ssn; 29 | t2_total = t2_total + t_sqp; 30 | if (t1_min > t_ssn) 31 | t1_min = t_ssn; 32 | end 33 | if (t2_min > t_sqp) 34 | t2_min = t_sqp; 35 | end 36 | if (t1_max < t_ssn) 37 | t1_max = t_ssn; 38 | end 39 | if (t2_max < t_sqp) 40 | t2_max = t_sqp; 41 | end 42 | it1_total = it1_total + it_ssn; 43 | it2_total = it2_total + it_sqp; 44 | end 45 | t1_total = t1_total/total; 46 | t2_total = t2_total/total; 47 | it1_total = it1_total/total; 48 | it2_total = it2_total/total; 49 | if ( nargin == 0 ) 50 | show = 1; 51 | end 52 | if ( (show == 1) && (k == total+1) ) 53 | x1 = sprintf('%.3f ',x_ssn); 54 | t1 = sprintf('solved in %.2f ms',t1_total*1000); 55 | t1min = sprintf(' (%.2f -',t1_min*1000); 56 | t1max = sprintf(' %.2f).',t1_max*1000); 57 | str1 = ['x_ssn = [ ', x1, '], it = ', num2str(it1_total), ', ', t1, t1min, t1max]; 58 | x2 = sprintf('%.3f ',x_sqp); 59 | t2 = sprintf('solved in %.2f ms',t2_total*1000); 60 | t2min = sprintf(' (%.2f -',t2_min*1000); 61 | t2max = sprintf(' %.2f).',t2_max*1000); 62 | str2 = ['x_sqp = [ ', x2, '], it = ', num2str(it2_total), ', ', t2, t2min, t2max]; 63 | disp(str1); 64 | disp(str2); 65 | if (k_total ~= 100) 66 | disp(['[', num2str(k_total), ']']); 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /test/problem_v_dixon/test_problem_v_dixon_100_times.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_dixon_100_times(show) 2 | t1_total = 0; 3 | t2_total = 0; 4 | t_max = 2.5; 5 | t1_min = t_max; 6 | t2_min = t_max; 7 | t1_max = 0; 8 | t2_max = 0; 9 | it1_total = 0; 10 | it2_total = 0; 11 | total = 100; 12 | k = 1; 13 | k_total = 0; 14 | while k<=total 15 | k_total = k_total+1; 16 | [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp] = test_problem_v_dixon(0); 17 | if (norm(x_ssn-x_sqp) > 0.1) 18 | disp('Different solutions..'); 19 | break; 20 | end 21 | if (t_ssn > t_max || t_sqp > t_max) 22 | break; 23 | end 24 | if (t_ssn == 0 || t_sqp == 0) 25 | continue; 26 | end 27 | k = k+1; 28 | t1_total = t1_total + t_ssn; 29 | t2_total = t2_total + t_sqp; 30 | if (t1_min > t_ssn) 31 | t1_min = t_ssn; 32 | end 33 | if (t2_min > t_sqp) 34 | t2_min = t_sqp; 35 | end 36 | if (t1_max < t_ssn) 37 | t1_max = t_ssn; 38 | end 39 | if (t2_max < t_sqp) 40 | t2_max = t_sqp; 41 | end 42 | it1_total = it1_total + it_ssn; 43 | it2_total = it2_total + it_sqp; 44 | end 45 | t1_total = t1_total/total; 46 | t2_total = t2_total/total; 47 | it1_total = it1_total/total; 48 | it2_total = it2_total/total; 49 | if ( nargin == 0 ) 50 | show = 1; 51 | end 52 | if ( (show == 1) && (k == total+1) ) 53 | x1 = sprintf('%.3f ',x_ssn); 54 | t1 = sprintf('solved in %.2f ms',t1_total*1000); 55 | t1min = sprintf(' (%.2f -',t1_min*1000); 56 | t1max = sprintf(' %.2f).',t1_max*1000); 57 | str1 = ['x_ssn = [ ', x1, '], it = ', num2str(it1_total), ', ', t1, t1min, t1max]; 58 | x2 = sprintf('%.3f ',x_sqp); 59 | t2 = sprintf('solved in %.2f ms',t2_total*1000); 60 | t2min = sprintf(' (%.2f -',t2_min*1000); 61 | t2max = sprintf(' %.2f).',t2_max*1000); 62 | str2 = ['x_sqp = [ ', x2, '], it = ', num2str(it2_total), ', ', t2, t2min, t2max]; 63 | disp(str1); 64 | disp(str2); 65 | if (k_total ~= 100) 66 | disp(['[', num2str(k_total), ']']); 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /test/problem_v_exp_1/test_problem_v_exp_1_100_times.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_exp_1_100_times(show) 2 | t1_total = 0; 3 | t2_total = 0; 4 | t_max = 2.5; 5 | t1_min = t_max; 6 | t2_min = t_max; 7 | t1_max = 0; 8 | t2_max = 0; 9 | it1_total = 0; 10 | it2_total = 0; 11 | total = 100; 12 | k = 1; 13 | k_total = 0; 14 | while k<=total 15 | k_total = k_total+1; 16 | [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp] = test_problem_v_exp_1(0); 17 | if (norm(x_ssn-x_sqp) > 0.1) 18 | disp('Different solutions..'); 19 | break; 20 | end 21 | if (t_ssn > t_max || t_sqp > t_max) 22 | break; 23 | end 24 | if (t_ssn == 0 || t_sqp == 0) 25 | continue; 26 | end 27 | k = k+1; 28 | t1_total = t1_total + t_ssn; 29 | t2_total = t2_total + t_sqp; 30 | if (t1_min > t_ssn) 31 | t1_min = t_ssn; 32 | end 33 | if (t2_min > t_sqp) 34 | t2_min = t_sqp; 35 | end 36 | if (t1_max < t_ssn) 37 | t1_max = t_ssn; 38 | end 39 | if (t2_max < t_sqp) 40 | t2_max = t_sqp; 41 | end 42 | it1_total = it1_total + it_ssn; 43 | it2_total = it2_total + it_sqp; 44 | end 45 | t1_total = t1_total/total; 46 | t2_total = t2_total/total; 47 | it1_total = it1_total/total; 48 | it2_total = it2_total/total; 49 | if ( nargin == 0 ) 50 | show = 1; 51 | end 52 | if ( (show == 1) && (k == total+1) ) 53 | x1 = sprintf('%.3f ',x_ssn); 54 | t1 = sprintf('solved in %.2f ms',t1_total*1000); 55 | t1min = sprintf(' (%.2f -',t1_min*1000); 56 | t1max = sprintf(' %.2f).',t1_max*1000); 57 | str1 = ['x_ssn = [ ', x1, '], it = ', num2str(it1_total), ', ', t1, t1min, t1max]; 58 | x2 = sprintf('%.3f ',x_sqp); 59 | t2 = sprintf('solved in %.2f ms',t2_total*1000); 60 | t2min = sprintf(' (%.2f -',t2_min*1000); 61 | t2max = sprintf(' %.2f).',t2_max*1000); 62 | str2 = ['x_sqp = [ ', x2, '], it = ', num2str(it2_total), ', ', t2, t2min, t2max]; 63 | disp(str1); 64 | disp(str2); 65 | if (k_total ~= 100) 66 | disp(['[', num2str(k_total), ']']); 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /test/problem_v_norm_1/test_problem_v_norm_1_100_times.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_norm_1_100_times(show) 2 | t1_total = 0; 3 | t2_total = 0; 4 | t_max = 2.5; 5 | t1_min = t_max; 6 | t2_min = t_max; 7 | t1_max = 0; 8 | t2_max = 0; 9 | it1_total = 0; 10 | it2_total = 0; 11 | total = 100; 12 | k = 1; 13 | k_total = 0; 14 | while k<=total 15 | k_total = k_total+1; 16 | [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp] = test_problem_v_norm_1(0); 17 | if (norm(x_ssn-x_sqp) > 0.1) 18 | disp('Different solutions..'); 19 | break; 20 | end 21 | if (t_ssn > t_max || t_sqp > t_max) 22 | break; 23 | end 24 | if (t_ssn == 0 || t_sqp == 0) 25 | continue; 26 | end 27 | k = k+1; 28 | t1_total = t1_total + t_ssn; 29 | t2_total = t2_total + t_sqp; 30 | if (t1_min > t_ssn) 31 | t1_min = t_ssn; 32 | end 33 | if (t2_min > t_sqp) 34 | t2_min = t_sqp; 35 | end 36 | if (t1_max < t_ssn) 37 | t1_max = t_ssn; 38 | end 39 | if (t2_max < t_sqp) 40 | t2_max = t_sqp; 41 | end 42 | it1_total = it1_total + it_ssn; 43 | it2_total = it2_total + it_sqp; 44 | end 45 | t1_total = t1_total/total; 46 | t2_total = t2_total/total; 47 | it1_total = it1_total/total; 48 | it2_total = it2_total/total; 49 | if ( nargin == 0 ) 50 | show = 1; 51 | end 52 | if ( (show == 1) && (k == total+1) ) 53 | x1 = sprintf('%.3f ',x_ssn); 54 | t1 = sprintf('solved in %.2f ms',t1_total*1000); 55 | t1min = sprintf(' (%.2f -',t1_min*1000); 56 | t1max = sprintf(' %.2f).',t1_max*1000); 57 | str1 = ['x_ssn = [ ', x1, '], it = ', num2str(it1_total), ', ', t1, t1min, t1max]; 58 | x2 = sprintf('%.3f ',x_sqp); 59 | t2 = sprintf('solved in %.2f ms',t2_total*1000); 60 | t2min = sprintf(' (%.2f -',t2_min*1000); 61 | t2max = sprintf(' %.2f).',t2_max*1000); 62 | str2 = ['x_sqp = [ ', x2, '], it = ', num2str(it2_total), ', ', t2, t2min, t2max]; 63 | disp(str1); 64 | disp(str2); 65 | if (k_total ~= 100) 66 | disp(['[', num2str(k_total), ']']); 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /test/test-populator/src/data/test_problem_100_times.tpl: -------------------------------------------------------------------------------- 1 | function test_{var_problem_name}_100_times(show) 2 | t1_total = 0; 3 | t2_total = 0; 4 | t_max = 2.5; 5 | t1_min = t_max; 6 | t2_min = t_max; 7 | t1_max = 0; 8 | t2_max = 0; 9 | it1_total = 0; 10 | it2_total = 0; 11 | total = 100; 12 | k = 1; 13 | k_total = 0; 14 | while k<=total 15 | k_total = k_total+1; 16 | [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp] = test_{var_problem_name}(0); 17 | if (norm(x_ssn-x_sqp) > 0.1) 18 | disp('Different solutions..'); 19 | break; 20 | end 21 | if (t_ssn > t_max || t_sqp > t_max) 22 | break; 23 | end 24 | if (t_ssn == 0 || t_sqp == 0) 25 | continue; 26 | end 27 | k = k+1; 28 | t1_total = t1_total + t_ssn; 29 | t2_total = t2_total + t_sqp; 30 | if (t1_min > t_ssn) 31 | t1_min = t_ssn; 32 | end 33 | if (t2_min > t_sqp) 34 | t2_min = t_sqp; 35 | end 36 | if (t1_max < t_ssn) 37 | t1_max = t_ssn; 38 | end 39 | if (t2_max < t_sqp) 40 | t2_max = t_sqp; 41 | end 42 | it1_total = it1_total + it_ssn; 43 | it2_total = it2_total + it_sqp; 44 | end 45 | t1_total = t1_total/total; 46 | t2_total = t2_total/total; 47 | it1_total = it1_total/total; 48 | it2_total = it2_total/total; 49 | if ( nargin == 0 ) 50 | show = 1; 51 | end 52 | if ( (show == 1) && (k == total+1) ) 53 | x1 = sprintf('%.3f ',x_ssn); 54 | t1 = sprintf('solved in %.2f ms',t1_total*1000); 55 | t1min = sprintf(' (%.2f -',t1_min*1000); 56 | t1max = sprintf(' %.2f).',t1_max*1000); 57 | str1 = ['x_ssn = [ ', x1, '], it = ', num2str(it1_total), ', ', t1, t1min, t1max]; 58 | x2 = sprintf('%.3f ',x_sqp); 59 | t2 = sprintf('solved in %.2f ms',t2_total*1000); 60 | t2min = sprintf(' (%.2f -',t2_min*1000); 61 | t2max = sprintf(' %.2f).',t2_max*1000); 62 | str2 = ['x_sqp = [ ', x2, '], it = ', num2str(it2_total), ', ', t2, t2min, t2max]; 63 | disp(str1); 64 | disp(str2); 65 | if (k_total ~= 100) 66 | disp(['[', num2str(k_total), ']']); 67 | end 68 | end 69 | end -------------------------------------------------------------------------------- /semismooth_newton.m: -------------------------------------------------------------------------------- 1 | % Function: [x,fval,it,X] = semismooth_newton (f, gradf, hessf, 2 | % A, b, G, r, x0, itmax, tol) 3 | % 4 | % Attempt to solve the problem 5 | % 6 | % min f(x) 7 | % x 8 | % 9 | % subject to 10 | % 11 | % A*x = b 12 | % G*x <= r 13 | % 14 | % using the semismooth Newton method. 15 | % 16 | % f : The name of the objective function f : R^n -> R. 17 | % gradf : The name of the function that returns the gradient of f. 18 | % hessf : The name of the function that returns the hessian matrix of f. 19 | % A : A matrix with dimension m x n for the linear equality contraints. 20 | % b : A vector with m elements for the linear equality contraints. 21 | % G : A matrix with dimension p x n for the linear inequality constraints. 22 | % r : A vector with p elements for the linear inequality constraints. 23 | % x0 : The start point for the algorithm. 24 | % itmax : The maximal number of iterations allowed. 25 | % tol : The bound needed for the stop criteria. 26 | % 27 | function [x,fval,it,X] = semismooth_newton(f,gradf,hessf,A,b,G,r,x0,itmax,tol) 28 | it = 0; 29 | [m,n] = size(A); 30 | [p,n] = size(G); 31 | n = length(x0); 32 | x = x0; 33 | X(1,:) = x'; 34 | lambda = zeros(m,1); 35 | mu = zeros(p,1); 36 | 37 | stop = false; 38 | while( ~stop ) 39 | h1 = feval(gradf,x); 40 | h2 = []; 41 | h3 = []; 42 | H2 = []; 43 | if (m ~= 0) 44 | h1 = h1 + A'*lambda; 45 | h2 = A*x - b; 46 | H2 = [A zeros(m,m+p)]; 47 | end 48 | if (p ~= 0) 49 | h1 = h1 + G'*mu; 50 | h3 = min(mu,r-G*x); 51 | end 52 | h = -[ h1; 53 | h2; 54 | h3 ]; 55 | % Check the stop criteria 56 | if (max(abs(h)) < tol) 57 | stop = true; 58 | end 59 | H = [ feval(hessf,x) A' G'; 60 | H2; 61 | zeros(p,n+m+p) ]; 62 | for k=1:p 63 | gk = G(k,1:n); 64 | if (r(k)-gk*x < mu(k)) 65 | H(n+m+k,1:n) = -gk; 66 | else 67 | H(n+m+k,n+m+k) = 1; 68 | end 69 | end 70 | d = H\h; 71 | dx = d(1:n); 72 | dlambda = d(n+1:n+m); 73 | dmu = d(n+m+1:n+m+p); 74 | x = x + dx; 75 | it = it + 1; 76 | X(it+1,:) = x'; 77 | lambda = lambda + dlambda; 78 | mu = mu + dmu; 79 | % If there are too many iterations 80 | if (it >= itmax) 81 | stop = true; 82 | end 83 | end 84 | fval = feval(f,x); 85 | end 86 | -------------------------------------------------------------------------------- /test/problem_v_beale_1/test_problem_v_beale_1_100_times.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_beale_1_100_times(show) 2 | t1_total = 0; 3 | t2_total = 0; 4 | t_max = 2.5; 5 | t1_min = t_max; 6 | t2_min = t_max; 7 | t1_max = 0; 8 | t2_max = 0; 9 | it1_total = 0; 10 | it2_total = 0; 11 | total = 100; 12 | k = 1; 13 | k_total = 0; 14 | while k<=total 15 | k_total = k_total+1; 16 | [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp] = test_problem_v_beale_1(0); 17 | if (norm(x_ssn-x_sqp) > 0.1) 18 | disp('Different solutions..'); 19 | break; 20 | end 21 | if (t_ssn > t_max || t_sqp > t_max) 22 | break; 23 | end 24 | if (t_ssn == 0 || t_sqp == 0) 25 | continue; 26 | end 27 | k = k+1; 28 | t1_total = t1_total + t_ssn; 29 | t2_total = t2_total + t_sqp; 30 | if (t1_min > t_ssn) 31 | t1_min = t_ssn; 32 | end 33 | if (t2_min > t_sqp) 34 | t2_min = t_sqp; 35 | end 36 | if (t1_max < t_ssn) 37 | t1_max = t_ssn; 38 | end 39 | if (t2_max < t_sqp) 40 | t2_max = t_sqp; 41 | end 42 | it1_total = it1_total + it_ssn; 43 | it2_total = it2_total + it_sqp; 44 | end 45 | t1_total = t1_total/total; 46 | t2_total = t2_total/total; 47 | it1_total = it1_total/total; 48 | it2_total = it2_total/total; 49 | if ( nargin == 0 ) 50 | show = 1; 51 | end 52 | if ( (show == 1) && (k == total+1) ) 53 | x1 = sprintf('%.3f ',x_ssn); 54 | t1 = sprintf('solved in %.2f ms',t1_total*1000); 55 | t1min = sprintf(' (%.2f -',t1_min*1000); 56 | t1max = sprintf(' %.2f).',t1_max*1000); 57 | str1 = ['x_ssn = [ ', x1, '], it = ', num2str(it1_total), ', ', t1, t1min, t1max]; 58 | x2 = sprintf('%.3f ',x_sqp); 59 | t2 = sprintf('solved in %.2f ms',t2_total*1000); 60 | t2min = sprintf(' (%.2f -',t2_min*1000); 61 | t2max = sprintf(' %.2f).',t2_max*1000); 62 | str2 = ['x_sqp = [ ', x2, '], it = ', num2str(it2_total), ', ', t2, t2min, t2max]; 63 | disp(str1); 64 | disp(str2); 65 | if (k_total ~= 100) 66 | disp(['[', num2str(k_total), ']']); 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /test/problem_v_dixon_1/test_problem_v_dixon_1_100_times.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_dixon_1_100_times(show) 2 | t1_total = 0; 3 | t2_total = 0; 4 | t_max = 2.5; 5 | t1_min = t_max; 6 | t2_min = t_max; 7 | t1_max = 0; 8 | t2_max = 0; 9 | it1_total = 0; 10 | it2_total = 0; 11 | total = 100; 12 | k = 1; 13 | k_total = 0; 14 | while k<=total 15 | k_total = k_total+1; 16 | [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp] = test_problem_v_dixon_1(0); 17 | if (norm(x_ssn-x_sqp) > 0.1) 18 | disp('Different solutions..'); 19 | break; 20 | end 21 | if (t_ssn > t_max || t_sqp > t_max) 22 | break; 23 | end 24 | if (t_ssn == 0 || t_sqp == 0) 25 | continue; 26 | end 27 | k = k+1; 28 | t1_total = t1_total + t_ssn; 29 | t2_total = t2_total + t_sqp; 30 | if (t1_min > t_ssn) 31 | t1_min = t_ssn; 32 | end 33 | if (t2_min > t_sqp) 34 | t2_min = t_sqp; 35 | end 36 | if (t1_max < t_ssn) 37 | t1_max = t_ssn; 38 | end 39 | if (t2_max < t_sqp) 40 | t2_max = t_sqp; 41 | end 42 | it1_total = it1_total + it_ssn; 43 | it2_total = it2_total + it_sqp; 44 | end 45 | t1_total = t1_total/total; 46 | t2_total = t2_total/total; 47 | it1_total = it1_total/total; 48 | it2_total = it2_total/total; 49 | if ( nargin == 0 ) 50 | show = 1; 51 | end 52 | if ( (show == 1) && (k == total+1) ) 53 | x1 = sprintf('%.3f ',x_ssn); 54 | t1 = sprintf('solved in %.2f ms',t1_total*1000); 55 | t1min = sprintf(' (%.2f -',t1_min*1000); 56 | t1max = sprintf(' %.2f).',t1_max*1000); 57 | str1 = ['x_ssn = [ ', x1, '], it = ', num2str(it1_total), ', ', t1, t1min, t1max]; 58 | x2 = sprintf('%.3f ',x_sqp); 59 | t2 = sprintf('solved in %.2f ms',t2_total*1000); 60 | t2min = sprintf(' (%.2f -',t2_min*1000); 61 | t2max = sprintf(' %.2f).',t2_max*1000); 62 | str2 = ['x_sqp = [ ', x2, '], it = ', num2str(it2_total), ', ', t2, t2min, t2max]; 63 | disp(str1); 64 | disp(str2); 65 | if (k_total ~= 100) 66 | disp(['[', num2str(k_total), ']']); 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /test/problem_AG_opt_ctrl/test_problem_AG_opt_ctrl_100_times.m: -------------------------------------------------------------------------------- 1 | function test_problem_AG_opt_ctrl_100_times(show) 2 | t1_total = 0; 3 | t2_total = 0; 4 | t_max = 2.5; 5 | t1_min = t_max; 6 | t2_min = t_max; 7 | t1_max = 0; 8 | t2_max = 0; 9 | it1_total = 0; 10 | it2_total = 0; 11 | total = 100; 12 | k = 1; 13 | k_total = 0; 14 | while k<=total 15 | k_total = k_total+1; 16 | [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp] = test_problem_AG_opt_ctrl(0); 17 | if (norm(x_ssn-x_sqp) > 0.1) 18 | disp('Different solutions..'); 19 | break; 20 | end 21 | if (t_ssn > t_max || t_sqp > t_max) 22 | break; 23 | end 24 | if (t_ssn == 0 || t_sqp == 0) 25 | continue; 26 | end 27 | k = k+1; 28 | t1_total = t1_total + t_ssn; 29 | t2_total = t2_total + t_sqp; 30 | if (t1_min > t_ssn) 31 | t1_min = t_ssn; 32 | end 33 | if (t2_min > t_sqp) 34 | t2_min = t_sqp; 35 | end 36 | if (t1_max < t_ssn) 37 | t1_max = t_ssn; 38 | end 39 | if (t2_max < t_sqp) 40 | t2_max = t_sqp; 41 | end 42 | it1_total = it1_total + it_ssn; 43 | it2_total = it2_total + it_sqp; 44 | end 45 | t1_total = t1_total/total; 46 | t2_total = t2_total/total; 47 | it1_total = it1_total/total; 48 | it2_total = it2_total/total; 49 | if ( nargin == 0 ) 50 | show = 1; 51 | end 52 | if ( (show == 1) && (k == total+1) ) 53 | x1 = sprintf('%.3f ',x_ssn); 54 | t1 = sprintf('solved in %.2f ms',t1_total*1000); 55 | t1min = sprintf(' (%.2f -',t1_min*1000); 56 | t1max = sprintf(' %.2f).',t1_max*1000); 57 | str1 = ['x_ssn = [ ', x1, '], it = ', num2str(it1_total), ', ', t1, t1min, t1max]; 58 | x2 = sprintf('%.3f ',x_sqp); 59 | t2 = sprintf('solved in %.2f ms',t2_total*1000); 60 | t2min = sprintf(' (%.2f -',t2_min*1000); 61 | t2max = sprintf(' %.2f).',t2_max*1000); 62 | str2 = ['x_sqp = [ ', x2, '], it = ', num2str(it2_total), ', ', t2, t2min, t2max]; 63 | disp(str1); 64 | disp(str2); 65 | if (k_total ~= 100) 66 | disp(['[', num2str(k_total), ']']); 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /test/problem_v_colville/test_problem_v_colville_100_times.m: -------------------------------------------------------------------------------- 1 | function test_problem_v_colville_100_times(show) 2 | t1_total = 0; 3 | t2_total = 0; 4 | t_max = 2.5; 5 | t1_min = t_max; 6 | t2_min = t_max; 7 | t1_max = 0; 8 | t2_max = 0; 9 | it1_total = 0; 10 | it2_total = 0; 11 | total = 100; 12 | k = 1; 13 | k_total = 0; 14 | while k<=total 15 | k_total = k_total+1; 16 | [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp] = test_problem_v_colville(0); 17 | if (norm(x_ssn-x_sqp) > 0.1) 18 | disp('Different solutions..'); 19 | break; 20 | end 21 | if (t_ssn > t_max || t_sqp > t_max) 22 | break; 23 | end 24 | if (t_ssn == 0 || t_sqp == 0) 25 | continue; 26 | end 27 | k = k+1; 28 | t1_total = t1_total + t_ssn; 29 | t2_total = t2_total + t_sqp; 30 | if (t1_min > t_ssn) 31 | t1_min = t_ssn; 32 | end 33 | if (t2_min > t_sqp) 34 | t2_min = t_sqp; 35 | end 36 | if (t1_max < t_ssn) 37 | t1_max = t_ssn; 38 | end 39 | if (t2_max < t_sqp) 40 | t2_max = t_sqp; 41 | end 42 | it1_total = it1_total + it_ssn; 43 | it2_total = it2_total + it_sqp; 44 | end 45 | t1_total = t1_total/total; 46 | t2_total = t2_total/total; 47 | it1_total = it1_total/total; 48 | it2_total = it2_total/total; 49 | if ( nargin == 0 ) 50 | show = 1; 51 | end 52 | if ( (show == 1) && (k == total+1) ) 53 | x1 = sprintf('%.3f ',x_ssn); 54 | t1 = sprintf('solved in %.2f ms',t1_total*1000); 55 | t1min = sprintf(' (%.2f -',t1_min*1000); 56 | t1max = sprintf(' %.2f).',t1_max*1000); 57 | str1 = ['x_ssn = [ ', x1, '], it = ', num2str(it1_total), ', ', t1, t1min, t1max]; 58 | x2 = sprintf('%.3f ',x_sqp); 59 | t2 = sprintf('solved in %.2f ms',t2_total*1000); 60 | t2min = sprintf(' (%.2f -',t2_min*1000); 61 | t2max = sprintf(' %.2f).',t2_max*1000); 62 | str2 = ['x_sqp = [ ', x2, '], it = ', num2str(it2_total), ', ', t2, t2min, t2max]; 63 | disp(str1); 64 | disp(str2); 65 | if (k_total ~= 100) 66 | disp(['[', num2str(k_total), ']']); 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /test/problem_A_miele_hs52/test_problem_A_miele_hs52_100_times.m: -------------------------------------------------------------------------------- 1 | function test_problem_A_miele_hs52_100_times(show) 2 | t1_total = 0; 3 | t2_total = 0; 4 | t_max = 2.5; 5 | t1_min = t_max; 6 | t2_min = t_max; 7 | t1_max = 0; 8 | t2_max = 0; 9 | it1_total = 0; 10 | it2_total = 0; 11 | total = 100; 12 | k = 1; 13 | k_total = 0; 14 | while k<=total 15 | k_total = k_total+1; 16 | [x_ssn,it_ssn,t_ssn,x_sqp,it_sqp,t_sqp] = test_problem_A_miele_hs52(0); 17 | if (norm(x_ssn-x_sqp) > 0.1) 18 | disp('Different solutions..'); 19 | break; 20 | end 21 | if (t_ssn > t_max || t_sqp > t_max) 22 | break; 23 | end 24 | if (t_ssn == 0 || t_sqp == 0) 25 | continue; 26 | end 27 | k = k+1; 28 | t1_total = t1_total + t_ssn; 29 | t2_total = t2_total + t_sqp; 30 | if (t1_min > t_ssn) 31 | t1_min = t_ssn; 32 | end 33 | if (t2_min > t_sqp) 34 | t2_min = t_sqp; 35 | end 36 | if (t1_max < t_ssn) 37 | t1_max = t_ssn; 38 | end 39 | if (t2_max < t_sqp) 40 | t2_max = t_sqp; 41 | end 42 | it1_total = it1_total + it_ssn; 43 | it2_total = it2_total + it_sqp; 44 | end 45 | t1_total = t1_total/total; 46 | t2_total = t2_total/total; 47 | it1_total = it1_total/total; 48 | it2_total = it2_total/total; 49 | if ( nargin == 0 ) 50 | show = 1; 51 | end 52 | if ( (show == 1) && (k == total+1) ) 53 | x1 = sprintf('%.3f ',x_ssn); 54 | t1 = sprintf('solved in %.2f ms',t1_total*1000); 55 | t1min = sprintf(' (%.2f -',t1_min*1000); 56 | t1max = sprintf(' %.2f).',t1_max*1000); 57 | str1 = ['x_ssn = [ ', x1, '], it = ', num2str(it1_total), ', ', t1, t1min, t1max]; 58 | x2 = sprintf('%.3f ',x_sqp); 59 | t2 = sprintf('solved in %.2f ms',t2_total*1000); 60 | t2min = sprintf(' (%.2f -',t2_min*1000); 61 | t2max = sprintf(' %.2f).',t2_max*1000); 62 | str2 = ['x_sqp = [ ', x2, '], it = ', num2str(it2_total), ', ', t2, t2min, t2max]; 63 | disp(str1); 64 | disp(str2); 65 | if (k_total ~= 100) 66 | disp(['[', num2str(k_total), ']']); 67 | end 68 | end 69 | end 70 | --------------------------------------------------------------------------------