Skip to content

Commit

Permalink
0.0.26
Browse files Browse the repository at this point in the history
  • Loading branch information
vlkong committed Oct 22, 2015
1 parent 77a05dc commit b8e3134
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 30 deletions.
4 changes: 2 additions & 2 deletions examples/ipython/campsite.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"outputs": [],
"source": [
"!pip install docplex==0.0.24"
"!pip install docplex"
]
},
{
Expand Down Expand Up @@ -287,7 +287,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
"version": "2.7.8"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions examples/ipython/kmedian.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
},
"outputs": [],
"source": [
"!pip install docplex==0.0.24"
"!pip install docplex"
]
},
{
Expand Down Expand Up @@ -469,7 +469,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
"version": "2.7.8"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions examples/ipython/matchmaker.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
},
"outputs": [],
"source": [
"!pip install docplex==0.0.24"
"!pip install docplex"
]
},
{
Expand Down Expand Up @@ -243,7 +243,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
"version": "2.7.8"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions examples/ipython/n_c.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"outputs": [],
"source": [
"!pip install docplex==0.0.24"
"!pip install docplex"
]
},
{
Expand Down Expand Up @@ -351,7 +351,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
"version": "2.7.8"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions examples/ipython/warehouse.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
},
"outputs": [],
"source": [
"!pip install docplex>=0.0.24"
"!pip install docplex"
]
},
{
Expand Down Expand Up @@ -642,7 +642,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
"version": "2.7.8"
}
},
"nbformat": 4,
Expand Down
12 changes: 6 additions & 6 deletions examples/ipython/whiskas.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
}
],
"source": [
"!pip install docplex>=0.0.24"
"!pip install docplex"
]
},
{
Expand Down Expand Up @@ -419,21 +419,21 @@
"metadata": {
"celltoolbar": "Dashboard",
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 2",
"language": "python",
"name": "python3"
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3"
"pygments_lexer": "ipython2",
"version": "2.7.8"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions examples/modeling/nurses.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def print_solution(model):
print("*************************** Solution ***************************")
print("Allocation By Department:")
for d in model.departments:
print ("\t{}: {}".format(d, sum(
print("\t{}: {}".format(d, sum(
model.nurse_assignment_vars[n, s].solution_value for n in model.nurses for s in model.shifts if
s.department == d)))
print("Cost By Department:")
Expand All @@ -267,7 +267,7 @@ def print_solution(model):
print("\t{}: total hours:{}".format(n.name, total_hours))
for s in model.shifts:
if model.nurse_assignment_vars[n, s].solution_value == 1:
print ("\t\t{}: {} {}-{}".format(s.day.name, s.department, s.start_time, s.end_time))
print("\t\t{}: {} {}-{}".format(s.day.name, s.department, s.start_time, s.end_time))


SKILLS = ["Anaesthesiology",
Expand Down
3 changes: 1 addition & 2 deletions examples/modeling/sport_scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def build_sports(docloud_context=None):
def solve_sports(docloud_context=None):
model = build_sports(docloud_context=docloud_context)
model.print_information()
model.export_as_lp()
model.solve()
model.report()
TSolution = namedtuple("TSolution", ["week", "is_divisional", "team1", "team2"])
Expand Down Expand Up @@ -126,7 +125,7 @@ def solve_sports(docloud_context=None):
url = "https://docloud.service.com/job_manager/rest/v1"
api_key = "example api_key"
"""
print("This example hits the limits of CPLEX Optimization Studio and will work only the DOcloud solve.")
print("This example hits the limits of CPLEX Optimization Studio Community Edition and will work only with the DOcloud solve or a commercial edition of CPLEX.")
url = "YOUR_URL_HERE"
api_key = None
ctx = DOcloudContext.make_default_context(url, api_key)
Expand Down
6 changes: 3 additions & 3 deletions examples/workflow/cutstock.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def setup_objective(self):
self.minimize(1 - self.scal_prod(self.use_vars, self.duals))

def get_use_values(self):
assert self.has_solution()
assert self.solution

return [use_var.solution_value for use_var in self.use_vars]

Expand Down Expand Up @@ -202,7 +202,7 @@ def run(self, context=None):
curr = self.infinity
status = False
while loop_count < 100 and abs(best - curr) >= obj_eps:
print('\n#items={},#patterns={},#vars={}'.format(len(self.items), len(self.patterns), self.variable_stats))
print('\n#items={},#patterns={}'.format(len(self.items), len(self.patterns)))
if loop_count > 0:
self.refresh_model()
status = master_model.solve()
Expand All @@ -212,7 +212,7 @@ def run(self, context=None):
print('{}> master model fails, stop'.format(loop_count))
break
else:
assert master_model.has_solution()
assert master_model.solution
curr = self.objective_value
print('{}> new column generation iteration, best={:g}, curr={:g}'.format(loop_count, best, curr))
duals = self.get_fill_dual_values()
Expand Down
4 changes: 2 additions & 2 deletions examples/workflow/lagrangian_relaxation.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def run_GAP_model_with_Lagrangian_relaxation(As, Bs, Cs, max_iters=101, docloud_
print("*** solve fails, stopping at iteration: %d" % loop_count)
break
best = mdl.objective_value
penalties = [pv.get_value() for pv in p_vars]
penalties = [pv.solution_value for pv in p_vars]
print('%d> new lagrangian iteration, obj=%g, m=%s, p=%s' % (loop_count, best, str(multipliers), str(penalties)))

do_stop = True
Expand All @@ -95,7 +95,7 @@ def run_GAP_model_with_Lagrangian_relaxation(As, Bs, Cs, max_iters=101, docloud_

if do_stop:
print("* Lagrangian relaxation succeeds, best={:g}, penalty={:g}, #iterations={}"
.format(best, total_penalty.get_value(), loop_count))
.format(best, total_penalty.solution_value, loop_count))
break
else:
# update multipliers and start loop again.
Expand Down
10 changes: 5 additions & 5 deletions examples/workflow/load_balancing.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ def run(self, docloud_context=None):
def print_solution(self, do_filter_zeros=True):
m = self
active_servers = sorted([s for s in m.servers if m.active_var_by_server[s].solution_value == 1])
print ("Active Servers: {}".format(active_servers))
print ("*** User assignment ***")
print("Active Servers: {}".format(active_servers))
print("*** User assignment ***")
for (u, s) in sorted(m.assign_user_to_server_vars):
if m.assign_user_to_server_vars[(u, s)].solution_value == 1:
print ("{} uses {}, migration: {}".format(u, s, "yes" if m._is_migration(u, s) else "no"))
print ("*** Servers sleeping processes ***")
print("{} uses {}, migration: {}".format(u, s, "yes" if m._is_migration(u, s) else "no"))
print("*** Servers sleeping processes ***")
for s in active_servers:
sleeping = sum(self.assign_user_to_server_vars[u, s].solution_value * u.sleeping for u in self.users)
print ("Server: {} #sleeping={}".format(s, sleeping))
print("Server: {} #sleeping={}".format(s, sleeping))


SERVERS = ["server002", "server003", "server001", "server006", "server007", "server004", "server005"]
Expand Down

0 comments on commit b8e3134

Please sign in to comment.