Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Tsegaye Tenagne <tsgelectric@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Mata Optimize with Inequality Constraint |

Date |
Mon, 17 Jun 2013 22:23:51 -0700 |

Dear All , I have the following exponential function that shows revenue per item for an arcade floor. The coefficients are from regression results. I have area and product type dummies, total number of similar units in the floor, along with many other variables in the regression. Below is a simplified form of my revenue equation. Revenue= exp(constant:+Area_fe:+producttype_fe:+b_N:*unit:+b_N2:*(unit:^2)+b_N3:*(unit:^3) + b_New:*new:+b_New2:*(new:^2)+b_New3:*(new:^3))*(Optimal Units) Units=number of similar items on floor New = number of new items on floor (less than certain age) I want to use mata _optimize() function to arrive at the optimal products combinations that can generate the floors maximum revenue. Below is a simplified matrix of variable that I am interested in Area Product Type Units Optimal_Units Similar_Units (unit) Decision A X 2 2 10 0 A Y 5 5 9 0 A Z 6 6 6 0 A P 3 3 6 0 B X 8 8 10 0 B P 2 2 6 0 C P 1 1 6 0 C Q 5 5 5 0 C Y 4 4 9 0 I wanted to use separate decision column for decision variable because new units have different demand compared to existing units. Decision (argument) is a column vector. The optimal units are defined as the decision (add or remove) + current units. The decision variable can only take integers (positive if additional items are required or negative if item has to be removed from the floor). The number of similar units is the count of similar items on the floor (example sum of x's in A, B and C =10) My question is: How do I tell mata that I have column vector evaluators? Can I use stata inside mata to generate aggregate values? example stata("bysort product_type:egen similar_units=total(units)" How do I add inequality and integer constraints? Is mata capable of adding inequality and integer constraints? How do I add collapsed matrix of constraints? Example below ( the total number of units in each area should be the same before and after the change). Area Product Type Units Optimal units A X 2 2 A Y 5 5 A Z 6 6 A P 3 3 B X 8 8 B P 2 2 C P 1 1 C Q 5 5 C Y 4 4 = Area units A 16 B 10 C 10 My apology for the lengthy email. Any help is very appreciated Tsegaye * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**st: RE: Mata Optimize with Inequality Constraint***From:*Timothy Mak <tshmak@hku.hk>

- Prev by Date:
**RE: st: about spmap** - Next by Date:
**st: Using prtest for large obs, in conjunction with oneway** - Previous by thread:
**st: interactions in mlogit** - Next by thread:
**st: RE: Mata Optimize with Inequality Constraint** - Index(es):