linear-programming
linear-programming copied to clipboard
An example of the documentation doesn't not work (with-solved-problem)
What i did ?
I type into a new file these lines :
(ql:quickload :linear-programming)
(use-package :linear-programming)
(with-solved-problem ((max (= w (+ x (* 4 y) (* 3 z))))
(<= (+ (* 2 x) y) 8)
(<= (+ y z) 7))
(format t "Objective value solution: ~A~%" w)
(format t "x = ~A (reduced cost: ~A)~%" x (reduced-cost x))
(format t "y = ~A (reduced cost: ~A)~%" y (reduced-cost y))
(format t "z = ~A (reduced cost: ~A)~%" z (reduced-cost z)))
The compilation is ok, but when i eval the with-solved-problem form I encountered this error :
Execution of a form compiled with errors.
Form:
#S(PROBLEM
:TYPE MAX
:VARS #<(SIMPLE-VECTOR 3) {100260C13F}>
:OBJECTIVE-VAR W
:OBJECTIVE-FUNC ((Z . 3) (Y . 4) (X . 1))
:INTEGER-VARS NIL
:VAR-BOUNDS NIL
:CONSTRAINTS ((<= ((Y . 1) (X . 2)) 8) (<= ((Z . 1) (Y . 1)) 7)))
Compile-time error:
don't know how to dump #S(PROBLEM
:TYPE MAX
:VARS #(X Z Y)
:OBJECTIVE-VAR W
:OBJECTIVE-FUNC ((Z . 3) (Y . 4) (X . 1))
:INTEGER-VARS NIL
:VAR-BOUNDS NIL
:CONSTRAINTS ((<= ((Y . 1) (X . 2)) 8)
(<= ((Z . 1) (Y . 1)) 7))) (default MAKE-LOAD-FORM method called).
[Condition of type SB-INT:COMPILED-PROGRAM-ERROR]