Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Solve(prob, dippyOpts)) function stuck if prob.relaxation = {} #137

@wangqiuoe

Description

@wangqiuoe

If I add nothing to prob.relaxation, i.e., simply a MILP problem without decomposition, the Solve() will stuck at some stage, except i add

for i in var:
    prob.relaxation[0] += var[i] >= 0, i

(add no useful constraints)

The whole script is like below, where the function generate_coefficient is from milp_func.py

n_var=2
n_constr=3
args = parseArgs()
args.algo = 'PriceCut'
args.numBlocks = 1
args.numVarsPerBlock = n_var
args.numConsPerBlock = n_constr
args.numLinkingCons = 0
args.randomSeed = 2
args.density = 1

OBJ, MAT, RHS, var = generate_coefficient(args)

prob = DipProblem("MILP", display_mode='matplotlib', display_interval=None)

# add objective
prob += -lpSum([OBJ[i]*var[i] for i in var]), "Objective"

# add constraints
n_cons = len(RHS)
for k in range(n_cons):
    j = "C1_%s" %(k)
    prob += lpSum([MAT[i, j]*var[i] for i in var]) <= RHS[j], j

#for i in var:                                                  # uncomment this two lines, then the code will not stuck 
#    prob.relaxation[0] += var[i] >= 0, i

tol = pow(pow(2, -24), old_div(2.0, 3.0))
dippyOpts = addDippyOpts(args)
dippyOpts['TolZero'] = str(tol)

Solve(prob, dippyOpts)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions