What solver for an integer minimization problem with linear objective and fractional constraints?

2 views (last 30 days)
Hi,
I have to solve an integer problem with a linear objective and fractional constraint, and specifically of this type:
Can you suggest me a solver I can use?
Many thanks,
Elisabetta

Answers (1)

Matt J
Matt J on 15 Oct 2020
Edited: Matt J on 15 Oct 2020
You can use ga(), if you havet Global Optimization Toolbox.
  1 Comment
Elisabetta Biondi
Elisabetta Biondi on 15 Oct 2020
Thank you Matt.
I have tried at first using ga() without the integer constraint. So I have built the function constraint.m:
function [c] = constraint(x)
global N aVec bVec T
c = -(ones(1,N)*((aVec.*transpose(x))./(bVec+transpose(x)))-T);
and then I have run the code
global N aVec bVec T
N=2;
aVec = [0.9; 0.9];
bVec = [2; 3];
T=1;
fun = @(x)(x*ones(N,1));
nonlcon = @constraint;
rng default
x = ga (fun, N, [], [], [], [], zeros(1,N), [], nonlcon)
However, it is returned to me an error:
Error using constraint
Too many output arguments.
Error in createAnonymousFcn>@(x)fcn(x,FcnArgs{:}) (line 11)
fcn_handle = @(x) fcn(x,FcnArgs{:});
Error in constrValidate (line 23)
[cineq,ceq] = nonlcon(Iterate.x');
Error in gacommon (line 132)
[LinearConstr, Iterate,nineqcstr,neqcstr,ncstr] = constrValidate(NonconFcn, ...
Error in ga (line 336)
NonconFcn,options,Iterate,type] = gacommon(nvars,fun,Aineq,bineq,Aeq,beq,lb,ub, ...
Error in optimization (line 22)
x = ga (fun, N, [], [], [], [], zeros(1,N), [], nonlcon)
Caused by:
Failure in initial user-supplied nonlinear constraint function evaluation.
In this case a solution exists, for example x=(10,10) satisfies the constraint. Can you tell me which is the problem? Thank you.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!