can GAMS solve such problem?

Archive of Gamsworld Google Group
Post Reply
Archiver
User
User
Posts: 7876
Joined: 7 years ago

can GAMS solve such problem?

Post by Archiver »



Hi,

I have modeled the problem I need to solve with GAMS. I first chose
nlp to solve the problem, but the compiler suggested me to use dnlp.
However, the compiler then said that "Endogenous $-control operations
not allowed". So I have been wondering if my problem is out of the
scope of GAMS?


I need to solve the following problem:

M is THE MATRIX I want to solve. None of its entries is known.

I have a lot of vectors. What I do is to use M to project them into a
new space, and try to keep their relative distance sequences.

Let a, b, c denote the vectors.

The test condition is:
If distance(a, b) > distance(a, c) AND distance(Ma, Mb)
sum(o2, power(face_vectors(f1, o2) - face_vectors(f3,
o2), 2)) and
sum(n1, power(projected_face_vectors(f1, n1) -
projected_face_vectors(f2, n1), 2)) <
sum(n2,power(projected_face_vectors(f1, n2) -
projected_face_vectors(f3, n2), 2))),
sum(n3, power(projected_face_vectors(f1, n3) -
projected_face_vectors(f3, n3), 2)) -
sum(n4, power(projected_face_vectors(f1, n4) -
projected_face_vectors(f2, n4), 2)));


Model new_projection_space /all/ ;
Solve new_projection_space using dnlp minimizing cost ;

display M.l, M.m;


I guess that trouble comes from that fact that it is a iterative
optimization problem; if I want to know the pairs in my vectors that
satisfy the test condition, I need to know M, but M is precisely the
variable I want to solve!

So is my problem something that can be solved by GAMS?
Or is there other softwares that I might use?
Any help is greatly appreciated!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---


Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: can GAMS solve such problem?

Post by Archiver »



Eunice,

In your model there is a discrete decision d(a,b)>d(a,c) and
d(Ma,Mb)>d(Ma,Mc) and the discrete decsion incures some cost. I think
you should have no problem forumlating your problem as an MINLP which
you nicely can do in GAMS. If you need help coming up with the right
model you should try to read HP Willams Book on Modeling (http://
www.amazon.com/Model-Building-Mathemati ... 0471997889).

Regards,
Michael Bussieck - GAMSWorld Coordinator

On Aug 23, 2:42 am, lweunice wrote:
> > Hi,
> >
> > I have modeled the problem I need to solve with GAMS. I first chose
> > nlp to solve the problem, but the compiler suggested me to use dnlp.
> > However, the compiler then said that "Endogenous $-control operations
> > not allowed". So I have been wondering if my problem is out of the
> > scope of GAMS?
> >
> > I need to solve the following problem:
> >
> > M is THE MATRIX I want to solve. None of its entries is known.
> >
> > I have a lot of vectors. What I do is to use M to project them into a
> > new space, and try to keep their relative distance sequences.
> >
> > Let a, b, c denote the vectors.
> >
> > The test condition is:
> > If distance(a, b) > distance(a, c) AND distance(Ma, Mb) > Mc)
> > It is an anomaly, so it entails some cost.
> >
> > The cost function is f(t), and is defined as:
> > S(t) = (Ma - Mc) (Ma - Mc)T - (Ma - Mb) (Ma - Mb)T
> > f(t) = summation(from 0 to t) S(t)
> >
> > my code:
> >
> > set face_number /1*8/;
> > set new_face_vector_length face vectors multiplied by M /1*3/;
> > 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));
> >
> > variable cost;
> > alias (face_number, f1, f2, f3);
> > alias (old_face_vector_length, o1, o2);
> > alias (new_face_vector_length, n1, n2, n3, n4);
> > equations cost_function;
> > cost_function ..
> > cost =e= sum((f1, f2, f3)
> > $(sum(o1, power(face_vectors(f1, o1) - face_vectors(f2,
> > o1), 2)) >
> > sum(o2, power(face_vectors(f1, o2) - face_vectors(f3,
> > o2), 2)) and
> > sum(n1, power(projected_face_vectors(f1, n1) -
> > projected_face_vectors(f2, n1), 2)) > sum(n2,power(projected_face_vectors(f1, n2) -
> > projected_face_vectors(f3, n2), 2))),
> > sum(n3, power(projected_face_vectors(f1, n3) -
> > projected_face_vectors(f3, n3), 2)) -
> > sum(n4, power(projected_face_vectors(f1, n4) -
> > projected_face_vectors(f2, n4), 2)));
> >
> > Model new_projection_space /all/ ;
> > Solve new_projection_space using dnlp minimizing cost ;
> >
> > display M.l, M.m;
> >
> > I guess that trouble comes from that fact that it is a iterative
> > optimization problem; if I want to know the pairs in my vectors that
> > satisfy the test condition, I need to know M, but M is precisely the
> > variable I want to solve!
> >
> > So is my problem something that can be solved by GAMS?
> > Or is there other softwares that I might use?
> > Any help is greatly appreciated!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---


Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: can GAMS solve such problem?

