Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

helloworld.py 823 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  1. import sys
  2. import pandas as pd
  3. from docplex.mp.model import Model
  4. import lightgbm as lgb
  5. import json
  6. from dagshub import DAGsHubLogger
  7. logger = DAGsHubLogger()
  8. par_json_file = open('pars.json','r', encoding='utf-8')
  9. pars_dict = json.load(par_json_file)
  10. m = Model(name='telephone_production')
  11. desk = m.continuous_var(name='desk')
  12. cell = m.continuous_var(name='cell')
  13. m.add_constraint(desk >= pars_dict['desk'])
  14. m.add_constraint(cell >= pars_dict['cell'])
  15. ct_assembly = m.add_constraint(0.2*desk + 0.4*cell <= 400)
  16. ct_painting = m.add_constraint(0.5*desk + 0.4*cell <=490)
  17. m.maximize(pars_dict['obj_cof_0']*desk+pars_dict['obj_cof_1']*cell)
  18. m.print_information()
  19. m.solve()
  20. print("The objective value is {}".format(m.solve().get_objective_value()))
  21. logger.log_metrics(objective_value=m.solve().get_objective_value())
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...