abs cannot be used in problem-based optimization expression
Mostrar comentarios más antiguos
Can someone tell me why I cannot use abs() in this simple setup.
prob = optimproblem();
x = optimvar('x',1,1);
y = 1;
x0 = struct('x',0);
prob.Objective = abs(x-y); % sum(abs(x-y)) also doesn't work
%prob.Objective = norm(x-y,1); % this however works
sol = solve(prob,x0)
If I use prob.Objective = norm(x-y,1) it wokks just fine
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Get Started with Problem-Based Optimization and Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!