summaryrefslogtreecommitdiff
path: root/glpk-5.0/examples/yacfs.mod
diff options
context:
space:
mode:
authorPasha <pasha@member.fsf.org>2023-01-27 00:54:07 +0000
committerPasha <pasha@member.fsf.org>2023-01-27 00:54:07 +0000
commitef800d4ffafdbde7d7a172ad73bd984b1695c138 (patch)
tree920cc189130f1e98f252283fce94851443641a6d /glpk-5.0/examples/yacfs.mod
parentec4ae3c2b5cb0e83fb667f14f832ea94f68ef075 (diff)
downloadoneapi-ef800d4ffafdbde7d7a172ad73bd984b1695c138.tar.gz
oneapi-ef800d4ffafdbde7d7a172ad73bd984b1695c138.tar.bz2
simplex-glpk with modified glpk for fpgaHEADmaster
Diffstat (limited to 'glpk-5.0/examples/yacfs.mod')
-rw-r--r--glpk-5.0/examples/yacfs.mod48
1 files changed, 48 insertions, 0 deletions
diff --git a/glpk-5.0/examples/yacfs.mod b/glpk-5.0/examples/yacfs.mod
new file mode 100644
index 0000000..270f2a0
--- /dev/null
+++ b/glpk-5.0/examples/yacfs.mod
@@ -0,0 +1,48 @@
+/*Yet Another Curve Fitting Solution
+
+ Obviously this solution produces the same answer
+ as examples/cflsq.mod
+
+ Nigel_Galloway@operamail.com
+ February 1st., 2009
+*/
+set Sample;
+param Sx {z in Sample};
+param Sy {z in Sample};
+
+var a;
+var b;
+
+equalz1 :sum{z in Sample} a*Sx[z]*Sx[z] + sum{z in Sample} b*Sx[z] = sum{z in Sample} Sy[z]*Sx[z];
+equalz2 :sum{z in Sample} a*Sx[z] + sum{z in Sample} b = sum{z in Sample} Sy[z];
+
+solve;
+
+printf "\nbest linear fit is:\n\ty = %f %s %fx\n\n", b, if a < 0 then "-" else "+", abs(a);
+
+data;
+
+param:
+Sample: Sx Sy :=
+ 1 0 1
+ 2 0.5 0.9
+ 3 1 0.7
+ 4 1.5 1.5
+ 5 1.9 2
+ 6 2.5 2.4
+ 7 3 3.2
+ 8 3.5 2
+ 9 4 2.7
+ 10 4.5 3.5
+ 11 5 1
+ 12 5.5 4
+ 13 6 3.6
+ 14 6.6 2.7
+ 15 7 5.7
+ 16 7.6 4.6
+ 17 8.5 6
+ 18 9 6.8
+ 19 10 7.3
+;
+
+end;