Question

Getting a 'Starting up Aimms failed' error when linking to Python

  • 17 February 2021
  • 2 replies
  • 36 views

Hiya! I’m completely new to AIMMS so apologies if this is a really fundamental thing to ask. 

I’ve been working on a model that I would like to call from within Python using AimmsCmd - for now while I’m just trying to get it to work, my code in Python linking to AIMMS is pretty much identical to the script in the guide to running batch commands:

aimmsPath = "C:\\Users\\44750\\AppData\\Local\\AIMMS\\IFA\\Aimms\\4.77.4.5-x64-VS2017\\Bin\\AimmsCmd.exe"

command = aimmsPath + " solver.aimms < cmds.txt > log.txt"

solve = subprocess.call(command, shell=True)

log = open("log.txt","r")

print(log.read())

log.close()

When I execute it however, I get this error:

Error: Unable to open AIMMS with "--as-server --ignore-dialogs --hidden  "solver.aimms"": Starting up Aimms failed. Program initialization error.

Thinking it was probably my model or my code that was flagging up the error, I downloaded the StandAlone example from that same guide and copypasted the Python script - but it returned the exact same error. Does anyone have any idea how I could fix this?

Just in case it is my model after all, I’ll paste my cmds.txt file and model here too.

 

Model Main_solver {     
Parameter s {         
IndexDomain: (i,j);         
Range: free;     
}     
Parameter t {         
IndexDomain: i;         
Range: free;     
}     
Parameter r {         
IndexDomain: i;         
Range: free;     
}     
Variable x {         
IndexDomain: j;         
Range: {             
{0..2}         
}     
}     
Variable y {         
IndexDomain: i;         
Range: {             
{0..2}         
}     
}     
Variable totalTiles {         
Range: free;         
Definition: sum[ i, y(i) ];     
}     
Set setsJ {         
Index: j;         
Definition: {             
{ 1 .. 1173 }         
}     
}     
Set tilesI {         
Index: i;         
Definition: {             
{ 1 .. 53 }         
}     
}     
Constraint constraint1 {         
IndexDomain: i;         
Definition: sum[ j, s(i,j) * x(j) ] = t(i) + y(i);     
}     
Constraint constraint2 {         
IndexDomain: i;         
Definition: y(i) <= r(i);     
}     
MathematicalProgram rummikubProblem {         
Objective: totalTiles;         
Direction: maximize;         
Constraints: AllConstraints;         
Variables: AllVariables;         
Type: Automatic;     
}

 

Many thanks in advance!

 


2 replies

Userlevel 3

Hi May,

Thanks for reporting this. This is one of the cases of using the new academic licensing scheme we just introduced, that needs some work on our side to support well. 

I need to do some thinking and adaptations and will get back to you when I have a solution.

Although it may delay your work a little bit, you’re providing us with very valuable use cases how we can improve the new academic licensing scheme.

 

No worries at all, thank you very much for your response! In the meantime, is there an alternative way to call AIMMS from Python that would work with my license? @MarcelRoelofs 

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator