Nicht verfügbare ZellstofflöserPython

Python-Programme
Anonymous
 Nicht verfügbare Zellstofflöser

Post by Anonymous »

Ich leite eine LP mit Pulp aus, aber das Fehler -AttributeError abruft: 'Nonetype' Objekt hat kein Attribut 'tatsächlichSolve'. Ich habe diesen Beitrag zum Bestimmen der verfügbaren Löser gefunden. Dies richtete mich, den Code unten auszuprobieren. < /P>

Code: Select all

import pulp
print(pulp.listSolvers())
print(pulp.listSolvers(onlyAvailable=True))
< /code>
Die erste Druckanweisung enthält mir eine Liste von Löser, aber die zweite Anweisung gibt mir eine leere Liste. [] 
Ich deinstallierte Pulpe auch mit PIP -Deinstallation von Pulp und dann neu installiert. Als nächstes fand ich diese Seite und versuchte, den Solver direkt mit Solver = pl.getSolver ('cplex_cmd') zu installieren. Ich habe das alles in vs Code gemacht. Was fehlt mir, damit es in einer IDE funktioniert, aber nicht in einer anderen?

Code: Select all

from pulp import LpProblem, LpMinimize, LpVariable, LpConstraint, lpSum, value

# Define the problem
prob = LpProblem("Minimize_Operating_Cost", LpMinimize)

# Define decision variables
x1 = LpVariable("Hours_Facility_1", lowBound=0)
x2 = LpVariable("Hours_Facility_2", lowBound=0)

# Objective function: Minimize cost
prob += 120 * x1 + 220 * x2, "Total_Cost"

# Constraints
prob += 300 * x1 + 350 * x2 >= 4500, "Regular_Detergent_Constraint"
prob += 220 * x1 + 450 * x2 >= 5200, "Concentrate_Detergent_Constraint"

# Solve the problem
prob.solve()

# Extract results
x1_opt = value(x1)
x2_opt = value(x2)
min_cost = value(prob.objective)

#
# Display results
x1_opt, x2_opt, min_cost

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post