I am very new in GAMS, so that would be great if you can tell me what
I am doing wrong with my model.
Scalar A /1000./;
Sets j attribute / 1 + 6 /
k point number in class vgoog / 1 + 65 /
l point number in class good / 1 + 69 /
m point number in class acc / 1 + 384 /
n point number in class unacc / 1 + 1210 /
h hype number / 1, 2, 3 /;
Variables z
w (h,j)
b (h);
Positive variable e (k,h),
f (l,h),
g (m,h),
i (n,h);
Parameters r (k,j), y (l,j), t (m,j), p (n,j);
Equations obj objective function
cla11(k), cla12(k), cla13(k), cla21(l), cla22(l),
cla23(l),
cla31, cla32, cla33, cla41, cla42, cla43
classification constraints
err11(k), err12(k), err13(k), err14(k), err15(k),
err16(k) error constraints
err21(l), err22(l),
err31(m), err32(m),
err41(n), err42(n), err43(n), err44(n), err45(n),
err46(n);
obj… z =e= (0.5 * (sum (h), w (h,“1”))) + (0.5 * (sum (h), w
(h,“2”))) + (0.5 * (sum (h), w (h,“3”))) +
(0.5 * (sum (h), w (h,“4”))) + (0.5 * (sum (h), w (h,“5”))) + (0.5 *
(sum (h), w (h,“6”))) +
(1 *(( count = sum ((k,h), e (k,h))) + ( count = sum ((l,h), f (l,h)))
- ( count = sum ((m,h), g(m,h))) + ( count = sum ((n,h), i(n,h))))) ;
- vgood points
cla11(k)… sum ((j) , w(“1”,j) * r(k,j)) + b (“1”) =g= 1 - e (k,“1”);
cla12(k)… sum ((j) , w(“2”,j) * r(k,j)) + b (“2”) =g= 1 - e (k,“2”);
cla13(k)… sum ((j) , w(“3”,j) * r(k,j)) + b (“3”) =g= 1 - e (k,“3”);
- good points
cla21(l)… sum ((j) , w(“1”,j) * y(l,j) + b (1) =g= - 1 + f (l,“1”));
cla22(l)… sum ((j) , w(“2”,j) * y(l,j) + b (2) =g= 1 - f (l,“2”));
cla23(l)… sum ((j) , w(“3”,j) * y(l,j) + b (3) =g= 1 - f (l,“3”));
*acc points
cla31(m)… sum ((j) , w(“1”,j) * t(m,j) + b (“1”) =g= - 1 + g
(m,“1”));
cla32(m)… sum ((j) , w(“2”,j) * t(m,j) + b (“2”) =g= - 1 + g
(m,“2”));
cla33(m)… sum ((j) , w(“3”,j) * t(m,j) + b (“3”) =g= 1 - g (m,“3”));
- unacc points
cla41(n)… sum ((j) , w(“1”,j) * p(n,j) + b (“1”) =g= - 1 + i
(n,“1”));
cla42(n)… sum ((j) , w(“2”,j) * p(n,j) + b (“2”) =g= - 1 + i
(n,“2”));
cla43(n)… sum ((j) , w(“3”,j) * p(n,j) + b (“3”) =g= - 1 + i
(n,“3”));
- vgood points-error
err11(k)… e (k,“1”) =l= e (k,“2”);
err12(k)… e (k,“1”) =l= e (k,“3”);
err13(k)… e (k,“2”) =l= e (k,“3”);
err14(k)… e (k,“1”) * A =g= e (k,“2”);
err15(k)… e (k,“1”) * A =g= e (k,“3”);
err16(k)… e (k,“2”) * A =g= e (k,“3”);
- good points-error
err21(l)… f (l,“2”) =l= f (l,“3”);
err22(l)… f (l,“2”) * A =g= f (l,“3”);
- acc points-error
err31(m)… g (m,“2”) =l= g (m,1);
err32(m)… g (m,“2”) * A =g= g (m,1);
- unacc points-error
err41(n)… i (n,“3”) =l= i (n,“2”);
err42(n)… i (n,“3”) =l= i (n,“1”);
err43(n)… i (n,“2”) =l= i (n,“1”);
err44(n)… i (n,“3”) * A =g= i (n,“2”);
err45(n)… i (n,“3”) * A =g= i (n,“1”);
err46(n)… i (n,“2”) * A =g= i (n,“1”);
Model svm / all / ;
$CALL GDXXRW.EXE vgood.xls par = r rng=A1:G66
Parameter r (k,j);
$GDXIN vgood.gdx
$LOAD r
$GDXIN;
$CALL GDXXRW.EXE good.xls par = y rng=A1:G70
Parameter y (l,j);
$GDXIN good.gdx
$LOAD y
$GDXIN;
$CALL GDXXRW.EXE acc.xls par = t rng=A1:G385
Parameter t (m,j);
$GDXIN acc.gdx
$LOAD t
$GDXIN;
$CALL GDXXRW.EXE unacc.xls par = p rng=A1:G1211
Parameter p (n,j);
$GDXIN unacc.gdx
$LOAD p
$GDXIN;
Solve svm using nlp minimizing z;
\