Hi !
So, I'm using the optimizer.
I'm working on a minimization of a classical problem :
With a constraint that is a function of a parameter
Constraints =[Constraints, cost*x <= some_value*(1 + delta)]
The idea is to see the result of the optimization if
delta is equal to 0, 1%, 2%, 3%, and so on, until, say, 50%
Naturally, I created a simple for loop using delta = 0 : 0.01 : 0.5 and called my optimization 50 times.
for delta = 0:0.01:0.5
some other constraints
Constraints =[Constraints, cost*x <= some_value*(1 + delta)]
rest of the code (objective, constraints, etc.)
solution = optimize(Constraints, Objective, Options);
end
Besides the time needed that is quite long, my code runs just fine.
This is a classical use for your tool 'optimizer'. Actually, there are more parameters and I want to run around 1000 times the previous optimization that takes around 30-60 sec to be solved.
So I worked on the optimizer :
delta = sdpvar(1,1,'full');
some other constraints
Constraints = [Constraints, cost*x <= some_value*(1 + delta)];
Constraints = [Constraints, 0<= delta <= 0.5];
rest of the code (objective, constraints, etc.)
solution = optimizer(Constraints, Objective, Options, delta, x);
Two questions arise:
1. how many values will delta take from 0 to 0.5 ? If I want to optimize for different values of delta by step of 0.1% can I declare delta as an intvar then use delta/100 ?
2. I don't have an error when I call the problem but all I get are "0" as values for my variables. Solution.info gives me a 'successfully solved (IBM CPLEX)'. What am I missing there ?
Thanks for the help