ImportError: DLL load failed: %1 is not a valid Win32 application.”

I am getting above error while running/loading Gurobi optimization file.

I am using Python 32 bit interprter for Pycharm and also Gurobi 6.5 with 32 bit.

Please explain the solution.

File code is as below.

#!/usr/bin/python

# Copyright 2015, Gurobi Optimization, Inc.

# This example formulates and solves the following simple MIP model:
# maximize
# x + y + 2 z
# subject to
# x + 2 y + 3 z <= 4
# x + y >= 1
# x, y, z binary

from gurobipy import *

try:

# Create a new model
m = Model("mip1")

# Create variables
x = m.addVar(vtype=GRB.BINARY, name="x")
y = m.addVar(vtype=GRB.BINARY, name="y")
z = m.addVar(vtype=GRB.BINARY, name="z")

# Integrate new variables
m.update()

# Set objective
m.setObjective(x + y + 2 * z, GRB.MAXIMIZE)

# Add constraint: x + 2 y + 3 z <= 4
m.addConstr(x + 2 * y + 3 * z <= 4, "c0")

# Add constraint: x + y >= 1
m.addConstr(x + y >= 1, "c1")

m.optimize()

for v in m.getVars():
print('%s %g' % (v.varName, v.x))

print('Obj: %g' % m.objVal)

except GurobiError:
print('Error reported')

 

0

Please sign in to leave a comment.