Hi,
I am trying to minimize "crit" and output a vector "item_price" with the command "optimize()". I am getting the following error:
Here is the code that I am running:
I also would like to define inequality constraints on the "item_price" vector (the error that I am getting may be related...)
LowerBound <= item_price <= UpperBound
I want to mention that I have printed the matrices, and it does not seem to be a matter of dimensions. Can someone help? Thanks!
I am trying to minimize "crit" and output a vector "item_price" with the command "optimize()". I am getting the following error:
Code:
: p=optimize(S) *: 3200 conformability error i_crit(): - function returned error opt__calluser0_d(): - function returned error opt__d0_calluser(): - function returned error deriv__call1user_d(): - function returned error _deriv__compute_value(): - function returned error _deriv(): - function returned error opt__eval_nr_d0(): - function returned error opt__eval(): - function returned error opt__looputil_iter0_common(): - function returned error opt__looputil_iter0_nr(): - function returned error opt__loop_nr(): - function returned error optimize(): - function returned error <istmt>: - function returned error (1 line skipped)
Code:
clear* sysuse auto, clear gen n= _n drop if n>38 rename price pack_price mata: void i_crit(todo,item_price,crit,g,H) { external pack_price, item_qty, item_price e=pack_price - item_qty*item_price crit=(e'*e) } pack_price = st_data(., "pack_price") item_qty=J(rows(pack_price),50,1) item_price = J(50,1,0) item_price_0 = J(50,1,1) S=optimize_init() optimize_init_evaluator(S, &i_crit()) optimize_init_which(S,"min") optimize_init_evaluatortype(S,"d0") optimize_init_params(S,item_price_0') p=optimize(S) p end
LowerBound <= item_price <= UpperBound
I want to mention that I have printed the matrices, and it does not seem to be a matter of dimensions. Can someone help? Thanks!
Comment