Azzera filtri
Azzera filtri

I want to solve optimization problem but when run it notifide : Undefined function or variable optimvar, how to fix it ?

1 visualizzazione (ultimi 30 giorni)
clear; clc
X = optimvar('x','LowerBound',0,'UpperBound',inf);
Y = optimvar('Y','LowerBound',0,'UpperBound',inf);
linprob = optimproblem('Objective',X+Y);
linprob.Constraints.cons1 = 2*X+2*Y >= 4;
linprob.Constraints.cons2 = -2*X+4*Y >= -2;
linprob.Constraints.cons3 = -2*X+Y >= -8;
linprob.Constraints.cons4 =-2*X+Y <= -2;
linprob.Constraints.cons5 = Y <= 6;
linsol = solve(linprob);

Risposte (1)

Marco Riani
Marco Riani il 5 Dic 2020
You need to install the Optimization toolbox

Categorie

Scopri di più su Get Started with Optimization Toolbox in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by