Is there any modified version of Djikstra with O(V+E) complexity? - time-complexity

I am looking to create a modified version of Djikstra to find number of shortest paths from a source to a target vertex. Using arrays, I have O(V^2), using binary heap, I have O(ElgV), and using Fibonacci heap, I have O(E+VlgV).
Is there a way to modify it to be O(V+E) instead?

If the graph is acyclic (DAG) it is possible to use topological sorting to achieve O(V+E).

Related

Is it possible to access SCIP's Statistics output values directly from PyScipOpt Model Object?

I'm using SCIP to solve MILPs in Python using PyScipOpt. After solving a problem, the solver statistics can be either 1) printed as a string using printStatistics(), or 2) saved to an external file using writeStatistics(). For example:
import pyscipopt as pso
model = pso.Model()
model.addVar(name="x", obj=1)
model.optimize()
model.printStatistics()
model.writeStatistics(filename="stats.txt")
There's a lot of information in printStatistics/writeStatistics that doesn't seem to be accessible from the Python model object directly (e.g. primal-dual integral value, data for individual branching rules or primal heuristics, etc.) It would be helpful to be able to extract the data from this output via, e.g., attributes of the model object or a dictionary.
Is there any way to access this information from the model object without having to parse the raw text/file output?
PySCIPOpt does not provide access to the statistics directly. The data for the various tables (e.g. separators, presolvers, etc.) are stored separately for every single plugin in SCIP and are sometimes not straightforward to collect.
If you are only interested in certain statistics about the general solving process, then you might want to add PySCIPOpt wrappers for a few of the simple get functions defined in scip_solvingstats.c.
Lastly, you might want to check out IPET for parsing the statistics output.

AnyLogic: Is there a way to specify array of decision variables in Optimization Experiment?

I am working on an optimization model using AnyLogic. Is there a way to specify an array of decision variables in AnyLogic like how it is in IBM Cplex? For lesser number of decision variables (say 2 to 5), I used to specify them individually, for example, numAgents_1, numAgents_2 for locations 1 and 2. However, as my model grows in size and more locations are added (up to 40), is there a way I can specify them as an array or list of decision variables?
Any help regarding this would be really useful. Thanks.
Yes, but you need to use a "custom experiment" instead and set it up using an Array of decision variables.
This is not totally straight forward, however, best start by checking the example models that apply custom experiments.
Some starting points below:

What is the best order of arguments for spatially indexed functions of sf (st_intersects, etc.)?

It is explained on https://www.r-spatial.org/r/2017/06/22/spatial-index.html that "The R tree is constructed on the first argument (x), and used to match all geometries on the second argument (y) of binary functions". However, it is finally not explained what are the criteria that could guide the user in the choice of the sf object to put in the first argument. Are there some rules of thumb for this choice?
Generally, with creating spatial indexes you want to start with a larger envelopes that decompose to smaller envelopes. So, if you are extending from that then starting with a geometry with a larger extent then building smaller envelopes from that would match the general schema of how these selections are optimized.

Interpret the Doc2Vec Vectors Clusters Representation

I am new to Doc2Vec, please bear with the naive questions.
I have generated Doc2vector score i.e. using the 'Paragraph Vector' algorithm.
I have an array output for each document.
I use the model.similar for doc1 and get the output - doc5 and doc10 are similar to doc1.
Q1) How to summarize using the code what are the important words or high-level summary this document holds?
In addition, If I use the array output and run K- means to get 5 clusters. How to define the cluster definition.
Q2) I can read the documents but the number of documents is very high and doing a manual read to find the cluster definition is not possible.
There's no built-in 'summarization' function for Doc2Vec doc-vectors (or clusters of same).
Theoretically, the model could do something that's sort-of the opposition of doc-vector inference. It could take a doc-vector – perhaps one corresponding to a existing document – and then provide it to the model, run the model "forward", and read out the activation levels of all its output nodes. At least in models using the default negative-sampling, those nodes map one-to-one with known vocabulary words, and you could plausibly sort/scale those activation levels to find the top-N "most-associated" words with that doc-vector.
You could look at the predict_output_word() method source of Word2Vec to get a rough idea of how such a calculation could work:
https://github.com/RaRe-Technologies/gensim/blob/3514d3fb9224280edd8ddd14c46b722220df5436/gensim/models/word2vec.py#L1131
As mentioned, this isn't an existing capability, and I don't know of an online source for code to do such a calculation. But, if it were implemented, it would be a welcome contribution.
(I'm not sure what your Q2 question actually is.)

nested if function transformation for linearization, solver optimization

I have 10 nested if functions. I'm trying to transform nonsmooth and non linear function to a linear function. In order to do that, I need to transform nested if functions to a linear format by adding binary variables. It is easy if there is only 1 if statement. What about more than one. Thanks in advance for your responds.
I suspect this may not still be an issue for you, but I just saw this post today. Manually linearizing nested IF statements can be quite a challenge. LINDO Systems has an Excel add-in solver named What'sBest that can internally linearize nested IF statements. This can allow What'sBest to solve the resulting model as a mixed integer linear program.