I'm a beginner on Event-B and I'm trying to model a machine where the set PERSONNE includes the set CLIENT which includes the set RESIDENT... I've searched on Rodin's documentation but I haven't found anything...
Here is the context
context contexteHumain
sets PERSONNE CLIENT RESIDENT
axioms
#axm1; finite(PERSONNE)
#axm2; finite(CLIENT)
#axm3; finite(RESIDENT) // Definition of three possible sets
and here is the machine
machine machineFunKeyHotel sees contexteHumain
variables
pers
reserv
cli
resid
chkin
chkout
invariants
#inv1: pers ⊆ PERSONNE
#inv2: cli ⊆ CLIENT
#inv3: resid ⊆ RESIDENT
// Définis les 3 variables d'ensemble de Personnes, Clients et Résidents
#inv4: reserv ∈ BOOL
#inv5: chkin ∈ BOOL
#inv6: chkout ∈ BOOL
// Les paramètres booléens si la ⦂personne a réservé, check-in ou check-out.
#inv7: CLIENT ⊆ PERSONNE
#inv8: RESIDENT ⊆ CLIENT
// Et les relations entre les différnets ensembles d'humains·
events
event INITIALISATION
begin
#act1: reserv ≔ FALSE
#act2: chkin ≔ FALSE
#act3: chkout ≔ FALSE
// Ces valeurs sont à faux, en effet, au début personne n'a ni réservé ni check-in
// Encore moins check out.
#act4: resid ≔ ∅
#act5: cli ≔ ∅
// Au début le nombre de client et de résidents sont zéro
#act6: pers ≔ ∅ //???
// Définir un nombre de personne presqu'infini (Personnes sur terre estimé à
// 7 290 477 807 personnes le vendredi 3 avril 2015 à 9 h 07 min et 24 s (GTM +1)
end
event réserver
// Lorsqu'une personne quelconque a réservé ça implique quelle soit ajoutée
// à l'ensemble clients.
any potentiel_client
where
#gr1: potentiel_client ∈ PERSONNE
#gr2: reserv = TRUE
then
#act1: cli ≔ cli ∪ {potentiel_client}
end
event checkerin
// Lorsqu'un client a passé l'étape de check-in, cela implique qu'il est ajouté
// à l'ensemble résident
any futur_resident
where
#gr1: futur_resident ∈ CLIENT
#gr2: chkin = TRUE
then
#act1: resid ≔ resid ∪ {futur_resident}
end
event checkerout
// Lorsqu'un résident a procédé au check out cela implique qu'il est retiré
// et de l'ensemble client et de l'ensemble résident.
any resident_actuel
where
#gr1: resident_actuel ∈ RESIDENT
#gr2: chkout = TRUE
then
#act1: resid ≔ resid ∖ {resident_actuel}
#act2: cli ≔ cli ∖ {resident_actuel}
end
end
I think I've got the idea but I cannot manage how to solve the various errors I get:
Types CLIENT and PERSONNE do not match (3 times)
Types RESIDENT and CLIENT do not match (2 times)...
There is a problem in your specification that is very common for beginners in Event-B. :)
You have introduced three deferred sets PERSONNE, CLIENT and RESIDENT. But I think a client or a resident are persons, too. And all deferred sets are constants, so with this construction, you're not able to modify your set of clients or residents.
I think the basic problem is the keyword SETS. You do not have to specify all sets of your machine there. Think TYPES! You just introduce a new type (I think you need only PERSONNE here) and have a constant for all elements.
context contexteHumain
sets PERSONNE
So remove the sets CLIENT and RESIDENT. I would suggest to remove all axioms, too. Do you really have to assume that the set of possible persons is finite?
Adapt your invariants:
invariants
#inv1: pers ⊆ PERSONNE
#inv2: cli ⊆ pers
#inv3: resid ⊆ cli
Remove inv7 and inv8. You probably want to add an invariant that the set of persons in your system is finite (in contrast to all possible persons in PERSONNE):
#inv9: finite(pers)
Accordingly, you would adapt your guards:
#gr1: futur_resident ∈ cli
resp.
#gr1: resident_actuel ∈ res
Related
Closed. This question is not written in English. It is not currently accepting answers.
Stack Overflow is an English-only site. The author must be able to communicate in English to understand and engage with any comments and/or answers their question receives. Don't translate this post for the author; machine translations can be inaccurate, and even human translations can alter the intended meaning of the post.
Closed 18 hours ago.
Improve this question
Olá , estou entrando recentemente no ramo de desenvolvedor , então alguns termos possam parecer confusos dentro da minha pergunta, pois estou aprendendo de forma autodidata.
Estou tentando criar uma base do Oracle APEX para meus estudos , e dentro do OracleXE, tenho duas Oracle connections Ilustração dos dois DB, Eu consegui criar a base APEX pela base SYS Dentro da Base APEX, mas queria criar com a base HR. Porque dentro da HR tenho as tabelas que criei para estudo com dados, e queria usa-las dentro do APEX , teria como mudar pra essa outra base? se não , como faço pra usar a base HR dentro do APEX?.
desde já agradeço por tentar me ajudar de qualquer forma.
Att.
Yuri Bertuzzi.
Criar uma base APEX para estudos , esperava conseguir usar a DB HR , mas apenas consegui pela SYS
I want to do spatial clustering, grouping data with a spatial proximity based on the network.
Indeed,
I have two shapefiles layers in input.
A linear layer constituting the network, the one on which the proximity distance must be based.
Another layer of the point type which will be used for the clustering.
However, my shapefile layer has a weight field.
The cluster must take this weight into account so that the total sum of weights in a cluster does not exceed the indicated value: Ex: 200.
I made a working code using DBSCAN. However, this algorithm does not take into account the weight, but the distance separating two entities to be in the same cluster.
In my case, the distance has little importance as long as the entities are the closest and that the total sum of the weights in a cluster is respected.
I put below the code with DBSCAN if it helps.
I take anything that could help me to advance in this research.
Thanks in advance.
from sklearn.cluster import DBSCAN
import networkx as nx
import pandas as pd
import numpy as np
from qgis.core import QgsProject, QgsField, QgsFeatureIterator
from qgis.PyQt.QtCore import QVariant
from tabulate import tabulate
class Clustering:
"""
Clustering logical grouping of points (populations) based on the linear networks (road networks) """
def __init__(self, copy_network_layer, node_nearest_point_layer) -> None:
"""
:param copy_network_layer: copy_network_layer: name of the new network layer
:param node_nearest_point_layer: Name of the new node table.
"""
self.copy_network_layer = copy_network_layer
self.node_nearest_point_layer = node_nearest_point_layer
#staticmethod
def formation_graph_in_network(feat_network_layer: QgsFeatureIterator) -> nx:
"""
:param feat_network_layer: Network layer name
:return: Graph constitutes the origin and the end of the network
"""
# Construction du graphe du réseau en utilisant networkx
network_graph = nx.Graph()
for feat_line in feat_network_layer:
start_point = feat_line.geometry().asPolyline()[0]
end_point = feat_line.geometry().asPolyline()[-1]
network_graph.add_edge(start_point, end_point)
return network_graph
#staticmethod
def association_node_closest_network(feat_points_layer: QgsFeatureIterator,
network_graph: nx) -> tuple[np, pd]:
"""
Association of each point entity to the network closest to it
:param feat_points_layer: point layer name
:param network_graph: origin and the end of the network
:return:
"""
# Récupération des points en utilisant qgis.core
points = []
gid = []
for feat_pt in feat_points_layer:
point = feat_pt.geometry().asPoint()
nearest_node = min(network_graph.nodes(),
key=lambda x: np.linalg.norm(np.array(x) -
np.array([point.x(),
point.y()])))
gid.append(feat_pt.id())
points.append(nearest_node)
data = pd.DataFrame({"gid": gid})
return np.array(points), data
def cluster_dbscan(self, field_weight: str) -> pd.DataFrame:
"""
:param field_weight: This field will be created for contains information cluster
The same cluster will have same number.
:return: Each entity is associated with the number of its cluster
"""
# Chargement des fichiers shapefiles en utilisant qgis.core
network_layer = QgsProject.instance().mapLayersByName(self.copy_network_layer)[0]
points_layer = QgsProject.instance().mapLayersByName(self.node_nearest_point_layer)[0]
network_graph = self.formation_graph_in_network(network_layer.getFeatures())
# print(f"network_graph : {network_graph}")
points, clustering = self.association_node_closest_network(points_layer.getFeatures(),
network_graph)
# Clustering en utilisant DBSCAN
# esp : distance maximale entre deux échantillons pour qu'ils soient considérés comme
# faisant partie du même voisinage. Il ne s'agit pas de distance entre toutes les éléments d'un même cluster
# min_samples : nombre minimum d'échantillons requis pour former une densité d'échantillons
dbscan = DBSCAN(eps=500, min_samples=3, algorithm="auto")
# print(tabulate(points, headers="keys", tablefmt="psql"))
clustering[field_weight] = dbscan.fit_predict(points)
# Ajout des résultats du clustering à la couche des points en utilisant qgis.core
# points_layer.startEditing()
points_layer.dataProvider().addAttributes([QgsField("label",
QVariant.Int,
comment="Valeur des cluster")])
points_layer.updateExtents()
points_layer.updateFields()
# If not existe, it will be
idx_label = points_layer.fields().indexFromName("label")
# Ajout des couches à un projet QGIS
for [gid, label] in clustering.values:
attrs = {idx_label: int(label)}
points_layer.dataProvider().changeAttributeValues({gid: attrs})
return clustering
if name == "name":
cluster_instance = Clustering("network_layer", "point_layer")
cluster_instance.cluster_dbscan("poids")
print("FIN")
I am using some WhatsApp templates associated with my number. But I am having mixed success in getting them to work without Error 63016. I create 9 templates, and 8 of them are getting the Error, which means that they are not matching the message I am sending with the template.
They do not work either if I execute them through Flow, or through Python (Rest API).
I have tried deleting and re-submitting the same template, and it failed again.
This is bothering me because testing out 9 templates and re-submitting them is laborsome.
Any ideas what m
Template #1, works fine:
Olá {{1}},
Nós vamos novamente te fazer algumas perguntas sobre seus hábitos de
consumo de notícias nas últimas semanas
São poucas perguntas, e as respostas são simples, como “Sim” ou “Não”.
Não deve levar mais de 2 minutos do seu tempo para responder à todas
as perguntas.
Quando estiver pronto para responder, mande qualquer mensagem nessa
conversa, como “Estou pronto”, ou clique no botão abaixo.
Template #2, not working:
Olá {{1}},
Nós vamos te fazer algumas perguntas sobre alguns fatos políticos que
aconteceram nas últimas semanas.
São poucas perguntas, e as respostas são simples, como “Sim” ou “Não”.
Não deve levar mais de 2 minutos do seu tempo para responder à todas
as perguntas.
Quando estiver pronto para responder, mande qualquer mensagem nesse
chat, como “Estou pronto”, ou clique no botão abaixo.
I'm parsing a text file with matlab which looks like this :
[Date]
2019-03-27 10:45:10.167618
[Component]
Component_Name : Manager principal
Component_ID : _ocl_MEu9Eemg_bhrv2HEbw
{Port}
Port_Name : FOP 1
Port_ID : _sZMXoEu9Eemg_bhrv2HEbw
Port_Type : Outgoing Port
[Component]
Component_Name : Manager 2
Component_ID : _r-HlMEu9Eemg_bhrv2HEbw
{Port}
Port_Name : FIP 1
Port_ID : _sZWIoku9Eemg_bhrv2HEbw
Port_Type : Incoming Port
[Link]
Link_Name : On/Off
Link_ID : _sZfSkku9Eemg_bhrv2HEbw
Link_Source_Name : Manager principal
Link_Source_ID : _ocl_MEu9Eemg_bhrv2HEbw
Link_Source_Port_Name : FOP 1
Link_Source_Port_ID : _sZMXoEu9Eemg_bhrv2HEbw
Link_Target_Name : Manager 2
Link_Target_ID : _r-HlMEu9Eemg_bhrv2HEbw
Link_Target_Port_Name : FIP 1
Link_Target_Port_ID : _sZWIoku9Eemg_bhrv2HEbw
I create a systeme for each [Component] i find and in each systems i create an input or output if the [Component] is a Source or a Target of a [Link].
In my text file example : On/Off is a link between 'Manager principal' and 'Manager 2'. So in the first System (Manager principal) i have an output called On/Off with a specific tag in tag description i set and in the second system (Manager 2) an input called On/Off with a specific tag in the Block tag i set.
So when i launch my code i have 2 system with 1 block in each system.
In this 2 blocks, if it's about the same link (in this example it is) we have this tag :
#_sZMXoEu9Eemg_bhrv2HEbw ==> #_sZWIoku9Eemg_bhrv2HEbw
The ID of the source port ==> the ID of the target port
This is what distinguish a Link than an other.
The context is : if the user change only the name of the Link for example Off/On instead of On/Off it must not create a new block because it's the same Link. So i would like to make a findBlocks() and for each blocks in the current system, i would like to do : if both ID's in tag description are same than in the text file so we just update the name of the block for example .
Here is the code where i create my blocks :
Update : I success to recover C which is the string inside Block tag.
B = find_system(sprintf('%s', component_NameValue));
C = get_param(find_system(sprintf('%s/%s', component_NameValue, link_NameValue)), 'Tag');
if (compareOut == 1) && (compareSource == 1) % Si c'est un port sortant et que c'est le port source du link
add_block('simulink/Ports & Subsystems/In1',[component_NameValue '/' link_NameValue]); % alors on ajoute un block Output de même nom que le link dans le système du composant que l'on parse
linkDescription = sprintf('Link : \n\n%s ==> %s \n\nComposant : \n\nDe : %s (%s) \nVers : %s (%s) \n\nPort Source : \n\n%s \n%s \n\n', link_NameValue , link_IDValue , link_SourceNameValue , link_SourceIDValue, link_TargetNameValue , link_TargetIDValue, link_SourcePortNameValue, link_SourcePortIDValue);
linkTag = sprintf('#%s ==> #%s', link_SourcePortIDValue, link_TargetPortIDValue);
set_param(gcb, 'Tag', linkTag);
set_param(gcb,'Description',linkDescription); % On ajoute une description au block contenant les infos du lien en question contenus dans le fichier texte
end
if (compareIn == 1) && (compareTarget == 1) % Si c'est un port entrant et que c'est le port target du link
add_block('simulink/Ports & Subsystems/Out1',[component_NameValue '/' link_NameValue]); % alors on ajoute un block Input de même nom que le link dans le système du composant que l'on parse
linkDescription = sprintf('Link : \n\n%s ==> %s \n\nComposant : \n\nDe : %s (%s) \nVers : %s (%s) \n\nPort Target : \n\n%s \n#%s', link_NameValue , link_IDValue , link_SourceNameValue , link_SourceIDValue, link_TargetNameValue , link_TargetIDValue,link_TargetPortNameValue, link_TargetPortIDValue);
linkTag = sprintf('#%s ==> #%s', link_SourcePortIDValue, link_TargetPortIDValue); %On ajoute un # devant l'ID du port pour pouvoir le retrouver et voir si un port à été modifié/rajouté/supprimé
set_param(gcb, 'Tag', linkTag);
set_param(gcb,'Description',linkDescription); % On ajoute une description au block contenant les infos du lien en question contenus dans le fichier texte
end
Thanks for helping in advance
I'm going deep into full-text search features and i'm finding some strange behaviors I cannot explain.
Here is a simple batch I run to setup my db for the test.
use MusicDB
db.songs.insertMany([{
"rank": 1000,
"authors": ["Pink Floyd"],
"title": [
{ "language": "en", "text": "Comfortably numb" },
{ "language": "it", "text": "Piacevolmente insensibile" }
],
"text": [
{ "language": "en", "text": "Hello, Is there anybody in there? Just nod if you can hear me Is there anyone at home? Come on now I hear you're feeling down I can ease your pain And get you on your feet again Relax I'll need some information first Just the basic facts Can you show me where it hurts There is no pain, you are receding A distant ship smoke on the horizon You are coming through in waves Your lips move but I can't hear what you're saying When I was a child I had a fever My hands felt just like two balloons Now I've got that feeling once again I can't explain, you would not understand This is now how I am I have become comfortably numb O.K. Just a little pin prick There'll be no more aaaaaaaah! But you may feel a little sick Can you stand up? I do belive it's working, good That'll keep you going through the show Come on it's time to go. There is no pain you are receding A distant ship smoke on the horizon You are only coming through in waves our lips move but I can't hear what you're saying When I was a child I caught a fleeting glimpse Out of the corner of my eye I turned to look but it was gone I cannot put my finger on it now The child is grown The dream is gone And I have become Comfortably numb."},
{ "language": "it", "text": "Coraggio, lo so che ti senti triste. Posso alleviare il tuo dolore e rimetterti di nuovo in piedi. Rilassati. Prima di tutto ho bisogno di sapere senza troppi dettagli dove ti fa male. Il dolore è sparito, stai guarendo Il fumo di una nave lontana all'orizzonte stai risalendo onda dopo onda. Le tue labbra si muovono, ma io non riesco a sentire quello che stai dicendo. Da bambino ho avuto la febbre, le mie mani erano gonfie come palloni. Adesso avverto di nuovo quella senzazione, non riesco a spiegartelo, non riusciresti a capire. Questo non sono io. Sto diventando piacevolmente insensibile. Va bene, solo una punturina, e non piangerai più. Ma può darsi che avrai un po' di nausea, Ce la fai a stare in piedi? Penso che stia funzionando, bene. Questo ti terrà in piedi per tutto lo spettacolo. Dai, è ora di andare. Il dolore è sparito, si sta allontanando. Il fumo di una nave lontana all'orizzonte Stai risalendo onda dopo onda. Le tue labbra si muovono, ma io non riesco a sentire quello che stai dicendo. Da bambino colsi con la coda dell'occhio un rapido movimento. Mi girai a guardare, ma era sparito, non riescii a capire cosa fosse, adesso il bambino è cresciuto, il sogno è finito. e io sono diventato piacevolmente insensibile."}
]
},
{
"rank": 999,
"authors": ["Led Zeppelin"],
"title": [
{ "language": "en", "text": "Stairway to Heaven" },
{ "language": "it", "text": "Scalinata per il paradiso" }
],
"text": [
{ "language": "en", "text": "There's a lady who's sure all that glitters is gold And she's buying a stairway to heaven. When she gets there she knows, if the stores are all closed With a word she can get what she came for. Ooh, ooh, and she's buying a stairway to heaven. There's a sign on the wall but she wants to be sure 'Cause you know sometimes words have two meanings. In a tree by the brook, there's a songbird who sings, Sometimes all of our thoughts are misgiven. Ooh, it makes me wonder, Ooh, it makes me wonder. There's a feeling I get when I look to the west, And my spirit is crying for leaving. In my thoughts I have seen rings of smoke through the trees, And the voices of those who standing looking. Ooh, it makes me wonder,Ooh, it really makes me wonder. And it's whispered that soon if we all call the tune Then the piper will lead us to reason. And a new day will dawn for those who stand long And the forests will echo with laughter. If there's a bustle in your hedgerow, don't be alarmed now, It's just a spring clean for the May queen. Yes, there are two paths you can go by, but in the long run There's still time to change the road you're on. And it makes me wonder. Your head is humming and it won't go, in case you don't know, The piper's calling you to join him, Dear lady, can you hear the wind blow, and did you know Your stairway lies on the whispering wind. And as we wind on down the road Our shadows taller than our soul. There walks a lady we all know Who shines white light and wants to show How ev'rything still turns to gold. And if you listen very hard The tune will come to you at last. When all are one and one is all To be a rock and not to roll. And she's buying a stairway to Heaven."},
{ "language": "it", "text": "C'è una donna che crede che tutto cio che luccica sia oro Ha intenzione di comprare una scala per raggiungere il Paradiso E quando vi arriva sa, se i negozi sono chiusi, con una parola può avere ciò per cui è venuta qui Ooh, ooh, e sta comprando una scala per il paradiso. C'è una scritta sul muro, ma lei vuole essere sicura Perchè, lo sai, a volte le parole hanni due significati Su un albero vicino al ponte, c'è un uccellino che canta A volte, tutti i nostri pensieri sono sospetti. Ooh, e mi domando, Ooh, e mi domando. Quella sensazione che provo quando guardo verso Ovest E la mia anima grida di partire Nei miei pensieri ho visto spirali di fumo tra gli alberi. E le voci di quelli che stanno a guardare Ooh, e mi fa pensare, Ooh, e mi fa pensare. E si mormora che presto, se tutti canteremo la melodia il pifferaio ci guiderà alla ragione e un nuovo giorno spunterà per quelli che stavano aspettando da tanto E le foreste eccheggeranno di risate. Se c'è una via vai sul tuo sentiero, non ti allarmare Sono solo i preparativi per la reginetta di Maggio Si, ci sono due strade che puoi percorrere, ma alla fine farai ancora tempo a cambiare il tuo percorso. E mi fa pensare La tua testa canitcchia e quella melodia non se ne andrà, nel caso non lo sapessi, Il pifferaio ti sta chiamando, vuole che tu vada da lui. Dolce donna, senti il vento soffiare e lo sapevi che la tua scala poggia sui sussurri del vento. E mentre scendiamo lungo la strada e le nostre ombre sono più alte della nostra anima Là cammina una signora che noi tutti conosciamo che fa splendere una luce bianca e vuol mostrarci come tutto continui a tramutarsi in oro. E se ascolti molto attentamente Prima o poi la melodia giungerà a te Quando tutti sono uno e una cosa sola è tutto essere una roccia ma senza rotolare. E sta comprando una scala verso il Paradiso."}
]
}]);
db.songs.createIndex({ "title.text": "text", "text.text": "text" })
Now please notice that the word "lady" appears only one time into the "en" text of the second record. Now I runs the following queries
db.songs.find({ "$text": { "$search": "lady", "$language": "it" }})
// no occurrences found
db.songs.find({ "$text": { "$search": "lady", "$language": "en" }})
// one occurrence found
db.songs.find({ "$text": { "$search": "lady", "$language": "none" }})
// no occurrences found
Unfortunately this does not match the documentation that say "language" field is only_ used for stemming so I figure that all the searches should return exactly one document.
"$search": "lady" with "$language": "en"
// "lady" is stemmed to "ladi" so this match "lady" and "ladies"
"$search": "lady" with "$language": "it"
// "lady" is stemmed exactly to "lady" so this match "lady"
"$search": "lady" with "$language": "none"
// "lady" is not stemmed but tokenization results in "lady" so this match "lady"
Can someone explain if I'm going wrong in creating the index of in reading the results?
Thanks.