Commit 6b06e5cb authored by Gianluca Frison's avatar Gianluca Frison

added remainig solutions to ex02

parent d618b40f
reset;
param n := 82;
param m := 10;
param yx{1..n,1..2};
data filip_yx.dat;
#display yx;
var a{i in 0..m}; # coefficients
minimize
obj: sum{i in 1..n} ( sum{k in 0..m} a[k]*yx[i,2]^k - yx[i,1] )^2;
#option solver gurobi;
#option solver ipopt;
#option solver bonmin;
#option solver minos;
#option solver loqo;
#option solver cplex;
#option solver snopt;
#option solver couenne;
option solver conopt;
solve;
display a;
display obj;
reset;
param n := 82;
param m := 10;
param yx{1..n,1..2};
data filip_yx.dat;
#display yx;
var a{0..m}; # coefficients
var d{1..n}; # x-error
minimize
obj: sum{i in 1..n} ( ( sum{k in 0..m} a[k]*(yx[i,2]+d[i])^k - yx[i,1] )^2 + d[i]^2 );
#option solver snopt;
#option solver minos;
#option solver bonmin;
#option solver ipopt;
#option solver couenne;
#option solver loqo;
option solver conopt;
solve;
display d;
display a;
display obj;
|------------------|
| Solution of ex02 |
|------------------|
---
2.1
---
J = [ 1 + x_2 , x_1 + 2 x_2 ;
2 x_1 - 2 , 2 x_2 ]
J(0,0) = [ 1 , 0 ;
-2 , 0 ]
is singular.
For all solvers, the solution for the x_2 component is inaccurate.
Using KNITRO and the suggested option, the accuracy is to machine precision.
---
2.2
---
There are at least two solutions, one for the suggested starting guess ( x_i = 1 / n ) and one for x_i = (-1)^i / n
Both solutions have the same objective, i.e. 0.
---
2.3
---
Most of solvers give very bad fits. Only CONOPT gives the same solution as the certified values.
The problem is ill-conditioned, with 9 orders of magnitude between the largest and the smallest coefficients.
---
2.4
---
Orthogonal distance regression improves the solution for most solvers (in that the residuals are smaller), but still CONOPT is the only one getting the same solution as the certified values.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment