moptipyapps.spoc.spoc_4.challenge_1.beginner package¶
The Luna Tomato Logistics beginner problem. A base object with stuff for handling the beginner problem. A small example experiment. Create the basic setup. instance ( title – a title desc – a description ilogger ( the search space and the basic execution Create the RLS setup. The instance of the Luna Tomato Logistics beginner problem. The instances of the Luna Tomato Logistics beginner problem. Get an iterable of all instances. Get all the beginner problem instances. Log all parameters of this component as key-value pairs. logger ( The objective function of the beginner problem. The clash of two orbits incurs a penalty: Bases: The objective function of the beginner problem. Evaluate the objective function of the beginner problem. x – the solution vector the result Log all parameters of this component as key-value pairs. logger ( The objective function of the beginner problem. The clash of two orbits incurs a penalty: Bases: The objective function of the beginner problem. Evaluate the objective function of the beginner problem. x – the solution vector the result Log all parameters of this component as key-value pairs. logger ( The permutation-based encoding. Bases: The permutation-based decoding function of the beginner problem.Subpackages¶
Submodules¶
moptipyapps.spoc.spoc_4.challenge_1.beginner.base_obj module¶
moptipyapps.spoc.spoc_4.challenge_1.beginner.experiment module¶
Instance) – the instance to useFileImprovementLoggerFactory, default: <moptipy.api.improvement_logger.FileImprovementLoggerFactory object at 0x7f42b8520380>) – the logger to usemoptipyapps.spoc.spoc_4.challenge_1.beginner.instance module¶
>>> inst1 = Instance("matching-i")
>>> inst1.n
25000
>>> inst1.shape
(25000, 4)
>>> list(map(int, inst1[0, :]))
[3390, 4454, 3664, 267]
>>> inst1[0, 1]
np.int64(4454)
>>> inst1.penalty
125526621
>>> inst1.lengths
(5000, 5000, 5000)
>>> inst1.name
'matching-i'
>>> inst1 is Instance("matching-i")
True
>>> inst2 = Instance("matching-ii")
>>> inst2.n
92103
>>> inst2.shape
(92103, 4)
>>> list(map(int, inst2[0, :]))
[5559, 5444, 3794, 9723]
>>> inst2[0, 1]
np.int64(5444)
>>> inst2.penalty
460191177
>>> inst2.lengths
(10000, 10000, 10000)
>>> inst2.name
'matching-ii'
>>> for ix in Instance.list_instances():
... print(ix().name)
matching-i
matching-ii
>>> Instance.list_resources()
('matching-i', 'matching-ii')
>>> for ix in Instance.list_resources():
... print(Instance(ix).name)
matching-i
matching-ii
KeyValueLogSection) – the logger for the parametersmoptipyapps.spoc.spoc_4.challenge_1.beginner.objective_no_penalty module¶
>>> inst = Instance("matching-i")
>>> obj = BeginnerObjectiveNP(inst)
>>> test_x = np.ndarray(inst.n, dtype=np.bool)
>>> test_x.fill(0)
>>> obj.evaluate(test_x)
0
>>> test_x[0] = 1
>>> obj.evaluate(test_x)
-267
>>> inst[0, -1]
np.int64(267)
>>> test_x[2234] = 1
>>> obj.evaluate(test_x)
-7903
>>> -267 - 7636
-7903
ObjectiveKeyValueLogSection) – the logger for the parametersmoptipyapps.spoc.spoc_4.challenge_1.beginner.objective_with_penalty module¶
>>> inst = Instance("matching-i")
>>> obj = BeginnerObjectiveP(inst)
>>> test_x = np.ndarray(inst.n, dtype=np.bool)
>>> test_x.fill(0)
>>> obj.evaluate(test_x)
0
>>> test_x[0] = 1
>>> obj.evaluate(test_x)
-267
>>> inst[0, -1]
np.int64(267)
>>> test_x[2234] = 1
>>> obj.evaluate(test_x)
125518718
>>> inst.penalty - 267 - 7636
125518718
BaseObjectWithArrays, ObjectiveKeyValueLogSection) – the logger for the parametersmoptipyapps.spoc.spoc_4.challenge_1.beginner.permutation_encoding module¶
BaseObjectWithArrays, Encoding