[OS-tickets] [Optimization Services] #53: handling of ASL MAXLIST
Optimization Services
coin-trac at coin-or.org
Tue Oct 22 04:50:39 EDT 2013
#53: handling of ASL MAXLIST
---------------------------+-----------------
Reporter: stefan | Owner:
Type: defect | Status: new
Priority: minor | Milestone:
Component: other/unknown | Version:
Keywords: |
---------------------------+-----------------
The MAXLIST operand in an AMPL expression is not handled correctly.
The attached files should demonstrate this behavior.
I talked to Victor at AMPL and the correct way to handle MAXLIST is to do
the following:
You should first cast a pointer to an expression representing max
(MAXLIST)
from expr* to expr_va*
(https://github.com/ampl/ampl/blob/master/solvers/nlp.h#L100). Then you
can iterate over arguments as follows:
{{{
for (const de *d = ((expr_va*)e)->L.d; d->e; ++d) {
// d->e points to an argument
}
}}}
Here's a simple C++ wrapper around expr_va which can be used as an
example:
https://github.com/ampl/ampl/blob/master/solvers/util/expr.h#L446
--
Ticket URL: <https://projects.coin-or.org/OS/ticket/53>
Optimization Services <http://projects.coin-or.org/OS>
An interface for Web services implementing optimization.
More information about the OS-tickets
mailing list