Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Aep Schedule Generator Rusty
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marc-Antoine Manningham
Aep Schedule Generator Rusty
Commits
109f7106
Commit
109f7106
authored
6 months ago
by
Marc-Antoine Manningham
Browse files
Options
Downloads
Patches
Plain Diff
refactor: simple fix
parent
49ccd0ba
No related branches found
No related tags found
1 merge request
!12
Feat update leptos
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
combinatoric-solver/src/collection.rs
+7
-6
7 additions, 6 deletions
combinatoric-solver/src/collection.rs
combinatoric-solver/src/solver.rs
+1
-1
1 addition, 1 deletion
combinatoric-solver/src/solver.rs
with
8 additions
and
7 deletions
combinatoric-solver/src/collection.rs
+
7
−
6
View file @
109f7106
...
...
@@ -7,39 +7,39 @@ where
V
:
ItemVariant
,
{
pub
score
:
S
,
pub
item_quantity
:
usize
,
pub
item_variant
:
[
V
;
MAX_ITEMS
],
}
impl
<
const
MAX_ITEMS
:
usize
,
S
:
Score
,
V
:
ItemVariant
>
Collection
<
MAX_ITEMS
,
S
,
V
>
{
pub
fn
push
(
&
self
,
item_variant
:
V
)
->
Self
{
#[inline]
pub
fn
push
(
&
self
,
iteration
:
usize
,
item_variant
:
V
)
->
Self
{
let
mut
new
=
self
.clone
();
new
.item_variant
[
self
.item_quantity
]
=
item_variant
;
new
.item_quantity
+=
1
;
new
.item_variant
[
iteration
]
=
item_variant
;
new
}
}
impl
<
const
MAX_ITEMS
:
usize
,
S
:
Score
,
V
:
ItemVariant
>
Default
for
Collection
<
MAX_ITEMS
,
S
,
V
>
{
#[inline]
fn
default
()
->
Self
{
let
score
=
S
::
default
();
let
item_quantity
=
0
;
let
item_variant
=
[
V
::
default
();
MAX_ITEMS
];
Self
{
score
,
item_quantity
,
item_variant
,
}
}
}
impl
<
const
MAX_ITEMS
:
usize
,
S
:
Score
,
V
:
ItemVariant
>
PartialEq
for
Collection
<
MAX_ITEMS
,
S
,
V
>
{
#[inline]
fn
eq
(
&
self
,
other
:
&
Self
)
->
bool
{
self
.item_variant
==
other
.item_variant
}
}
impl
<
const
MAX_ITEMS
:
usize
,
S
:
Score
,
V
:
ItemVariant
>
PartialOrd
for
Collection
<
MAX_ITEMS
,
S
,
V
>
{
#[inline]
fn
partial_cmp
(
&
self
,
other
:
&
Self
)
->
Option
<
std
::
cmp
::
Ordering
>
{
self
.score
.partial_cmp
(
&
other
.score
)
}
...
...
@@ -48,6 +48,7 @@ impl<const MAX_ITEMS: usize, S: Score, V: ItemVariant> PartialOrd for Collection
impl
<
const
MAX_ITEMS
:
usize
,
S
:
Score
,
V
:
ItemVariant
>
Eq
for
Collection
<
MAX_ITEMS
,
S
,
V
>
{}
impl
<
const
MAX_ITEMS
:
usize
,
S
:
Score
,
V
:
ItemVariant
>
Ord
for
Collection
<
MAX_ITEMS
,
S
,
V
>
{
#[inline]
fn
cmp
(
&
self
,
other
:
&
Self
)
->
std
::
cmp
::
Ordering
{
self
.score
.cmp
(
&
other
.score
)
}
...
...
This diff is collapsed.
Click to expand it.
combinatoric-solver/src/solver.rs
+
1
−
1
View file @
109f7106
...
...
@@ -49,7 +49,7 @@ where
}
for
variant
in
items
[
i
]
.variants
()
{
let
collections
=
collection
.push
(
variant
);
let
collections
=
collection
.push
(
i
,
variant
);
Self
::
rec_iter
(
i
+
1
,
collections
,
items
,
top_items
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment