3
$\begingroup$

Given that R possesses superior data pre-processing and post-processing packages, I am thinking of coding a matheuristic using R for publishing in an academic research journal.

However, I am unable to locate papers which mention the use of R whether in formulating exact MIP formulations (using the R APIs of either CPLEX, Gurobi) or coding pure heuristics or metaheuristics.

I guess it might be due to its inherent slower processing speed than C++ or Java or even Python.

However, R seems easier to code than C++ or Java when pre-processing data or adding constraints and fixing variables, thus I would like to enquire the chances of getting published via using R instead of C++ or Java or even Python.

Greatly appreciate your kind inputs!

Thank you!

$\endgroup$
2
$\begingroup$

A couple of years ago we had a student who wanted to call CPLEX from R and I think after spending a lot of time with a colleague they couldn't get it to work. The situation may have been improved, but back then Gurobi was a lot easier to call from R, and these kinds of struggles may be one reason why R is not very popular in papers that focus on MIPs. There are also not many tools available in R that can help you use commercial solvers in a convenient way. In one of our postgraduate courses we actually developed a small R-script that makes it a lot easier to manage variables and constraints on top of the standard Gurobi API. Python has packages that make those kinds of things easier, and with CPLEX you can use Concert technology in most supported languages that makes those kinds of things a lot easier as well. The lack of such technologies may be a second reason why R is not so popular for MIP papers, although this is a situation that may get better and better as time passes.

Furthermore, as you mentioned, for iterative computations the standard GNU R interpreter is really slow. There are some efforts to create faster alternative implementations of the R language, mostly based on Java technology, such as the experimental FastR interpreter by Oracle. The language itself was designed for statistics and I think ease of use for statistical usage is a much more important goal of the language than efficiency of arbitrary algorithms written in it.

If the speed of your math heuristic is a concern, in particular if it must make as many iterations as possible, R's speed is something to consider. Many core parts and popular packages of R are contain parts writte in C or Fortran to keep stuff under the hood efficient. If your heuristic is not really about iterations, i.e. you do a single preprocessing step, solve a MIP once, then do a postprocessing step, it is only important whether R is "fast enough". If the pre and postprocessing take 10 seconds in R, no one will complain that you can do it in 0.1 seconds in some other language (unless you want to run this heuristic millions of times).

So it really depends on the story you want to tell with your paper: if you solve a problem from practice and intend to investigate how you can improve some process with optimization techniques, it is usually enough to show you can solve it fast enough to be useful and focus on the objective values that come out. If you want to argue that your new method is faster than the state of the art for a problem that has seen a lot of research already, it becomes a greater concern.

Also, be aware that no one forces you write all code of a project in a single language. Personally I like to do most computational expensive stuff in Java, but I often use Python scripts to do some data transformations or stuff that other people probably like to do in Excel. For some types of visualization and statistical analysis I sometimes use R as well, if that is more convenient than Python.

If the main reason you like R is the built-in dataframe but R's speed is an issue, you can look at dataframe packages for other languages. Python has the extremely popular pandas package and for Java there are also packages that aim to provide a more easy to use data frame, for example Tablesaw (but I'm not sure how popular that one actually is).

While data frames are nice to process tabular data, I really dislike dealing with more complex hierarchical object data in R. Navigating an XML-tree or accessing particular document elements of an HTML page in R always feels cumbersome to me compared to other languages. The ease of data processing in R thus also depends on the kind of data processing you intend to do.

| improve this answer | |
$\endgroup$
7
$\begingroup$

You mention data pre-/post-processing. If what you propose to do is in the context of data science (for instance, a matheuristic for outlier identification to be embedded in some statistical data-torturing exercise), I don't see any problem at all. If what you propose to do is not specifically related to data science (for instance, a heuristic for solving traveling salesperson problems with regularly spaced bathroom breaks), then I suspect it will come down to how you benchmark your heuristic. As a reviewer, if most of the work is done in a separate solver (CPLEX, Gurobi, SCIP, ...), I don't see a problem. If your R code does a significant amount of work, and if you are benchmarking against some published alternatives that you have coded in R, I probably wouldn't have a problem, provided that I was fairly confident the difference between your method and the benchmark (your method presumably being faster) was not due to some inefficiency in how R does something (i.e., some "gotcha" afflicting the benchmark that wouldn't happen if you wrote the benchmark in C++ or Java or ...).

There's one other wrinkle: if your matheuristic needs R for some reason (cannot be translated to Python or whatever the current trendy language is), it makes the matheuristic somewhat less generally useful, and reviewers may view that as a drawback.

Disclaimer: I use R for some things, so I'm not prone to fainting at the mention of it. People (meaning reviewers) who do optimization only will have heard of it but may not be familiar with it, so in the first round they may ask "Why R?" unless you explain why in the paper.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Dear Prof Rubin, Thank you for your reply! R will primarily be used to construct constraints via reading off and iterating off data frames, on top of running the heuristic. The heuristic will most probably be along the lines of Tabu Search or VNS blended with some MIP-based heuristic like Fix-and-Optimize. I understand that the solution speed of the solver API should not vary much from language to language as it is written in C, but heuristics execution are dependant on the respective languages. $\endgroup$ – Mike Jun 3 at 23:39
  • $\begingroup$ Also, my problem might probably one whereby there is no prior literature on it as it is more like a specific problem stemming from some classical problem motivated by the peculiarities of some industrial application. Due to such, benchmarking might not be possible, thus I would like to ask if the novelty of it and its attendant formulation is sufficient ground for publication. $\endgroup$ – Mike Jun 3 at 23:40
  • 1
    $\begingroup$ Whether the novelty is grounds for publication will depend on the journal and the reviewers and associate editor. In my experience, sometimes the answer is yes, sometimes no, the latter coming in particular if the reviewers deem either the problem uninteresting or the formulation obvious. What you might call "straightforward" answers to previously unaddressed problems may be more publishable in a journal associated with the problem area (e.g., a healthcare journal if you are scheduling nurses) than a journal associated with the methodology. $\endgroup$ – prubin Jun 4 at 14:37
  • 1
    $\begingroup$ I think so, with one caveat. With a solver such as CPLEX or Gurobi, there is a trade-off between finding and improving feasible solutions on the one hand and proving optimality on the other. I have seen authors get in trouble because they compared their heuristic (which has no proof of optimality) to a solver that was spending lots of cycles trying to improve the best bound or prove optimality. So you would need to show that heuristic produces better feasible (suboptimal) solutions in a given time than the solver does when its parameters are chosen to emphasize the incumbent solution. $\endgroup$ – prubin Jun 5 at 17:12
  • 1
    $\begingroup$ The latter. As one example, CPLEX has a "MIP emphasis switch" (parameter). The default is "balanced" (between improving the solution and proving optimality). If I'm only concerned with getting a good solution, and don't care about proving optimality or getting a good bound, I can change that setting to "feasibility" or (even stronger) "hidden feasible". There are other settings that control how often heuristics, dives and such are used. If I were comparing CPLEX to a heuristic, I'd consider switching those settings to emphasize incumbent solution and deemphasize best bound/proof of optimality. $\endgroup$ – prubin Jun 7 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.