POptUS / IBCDFO

Interpolation-Based Composite Derivative-Free Optimization
Other
7 stars 2 forks source link

MATLAB Path Management #127

Open jared321 opened 6 months ago

jared321 commented 6 months ago

For a project that is using MATLAB POUNDERS presently, my callpounders.m sets the current working directory (CWD) to the location in which needed configuration files are stored and where I want results to be written. This is completely unrelated to where IBCDFO is installed.

However, this doesn't presently work because of the relative path in https://github.com/POptUS/IBCDFO/blob/0b6d01771a6f1c2e0e2dd209c23d4af14a6de54e/pounders/m/pounders.m#L7-L9

which I believe looks for general_h_funs with respect to the CWD.

@jmlarson1 @mmenickelly @wildsm Can we assume that if someone is calling a specific pounders.m, then they should be using the general_h_funs in the same clone? If so, then how about using

[here_path, ~, ~] = fileparts(mfilename('fullpath'));
addpath(fullfile(here_path, 'general_h_funs'));
jared321 commented 6 months ago

It looks like users (or perhaps the person who writes something like callpounders) are expected to add the location of the correct minq to MATLAB's path. Based on your response to the above and the above technique for adding to the path, couldn't POUNDERS automatically add the correct minq to the path based on the final value of spsolver?

jared321 commented 4 months ago

Some potentially useful info regarding addpath:

In light of this, is it acceptable for a tool like POUNDERS to blindly add general_h_funs or minq5 to the path automatically without seeing if they are already in the path or restoring the PATH upon termination? Is there a reasonable use case where someone might manipulate the PATH so that an alternate version of external dependencies are found?

jared321 commented 4 months ago

It looks like manifold_sampling_primal uses POUNDERS's checkinputss function, which necessitates adding pounders/m to the path.

Naively, I would believe that if I want to use one method, I shouldn't add another method to the MATLAB path unless there is an obvious dependence such as between POUNDERS and MINQ.

@jmlarson1 @mmenickelly Would a better solution be to add a folder such as common/m to IBCDFO and locate checkinputss there? Copy or symlink checkinputss into manifold_sampling/m?

jared321 commented 4 months ago

As part of working Issue #145, I have come across

These might ease path management and overcome some of the aforementioned technical difficulties.

Consensus is that for now we assume that MATLAB users are happy to work from a clone of the repo with the need for them to alter the path. In particular, there is no need to offer the MATLAB code as a potentially simpler, cleaner toolbox through FileExchange. The possibility of methods such as pounders.m silently altering their path at the global level as a side effect is not particularly troubling for a such a workflow.