I’m trying to make a Seize block to choose from different resource pools depending on the agent type that is passing through the block.
My first try was to create a dynamic reference of the Resource set parameter in a Seize block as the image shows:
image of dynamic value in Resource set
if(agent instanceof Pala || agent instanceof Torre){
Extensibles;
}else{
Camabajas3e;
}
where Extensibles and Camabajas3e are the resource pool names.
But I get the error: “Type mismatch: cannot convert from ResourcePool to ResourcePool[][].”
My second attempt was to include both resource pools in the list and instead use the parameter “Resource choice condition” with the following code:
agent.vehículo==unit.vehículo
were vehículo es a parameter inside each agent type in the flowchart and each resource type from the resource pool.
But I get the error: “vehículo connot be resolved or is not a field” but it is a parameter inside agents and resources.
What I’m doing wrong? How can I solve it?
Thank you.
use units of the same pool instead of (alternative) resource sents
and in the code write this:
(agent instanceof Pala || agent instanceof Torre) ? Extensibles : Camabajas3e
with your second option you can actually use what you did, but you need to tell anylogic what is your agent type..
agent.vehiculo==((ResourceType)unit).vehiculo
Related
I am trying to set up a standard Github repository template for my organization that uses Terraform to spin up new repos with the configured settings.
Every time I try to update the configuration file to create a new instance of the repository with a new name, instead it will try to update-in-place any repo that was already created using that file.
My question is what is the best practice for making my configuration file reusable with input variables like repo name? Should I make a module or is there some way of reusing that file otherwise?
Thanks for the help.
Terraform is a desired-state-configuration system, which means that your configuration should represent the full set of objects that should exist rather than an instruction to create a single object.
Therefore the typical way to add a new repository is to add a new resource block declaring that new repository, and leave the existing ones unchanged. Terraform will then see that there's a new resource not currently tracked in the state and will propose to create it.
If your repositories are configured in some systematic way that you can describe using a mechanical rule rather than manual configuration then you can potentially use the for_each meta-argument to declare multiple resource instances from the same resource block, using Terraform language expressions to describe the systematic rule.
For example, you could create a local value with a higher-level data structure that describes what should be different between your repositories and then use that data structure with for_each on a single resource block:
locals {
repositories = tomap({
example_1 = {
description = "First example repository"
}
example_2 = {
description = "Second example repository"
}
})
}
resource "github_repository" "all" {
for_each = local.repositories
name = each.key
description = each.value.description
private = true
}
For simplicity in this example I've only made the name and description variable between the instances, but you can add whatever extra attributes you need for each of the elements of local.repositories and then access them via each.value inside the resource block.
The private argument above illustrates how this approach can avoid the need to re-state argument values that will be the same for each declared repository, and have your local.repositories data structure focus only on the minimum attributes needed to describe the variations you need for your local policies around GitHub repositories.
A resource block with for_each set appears as a map of objects when used in expressions elsewhere, using the same keys as in the map given in for_each. Therefore if you need to access the repository ids, or any other attribute of the systematically-declared objects, you can write Terraform expressions that work with maps. For example, if you want to output all of the repository ids as a map of strings:
output "repository_ids" {
value = tomap({
for k, r in github_repository.all : k => r.repo_id
})
}
I created a GUI-designed Agent MyBatch. I would like to know if it is possible to define a constructor for this agent.
More specifically, I would need it in fluidToAgent, where I would like the new Agent to be the type of MyBatch.
However,
New agent = new MyBatch()
gives me an 'empty' MyBatch, where I would like have something along the lines of
New agent = new MyBatch(batch.variable_1, batch.variable_2, etc...)
so that I can initialize New agent with data contained in the current batch
Thanks
The easiest way to do this is to add parameters to your GUI constructed agent. Then
new agent = new MyBatch( param1, param2...)
You can go to the agents properties window to see which order the parameters should be passed in. This get the parameters passed in and set, and then you can use OnStartUp action to perform any logic you would like.
One important item to note is that if you create an AnyLogic agent via new MyBatch().. you must also call createAndStart( anyAgent ) to initialize any objects on the canvas.
If you use a population of MyBatch, and then use
new agent = add_populationMyBatch( param1, param2, ...)
you do not have to worry about calling createAndStart
Another alternative is to have you own initialization function within MyBatch. You can create the agent via new agent = new MyBatch() and then call agent.init( variables passed in ). Within init you can call createAndStart and whatever other code you would like.
I am writing a Golang application using Dgraph for persisting objects. From the documentation, I can infer that a new UID and hence a new node is created everytime I mutate an object/run the code.
Is there a way to update the same node data instead for creating a new node?
I tried changing the UID to use "_:name" for the UID field but even this creates a new node everytime the application is run. I wish to be able to update the existing node if it is already present in the DB instead of creating a new node for it.
Unfortunately the docs aren't very beginner friendly yet :/
To modify / mutate existing data you have to run a set operation and supply a rdf-triple like <uid> <predicate> "value" / <objectYouWantToModify> <attributeYouWantToModify> "quotedStringValue". If it is not an attribute but an edge, the value has to be another <uid>.
The full mutation would be for example
{
set {
<0x2> <name> "modified-name" .
}
}
The . terminates the sequence and there is an optional fourth parameter you can use to also assign a label.
Check https://www.w3.org/TR/n-quads/ for further details.
I am using activiti for my application.Here,when i'm assigning a task to the particular user sometimes the identity link type is as 'PARTICIPANT' and sometimes it is like 'CANDIDATE".In the modeler,for the user task i'm assigning the variable to assignee as
assignee = ${user} //In my case user = "kermit" or customUser
If the identity link type is 'participant' it has the process instance id.With the process instance id i'm getting the task as null.Is there any way to get the task.
val processEngine: ProcessEngine = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration.buildProcessEngine()
val taskService: TaskService = processEngine.getTaskService
val task = taskService.createTaskQuery().processInstanceId(idl.getProcessInstanceId).singleResult()
Can anyone please tell me how the identity link type will be generated during runtime as 'candidate' or 'participant'.
'candidate' is added when the user task has the 'candidate groups' or 'candidate users' set.
'participant' is set for a user that is the assignee, the task owner or the person who has completed the task (not necessarily the same as assignee/owner for the Activiti API).
It is also possible to add a custom user/group with these identityLink types to a task, using the taskService.addUserIdentityLink and taskService.addGroupIdentityLink method. The types are in the org.activiti.engine.task.IdentityLinkType class.
The objective was to find out the workflow starter does the member of a specific group.
First, I need to get the member list inside a group.
A simple javascript that get the list of member inside a group, but it failed:
<scriptTask id="scripttask1" name="Script Task" scriptFormat="javascript" activiti:autoStoreVariables="true">
<script>var node = people.getGroup("GROUP_Marketing");
if(node) {
logger.log("Marketing member list: " + people.getMembers(node));
}
</script>
</scriptTask>
And I get this error:
SEVERE: Error while closing command context
org.activiti.engine.ActivitiException: problem evaluating script: sun.org.mozilla.javascript.EcmaError: ReferenceError: "people" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1
So, may I know the correct method to determine the workflow starter does exist the member of a specific group?
The clean way would be to add an interceptor on the WorkflowService.
Intercept the result of the methods you need. At the very least "getDefinitions()". Possibly others too.
Complete post available here : https://forums.alfresco.com/comment/155580#comment-155580