CountreExample generation in KodKod - alloy

I have just switched to working with KodKod I am still trying to understand it. I have wrote a program to help me understand I succeeded to see if the solution is SATISFIABLE or UNSATISFIABLE .
I want to be able to see the CountreExample like we normally do in Alloy, I found the Method proof() of the type solution but it always returns null .
I want to know if there is a way to return the CountreExample or not.
Thank you in advance.

Try to look at this examples of Alloy API usages: https://github.com/kaptoxic/alloy/tree/master/src/edu/mit/csail/sdg/alloy4whole

Related

How to choose a specific msvcr.dl in Nim?

I would like to use an old msvcr71.dll when compiling Nim.
Is there a way to do so? If yes, how?
This is explained in the manual, right here. As StackOverflow doesn't like link responses, a copy-paste:
proc imported_proc(): ReturnType
{.cdecl, dynlib: "msvcr71.dll", importc.}
This asumes there is a function in msvcf71.dll called imported_proc that you want to wrap in your Nim code without changing the name.
You can also tweak which libraries to load when compiling, as explained here:
$ nim c --dynlibOverride:msvcr71 --passL:msvcr71.dll program.nim
Didn't test any of the code, hope it helps. You can always try to find some code that does this kind of linking, for example https://github.com/khchen/wNim/blob/master/wNim/private/winimx.nim or maybe https://github.com/brentp/hts-nim/blob/master/src/hts/private/hts_concat.nim

Reading dot files with graphviz package in haskell

For a program i have to reformat a dot file in Haskell to adjust the layout of its tree/content. I decided to use https://hackage.haskell.org/package/graphviz-2999.20.1.0/docs/Data-GraphViz.html , but i cant find simple tutorials and the documentation confuses me, namely:
1 . It contains a function: dotToGraph, which reads: "A pseudo-inverse to graphToDot; "pseudo" in the sense that the original node and edge labels aren't able to be reconstructed."
I do need to retain the names of the nodes and edges, which i suppose are the labels mentioned here? but it seems weird that it cannot do this. It also does not take in a file name or string for the dot text, so i assume this is the wrong function.
2 . There also seems to be a parseDot function/class that comes with the package, but i cant find clear documentation for its use. (see: https://hackage.haskell.org/package/graphviz-2999.20.1.0/docs/Data-GraphViz-Parsing.html#t:ParseDot)
Can you recommend me a simple overview/summary/online example for doing this? Should i be using a different function? I have only recently started using Haskell, so the package documentation is sometimes difficult to decipher for me.
It would help a great deal, thanks!

Where can I find the lua script of a Co-Simulation model in OMSimulator (OpenModelica)?

I am trying to run a co-simulation model using OMSimulator. I managed to create a FMU from a TRNSYS model thanks to this tool: https://sourceforge.net/projects/trnsys-fmu/
When I import it, I get the following error:
[2] 12:23:32 Scripting Error
[fmiLogger] module FMI2XML: Start attribute is required for this causality, variability and initial combination
It seems that I need to initialize some variables (not sure about what) in the OMSimulator command line. I think that it is the Lua script I heard about, but I cannot really find it.
I would really appreciate it someone could help me on this, since the documentation (https://openmodelica.org/doc/OMSimulator/v2.0.1/html/OMSimulator.html) it is not enough for my level.
Thanks!!!
It seems to be a problem with the FMU and not OMSimulator. The start value is required in the modelDescription.xml file of the FMU according to the FMI specification.

Processing insists pause() is not a function, when it very much is

Aite, [first poster here, pls don't bash]
So, I'm using the sound library, which I of course remembered to import, and works just fine, proof being given by the fact that all the other functions I used work as expected and give no problems neither in editor nor in execution.
Except, of course, for this little bugger of a pause() function, which I wrote as per below using no different a syntax from all the other functions, only to find out Processing isn't very keen on accepting its existence.
Problem shows both using 3.3.6 and 3.5.
Oh, and also, apparently isPlaying() returns an int, what's up with that?
If, as I'd suspect, that single line below won't be enough code to couple with the info to get to the bottom of it, here's a Dropbox link to the code (since it uses a bunch of files) so you can test it yourself.
It kinda won't work if you try to run it as is tho because it messes up when trying to load all the songs (in the last line of setup), yeah I kinda need some help with that too... works fine if you only load the first one tho!
https://www.dropbox.com/sh/di7mwit0w2l4513/AABipGDAdoKx277f8Hg_ZfhDa?dl=0
(Please, don't expect clear, extensively commented coding. I started working on this way before I learnt that was a thing. Deeply sorry. Of course, you can ask away about anything baffling you)
What did I try, er, writing it well???
I used .play(), .stop(), the volume ones, and they all, as per stated, work fine.
import processing.sound.*;
SoundFile[] songs= new SoundFile[1];
void setup(){
songs[0]=new SoundFile(this,"Small Bump.mp3");
songs[0].play();
}
void draw(){
}
void keyPressed(){
if (songs[0].isPlaying()==1)songs[0].pause();
}
When I copy your code into my Processing editor, I get a couple errors:
songs[0]="Small Bump.mp3";
The sounds array holds instances of SoundFile, but you're trying to store a String value here. Maybe you're looking for the SoundFile constructor?
if (songs[0].isPlaying()==1)
The isPlaying() function returns a boolean value, but you're comparing it to an int value.
songs[i].pause();
You haven't declared this i variable anywhere. Probably meant for this to be a 0.
If I fix all of these errors, then your code compiles fine.
You might want to take a look at the reference for the Sound library here.
The Sound library I had installed was 1.3.2, or something of the likes.
All the references I'd read were for 2.0+.
Having updated that through the "add library" menu, all was solved.

How does cocoa's obsolete CGSCStringValue function actually work?

I've been using CGSPrivate.h for cocoa development under MacOSX for a while. I'm now using it under Lion (10.7.x), and it turns out that the CGSCStringValue() function described in that file no longer exists under that OS version.
I want to make use of the functionality of CGSCStringValue() -- i.e., converting a CGSValue to its associated char* when appropriate -- and I'm wondering if anyone knows how that function is actually implemented.
I've tried various forms of casting of the CGSValue, but to no avail. So could anyone point me to some documentation or actual cocoa code that runs in 10.7 which will take a CGSValue that's associated with a string as input and return its char* equivalent?
Thanks in advance.
It's implemented by checking the type (to make sure it's really a CFString) and calling CFStringGetCString(). You can do that yourself, there is no real need for CGSCStringValue.

Resources