Applied-Systems-Lab / zonoLAB

GNU General Public License v3.0
0 stars 0 forks source link

enforceSetContain() - Add option to get initial solutions for solving the problem #20

Open jonaswagner2826 opened 8 months ago

jonaswagner2826 commented 8 months ago

When working with additional optimvars() within a problem sometimes an initial condition is required (or just desired) and thus an initial (ideally feasible) solution with the appropriate variable names is needed.

jonaswagner2826 commented 8 months ago

@amvellucci - is this a feature that you think would be easy to add to those conZono methods? The simpilist implementation is likely to have an optional output of [prob, x0] instead of just prob

jonaswagner2826 commented 8 months ago

Disscussion note:

jruths commented 7 months ago

I think this snippet will fix the issue of not having initial conditions for your variables....

vars = fieldnames(prob.Variables);

vals = struct();
for i = 1:length(vars)
    var = vars{i};
    vals.(var) = zeros(size(prob.Variables.(var)));
end

[sol, fval, exitflag] = solve(prob, vals, 'Options',options);
jonaswagner2826 commented 7 months ago

@jruths Assuming that zeros are reasonable (although potentially infeasible) values, then yes that would generate what I was looking for.

Ideally we should generate those and provide them as optional outputs to the enforceSetContain() function (and having it append to an exististing inputted solution struct would also be nice, but less critical)... It would be very tedious to do that (along with bookkeeping of and not overwriteing additional variables) every time you call enforceSetContain and want to give any initial guess at all

jruths commented 7 months ago

I see what you're saying. Let's put this into our optimvar discussion with Dr Koeln