Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wangqiuoe opened this issue May 11, 2021 · 0 comments
Open

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

wangqiuoe opened this issue May 11, 2021 · 0 comments

Comments

@wangqiuoe
Copy link

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant