Optimisation using intlinprog for a portfolio

here is the code i am using (adapted from the matlab intlinprog page):
clc
clear all
close all
f = [100 60 70 65 50 50 45 40 40 30];
b = [100];
N=10;
lb = zeros(N,1);
ub = ones(N,1);
intcon = 1:N;
A = [61 28 33 30 25 17 25 12 16 10];
[x1,fval1,exitflag1,output1] = intlinprog(f,intcon,[],[],A,b,lb,ub)
Question:
I am using the above code to try and maximise the profit of a portfolio for a project. I have a bughet (b) of £100 million with 10 projects with their individual costs (A). The profit to be made from each project is displayed in (f). The problem requires me to find the maximum profit for £100 million and £110 million. When I chnage b to 110 I get a profit (fval1) less than when I enter 100. I believe the code is finding a protfolio that adds upto exaclty 100 and 110 million rather than finding the max profit for each budget.
Any idea how to fix this?

 采纳的回答

[x1,fval1,exitflag1,output1] = intlinprog(-f,intcon,A,b,[],[],lb,ub)

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Linear Programming and Mixed-Integer Linear Programming 的更多信息

产品

版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by