[OS] Common expressions -- user defined variables

Robert Fourer 4er at ampl.com
Mon Mar 10 17:32:47 EDT 2008


Kipp & Leo,

These are often called "defined variables" in descriptions of AMPL.  An nl file
gives statistics for the number of defined variables appearing

     b   in both the objective and constraints
     c   in two or more constraints but not any objectives
     o   in two or more objectives but not any constraints
     c1  in only one constraint and no objectives
     o1  in only one objective and no constraints

Presumably these distinctions make a difference to some aspects of the ASL,
such as such as the function evaluation routines.

The b, c, o variables can be regarded as defining "common subexpressions" in
the objectives and/or constraints.  I think that's the origin of the term
"common exprs" in the comments of the nl file.

-- Bob


> -----Original Message-----
> From: optimizationservices at googlegroups.com
> [mailto:optimizationservices at googlegroups.com] On Behalf Of Kipp Martin
> Sent: Monday, March 10, 2008 12:31 PM
> To: optimizationservices at googlegroups.com
> Subject: Re: [OS] Common expressions -- user defined variables
> 
> 
> Hi Leo:
> 
> > What do you mean by common expressions? Definitions using a := at
> > declaration time?
> 
> A common expression is a variable defined in terms of other variables.
> Here is an example from
> 
> http://www.gerad.ca/~orban/drampl/def-vars.html
> 
> var x {1..n};
> var v = sum {i in 1..n} x[i]^2;
> var u = v-x[n];
> 
> In the past I have always called v and u, "definitional variables" and
> have no idea where the term "common expression" comes from.  If you look
> at an AMPL nl file you will see, for example, a line:
> 
>   0 0 0 3 0	# common exprs: b,c,o,c1,o1
> 
>  From playing around, I think c1 is the number of common expression in
> the constraints and o1 is the number of common expressions in the
> objective function.  I have no idea as to what (b,c,and o) are. There is
> no documentation on this in "Hooking Your Solver to AMPL"  Working with
> the common expressions is tough because of the lack of documentation and
> trying to figure out what the variables are.
> 
> Cheers,
> 
> 
> 
> 
> >
> > Thanks,
> > Leo.
> >
> > On Sun, Mar 9, 2008 at 11:40 PM, Kipp Martin <Kipp.Martin at chicagogsb.edu>
> wrote:
> >>  Hello:
> >>
> >>  The current trunk version (1701) of OS now supports AMPL common
> >>  expressions (user-defined variables).  If your nl file has user defined
> >>  variables
> >>
> >>  OSSolverService -solver solverName -nl path/to/file/fileName.nl
> >>
> >>  should now work instead of throwing an exception.
> >>
> >>  Please report any problems with this.
> >>
> >>  Thanks
> >>
> >>
> >>  --
> >>  Kipp Martin
> >>  Professor of Operations Research
> >>  and Computing Technology
> >>  Graduate School of Business
> >>  University of Chicago
> >>  5807 South Woodlawn Avenue
> >>  Chicago, IL 60637
> >>  773-702-7456
> >>  kipp.martin at chicagogsb.edu
> >>  http://gsbkip.chicagogsb.edu
> >>  http://www.coin-or.org
> >>  _______________________________________________
> >>  OS mailing list
> >>  OS at list.coin-or.org
> >>  http://list.coin-or.org/mailman/listinfo/os
> >>
> >>  >
> >>
> >
> >
> >
> 
> 
> --
> Kipp Martin
> Professor of Operations Research
> and Computing Technology
> Graduate School of Business
> University of Chicago
> 5807 South Woodlawn Avenue
> Chicago, IL 60637
> 773-702-7456
> kipp.martin at chicagogsb.edu
> http://gsbkip.chicagogsb.edu
> http://www.coin-or.org
> 
> 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Optimization Services (OS)" group.
To post to this group, send email to optimizationservices at googlegroups.com
To unsubscribe from this group, send email to optimizationservices-unsubscribe at googlegroups.com
For more options, visit this group at http://groups.google.com/group/optimizationservices?hl=en
-~----------~----~----~----~------~----~------~--~---



More information about the OS mailing list