I am new to Dynare++ and I have really quick question I cannot seem to find the answer too.
What is the difference between these two commands and why is the output different?
!dynare++ --per 50 --sim 3 file_name.mod
dynare file_name.mod
In the first command its unable to find steady state values based on my initial values and in the second it can. Why?
The first command calls the standalone Dynare++ instead of Matab-based Dynare. The latter uses Matlab's solvers for numerically finding the steady state. Note that there is a dedicated forum for Dynare at https://forum.dynare.org
Related
I'm having trouble interpreting the clingo v 5.2.2 output below:
Why did clingo print answer1 twice? I've checked that the two answer1s are exactly the same.
I'm using optimization in my code. Could that be the problem?
I've set up a test repo. The above output can be generated by running the following line in the test repo.
clingo --opt-mode=OptN examples/swap-shift.lp
Here's what I understand now: with the --opt-mode=OptN option, clingo will try multiple models until it finds all the optimal models, and it will print all the models it has witnessed followed by the optimal models. I think that could explain why answer1 was printed twice in my original question.
In the output, I think Models is the number of total witnesses (including the first optimal model that got printed twice). Optimal is the number of optimal models found.
I made my observation by observing the output of this example
clingo --opt-mode=OptN asp/_all.lp asp/examples/scatter.lp
See how Optimization decreases and the two optimum models are printed in the end.
While looking for an optimal answer set, clingo prints each answer set that is better than previously found answer sets.
If no better answer set can be found, this means that the optimality of the last answer set has been proved.
If you have use the optN mode, clingo then enumerates all answer sets with that optimal cost. This will again find the first optimal answer set that was found.
I personally do not know how to print only the optimal answer sets and each only one from the command line. It would be possible to implement such a behavior using the Python API.
As per official guide, you can use the flags --opt-mode=optN --quiet=1 to find and print all optimal solutions.
To compute all optimal answer sets, we can change clasp’s
optimization mode using option ‘--opt-mode=optN’. In this mode, clasp
first prints the tenta- tive answer sets where optimality is not yet
proven and afterwards prints the optimal answer sets. Note that the
first optimal answer set is printed twice in this mode. To omit
tentative answer sets in the output and only print optimal answer
sets, we can add option ‘--quiet=1’
From the Potassco guide version 2.2.0.
I am using MATLAB's fitgmdist ("fit a guassian mixture to data", from the Statistics and Machine Learning Toolbox) with some success. Is there a way to make it run in a verbose mode, e.g., tell me what iteration it is on, or show convergence stats during the process, so I know how well it is progressing?
Related, is there a way after the function has run and delivered the gmdistribution object, to determine how many iterations actually ran or how close the convergence came? (It would be useful to know these things so I could better set the options parameters up front.)
Simply put: no and yes.
You can try to access the actual .m-file (e.g. open(fitgmdist)) to copy it and then edit it to your purposes (copy it so you won't overwrite the build-in function), but there is no straight-forward implemented way to obtain the verbosity you want. The name-value pair which comes closest to what you want is display, iter:
iter: Display iterative output to the Command Window for some functions; otherwise display the final output.
I am not quite sure about this part, since I can't run a test, but the final number of iterations should be available in the gmdistribution structure under gmdistribution.NumIterations. The docs state that this is only for objects constructed with fitgmdist.
I implemented a 100 km long highway scenario using Veins Framework for OMNET++.
In order to get more reliable results, how many simulation runs are required for each set of experiment ?
How can we define and control the number of simulation runs?
Quicker simulations:
You can make your simulations run faster in 3 possible ways:
run sumo without the gui by starting the ./sumo-launchd.py excluding sumo-gui in the end and writing only sumo.
run simulations using Cmdenv and not Tkenv,
compile your Veins project code in in release mode. You can achieve that by doing:
-make MODE=release -j <number-of-cores>
These steps will improve simulation run-time up to 50%.
In the Veins FAQ you have the following questions:
I've launched a simulation in the OMNeT++ TkEnv; why is it running so
awefully slow?
I've launched a simulation in the OMNeT++ Cmdenv; can I speed it up
further?
There are some suggestions given in the FAQ which might help you run simulations quicker.
Number of simulation runs:
As far as the number of simulation runs is concerned, it is hard to tell. You can use confidence intervals for your results to see how fine-grained they are; In any case I would suggest starting with 5 repetitions.
Automatic control of simulation runs:
This can be accomplished using repeat parameter in the .ini file as it is explained here.
On how to do that from the OMNeT++ IDE follow this answer (note the comments as well).
To run parallel simulations through the command line, follow this answer.
a) This is an open ended question as you have not defined what 'more reliable' means. To get a more reliable result, you need more runs. That's all that can be said.
b) use repeat = 2 in the ini file to get two repetitions
I'm also suggesting reading the manual's corresponding chapter:
https://omnetpp.org/doc/omnetpp/manual/usman.html#sec341
(Chapter 10 is also related to your question)
I created a subsystem in Simulink with mask underneath. There are all sorts of control and calculation inside this subsystem. Now I have to duplicate this subsystem for one hundred thousand times because I need to connect one hundred thousands of this block in series.
What I have tried, I used the commands “add_block” and “add_line” where I can just type it in the Matlab command and the blocks and lines are added automatically.
What I wish to do now is,
I want to have 100 signals in a single subsystem, so instead of using one hundred thousand subsystem, I will only need one thousand of this subsystem, I understand that this can be done by vectorization.
I have a very limited knowledge on using vectorization feature in Matlab/Simulink. I appreciate if anyone of you could provide me a great reference on how to do this?
What I found here is something like this which I could not link it to my issue above: http://www.mathworks.co.uk/help/matlab/matlab_prog/vectorization.html
The other thing I found is by "using vectorization for most components. Most components are vectorized if they have a vectorized input signal or if one of their parameter is specified as a vector."
However, I could not find any further information/details, appreciate if anyone of you could give opinion on this? Thanks!
I am solving a stiff PDE in MATLAB using ode15, and it often freezes depending on the initial conditions. I never actually get an error, it just won't finish even after 10 hours when it should take around 30 seconds to run. I am experimenting with different spatial and time node intervals, but it is hard, because I don't get feedback.
Is there some sort of equivalent to diagnostic for fsolve? stats is not useful because it only displays an output after fsolve is finished.
Check out the documentation on odeset, and specifically the stats option. I think you basically just want to set stats to on and you will get some feedback.
Also, depending on your ODE, you may need a different solver. About half way down the page on this page there is a list of most of the solvers available in MATLAB. Depending on whether your function is stiff or non-stiff, and how accurate you need to get, one of those might work better for you. Sometimes I just code them all in and comment out all but one until I find the one that runs the best for me, but check out the documentation on each if you want to find the "right" one for your application.
Your question is confusing because you refer to both ode15s and fsolve locking up. These are two completely different functions. One does numerical integration and the other solves for roots. Also, fsolve has no option called 'Stats' (see doc fsolve). If you want continuous output from fsolve use:
options = optimist('Display','iter');
[x,fval,exitflag] = fsolve(myfun,x0,options)
This will display the iteration count, number of function evaluations, the function value, and other stuff depending on what algorithm you use (the alorithm can be adjusted via the 'Algorithm' option). Again see doc fsolve for full details.
As far as the 'Stats' option with ode15s goes, it's not going to give you very much information. I doubt that it will you figure out why your system is halting (if it even is ode15s that you have a problem with). What you can try is using an output function via the 'OutputFcn' option of odeset. You can try the simple odeprint first:
options = odeset('OutputFcn',#odeprint)
which will print your state after each integration step. Type edit odeprint to see the code and how you might write your own output function if you need to do more.