Hello everybody,
Could anybody please tell me if the task I am trying to do is at all possible...??
The problem I want to tackle is as follows: I have two separate things here. One is a system dynamics simulation model in Vensim. And the other one is a Genetic Algorithm written in C language to solve an optimization problem. Now, my task is to link both of them, as mentioned below, to optimize the simulation model.
What this C program actually does is, at every iteration, it generates a set of 5 values (these are the variables in my problem). I want to send these 5 values to the Vensim model and simulate the model with these 5 values and then send the output back to the C program (in this case the output is set of points on a curve) . Now the C program, using these output values, computes the area of that curve and stores it in the memory. The next thing to happen is C program again generates a different set of 5 values. Again I want these values be sent to Vensim, simulate the model and get the output back to C. And the process goes on till the end of the loop. Finally I would pick the set of values that generated the curve with minimum area.
Could you please tell me if what I am trying to do here is at all possible? I would greatly appreciate all your comments and feedback on how I could get this done.
With best regards,
-Ram.
"Vensim <--> C" - Could anybody help me plea
-
- Super Administrator
- Posts: 4827
- Joined: Wed Mar 05, 2003 3:10 am
This is possible.
Start by looking at the example source code for the Vensim external function library. This is fairly straightforward, you just create your own custom function and pass any parameters from Vensim to it. Then what you do within the function is up to you.
Have a look at chapter 8 of the DSS Reference Manual
http://www.vensim.com/documentation/vensim.htm
When I started using external functions, I found the easiest way was to just look at the example that comes with Vensim, it is well documented.
Tony.
Start by looking at the example source code for the Vensim external function library. This is fairly straightforward, you just create your own custom function and pass any parameters from Vensim to it. Then what you do within the function is up to you.
Have a look at chapter 8 of the DSS Reference Manual
http://www.vensim.com/documentation/vensim.htm
When I started using external functions, I found the easiest way was to just look at the example that comes with Vensim, it is well documented.
Tony.
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
Thank you very much
Mr. Tony and Mr. Bob,
Thank you very very much for your immediate response and Valuable advice. I felt very happy about it. I will immediately try to do what you guys suggested.
With best regards,
-Ram.
[Edited on 4-30-2005 by ram]
Thank you very very much for your immediate response and Valuable advice. I felt very happy about it. I will immediately try to do what you guys suggested.
With best regards,
-Ram.
[Edited on 4-30-2005 by ram]