We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Cbc installable via coin does not return duals. Check this model:
%%ampl_eval set CHIPS; param profits{CHIPS}; param copper{CHIPS}; var x{CHIPS} >= 0; maximize Profit: sum {c in CHIPS} profits[c] * x[c]; s.t. Silicon: x['logic'] <= 1000; s.t. Germanium: x['memory'] <= 1500; s.t. Plastic: sum {c in CHIPS} x[c] <= 1750; s.t. Copper: sum {c in CHIPS} copper[c] * x[c] <= 4800;
chips = ["logic", "memory"] profits = {"logic": 12, "memory": 9} copper = {"logic": 4, "memory": 2} ampl.set['CHIPS'] = chips ampl.param['profits'] = profits ampl.param['copper'] = copper ampl.option["solver"] = "cbc" ampl.solve() x = ampl.get_variable('x').get_values().to_list() print(f'x = ({x})') print(f'optimal value = {ampl.obj["Profit"].value():.2f}')
def ShowDuals(ampl): import fractions # display all duals print("The dual variable corresponding to:\n") for c in ampl.get_constraints(): print("- the constraint on", c[0], "is equal to ", str(c[1].dual())) #str(fractions.Fraction(c[1].get_value())), end="") ShowDuals(ampl)
The text was updated successfully, but these errors were encountered:
mapgccv
glebbelov
No branches or pull requests
Cbc installable via coin does not return duals. Check this model:
The text was updated successfully, but these errors were encountered: