Optimization of objective function with integrals where a bound is an optimization variable
Show older comments
I am attempting to maximize an objective function with integrals where the integrals' upper bounds are also the choice variables. e.g. I would like to maximize the following by choice of a 10x1 vector v
[int_0^v(1) (a(1)/(v(1))^(e(1)) dv(1) - b(1)*v(1)] + [int_0^v(2) (a(2)/(v(2))^(e(2)) dv(2) - b(2)*v(2)] + ... + [int_0^v(10) (a(10)/(v(10))^(e(10)) dv(10) - b(10)*v(10)]
My code is:
n=10;
a=rand(n,1);
b=rand(n,1)*3;
e=rand(n,1)*(-1);
prob= optimproblem('ObjectiveSense','max');
v=optimvar('v',n,1,'LowerBound',0);
series=int((a./v).^(e),0,v) -b.*v;
expand=sum(series);
prob.Objective=expand;
showproblem(prob)
sol=solve(prob);
sol.v
I receive the error "optim.internal.problemdef.Rdivide.getRdivideOperator Division by an OptimizationVariable not supported."
However, I also don't believe that I can use the 'int' function form optimization variables either, so I may be going about the problem entirely incorrectly.
Answers (1)
Alan Weiss
on 8 Oct 2018
0 votes
Currently, the problem-based approach, using optimproblem and the like, is only for linear or quadratic objective functions with linear constraints. To use Optimization Toolbox™ solvers, you will have to formulate your problem using the solver-based approach.
Alan Weiss
MATLAB mathematical toolbox documentation
Categories
Find more on Solver Outputs and Iterative Display in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!