alloy

ElasticSearch之向量空间模型算法介绍

China☆狼群 提交于 2019-12-19 15:49:31
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 一 检索模型 1.1 bool模式 bool模式下,是最简单的检索模式,依据操作符AND 或者 OR 过滤document,结果只是包含指定的term的文档。他不会对document打分,只是为了减少后续要计算的document的数量,提升性能 1.2 TF/IDF TF 是 term frequency的缩写,表示这个词条term在该文档出现的频率,往往能够表现文档的主体信息,即TF值越大,应该给于这个单词更大权值,具体计算词频因子的时候,基于不同的出发点,可以采纳不同的计算公式,最直接的方式就是直接利用词频数。假设某一个term出现过5次,那么这个term的TF值就是5,还有些变体计算公式: 第一个变体,为身取log是因为基于如下考虑:假设一个term出现了10次,也不该在计算权值时比出现1次的情况大10倍。加上1的目的是为进行平滑,比如TF就是1,那么计算对数,就是0,本来出现了一次的term,现在是不出现了。所以需要+1进行平滑。 第二个变体:a 是调节因子,0.4效果更好,TF表示实际的词频数,Max(TF)表示文档中所有单词出现次数最多的单词对应的词频数。 之所以这样做是因为:出于对长文档的限制,因为如果文档比较长,与短文档相比,则长文档中所有单词的TF值普遍比短文档高

Dealing with multirelations (of arity ~10)

天涯浪子 提交于 2019-12-13 20:43:26
问题 I have a model with a sig similar to this one: sig State { ps: set P, cs: set C, o: set C -> set P, m: set M } And predicates like this, dealing with two State s: pred my_pred [s, s': State] { ... } I'm trying to create a parameterized version of my model, where I don't have a State sig, and instead I pass those fields around explicitly in functions and predicates. That would mean having predicates that look something like pred my_pred [(M -> P -> C -> (C -> P)) -> (M -> P -> C -> (C -> P))]

How to translate Event-Condition-Action rules to Alloy [closed]

丶灬走出姿态 提交于 2019-12-13 09:01:49
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . How can we translate Event-Condition-Action rules to Alloy (http://alloy.mit.edu/alloy/) 回答1: You can look at the following slides to learn more about the event idiom in Alloy http://people.csail.mit.edu/dnj

Relational Join and Operators in Alloy

和自甴很熟 提交于 2019-12-13 07:19:15
问题 I've been going over Alloy in general and found some concepts that I need some clearance on. First of all, the . (Dot Join). I got how it works for trivial examples but in a case like this: sig B {} sig A { rel: B -> C } sig C { rel1: B -> A } rel = {(a1,b1,c1), (a2,b2,c2)} rel1 = {(c1,b1,a1),(c2,b2,a2)} rel.rel1 = {(a1,b1,b1,a1),(a2,b2,b2,a2)} rel1.rel = {(c1,b1,b1,c1),(c2,b2,b2,c2) I don't get the result of rel.rel1 or rel1.rel. Can somebody explain how it works please? I am also having

Running alloy analyzers in parallel

可紊 提交于 2019-12-12 08:36:09
问题 I am generating quite a lot of Alloys specifications (*.als files). For a medium-size problem I am trying to solve, I generated 1536 *.als files. In order to save time running all these files, I used the Java concurrency API (in particular ExecutorCompletionService with Future ) to run n Alloy commands in parallel, where n is the number of available logical cores on the machine (in my case 4, for 2 CPUs with HyperThreading). In this context, it sometimes happens that a command freezes and

Execution Error when change the SATSolver from SAT4J to MiniSAT

人盡茶涼 提交于 2019-12-12 02:59:07
问题 In my Java code, when i change the SATSolver from SAT4J to MiniSatJNI or MiniSatProverJNI in: A4Options options = new A4Options(); options.solver = A4Options.SatSolver.SAT4J; For instance, to: A4Options options = new A4Options(); options.solver = A4Options.SatSolver.MiniSatProverJNI; And then call: A4Solution currentAns = TranslateAlloyToKodkod.execute_command(null, javaMetamodel.getAllReachableSigs(), command, options); I receive the following execution error: Fatal error: The required JNI

Using Alloy API to provide custom instances to alloy analyzer

天涯浪子 提交于 2019-12-11 20:32:53
问题 I've just read the Software Abstractions book and really like Alloy for its intended purpose. But I'd like to use it for more than its intended purpose. Thinking creatively, I'd like to use Alloy to find counterexamples in model instances extrapolated from real data (assertion checking). Is it possible to use the Alloy API against your own data instances? I'm hoping that the underlying API is modular enough that I can code my own workflow without having to learn the whole system in detail. If

Using Alloy functions in a recursive way through transitive closures

眉间皱痕 提交于 2019-12-11 20:19:35
问题 I am doing a model in Alloy to represent a subset of Java language. Below we have some elements of this model: sig Method { id : one MethodId, param: lone Type, return: one Type, acc: lone Accessibility, b: one Block } abstract sig Expression {} abstract sig StatementExpression extends Expression {} sig MethodInvocation extends StatementExpression{ pExp: lone PrimaryExpression, id_methodInvoked: one Method, param: lone Type } sig Block { statements: seq StatementExpression } pred

How to model a consitent database in alloy?

余生长醉 提交于 2019-12-11 16:39:18
问题 Alloy newbie here. I'm trying to model a medical database containing user and some medical information. sig User{ name: one String, surname: one String, socialNumber: one String, address: one String, age: one Int, registration: one UserCredential, healthStatus: one HealthInformation }{ age>0 } sig UserCredential{ user: one String, pass: one String, mail: one String } sig HealthInformation{} sig Data4Help{ users: some User, } pred show(d:Data4Help){ #d.users>1 } run show for 10 The analyzer

Alloy: define relation to only positive integers

别等时光非礼了梦想. 提交于 2019-12-11 14:41:43
问题 I have a model with this sig: sig Thing {} sig World { quantities: Thing ->one Int, } I want to define a constraint on the quantities relationship such that the quantity of each Thing must be a positive int. I am total beginner with Alloy (and I have no theory background to draw on, am just a Python programmer). I followed through the tutorial but I did not see a recipe for what I want to do. I know how to: fact { all w: World | w.quantities <something> } ...but I am not clear how to address