Post by Archiver »



Thanks for your reply :)

But using minlp shows the same error message:
"Endogenous $-control operations not allowed"

I have used all available solution procedures in the used guide:
lp, qcp, nlp, dnlp, mip, ...mpec, cns
but none of them worked.

So I guess this means that my problem is out of the scope of GAMS !?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---


Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: can GAMS solve such problem?

Post by Archiver »



Eunice,

Just changing the model type to MINLP does not solve the problem. You
need to go back to the drawing board and properly formulate your model
as an MINLP (this is independent of GAMS). Unfortunately, this will
require some reading up on model formulations (again independent of
GAMS). But I can assure you that one can nicely forumulate your
problem as an MINLP. Other solution techniques as Genetic Algorithms
and other meta heuristics could also do a decent job, but with that
you won't get proven optimal solutions.

Regards,
Michael Bussieck - GAMSWorld Coordinator

On Aug 25, 7:53 am, lweunice wrote:
> > Thanks for your reply :)
> >
> > But using minlp shows the same error message:
> > "Endogenous $-control operations not allowed"
> >
> > I have used all available solution procedures in the used guide:
> > lp, qcp, nlp, dnlp, mip, ...mpec, cns
> > but none of them worked.
> >
> > So I guess this means that my problem is out of the scope of GAMS !?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---


Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: can GAMS solve such problem?

Post by Archiver »



OK, I see. I will try to get my hands on the book.
And many thanks to your help. I really appreciated it.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---


Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: can GAMS solve such problem?

Post by Archiver »



Hi Eunice, may be your problem can be reformulated as a disjunctive
problem and solve it with Logical Mixed Integer Programming (LogMIP),
you can visit http://www.logmip.ceride.gov.ar/eng/about/about.htm . In
this Page there is nice examples for using this solver in disjunctive
problem. Please note, that you can define binary variables indicating
if the logical condition is true or false.


Bye


On Aug 23, 2:42 am, lweunice wrote:
> > Hi,
> >
> > I have modeled the problem I need to solve with GAMS. I first chose
> > nlp to solve the problem, but the compiler suggested me to use dnlp.
> > However, the compiler then said that "Endogenous $-control operations
> > not allowed". So I have been wondering if my problem is out of the
> > scope of GAMS?
> >
> > I need to solve the following problem:
> >
> > M is THE MATRIX I want to solve. None of its entries is known.
> >
> > I have a lot of vectors. What I do is to use M to project them into a
> > new space, and try to keep their relative distance sequences.
> >
> > Let a, b, c denote the vectors.
> >
> > The test condition is:
> > If distance(a, b) > distance(a, c) AND distance(Ma, Mb) > Mc)
> > It is an anomaly, so it entails some cost.
> >
> > The cost function is f(t), and is defined as:
> > S(t) = (Ma - Mc) (Ma - Mc)T - (Ma - Mb) (Ma - Mb)T
> > f(t) = summation(from 0 to t) S(t)
> >
> > my code:
> >
> > set face_number /1*8/;
> > set new_face_vector_length face vectors multiplied by M /1*3/;
> > 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));
> >
> > variable cost;
> > alias (face_number, f1, f2, f3);
> > alias (old_face_vector_length, o1, o2);
> > alias (new_face_vector_length, n1, n2, n3, n4);
> > equations cost_function;
> > cost_function ..
> > cost =e= sum((f1, f2, f3)
> > $(sum(o1, power(face_vectors(f1, o1) - face_vectors(f2,
> > o1), 2)) >
> > sum(o2, power(face_vectors(f1, o2) - face_vectors(f3,
> > o2), 2)) and
> > sum(n1, power(projected_face_vectors(f1, n1) -
> > projected_face_vectors(f2, n1), 2)) > sum(n2,power(projected_face_vectors(f1, n2) -
> > projected_face_vectors(f3, n2), 2))),
> > sum(n3, power(projected_face_vectors(f1, n3) -
> > projected_face_vectors(f3, n3), 2)) -
> > sum(n4, power(projected_face_vectors(f1, n4) -
> > projected_face_vectors(f2, n4), 2)));
> >
> > Model new_projection_space /all/ ;
> > Solve new_projection_space using dnlp minimizing cost ;
> >
> > display M.l, M.m;
> >
> > I guess that trouble comes from that fact that it is a iterative
> > optimization problem; if I want to know the pairs in my vectors that
> > satisfy the test condition, I need to know M, but M is precisely the
> > variable I want to solve!
> >
> > So is my problem something that can be solved by GAMS?
> > Or is there other softwares that I might use?
> > Any help is greatly appreciated!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---


Post Reply