Hi,
I am still working on the problem that I asked about few weeks ago.
My best guess after reading the book is that I should use an indicator
instead of conditional expressions when I sum up my cost. But still I
got an “Endogenous $ operation not allowed.”
Here is my code:
set face_number /18/;
set new_face_vector_length face vectors multiplied by M /13/;
set old_face_vector_length face vectors that already multiplied
eigenface /1*5/;
parameter face_vectors(face_number, old_face_vector_length) /
$ondelim
$include face_vectors.txt
$offdelim
/;
variable M(new_face_vector_length, old_face_vector_length);
variable projected_face_vectors(face_number, new_face_vector_length);
equations projection(face_number, new_face_vector_length);
projection(face_number, new_face_vector_length) …
projected_face_vectors(face_number, new_face_vector_length)
=e= sum(old_face_vector_length, M(new_face_vector_length,
old_face_vector_length) * face_vectors(face_number,
old_face_vector_length));
integer variable indicator(face_number, face_number, face_number);
variable cost;
alias (face_number, f1, f2, f3, f4, f5, f6);
alias (new_face_vector_length, n1, n2, n3, n4);
alias (old_face_vector_length, o1, o2);
equations cost_function, filter_function(f4, f5, f6);
cost_function …
cost =e= sum((f1, f2, f3),
indicator(f1, f2, f3)*
(sum(n1, power(projected_face_vectors(f1, n1) -
projected_face_vectors(f3, n1), 2)) -
sum(n2, power(projected_face_vectors(f1, n2) -
projected_face_vectors(f2, n2), 2))));
filter_function(f4, f5, f6) …
indicator(f4, f5, f6) =e= 1 $(sum(o1, power(face_vectors(f4, o1) -
face_vectors(f5, o1), 2)) >
sum(o2, power(face_vectors(f4, o2) -
face_vectors(f6, o2), 2)) and
sum(n3, power(projected_face_vectors(f4,
n3) - projected_face_vectors(f5, n3), 2)) <
sum(n4,power(projected_face_vectors(f4,
n4) - projected_face_vectors(f6, n4), 2)));
Model new_projection_space /all/ ;
Solve new_projection_space using minlp minimizing cost ;
display M.l, M.m;
Many thanks.
–~–~---------~–~----~------------~-------~–~----~
To post to this group, send email to gamsworld@googlegroups.com
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en
-~----------~----~----~----~------~----~------~–~—
\